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