001    /**
002     * Copyright (c) 2000-2010 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.PortalServiceUtil;
023    
024    /**
025     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.PortalServiceUtil} 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       PortalServiceSoap
050     * @see       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.PortalServiceUtil
052     * @generated
053     */
054    public class PortalServiceHttp {
055            public static java.lang.String getAutoDeployDirectory(
056                    HttpPrincipal httpPrincipal)
057                    throws com.liferay.portal.kernel.exception.SystemException {
058                    try {
059                            MethodKey methodKey = new MethodKey(PortalServiceUtil.class.getName(),
060                                            "getAutoDeployDirectory",
061                                            _getAutoDeployDirectoryParameterTypes0);
062    
063                            MethodHandler methodHandler = new MethodHandler(methodKey);
064    
065                            Object returnObj = null;
066    
067                            try {
068                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
069                            }
070                            catch (Exception e) {
071                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
072                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
073                                    }
074    
075                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
076                            }
077    
078                            return (java.lang.String)returnObj;
079                    }
080                    catch (com.liferay.portal.kernel.exception.SystemException se) {
081                            _log.error(se, se);
082    
083                            throw se;
084                    }
085            }
086    
087            public static int getBuildNumber(HttpPrincipal httpPrincipal)
088                    throws com.liferay.portal.kernel.exception.SystemException {
089                    try {
090                            MethodKey methodKey = new MethodKey(PortalServiceUtil.class.getName(),
091                                            "getBuildNumber", _getBuildNumberParameterTypes1);
092    
093                            MethodHandler methodHandler = new MethodHandler(methodKey);
094    
095                            Object returnObj = null;
096    
097                            try {
098                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
099                            }
100                            catch (Exception e) {
101                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
102                            }
103    
104                            return ((Integer)returnObj).intValue();
105                    }
106                    catch (com.liferay.portal.kernel.exception.SystemException se) {
107                            _log.error(se, se);
108    
109                            throw se;
110                    }
111            }
112    
113            public static void test(HttpPrincipal httpPrincipal)
114                    throws com.liferay.portal.kernel.exception.SystemException {
115                    try {
116                            MethodKey methodKey = new MethodKey(PortalServiceUtil.class.getName(),
117                                            "test", _testParameterTypes2);
118    
119                            MethodHandler methodHandler = new MethodHandler(methodKey);
120    
121                            try {
122                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
123                            }
124                            catch (Exception e) {
125                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
126                            }
127                    }
128                    catch (com.liferay.portal.kernel.exception.SystemException se) {
129                            _log.error(se, se);
130    
131                            throw se;
132                    }
133            }
134    
135            public static void testCounterRollback(HttpPrincipal httpPrincipal)
136                    throws com.liferay.portal.kernel.exception.SystemException {
137                    try {
138                            MethodKey methodKey = new MethodKey(PortalServiceUtil.class.getName(),
139                                            "testCounterRollback", _testCounterRollbackParameterTypes3);
140    
141                            MethodHandler methodHandler = new MethodHandler(methodKey);
142    
143                            try {
144                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
145                            }
146                            catch (Exception e) {
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            private static Log _log = LogFactoryUtil.getLog(PortalServiceHttp.class);
162            private static final Class<?>[] _getAutoDeployDirectoryParameterTypes0 = new Class[] {
163                            
164                    };
165            private static final Class<?>[] _getBuildNumberParameterTypes1 = new Class[] {
166                            
167                    };
168            private static final Class<?>[] _testParameterTypes2 = new Class[] {  };
169            private static final Class<?>[] _testCounterRollbackParameterTypes3 = new Class[] {
170                            
171                    };
172    }