001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.jsonwebservice;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    import java.lang.reflect.Method;
020    
021    import java.util.List;
022    import java.util.Map;
023    
024    import javax.servlet.http.HttpServletRequest;
025    
026    /**
027     * @author Igor Spasic
028     */
029    public class JSONWebServiceActionsManagerUtil {
030    
031            public static JSONWebServiceAction getJSONWebServiceAction(
032                    HttpServletRequest request) {
033    
034                    return getJSONWebServiceActionsManager().getJSONWebServiceAction(
035                            request);
036            }
037    
038            public static JSONWebServiceAction getJSONWebServiceAction(
039                    HttpServletRequest request, String path, String method,
040                    Map<String, Object> parameterMap) {
041    
042                    return getJSONWebServiceActionsManager().getJSONWebServiceAction(
043                            request, path, method, parameterMap);
044            }
045    
046            public static JSONWebServiceActionMapping getJSONWebServiceActionMapping(
047                    String signature) {
048    
049                    return getJSONWebServiceActionsManager().
050                            getJSONWebServiceActionMapping(signature);
051            }
052    
053            public static List<JSONWebServiceActionMapping>
054                    getJSONWebServiceActionMappings(String servletContextPath) {
055    
056                    PortalRuntimePermission.checkGetBeanProperty(
057                            JSONWebServiceActionsManagerUtil.class);
058    
059                    return _jsonWebServiceActionsManager.getJSONWebServiceActionMappings(
060                            servletContextPath);
061            }
062    
063            public static JSONWebServiceActionsManager
064                    getJSONWebServiceActionsManager() {
065    
066                    return _jsonWebServiceActionsManager;
067            }
068    
069            public static void registerJSONWebServiceAction(
070                    String servletContextPath, Class<?> actionClass, Method actionMethod,
071                    String path, String method) {
072    
073                    getJSONWebServiceActionsManager().registerJSONWebServiceAction(
074                            servletContextPath, actionClass, actionMethod, path, method);
075            }
076    
077            public static int unregisterJSONWebServiceActions(
078                    String servletContextPath) {
079    
080                    return getJSONWebServiceActionsManager().
081                            unregisterJSONWebServiceActions(servletContextPath);
082            }
083    
084            public void setJSONWebServiceActionsManager(
085                    JSONWebServiceActionsManager jsonWebServiceActionsManager) {
086    
087                    PortalRuntimePermission.checkSetBeanProperty(getClass());
088    
089                    _jsonWebServiceActionsManager = jsonWebServiceActionsManager;
090            }
091    
092            private static JSONWebServiceActionsManager _jsonWebServiceActionsManager;
093    
094    }