001    /**
002     * Copyright (c) 2000-2012 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    
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().getJSONWebServiceActionMapping(
050                            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    }