001    /**
002     * Copyright (c) 2000-2013 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 com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.RepositoryServiceUtil;
023    
024    /**
025     * Provides the HTTP utility for the
026     * {@link com.liferay.portal.service.RepositoryServiceUtil} service utility. The
027     * static methods of this class calls the same methods of the service utility.
028     * However, the signatures are different because it requires an additional
029     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
030     *
031     * <p>
032     * The benefits of using the HTTP utility is that it is fast and allows for
033     * tunneling without the cost of serializing to text. The drawback is that it
034     * only works with Java.
035     * </p>
036     *
037     * <p>
038     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
039     * configure security.
040     * </p>
041     *
042     * <p>
043     * The HTTP utility is only generated for remote services.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see RepositoryServiceSoap
048     * @see com.liferay.portal.security.auth.HttpPrincipal
049     * @see com.liferay.portal.service.RepositoryServiceUtil
050     * @generated
051     */
052    public class RepositoryServiceHttp {
053            public static com.liferay.portal.model.Repository addRepository(
054                    HttpPrincipal httpPrincipal, long groupId, long classNameId,
055                    long parentFolderId, java.lang.String name,
056                    java.lang.String description, java.lang.String portletId,
057                    com.liferay.portal.kernel.util.UnicodeProperties typeSettingsProperties,
058                    com.liferay.portal.service.ServiceContext serviceContext)
059                    throws com.liferay.portal.kernel.exception.PortalException,
060                            com.liferay.portal.kernel.exception.SystemException {
061                    try {
062                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
063                                            "addRepository", _addRepositoryParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
066                                            classNameId, parentFolderId, name, description, portletId,
067                                            typeSettingsProperties, serviceContext);
068    
069                            Object returnObj = null;
070    
071                            try {
072                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
073                            }
074                            catch (Exception e) {
075                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
076                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
077                                    }
078    
079                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
080                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
081                                    }
082    
083                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
084                            }
085    
086                            return (com.liferay.portal.model.Repository)returnObj;
087                    }
088                    catch (com.liferay.portal.kernel.exception.SystemException se) {
089                            _log.error(se, se);
090    
091                            throw se;
092                    }
093            }
094    
095            public static void checkRepository(HttpPrincipal httpPrincipal,
096                    long repositoryId)
097                    throws com.liferay.portal.kernel.exception.PortalException,
098                            com.liferay.portal.kernel.exception.SystemException {
099                    try {
100                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
101                                            "checkRepository", _checkRepositoryParameterTypes1);
102    
103                            MethodHandler methodHandler = new MethodHandler(methodKey,
104                                            repositoryId);
105    
106                            try {
107                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
108                            }
109                            catch (Exception e) {
110                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
111                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
112                                    }
113    
114                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
115                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
116                                    }
117    
118                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
119                            }
120                    }
121                    catch (com.liferay.portal.kernel.exception.SystemException se) {
122                            _log.error(se, se);
123    
124                            throw se;
125                    }
126            }
127    
128            public static void deleteRepository(HttpPrincipal httpPrincipal,
129                    long repositoryId)
130                    throws com.liferay.portal.kernel.exception.PortalException,
131                            com.liferay.portal.kernel.exception.SystemException {
132                    try {
133                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
134                                            "deleteRepository", _deleteRepositoryParameterTypes2);
135    
136                            MethodHandler methodHandler = new MethodHandler(methodKey,
137                                            repositoryId);
138    
139                            try {
140                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
141                            }
142                            catch (Exception e) {
143                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
144                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
145                                    }
146    
147                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
148                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
149                                    }
150    
151                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
152                            }
153                    }
154                    catch (com.liferay.portal.kernel.exception.SystemException se) {
155                            _log.error(se, se);
156    
157                            throw se;
158                    }
159            }
160    
161            public static com.liferay.portal.kernel.repository.LocalRepository getLocalRepositoryImpl(
162                    HttpPrincipal httpPrincipal, long repositoryId)
163                    throws com.liferay.portal.kernel.exception.PortalException,
164                            com.liferay.portal.kernel.exception.SystemException {
165                    try {
166                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
167                                            "getLocalRepositoryImpl",
168                                            _getLocalRepositoryImplParameterTypes3);
169    
170                            MethodHandler methodHandler = new MethodHandler(methodKey,
171                                            repositoryId);
172    
173                            Object returnObj = null;
174    
175                            try {
176                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
177                            }
178                            catch (Exception e) {
179                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
180                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
181                                    }
182    
183                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
184                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
185                                    }
186    
187                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
188                            }
189    
190                            return (com.liferay.portal.kernel.repository.LocalRepository)returnObj;
191                    }
192                    catch (com.liferay.portal.kernel.exception.SystemException se) {
193                            _log.error(se, se);
194    
195                            throw se;
196                    }
197            }
198    
199            public static com.liferay.portal.kernel.repository.LocalRepository getLocalRepositoryImpl(
200                    HttpPrincipal httpPrincipal, long folderId, long fileEntryId,
201                    long fileVersionId)
202                    throws com.liferay.portal.kernel.exception.PortalException,
203                            com.liferay.portal.kernel.exception.SystemException {
204                    try {
205                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
206                                            "getLocalRepositoryImpl",
207                                            _getLocalRepositoryImplParameterTypes4);
208    
209                            MethodHandler methodHandler = new MethodHandler(methodKey,
210                                            folderId, fileEntryId, fileVersionId);
211    
212                            Object returnObj = null;
213    
214                            try {
215                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
216                            }
217                            catch (Exception e) {
218                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
219                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
220                                    }
221    
222                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
223                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
224                                    }
225    
226                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
227                            }
228    
229                            return (com.liferay.portal.kernel.repository.LocalRepository)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 com.liferay.portal.model.Repository getRepository(
239                    HttpPrincipal httpPrincipal, long repositoryId)
240                    throws com.liferay.portal.kernel.exception.PortalException,
241                            com.liferay.portal.kernel.exception.SystemException {
242                    try {
243                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
244                                            "getRepository", _getRepositoryParameterTypes5);
245    
246                            MethodHandler methodHandler = new MethodHandler(methodKey,
247                                            repositoryId);
248    
249                            Object returnObj = null;
250    
251                            try {
252                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
253                            }
254                            catch (Exception e) {
255                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
256                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
257                                    }
258    
259                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
260                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
261                                    }
262    
263                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
264                            }
265    
266                            return (com.liferay.portal.model.Repository)returnObj;
267                    }
268                    catch (com.liferay.portal.kernel.exception.SystemException se) {
269                            _log.error(se, se);
270    
271                            throw se;
272                    }
273            }
274    
275            public static com.liferay.portal.kernel.repository.Repository getRepositoryImpl(
276                    HttpPrincipal httpPrincipal, long repositoryId)
277                    throws com.liferay.portal.kernel.exception.PortalException,
278                            com.liferay.portal.kernel.exception.SystemException {
279                    try {
280                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
281                                            "getRepositoryImpl", _getRepositoryImplParameterTypes6);
282    
283                            MethodHandler methodHandler = new MethodHandler(methodKey,
284                                            repositoryId);
285    
286                            Object returnObj = null;
287    
288                            try {
289                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
290                            }
291                            catch (Exception e) {
292                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
293                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
294                                    }
295    
296                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
297                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
298                                    }
299    
300                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
301                            }
302    
303                            return (com.liferay.portal.kernel.repository.Repository)returnObj;
304                    }
305                    catch (com.liferay.portal.kernel.exception.SystemException se) {
306                            _log.error(se, se);
307    
308                            throw se;
309                    }
310            }
311    
312            public static com.liferay.portal.kernel.repository.Repository getRepositoryImpl(
313                    HttpPrincipal httpPrincipal, long folderId, long fileEntryId,
314                    long fileVersionId)
315                    throws com.liferay.portal.kernel.exception.PortalException,
316                            com.liferay.portal.kernel.exception.SystemException {
317                    try {
318                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
319                                            "getRepositoryImpl", _getRepositoryImplParameterTypes7);
320    
321                            MethodHandler methodHandler = new MethodHandler(methodKey,
322                                            folderId, fileEntryId, fileVersionId);
323    
324                            Object returnObj = null;
325    
326                            try {
327                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
328                            }
329                            catch (Exception e) {
330                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
331                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
332                                    }
333    
334                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
335                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
336                                    }
337    
338                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
339                            }
340    
341                            return (com.liferay.portal.kernel.repository.Repository)returnObj;
342                    }
343                    catch (com.liferay.portal.kernel.exception.SystemException se) {
344                            _log.error(se, se);
345    
346                            throw se;
347                    }
348            }
349    
350            public static java.lang.String[] getSupportedConfigurations(
351                    HttpPrincipal httpPrincipal, long classNameId)
352                    throws com.liferay.portal.kernel.exception.SystemException {
353                    try {
354                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
355                                            "getSupportedConfigurations",
356                                            _getSupportedConfigurationsParameterTypes8);
357    
358                            MethodHandler methodHandler = new MethodHandler(methodKey,
359                                            classNameId);
360    
361                            Object returnObj = null;
362    
363                            try {
364                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
365                            }
366                            catch (Exception e) {
367                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
368                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
369                                    }
370    
371                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
372                            }
373    
374                            return (java.lang.String[])returnObj;
375                    }
376                    catch (com.liferay.portal.kernel.exception.SystemException se) {
377                            _log.error(se, se);
378    
379                            throw se;
380                    }
381            }
382    
383            public static java.lang.String[] getSupportedParameters(
384                    HttpPrincipal httpPrincipal, long classNameId,
385                    java.lang.String configuration)
386                    throws com.liferay.portal.kernel.exception.SystemException {
387                    try {
388                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
389                                            "getSupportedParameters",
390                                            _getSupportedParametersParameterTypes9);
391    
392                            MethodHandler methodHandler = new MethodHandler(methodKey,
393                                            classNameId, configuration);
394    
395                            Object returnObj = null;
396    
397                            try {
398                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
399                            }
400                            catch (Exception e) {
401                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
402                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
403                                    }
404    
405                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
406                            }
407    
408                            return (java.lang.String[])returnObj;
409                    }
410                    catch (com.liferay.portal.kernel.exception.SystemException se) {
411                            _log.error(se, se);
412    
413                            throw se;
414                    }
415            }
416    
417            public static com.liferay.portal.kernel.util.UnicodeProperties getTypeSettingsProperties(
418                    HttpPrincipal httpPrincipal, long repositoryId)
419                    throws com.liferay.portal.kernel.exception.PortalException,
420                            com.liferay.portal.kernel.exception.SystemException {
421                    try {
422                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
423                                            "getTypeSettingsProperties",
424                                            _getTypeSettingsPropertiesParameterTypes10);
425    
426                            MethodHandler methodHandler = new MethodHandler(methodKey,
427                                            repositoryId);
428    
429                            Object returnObj = null;
430    
431                            try {
432                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
433                            }
434                            catch (Exception e) {
435                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
436                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
437                                    }
438    
439                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
440                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
441                                    }
442    
443                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
444                            }
445    
446                            return (com.liferay.portal.kernel.util.UnicodeProperties)returnObj;
447                    }
448                    catch (com.liferay.portal.kernel.exception.SystemException se) {
449                            _log.error(se, se);
450    
451                            throw se;
452                    }
453            }
454    
455            public static void updateRepository(HttpPrincipal httpPrincipal,
456                    long repositoryId, java.lang.String name, java.lang.String description)
457                    throws com.liferay.portal.kernel.exception.PortalException,
458                            com.liferay.portal.kernel.exception.SystemException {
459                    try {
460                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
461                                            "updateRepository", _updateRepositoryParameterTypes11);
462    
463                            MethodHandler methodHandler = new MethodHandler(methodKey,
464                                            repositoryId, name, description);
465    
466                            try {
467                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
468                            }
469                            catch (Exception e) {
470                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
471                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
472                                    }
473    
474                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
475                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
476                                    }
477    
478                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
479                            }
480                    }
481                    catch (com.liferay.portal.kernel.exception.SystemException se) {
482                            _log.error(se, se);
483    
484                            throw se;
485                    }
486            }
487    
488            private static Log _log = LogFactoryUtil.getLog(RepositoryServiceHttp.class);
489            private static final Class<?>[] _addRepositoryParameterTypes0 = new Class[] {
490                            long.class, long.class, long.class, java.lang.String.class,
491                            java.lang.String.class, java.lang.String.class,
492                            com.liferay.portal.kernel.util.UnicodeProperties.class,
493                            com.liferay.portal.service.ServiceContext.class
494                    };
495            private static final Class<?>[] _checkRepositoryParameterTypes1 = new Class[] {
496                            long.class
497                    };
498            private static final Class<?>[] _deleteRepositoryParameterTypes2 = new Class[] {
499                            long.class
500                    };
501            private static final Class<?>[] _getLocalRepositoryImplParameterTypes3 = new Class[] {
502                            long.class
503                    };
504            private static final Class<?>[] _getLocalRepositoryImplParameterTypes4 = new Class[] {
505                            long.class, long.class, long.class
506                    };
507            private static final Class<?>[] _getRepositoryParameterTypes5 = new Class[] {
508                            long.class
509                    };
510            private static final Class<?>[] _getRepositoryImplParameterTypes6 = new Class[] {
511                            long.class
512                    };
513            private static final Class<?>[] _getRepositoryImplParameterTypes7 = new Class[] {
514                            long.class, long.class, long.class
515                    };
516            private static final Class<?>[] _getSupportedConfigurationsParameterTypes8 = new Class[] {
517                            long.class
518                    };
519            private static final Class<?>[] _getSupportedParametersParameterTypes9 = new Class[] {
520                            long.class, java.lang.String.class
521                    };
522            private static final Class<?>[] _getTypeSettingsPropertiesParameterTypes10 = new Class[] {
523                            long.class
524                    };
525            private static final Class<?>[] _updateRepositoryParameterTypes11 = new Class[] {
526                            long.class, java.lang.String.class, java.lang.String.class
527                    };
528    }