001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.http;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.security.auth.HttpPrincipal;
022    import com.liferay.portal.kernel.service.RepositoryServiceUtil;
023    import com.liferay.portal.kernel.service.http.TunnelUtil;
024    import com.liferay.portal.kernel.util.MethodHandler;
025    import com.liferay.portal.kernel.util.MethodKey;
026    
027    /**
028     * Provides the HTTP utility for the
029     * {@link RepositoryServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link HttpPrincipal} parameter.
033     *
034     * <p>
035     * The benefits of using the HTTP utility is that it is fast and allows for
036     * tunneling without the cost of serializing to text. The drawback is that it
037     * only works with Java.
038     * </p>
039     *
040     * <p>
041     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
042     * configure security.
043     * </p>
044     *
045     * <p>
046     * The HTTP utility is only generated for remote services.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see RepositoryServiceSoap
051     * @see HttpPrincipal
052     * @see RepositoryServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class RepositoryServiceHttp {
057            public static com.liferay.portal.kernel.model.Repository addRepository(
058                    HttpPrincipal httpPrincipal, long groupId, long classNameId,
059                    long parentFolderId, java.lang.String name,
060                    java.lang.String description, java.lang.String portletId,
061                    com.liferay.portal.kernel.util.UnicodeProperties typeSettingsProperties,
062                    com.liferay.portal.kernel.service.ServiceContext serviceContext)
063                    throws com.liferay.portal.kernel.exception.PortalException {
064                    try {
065                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
066                                            "addRepository", _addRepositoryParameterTypes0);
067    
068                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
069                                            classNameId, parentFolderId, name, description, portletId,
070                                            typeSettingsProperties, serviceContext);
071    
072                            Object returnObj = null;
073    
074                            try {
075                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
076                            }
077                            catch (Exception e) {
078                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
079                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
080                                    }
081    
082                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
083                            }
084    
085                            return (com.liferay.portal.kernel.model.Repository)returnObj;
086                    }
087                    catch (com.liferay.portal.kernel.exception.SystemException se) {
088                            _log.error(se, se);
089    
090                            throw se;
091                    }
092            }
093    
094            public static void checkRepository(HttpPrincipal httpPrincipal,
095                    long repositoryId)
096                    throws com.liferay.portal.kernel.exception.PortalException {
097                    try {
098                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
099                                            "checkRepository", _checkRepositoryParameterTypes1);
100    
101                            MethodHandler methodHandler = new MethodHandler(methodKey,
102                                            repositoryId);
103    
104                            try {
105                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
106                            }
107                            catch (Exception e) {
108                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
109                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
110                                    }
111    
112                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
113                            }
114                    }
115                    catch (com.liferay.portal.kernel.exception.SystemException se) {
116                            _log.error(se, se);
117    
118                            throw se;
119                    }
120            }
121    
122            public static void deleteRepository(HttpPrincipal httpPrincipal,
123                    long repositoryId)
124                    throws com.liferay.portal.kernel.exception.PortalException {
125                    try {
126                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
127                                            "deleteRepository", _deleteRepositoryParameterTypes2);
128    
129                            MethodHandler methodHandler = new MethodHandler(methodKey,
130                                            repositoryId);
131    
132                            try {
133                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
134                            }
135                            catch (Exception e) {
136                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
137                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
138                                    }
139    
140                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
141                            }
142                    }
143                    catch (com.liferay.portal.kernel.exception.SystemException se) {
144                            _log.error(se, se);
145    
146                            throw se;
147                    }
148            }
149    
150            public static com.liferay.portal.kernel.model.Repository getRepository(
151                    HttpPrincipal httpPrincipal, long repositoryId)
152                    throws com.liferay.portal.kernel.exception.PortalException {
153                    try {
154                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
155                                            "getRepository", _getRepositoryParameterTypes3);
156    
157                            MethodHandler methodHandler = new MethodHandler(methodKey,
158                                            repositoryId);
159    
160                            Object returnObj = null;
161    
162                            try {
163                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
164                            }
165                            catch (Exception e) {
166                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
167                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
168                                    }
169    
170                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
171                            }
172    
173                            return (com.liferay.portal.kernel.model.Repository)returnObj;
174                    }
175                    catch (com.liferay.portal.kernel.exception.SystemException se) {
176                            _log.error(se, se);
177    
178                            throw se;
179                    }
180            }
181    
182            public static java.lang.String[] getSupportedConfigurations(
183                    HttpPrincipal httpPrincipal, long classNameId) {
184                    try {
185                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
186                                            "getSupportedConfigurations",
187                                            _getSupportedConfigurationsParameterTypes4);
188    
189                            MethodHandler methodHandler = new MethodHandler(methodKey,
190                                            classNameId);
191    
192                            Object returnObj = null;
193    
194                            try {
195                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
196                            }
197                            catch (Exception e) {
198                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
199                            }
200    
201                            return (java.lang.String[])returnObj;
202                    }
203                    catch (com.liferay.portal.kernel.exception.SystemException se) {
204                            _log.error(se, se);
205    
206                            throw se;
207                    }
208            }
209    
210            public static java.lang.String[] getSupportedParameters(
211                    HttpPrincipal httpPrincipal, long classNameId,
212                    java.lang.String configuration) {
213                    try {
214                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
215                                            "getSupportedParameters",
216                                            _getSupportedParametersParameterTypes5);
217    
218                            MethodHandler methodHandler = new MethodHandler(methodKey,
219                                            classNameId, configuration);
220    
221                            Object returnObj = null;
222    
223                            try {
224                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
225                            }
226                            catch (Exception e) {
227                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
228                            }
229    
230                            return (java.lang.String[])returnObj;
231                    }
232                    catch (com.liferay.portal.kernel.exception.SystemException se) {
233                            _log.error(se, se);
234    
235                            throw se;
236                    }
237            }
238    
239            public static java.lang.String[] getSupportedParameters(
240                    HttpPrincipal httpPrincipal, java.lang.String className,
241                    java.lang.String configuration) {
242                    try {
243                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
244                                            "getSupportedParameters",
245                                            _getSupportedParametersParameterTypes6);
246    
247                            MethodHandler methodHandler = new MethodHandler(methodKey,
248                                            className, configuration);
249    
250                            Object returnObj = null;
251    
252                            try {
253                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
254                            }
255                            catch (Exception e) {
256                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
257                            }
258    
259                            return (java.lang.String[])returnObj;
260                    }
261                    catch (com.liferay.portal.kernel.exception.SystemException se) {
262                            _log.error(se, se);
263    
264                            throw se;
265                    }
266            }
267    
268            public static com.liferay.portal.kernel.util.UnicodeProperties getTypeSettingsProperties(
269                    HttpPrincipal httpPrincipal, long repositoryId)
270                    throws com.liferay.portal.kernel.exception.PortalException {
271                    try {
272                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
273                                            "getTypeSettingsProperties",
274                                            _getTypeSettingsPropertiesParameterTypes7);
275    
276                            MethodHandler methodHandler = new MethodHandler(methodKey,
277                                            repositoryId);
278    
279                            Object returnObj = null;
280    
281                            try {
282                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
283                            }
284                            catch (Exception e) {
285                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
286                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
287                                    }
288    
289                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
290                            }
291    
292                            return (com.liferay.portal.kernel.util.UnicodeProperties)returnObj;
293                    }
294                    catch (com.liferay.portal.kernel.exception.SystemException se) {
295                            _log.error(se, se);
296    
297                            throw se;
298                    }
299            }
300    
301            public static void updateRepository(HttpPrincipal httpPrincipal,
302                    long repositoryId, java.lang.String name, java.lang.String description)
303                    throws com.liferay.portal.kernel.exception.PortalException {
304                    try {
305                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
306                                            "updateRepository", _updateRepositoryParameterTypes8);
307    
308                            MethodHandler methodHandler = new MethodHandler(methodKey,
309                                            repositoryId, name, description);
310    
311                            try {
312                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
313                            }
314                            catch (Exception e) {
315                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
316                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
317                                    }
318    
319                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
320                            }
321                    }
322                    catch (com.liferay.portal.kernel.exception.SystemException se) {
323                            _log.error(se, se);
324    
325                            throw se;
326                    }
327            }
328    
329            private static Log _log = LogFactoryUtil.getLog(RepositoryServiceHttp.class);
330            private static final Class<?>[] _addRepositoryParameterTypes0 = new Class[] {
331                            long.class, long.class, long.class, java.lang.String.class,
332                            java.lang.String.class, java.lang.String.class,
333                            com.liferay.portal.kernel.util.UnicodeProperties.class,
334                            com.liferay.portal.kernel.service.ServiceContext.class
335                    };
336            private static final Class<?>[] _checkRepositoryParameterTypes1 = new Class[] {
337                            long.class
338                    };
339            private static final Class<?>[] _deleteRepositoryParameterTypes2 = new Class[] {
340                            long.class
341                    };
342            private static final Class<?>[] _getRepositoryParameterTypes3 = new Class[] {
343                            long.class
344                    };
345            private static final Class<?>[] _getSupportedConfigurationsParameterTypes4 = new Class[] {
346                            long.class
347                    };
348            private static final Class<?>[] _getSupportedParametersParameterTypes5 = new Class[] {
349                            long.class, java.lang.String.class
350                    };
351            private static final Class<?>[] _getSupportedParametersParameterTypes6 = new Class[] {
352                            java.lang.String.class, java.lang.String.class
353                    };
354            private static final Class<?>[] _getTypeSettingsPropertiesParameterTypes7 = new Class[] {
355                            long.class
356                    };
357            private static final Class<?>[] _updateRepositoryParameterTypes8 = new Class[] {
358                            long.class, java.lang.String.class, java.lang.String.class
359                    };
360    }