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