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.kernel.servlet.filters.invoker;
016    
017    import java.util.Enumeration;
018    import java.util.Iterator;
019    import java.util.Map;
020    
021    import javax.servlet.FilterConfig;
022    import javax.servlet.ServletContext;
023    
024    /**
025     * @author Mika Koivisto
026     * @author Brian Wing Shun Chan
027     */
028    public class InvokerFilterConfig implements FilterConfig {
029    
030            public InvokerFilterConfig(
031                    ServletContext servletContext, String filterName,
032                    Map<String, String> initParameterMap) {
033    
034                    _servletContext = servletContext;
035                    _filterName = filterName;
036                    _initParameterMap = initParameterMap;
037            }
038    
039            public String getFilterName() {
040                    return _filterName;
041            }
042    
043            public String getInitParameter(String key) {
044                    return _initParameterMap.get(key);
045            }
046    
047            public Enumeration<String> getInitParameterNames() {
048                    return new Enumeration<String>() {
049    
050                            public boolean hasMoreElements() {
051                                    return _keys.hasNext();
052                            }
053    
054                            public String nextElement() {
055                                    return _keys.next();
056                            }
057    
058                            private Iterator<String> _keys =
059                                    _initParameterMap.keySet().iterator();
060    
061                    };
062            }
063    
064            public ServletContext getServletContext() {
065                    return _servletContext;
066            }
067    
068            private String _filterName;
069            private Map<String, String> _initParameterMap;
070            private ServletContext _servletContext;
071    
072    }