001    /**
002     * Copyright (c) 2000-2010 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.MethodWrapper;
020    import com.liferay.portal.security.auth.HttpPrincipal;
021    import com.liferay.portal.service.PortalServiceUtil;
022    
023    /**
024     * <p>
025     * This class provides a HTTP utility for the
026     * {@link com.liferay.portal.service.PortalServiceUtil} 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     * </p>
031     *
032     * <p>
033     * The benefits of using the HTTP utility is that it is fast and allows for
034     * tunneling without the cost of serializing to text. The drawback is that it
035     * only works with Java.
036     * </p>
037     *
038     * <p>
039     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
040     * configure security.
041     * </p>
042     *
043     * <p>
044     * The HTTP utility is only generated for remote services.
045     * </p>
046     *
047     * @author    Brian Wing Shun Chan
048     * @see       PortalServiceSoap
049     * @see       com.liferay.portal.security.auth.HttpPrincipal
050     * @see       com.liferay.portal.service.PortalServiceUtil
051     * @generated
052     */
053    public class PortalServiceHttp {
054            public static java.lang.String getAutoDeployDirectory(
055                    HttpPrincipal httpPrincipal)
056                    throws com.liferay.portal.kernel.exception.SystemException {
057                    try {
058                            MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
059                                            "getAutoDeployDirectory", new Object[0]);
060    
061                            Object returnObj = null;
062    
063                            try {
064                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
065                            }
066                            catch (Exception e) {
067                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
068                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
069                                    }
070    
071                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
072                            }
073    
074                            return (java.lang.String)returnObj;
075                    }
076                    catch (com.liferay.portal.kernel.exception.SystemException se) {
077                            _log.error(se, se);
078    
079                            throw se;
080                    }
081            }
082    
083            public static int getBuildNumber(HttpPrincipal httpPrincipal)
084                    throws com.liferay.portal.kernel.exception.SystemException {
085                    try {
086                            MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
087                                            "getBuildNumber", new Object[0]);
088    
089                            Object returnObj = null;
090    
091                            try {
092                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
093                            }
094                            catch (Exception e) {
095                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
096                            }
097    
098                            return ((Integer)returnObj).intValue();
099                    }
100                    catch (com.liferay.portal.kernel.exception.SystemException se) {
101                            _log.error(se, se);
102    
103                            throw se;
104                    }
105            }
106    
107            public static void test(HttpPrincipal httpPrincipal)
108                    throws com.liferay.portal.kernel.exception.SystemException {
109                    try {
110                            MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
111                                            "test", new Object[0]);
112    
113                            try {
114                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
115                            }
116                            catch (Exception e) {
117                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
118                            }
119                    }
120                    catch (com.liferay.portal.kernel.exception.SystemException se) {
121                            _log.error(se, se);
122    
123                            throw se;
124                    }
125            }
126    
127            public static void testCounterRollback(HttpPrincipal httpPrincipal)
128                    throws com.liferay.portal.kernel.exception.SystemException {
129                    try {
130                            MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
131                                            "testCounterRollback", new Object[0]);
132    
133                            try {
134                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
135                            }
136                            catch (Exception e) {
137                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
138                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
139                                    }
140    
141                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
142                            }
143                    }
144                    catch (com.liferay.portal.kernel.exception.SystemException se) {
145                            _log.error(se, se);
146    
147                            throw se;
148                    }
149            }
150    
151            private static Log _log = LogFactoryUtil.getLog(PortalServiceHttp.class);
152    }