001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.RepositoryServiceUtil} service utility. The
028     * static methods of this class calls the same methods of the service utility.
029     * However, the signatures are different because it requires an additional
030     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
031     * </p>
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       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.RepositoryServiceUtil
052     * @generated
053     */
054    public class RepositoryServiceHttp {
055            public static long addRepository(HttpPrincipal httpPrincipal, long groupId,
056                    long classNameId, long parentFolderId, java.lang.String name,
057                    java.lang.String description, java.lang.String portletId,
058                    com.liferay.portal.kernel.util.UnicodeProperties typeSettingsProperties,
059                    com.liferay.portal.service.ServiceContext serviceContext)
060                    throws com.liferay.portal.kernel.exception.PortalException,
061                            com.liferay.portal.kernel.exception.SystemException {
062                    try {
063                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
064                                            "addRepository", _addRepositoryParameterTypes0);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
067                                            classNameId, parentFolderId, name, description, portletId,
068                                            typeSettingsProperties, serviceContext);
069    
070                            Object returnObj = null;
071    
072                            try {
073                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
074                            }
075                            catch (Exception e) {
076                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
077                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
078                                    }
079    
080                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
081                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
082                                    }
083    
084                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
085                            }
086    
087                            return ((Long)returnObj).longValue();
088                    }
089                    catch (com.liferay.portal.kernel.exception.SystemException se) {
090                            _log.error(se, se);
091    
092                            throw se;
093                    }
094            }
095    
096            public static void checkRepository(HttpPrincipal httpPrincipal,
097                    long repositoryId)
098                    throws com.liferay.portal.kernel.exception.SystemException {
099                    try {
100                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
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.SystemException) {
111                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
112                                    }
113    
114                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
115                            }
116                    }
117                    catch (com.liferay.portal.kernel.exception.SystemException se) {
118                            _log.error(se, se);
119    
120                            throw se;
121                    }
122            }
123    
124            public static com.liferay.portal.kernel.repository.LocalRepository getLocalRepositoryImpl(
125                    HttpPrincipal httpPrincipal, long repositoryId)
126                    throws com.liferay.portal.kernel.exception.PortalException,
127                            com.liferay.portal.kernel.exception.SystemException {
128                    try {
129                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
130                                            "getLocalRepositoryImpl",
131                                            _getLocalRepositoryImplParameterTypes2);
132    
133                            MethodHandler methodHandler = new MethodHandler(methodKey,
134                                            repositoryId);
135    
136                            Object returnObj = null;
137    
138                            try {
139                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
140                            }
141                            catch (Exception e) {
142                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
143                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
144                                    }
145    
146                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
147                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
148                                    }
149    
150                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
151                            }
152    
153                            return (com.liferay.portal.kernel.repository.LocalRepository)returnObj;
154                    }
155                    catch (com.liferay.portal.kernel.exception.SystemException se) {
156                            _log.error(se, se);
157    
158                            throw se;
159                    }
160            }
161    
162            public static com.liferay.portal.kernel.repository.LocalRepository getLocalRepositoryImpl(
163                    HttpPrincipal httpPrincipal, long folderId, long fileEntryId,
164                    long fileVersionId)
165                    throws com.liferay.portal.kernel.exception.PortalException,
166                            com.liferay.portal.kernel.exception.SystemException {
167                    try {
168                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
169                                            "getLocalRepositoryImpl",
170                                            _getLocalRepositoryImplParameterTypes3);
171    
172                            MethodHandler methodHandler = new MethodHandler(methodKey,
173                                            folderId, fileEntryId, fileVersionId);
174    
175                            Object returnObj = null;
176    
177                            try {
178                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
179                            }
180                            catch (Exception e) {
181                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
182                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
183                                    }
184    
185                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
186                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
187                                    }
188    
189                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
190                            }
191    
192                            return (com.liferay.portal.kernel.repository.LocalRepository)returnObj;
193                    }
194                    catch (com.liferay.portal.kernel.exception.SystemException se) {
195                            _log.error(se, se);
196    
197                            throw se;
198                    }
199            }
200    
201            public static com.liferay.portal.model.Repository getRepository(
202                    HttpPrincipal httpPrincipal, long repositoryId)
203                    throws com.liferay.portal.kernel.exception.PortalException,
204                            com.liferay.portal.kernel.exception.SystemException {
205                    try {
206                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
207                                            "getRepository", _getRepositoryParameterTypes4);
208    
209                            MethodHandler methodHandler = new MethodHandler(methodKey,
210                                            repositoryId);
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.model.Repository)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.kernel.repository.Repository getRepositoryImpl(
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.getName(),
244                                            "getRepositoryImpl", _getRepositoryImplParameterTypes5);
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.kernel.repository.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 folderId, long fileEntryId,
277                    long fileVersionId)
278                    throws com.liferay.portal.kernel.exception.PortalException,
279                            com.liferay.portal.kernel.exception.SystemException {
280                    try {
281                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
282                                            "getRepositoryImpl", _getRepositoryImplParameterTypes6);
283    
284                            MethodHandler methodHandler = new MethodHandler(methodKey,
285                                            folderId, fileEntryId, fileVersionId);
286    
287                            Object returnObj = null;
288    
289                            try {
290                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
291                            }
292                            catch (Exception e) {
293                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
294                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
295                                    }
296    
297                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
298                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
299                                    }
300    
301                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
302                            }
303    
304                            return (com.liferay.portal.kernel.repository.Repository)returnObj;
305                    }
306                    catch (com.liferay.portal.kernel.exception.SystemException se) {
307                            _log.error(se, se);
308    
309                            throw se;
310                    }
311            }
312    
313            public static java.lang.String[] getSupportedConfigurations(
314                    HttpPrincipal httpPrincipal, long classNameId)
315                    throws com.liferay.portal.kernel.exception.SystemException {
316                    try {
317                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
318                                            "getSupportedConfigurations",
319                                            _getSupportedConfigurationsParameterTypes7);
320    
321                            MethodHandler methodHandler = new MethodHandler(methodKey,
322                                            classNameId);
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.SystemException) {
331                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
332                                    }
333    
334                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
335                            }
336    
337                            return (java.lang.String[])returnObj;
338                    }
339                    catch (com.liferay.portal.kernel.exception.SystemException se) {
340                            _log.error(se, se);
341    
342                            throw se;
343                    }
344            }
345    
346            public static java.lang.String[] getSupportedParameters(
347                    HttpPrincipal httpPrincipal, long classNameId,
348                    java.lang.String configuration)
349                    throws com.liferay.portal.kernel.exception.SystemException {
350                    try {
351                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
352                                            "getSupportedParameters",
353                                            _getSupportedParametersParameterTypes8);
354    
355                            MethodHandler methodHandler = new MethodHandler(methodKey,
356                                            classNameId, configuration);
357    
358                            Object returnObj = null;
359    
360                            try {
361                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
362                            }
363                            catch (Exception e) {
364                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
365                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
366                                    }
367    
368                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
369                            }
370    
371                            return (java.lang.String[])returnObj;
372                    }
373                    catch (com.liferay.portal.kernel.exception.SystemException se) {
374                            _log.error(se, se);
375    
376                            throw se;
377                    }
378            }
379    
380            public static com.liferay.portal.kernel.util.UnicodeProperties getTypeSettingsProperties(
381                    HttpPrincipal httpPrincipal, long repositoryId)
382                    throws com.liferay.portal.kernel.exception.PortalException,
383                            com.liferay.portal.kernel.exception.SystemException {
384                    try {
385                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
386                                            "getTypeSettingsProperties",
387                                            _getTypeSettingsPropertiesParameterTypes9);
388    
389                            MethodHandler methodHandler = new MethodHandler(methodKey,
390                                            repositoryId);
391    
392                            Object returnObj = null;
393    
394                            try {
395                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
396                            }
397                            catch (Exception e) {
398                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
399                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
400                                    }
401    
402                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
403                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
404                                    }
405    
406                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
407                            }
408    
409                            return (com.liferay.portal.kernel.util.UnicodeProperties)returnObj;
410                    }
411                    catch (com.liferay.portal.kernel.exception.SystemException se) {
412                            _log.error(se, se);
413    
414                            throw se;
415                    }
416            }
417    
418            public static void unmountRepositories(HttpPrincipal httpPrincipal,
419                    long groupId)
420                    throws com.liferay.portal.kernel.exception.PortalException,
421                            com.liferay.portal.kernel.exception.SystemException {
422                    try {
423                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
424                                            "unmountRepositories", _unmountRepositoriesParameterTypes10);
425    
426                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
427    
428                            try {
429                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
430                            }
431                            catch (Exception e) {
432                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
433                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
434                                    }
435    
436                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
437                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
438                                    }
439    
440                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
441                            }
442                    }
443                    catch (com.liferay.portal.kernel.exception.SystemException se) {
444                            _log.error(se, se);
445    
446                            throw se;
447                    }
448            }
449    
450            public static void unmountRepository(HttpPrincipal httpPrincipal,
451                    long repositoryId)
452                    throws com.liferay.portal.kernel.exception.PortalException,
453                            com.liferay.portal.kernel.exception.SystemException {
454                    try {
455                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
456                                            "unmountRepository", _unmountRepositoryParameterTypes11);
457    
458                            MethodHandler methodHandler = new MethodHandler(methodKey,
459                                            repositoryId);
460    
461                            try {
462                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
463                            }
464                            catch (Exception e) {
465                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
466                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
467                                    }
468    
469                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
470                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
471                                    }
472    
473                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
474                            }
475                    }
476                    catch (com.liferay.portal.kernel.exception.SystemException se) {
477                            _log.error(se, se);
478    
479                            throw se;
480                    }
481            }
482    
483            public static void updateRepository(HttpPrincipal httpPrincipal,
484                    long repositoryId, java.lang.String name, java.lang.String description)
485                    throws com.liferay.portal.kernel.exception.PortalException,
486                            com.liferay.portal.kernel.exception.SystemException {
487                    try {
488                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class.getName(),
489                                            "updateRepository", _updateRepositoryParameterTypes12);
490    
491                            MethodHandler methodHandler = new MethodHandler(methodKey,
492                                            repositoryId, name, description);
493    
494                            try {
495                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
496                            }
497                            catch (Exception e) {
498                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
499                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
500                                    }
501    
502                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
503                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
504                                    }
505    
506                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
507                            }
508                    }
509                    catch (com.liferay.portal.kernel.exception.SystemException se) {
510                            _log.error(se, se);
511    
512                            throw se;
513                    }
514            }
515    
516            private static Log _log = LogFactoryUtil.getLog(RepositoryServiceHttp.class);
517            private static final Class<?>[] _addRepositoryParameterTypes0 = new Class[] {
518                            long.class, long.class, long.class, java.lang.String.class,
519                            java.lang.String.class, java.lang.String.class,
520                            com.liferay.portal.kernel.util.UnicodeProperties.class,
521                            com.liferay.portal.service.ServiceContext.class
522                    };
523            private static final Class<?>[] _checkRepositoryParameterTypes1 = new Class[] {
524                            long.class
525                    };
526            private static final Class<?>[] _getLocalRepositoryImplParameterTypes2 = new Class[] {
527                            long.class
528                    };
529            private static final Class<?>[] _getLocalRepositoryImplParameterTypes3 = new Class[] {
530                            long.class, long.class, long.class
531                    };
532            private static final Class<?>[] _getRepositoryParameterTypes4 = new Class[] {
533                            long.class
534                    };
535            private static final Class<?>[] _getRepositoryImplParameterTypes5 = new Class[] {
536                            long.class
537                    };
538            private static final Class<?>[] _getRepositoryImplParameterTypes6 = new Class[] {
539                            long.class, long.class, long.class
540                    };
541            private static final Class<?>[] _getSupportedConfigurationsParameterTypes7 = new Class[] {
542                            long.class
543                    };
544            private static final Class<?>[] _getSupportedParametersParameterTypes8 = new Class[] {
545                            long.class, java.lang.String.class
546                    };
547            private static final Class<?>[] _getTypeSettingsPropertiesParameterTypes9 = new Class[] {
548                            long.class
549                    };
550            private static final Class<?>[] _unmountRepositoriesParameterTypes10 = new Class[] {
551                            long.class
552                    };
553            private static final Class<?>[] _unmountRepositoryParameterTypes11 = new Class[] {
554                            long.class
555                    };
556            private static final Class<?>[] _updateRepositoryParameterTypes12 = new Class[] {
557                            long.class, java.lang.String.class, java.lang.String.class
558                    };
559    }