001    /**
002     * Copyright (c) 2000-2013 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.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.StagingServiceUtil;
023    
024    /**
025     * Provides the HTTP utility for the
026     * {@link com.liferay.portal.service.StagingServiceUtil} 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     *
031     * <p>
032     * The benefits of using the HTTP utility is that it is fast and allows for
033     * tunneling without the cost of serializing to text. The drawback is that it
034     * only works with Java.
035     * </p>
036     *
037     * <p>
038     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
039     * configure security.
040     * </p>
041     *
042     * <p>
043     * The HTTP utility is only generated for remote services.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see StagingServiceSoap
048     * @see com.liferay.portal.security.auth.HttpPrincipal
049     * @see com.liferay.portal.service.StagingServiceUtil
050     * @generated
051     */
052    public class StagingServiceHttp {
053            public static void cleanUpStagingRequest(HttpPrincipal httpPrincipal,
054                    long stagingRequestId)
055                    throws com.liferay.portal.kernel.exception.PortalException,
056                            com.liferay.portal.kernel.exception.SystemException {
057                    try {
058                            MethodKey methodKey = new MethodKey(StagingServiceUtil.class,
059                                            "cleanUpStagingRequest",
060                                            _cleanUpStagingRequestParameterTypes0);
061    
062                            MethodHandler methodHandler = new MethodHandler(methodKey,
063                                            stagingRequestId);
064    
065                            try {
066                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
067                            }
068                            catch (Exception e) {
069                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
070                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
071                                    }
072    
073                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
074                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
075                                    }
076    
077                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
078                            }
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 long createStagingRequest(HttpPrincipal httpPrincipal,
088                    long groupId, java.lang.String checksum)
089                    throws com.liferay.portal.kernel.exception.PortalException,
090                            com.liferay.portal.kernel.exception.SystemException {
091                    try {
092                            MethodKey methodKey = new MethodKey(StagingServiceUtil.class,
093                                            "createStagingRequest", _createStagingRequestParameterTypes1);
094    
095                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
096                                            checksum);
097    
098                            Object returnObj = null;
099    
100                            try {
101                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
102                            }
103                            catch (Exception e) {
104                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
105                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
106                                    }
107    
108                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
109                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
110                                    }
111    
112                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
113                            }
114    
115                            return ((Long)returnObj).longValue();
116                    }
117                    catch (com.liferay.portal.kernel.exception.SystemException se) {
118                            _log.error(se, se);
119    
120                            throw se;
121                    }
122            }
123    
124            public static void publishStagingRequest(HttpPrincipal httpPrincipal,
125                    long stagingRequestId, boolean privateLayout,
126                    java.util.Map<java.lang.String, java.lang.String[]> parameterMap)
127                    throws com.liferay.portal.kernel.exception.PortalException,
128                            com.liferay.portal.kernel.exception.SystemException {
129                    try {
130                            MethodKey methodKey = new MethodKey(StagingServiceUtil.class,
131                                            "publishStagingRequest",
132                                            _publishStagingRequestParameterTypes2);
133    
134                            MethodHandler methodHandler = new MethodHandler(methodKey,
135                                            stagingRequestId, privateLayout, parameterMap);
136    
137                            try {
138                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
139                            }
140                            catch (Exception e) {
141                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
142                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
143                                    }
144    
145                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
146                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
147                                    }
148    
149                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
150                            }
151                    }
152                    catch (com.liferay.portal.kernel.exception.SystemException se) {
153                            _log.error(se, se);
154    
155                            throw se;
156                    }
157            }
158    
159            public static void updateStagingRequest(HttpPrincipal httpPrincipal,
160                    long stagingRequestId, java.lang.String fileName, byte[] bytes)
161                    throws com.liferay.portal.kernel.exception.PortalException,
162                            com.liferay.portal.kernel.exception.SystemException {
163                    try {
164                            MethodKey methodKey = new MethodKey(StagingServiceUtil.class,
165                                            "updateStagingRequest", _updateStagingRequestParameterTypes3);
166    
167                            MethodHandler methodHandler = new MethodHandler(methodKey,
168                                            stagingRequestId, fileName, bytes);
169    
170                            try {
171                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
172                            }
173                            catch (Exception e) {
174                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
175                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
176                                    }
177    
178                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
179                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
180                                    }
181    
182                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
183                            }
184                    }
185                    catch (com.liferay.portal.kernel.exception.SystemException se) {
186                            _log.error(se, se);
187    
188                            throw se;
189                    }
190            }
191    
192            public static com.liferay.portal.kernel.lar.MissingReferences validateStagingRequest(
193                    HttpPrincipal httpPrincipal, long stagingRequestId,
194                    boolean privateLayout,
195                    java.util.Map<java.lang.String, java.lang.String[]> parameterMap)
196                    throws com.liferay.portal.kernel.exception.PortalException,
197                            com.liferay.portal.kernel.exception.SystemException {
198                    try {
199                            MethodKey methodKey = new MethodKey(StagingServiceUtil.class,
200                                            "validateStagingRequest",
201                                            _validateStagingRequestParameterTypes4);
202    
203                            MethodHandler methodHandler = new MethodHandler(methodKey,
204                                            stagingRequestId, privateLayout, parameterMap);
205    
206                            Object returnObj = null;
207    
208                            try {
209                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
210                            }
211                            catch (Exception e) {
212                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
213                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
214                                    }
215    
216                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
217                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
218                                    }
219    
220                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
221                            }
222    
223                            return (com.liferay.portal.kernel.lar.MissingReferences)returnObj;
224                    }
225                    catch (com.liferay.portal.kernel.exception.SystemException se) {
226                            _log.error(se, se);
227    
228                            throw se;
229                    }
230            }
231    
232            private static Log _log = LogFactoryUtil.getLog(StagingServiceHttp.class);
233            private static final Class<?>[] _cleanUpStagingRequestParameterTypes0 = new Class[] {
234                            long.class
235                    };
236            private static final Class<?>[] _createStagingRequestParameterTypes1 = new Class[] {
237                            long.class, java.lang.String.class
238                    };
239            private static final Class<?>[] _publishStagingRequestParameterTypes2 = new Class[] {
240                            long.class, boolean.class, java.util.Map.class
241                    };
242            private static final Class<?>[] _updateStagingRequestParameterTypes3 = new Class[] {
243                            long.class, java.lang.String.class, byte[].class
244                    };
245            private static final Class<?>[] _validateStagingRequestParameterTypes4 = new Class[] {
246                            long.class, boolean.class, java.util.Map.class
247                    };
248    }