001    /**
002     * Copyright (c) 2000-2010 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.portlet;
016    
017    import java.util.Collections;
018    import java.util.Enumeration;
019    import java.util.Map;
020    
021    import javax.portlet.PortletContext;
022    import javax.portlet.filter.FilterConfig;
023    
024    /**
025     * @author Brian Wing Shun Chan
026     */
027    public class FilterConfigImpl implements FilterConfig {
028    
029            public FilterConfigImpl(
030                    String filterName, PortletContext portletContext,
031                    Map<String, String> params) {
032    
033                    _filterName = filterName;
034                    _portletContext = portletContext;
035                    _params = params;
036            }
037    
038            public String getFilterName() {
039                    return _filterName;
040            }
041    
042            public String getInitParameter(String name) {
043                    if (name == null) {
044                            throw new IllegalArgumentException();
045                    }
046    
047                    return _params.get(name);
048            }
049    
050            public Enumeration<String> getInitParameterNames() {
051                    return Collections.enumeration(_params.keySet());
052            }
053    
054            public PortletContext getPortletContext() {
055                    return _portletContext;
056            }
057    
058            private String _filterName;
059            private PortletContext _portletContext;
060            private Map<String, String> _params;
061    
062    }