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