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 servletContextPath) {
060    
061                    PortalRuntimePermission.checkGetBeanProperty(
062                            JSONWebServiceActionsManagerUtil.class);
063    
064                    return _jsonWebServiceActionsManager.getJSONWebServiceActionMappings(
065                            servletContextPath);
066            }
067    
068            public static JSONWebServiceActionsManager
069                    getJSONWebServiceActionsManager() {
070    
071                    return _jsonWebServiceActionsManager;
072            }
073    
074            public static void registerJSONWebServiceAction(
075                    String servletContextPath, Class<?> actionClass, Method actionMethod,
076                    String path, String method) {
077    
078                    getJSONWebServiceActionsManager().registerJSONWebServiceAction(
079                            servletContextPath, actionClass, actionMethod, path, method);
080            }
081    
082            public static int unregisterJSONWebServiceActions(
083                    String servletContextPath) {
084    
085                    return getJSONWebServiceActionsManager().
086                            unregisterJSONWebServiceActions(servletContextPath);
087            }
088    
089            public void setJSONWebServiceActionsManager(
090                    JSONWebServiceActionsManager jsonWebServiceActionsManager) {
091    
092                    PortalRuntimePermission.checkSetBeanProperty(getClass());
093    
094                    _jsonWebServiceActionsManager = jsonWebServiceActionsManager;
095            }
096    
097            private static JSONWebServiceActionsManager _jsonWebServiceActionsManager;
098    
099    }