1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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)
63          throws com.liferay.portal.kernel.exception.SystemException {
64          try {
65              MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
66                      "getAutoDeployDirectory", new Object[0]);
67  
68              Object returnObj = null;
69  
70              try {
71                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
72              }
73              catch (Exception e) {
74                  if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
75                      throw (com.liferay.portal.kernel.exception.SystemException)e;
76                  }
77  
78                  throw new com.liferay.portal.kernel.exception.SystemException(e);
79              }
80  
81              return (java.lang.String)returnObj;
82          }
83          catch (com.liferay.portal.kernel.exception.SystemException se) {
84              _log.error(se, se);
85  
86              throw se;
87          }
88      }
89  
90      public static int getBuildNumber(HttpPrincipal httpPrincipal)
91          throws com.liferay.portal.kernel.exception.SystemException {
92          try {
93              MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
94                      "getBuildNumber", new Object[0]);
95  
96              Object returnObj = null;
97  
98              try {
99                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
100             }
101             catch (Exception e) {
102                 throw new com.liferay.portal.kernel.exception.SystemException(e);
103             }
104 
105             return ((Integer)returnObj).intValue();
106         }
107         catch (com.liferay.portal.kernel.exception.SystemException se) {
108             _log.error(se, se);
109 
110             throw se;
111         }
112     }
113 
114     public static void test(HttpPrincipal httpPrincipal)
115         throws com.liferay.portal.kernel.exception.SystemException {
116         try {
117             MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
118                     "test", new Object[0]);
119 
120             try {
121                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
122             }
123             catch (Exception e) {
124                 throw new com.liferay.portal.kernel.exception.SystemException(e);
125             }
126         }
127         catch (com.liferay.portal.kernel.exception.SystemException se) {
128             _log.error(se, se);
129 
130             throw se;
131         }
132     }
133 
134     public static void testCounterRollback(HttpPrincipal httpPrincipal)
135         throws com.liferay.portal.kernel.exception.SystemException {
136         try {
137             MethodWrapper methodWrapper = new MethodWrapper(PortalServiceUtil.class.getName(),
138                     "testCounterRollback", new Object[0]);
139 
140             try {
141                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
142             }
143             catch (Exception e) {
144                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
145                     throw (com.liferay.portal.kernel.exception.SystemException)e;
146                 }
147 
148                 throw new com.liferay.portal.kernel.exception.SystemException(e);
149             }
150         }
151         catch (com.liferay.portal.kernel.exception.SystemException se) {
152             _log.error(se, se);
153 
154             throw se;
155         }
156     }
157 
158     private static Log _log = LogFactoryUtil.getLog(PortalServiceHttp.class);
159 }