1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.PortalServiceUtil;
23  
24  /**
25   * <a href="PortalServiceHttp.java.html"><b><i>View Source</i></b></a>
26   *
27   * <p>
28   * ServiceBuilder generated this class. Modifications in this class will be
29   * overwritten the next time is generated.
30   * </p>
31   *
32   * <p>
33   * This class provides a HTTP utility for the
34   * {@link com.liferay.portal.service.PortalServiceUtil} service utility. The
35   * static methods of this class calls the same methods of the service utility.
36   * However, the signatures are different because it requires an additional
37   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
38   * </p>
39   *
40   * <p>
41   * The benefits of using the HTTP utility is that it is fast and allows for
42   * tunneling without the cost of serializing to text. The drawback is that it
43   * only works with Java.
44   * </p>
45   *
46   * <p>
47   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
48   * configure security.
49   * </p>
50   *
51   * <p>
52   * The HTTP utility is only generated for remote services.
53   * </p>
54   *
55   * @author    Brian Wing Shun Chan
56   * @see       PortalServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.PortalServiceUtil
59   * @generated
60   */
61  public class PortalServiceHttp {
62      public static java.lang.String getAutoDeployDirectory(
63          HttpPrincipal httpPrincipal) throws com.liferay.portal.SystemException {
64          try {
65              MethodKey methodKey = new MethodKey(PortalServiceUtil.class.getName(),
66                      "getAutoDeployDirectory",
67                      _getAutoDeployDirectoryParameterTypes0);
68  
69              MethodHandler methodHandler = new MethodHandler(methodKey);
70  
71              Object returnObj = null;
72  
73              try {
74                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
75              }
76              catch (Exception e) {
77                  if (e instanceof com.liferay.portal.SystemException) {
78                      throw (com.liferay.portal.SystemException)e;
79                  }
80  
81                  throw new com.liferay.portal.SystemException(e);
82              }
83  
84              return (java.lang.String)returnObj;
85          }
86          catch (com.liferay.portal.SystemException se) {
87              _log.error(se, se);
88  
89              throw se;
90          }
91      }
92  
93      public static int getBuildNumber(HttpPrincipal httpPrincipal)
94          throws com.liferay.portal.SystemException {
95          try {
96              MethodKey methodKey = new MethodKey(PortalServiceUtil.class.getName(),
97                      "getBuildNumber", _getBuildNumberParameterTypes1);
98  
99              MethodHandler methodHandler = new MethodHandler(methodKey);
100 
101             Object returnObj = null;
102 
103             try {
104                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
105             }
106             catch (Exception e) {
107                 throw new com.liferay.portal.SystemException(e);
108             }
109 
110             return ((Integer)returnObj).intValue();
111         }
112         catch (com.liferay.portal.SystemException se) {
113             _log.error(se, se);
114 
115             throw se;
116         }
117     }
118 
119     public static void test(HttpPrincipal httpPrincipal)
120         throws com.liferay.portal.SystemException {
121         try {
122             MethodKey methodKey = new MethodKey(PortalServiceUtil.class.getName(),
123                     "test", _testParameterTypes2);
124 
125             MethodHandler methodHandler = new MethodHandler(methodKey);
126 
127             try {
128                 TunnelUtil.invoke(httpPrincipal, methodHandler);
129             }
130             catch (Exception e) {
131                 throw new com.liferay.portal.SystemException(e);
132             }
133         }
134         catch (com.liferay.portal.SystemException se) {
135             _log.error(se, se);
136 
137             throw se;
138         }
139     }
140 
141     public static void testCounterRollback(HttpPrincipal httpPrincipal)
142         throws com.liferay.portal.SystemException {
143         try {
144             MethodKey methodKey = new MethodKey(PortalServiceUtil.class.getName(),
145                     "testCounterRollback", _testCounterRollbackParameterTypes3);
146 
147             MethodHandler methodHandler = new MethodHandler(methodKey);
148 
149             try {
150                 TunnelUtil.invoke(httpPrincipal, methodHandler);
151             }
152             catch (Exception e) {
153                 if (e instanceof com.liferay.portal.SystemException) {
154                     throw (com.liferay.portal.SystemException)e;
155                 }
156 
157                 throw new com.liferay.portal.SystemException(e);
158             }
159         }
160         catch (com.liferay.portal.SystemException se) {
161             _log.error(se, se);
162 
163             throw se;
164         }
165     }
166 
167     private static Log _log = LogFactoryUtil.getLog(PortalServiceHttp.class);
168     private static final Class<?>[] _getAutoDeployDirectoryParameterTypes0 = new Class[] {
169             
170         };
171     private static final Class<?>[] _getBuildNumberParameterTypes1 = new Class[] {
172             
173         };
174     private static final Class<?>[] _testParameterTypes2 = new Class[] {  };
175     private static final Class<?>[] _testCounterRollbackParameterTypes3 = new Class[] {
176             
177         };
178 }