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.MethodWrapper;
20  import com.liferay.portal.security.auth.HttpPrincipal;
21  import com.liferay.portal.service.PortalServiceUtil;
22  
23  /**
24   * <a href="PortalServiceHttp.java.html"><b><i>View Source</i></b></a>
25   *
26   * <p>
27   * ServiceBuilder generated this class. Modifications in this class will be
28   * overwritten the next time is generated.
29   * </p>
30   *
31   * <p>
32   * This class provides a HTTP utility for the
33   * {@link com.liferay.portal.service.PortalServiceUtil} service utility. The
34   * static methods of this class calls the same methods of the service utility.
35   * However, the signatures are different because it requires an additional
36   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
37   * </p>
38   *
39   * <p>
40   * The benefits of using the HTTP utility is that it is fast and allows for
41   * tunneling without the cost of serializing to text. The drawback is that it
42   * only works with Java.
43   * </p>
44   *
45   * <p>
46   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
47   * configure security.
48   * </p>
49   *
50   * <p>
51   * The HTTP utility is only generated for remote services.
52   * </p>
53   *
54   * @author    Brian Wing Shun Chan
55   * @see       PortalServiceSoap
56   * @see       com.liferay.portal.security.auth.HttpPrincipal
57   * @see       com.liferay.portal.service.PortalServiceUtil
58   * @generated
59   */
60  public class PortalServiceHttp {
61      public static java.lang.String getAutoDeployDirectory(
62          HttpPrincipal httpPrincipal) throws com.liferay.portal.SystemException {
63          try {
64              MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
65                      "getAutoDeployDirectory", new Object[0]);
66  
67              Object returnObj = null;
68  
69              try {
70                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
71              }
72              catch (Exception e) {
73                  if (e instanceof com.liferay.portal.SystemException) {
74                      throw (com.liferay.portal.SystemException)e;
75                  }
76  
77                  throw new com.liferay.portal.SystemException(e);
78              }
79  
80              return (java.lang.String)returnObj;
81          }
82          catch (com.liferay.portal.SystemException se) {
83              _log.error(se, se);
84  
85              throw se;
86          }
87      }
88  
89      public static int getBuildNumber(HttpPrincipal httpPrincipal)
90          throws com.liferay.portal.SystemException {
91          try {
92              MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
93                      "getBuildNumber", new Object[0]);
94  
95              Object returnObj = null;
96  
97              try {
98                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
99              }
100             catch (Exception e) {
101                 throw new com.liferay.portal.SystemException(e);
102             }
103 
104             return ((Integer)returnObj).intValue();
105         }
106         catch (com.liferay.portal.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.SystemException {
115         try {
116             MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
117                     "test", new Object[0]);
118 
119             try {
120                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
121             }
122             catch (Exception e) {
123                 throw new com.liferay.portal.SystemException(e);
124             }
125         }
126         catch (com.liferay.portal.SystemException se) {
127             _log.error(se, se);
128 
129             throw se;
130         }
131     }
132 
133     public static void testCounterRollback(HttpPrincipal httpPrincipal)
134         throws com.liferay.portal.SystemException {
135         try {
136             MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
137                     "testCounterRollback", new Object[0]);
138 
139             try {
140                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
141             }
142             catch (Exception e) {
143                 if (e instanceof com.liferay.portal.SystemException) {
144                     throw (com.liferay.portal.SystemException)e;
145                 }
146 
147                 throw new com.liferay.portal.SystemException(e);
148             }
149         }
150         catch (com.liferay.portal.SystemException se) {
151             _log.error(se, se);
152 
153             throw se;
154         }
155     }
156 
157     private static Log _log = LogFactoryUtil.getLog(PortalServiceHttp.class);
158 }