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.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    import java.util.Set;
024    
025    import javax.servlet.http.HttpServletRequest;
026    
027    /**
028     * @author Igor Spasic
029     */
030    public class JSONWebServiceActionsManagerUtil {
031    
032            public static Set<String> getContextPaths() {
033                    return _jsonWebServiceActionsManager. getContextPaths();
034            }
035    
036            public static JSONWebServiceAction getJSONWebServiceAction(
037                    HttpServletRequest request) {
038    
039                    return getJSONWebServiceActionsManager().getJSONWebServiceAction(
040                            request);
041            }
042    
043            public static JSONWebServiceAction getJSONWebServiceAction(
044                    HttpServletRequest request, String path, String method,
045                    Map<String, Object> parameterMap) {
046    
047                    return getJSONWebServiceActionsManager().getJSONWebServiceAction(
048                            request, path, method, parameterMap);
049            }
050    
051            public static JSONWebServiceActionMapping getJSONWebServiceActionMapping(
052                    String signature) {
053    
054                    return getJSONWebServiceActionsManager().getJSONWebServiceActionMapping(
055                            signature);
056            }
057    
058            public static List<JSONWebServiceActionMapping>
059                    getJSONWebServiceActionMappings(String contextPath) {
060    
061                    PortalRuntimePermission.checkGetBeanProperty(
062                            JSONWebServiceActionsManagerUtil.class);
063    
064                    return _jsonWebServiceActionsManager.getJSONWebServiceActionMappings(
065                            contextPath);
066            }
067    
068            public static int getJSONWebServiceActionsCount(String contextPath) {
069                    return getJSONWebServiceActionsManager().getJSONWebServiceActionsCount(
070                            contextPath);
071            }
072    
073            public static JSONWebServiceActionsManager
074                    getJSONWebServiceActionsManager() {
075    
076                    return _jsonWebServiceActionsManager;
077            }
078    
079            public static void registerJSONWebServiceAction(
080                    String contextPath, Class<?> actionClass, Method actionMethod,
081                    String path, String method) {
082    
083                    getJSONWebServiceActionsManager().registerJSONWebServiceAction(
084                            contextPath, actionClass, actionMethod, path, method);
085            }
086    
087            public static void registerJSONWebServiceAction(
088                    String contextPath, Object actionObject, Class<?> actionClass,
089                    Method actionMethod, String path, String method) {
090    
091                    getJSONWebServiceActionsManager().registerJSONWebServiceAction(
092                            contextPath, actionObject, actionClass, actionMethod, path, method);
093            }
094    
095            public static int unregisterJSONWebServiceActions(Object actionObject) {
096                    return getJSONWebServiceActionsManager().
097                            unregisterJSONWebServiceActions(actionObject);
098            }
099    
100            public static int unregisterJSONWebServiceActions(String contextPath) {
101                    return getJSONWebServiceActionsManager().
102                            unregisterJSONWebServiceActions(contextPath);
103            }
104    
105            public void setJSONWebServiceActionsManager(
106                    JSONWebServiceActionsManager jsonWebServiceActionsManager) {
107    
108                    PortalRuntimePermission.checkSetBeanProperty(getClass());
109    
110                    _jsonWebServiceActionsManager = jsonWebServiceActionsManager;
111            }
112    
113            private static JSONWebServiceActionsManager _jsonWebServiceActionsManager;
114    
115    }