001    /**
002     * Copyright (c) 2000-2011 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.struts;
016    
017    import com.liferay.portal.kernel.struts.StrutsAction;
018    import com.liferay.portal.kernel.struts.StrutsPortletAction;
019    
020    import java.util.Map;
021    import java.util.concurrent.ConcurrentHashMap;
022    
023    import org.apache.struts.action.Action;
024    
025    /**
026     * @author Mika Koivisto
027     */
028    public class StrutsActionRegistry {
029    
030            public static void register(
031                    String path, StrutsPortletAction strutsPortletAction) {
032    
033                    Action action = new PortletActionAdapter(strutsPortletAction);
034    
035                    _actions.put(path, action);
036            }
037    
038            public static void register(String path, StrutsAction strutsAction) {
039                    Action action = new ActionAdapter(strutsAction);
040    
041                    _actions.put(path, action);
042            }
043    
044            public static void unregister(String path) {
045                    _actions.remove(path);
046            }
047    
048            public static Action getAction(String path) {
049                    return _actions.get(path);
050            }
051    
052            private static Map<String, Action> _actions =
053                    new ConcurrentHashMap<String, Action>();
054    
055    }