Author: julien(a)jboss.com
Date: 2008-02-02 13:26:59 -0500 (Sat, 02 Feb 2008)
New Revision: 9714
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ClassInstanceLifeCycle.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterConfigImpl.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerFilterInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletApplicationInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
modules/portlet/trunk/test/src/test/build.xml
Log:
implementation of portlet filtering, no unit tests yet (but will follow).
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerFilterInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerFilterInfo.java 2008-02-02
14:21:03 UTC (rev 9713)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerFilterInfo.java 2008-02-02
18:26:59 UTC (rev 9714)
@@ -26,6 +26,7 @@
import org.jboss.portal.common.i18n.LocalizedString;
import java.util.Map;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -41,7 +42,7 @@
private final String className;
/** . */
- private final LifeCyclePhase lifeCycle;
+ private final Set<LifeCyclePhase> lifeCycles;
/** . */
private final LocalizedString displayName;
@@ -55,14 +56,14 @@
public ContainerFilterInfo(
String name,
String className,
- LifeCyclePhase lifeCycle,
+ Set<LifeCyclePhase> lifeCycles,
LocalizedString displayName,
LocalizedString description,
Map<String, String> parameters)
{
this.name = name;
this.className = className;
- this.lifeCycle = lifeCycle;
+ this.lifeCycles = lifeCycles;
this.displayName = displayName;
this.description = description;
this.parameters = parameters;
@@ -78,9 +79,9 @@
return className;
}
- public LifeCyclePhase getLifeCycle()
+ public Set<LifeCyclePhase> getLifeCycles()
{
- return lifeCycle;
+ return lifeCycles;
}
public LocalizedString getDisplayName()
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-02-02
14:21:03 UTC (rev 9713)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-02-02
18:26:59 UTC (rev 9714)
@@ -40,6 +40,7 @@
import org.jboss.portal.portlet.impl.metadata.PublicRenderParameterMetaData;
import org.jboss.portal.portlet.impl.metadata.ListenerMetaData;
import org.jboss.portal.portlet.impl.metadata.filter.FilterMetaData;
+import org.jboss.portal.portlet.impl.metadata.filter.FilterMappingMetaData;
import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.portlet.LifeCyclePhase;
import org.jboss.portal.common.util.ConversionException;
@@ -64,6 +65,7 @@
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Collections;
+import java.util.HashSet;
import java.net.URI;
import java.net.URISyntaxException;
@@ -84,6 +86,51 @@
private static final String[] BUNDLE_KEYS = {JAVAX_PORTLET + MetaInfo.TITLE,
JAVAX_PORTLET + MetaInfo.SHORT_TITLE, JAVAX_PORTLET + MetaInfo.KEYWORDS};
/** . */
+ private static final List<ListenerMetaData> EMPTY_LISTENER_LIST =
Collections.emptyList();
+
+ /** . */
+ private static final List<PublicRenderParameterMetaData>
EMPTY_PUBLIC_RENDER_PARAMETER_LIST = Collections.emptyList();
+
+ /** . */
+ private static final List<EventDefinitionMetaData> EMPTY_EVENT_DEFINITION_LIST =
Collections.emptyList();
+
+ /** . */
+ private static final List<SecurityRoleRefMetaData> EMPPTY_SECURITY_ROLE_REF_LIST
= Collections.emptyList();
+
+ /** . */
+ private static final List<SecurityConstraintMetaData>
EMPTY_SECURITY_CONSTRAINT_LIST = Collections.emptyList();
+
+ /** . */
+ private static final List<SupportedLocaleMetaData> EMPTY_SUPPORTED_LOCALE_LIST =
Collections.emptyList();
+
+ /** . */
+ private static final List<PortletModeMetaData> EMPTY_PORTLET_MODE_LIST =
Collections.emptyList();
+
+ /** . */
+ private static final List<WindowStateMetaData> EMPTY_WINDOW_STATE_LIST =
Collections.emptyList();
+
+ /** . */
+ private static final Map<String,PortletPreferenceMetaData>
EMPTY_PORTLET_PREFERENCE_MAP = Collections.emptyMap();
+
+ /** . */
+ private static final PortletPreferencesMetaData EMPTY_PORTLET_PREFERENCES = new
PortletPreferencesMetaData();
+
+ /** . */
+ private static final List<InitParamMetaData> EMPTY_INIT_PARAM_LIST =
Collections.emptyList();
+
+ /** . */
+ private static final List<String> EMPTY_STRING_LIST = Collections.emptyList();
+
+ /** . */
+ private static final List<EventDefinitionReferenceMetaData>
EMPTY_EVENT_DEFINITION_REFERENCE_LIST = Collections.emptyList();
+
+ /** . */
+ private static final Map<String,FilterMappingMetaData> EMPTY_FILTER_MAPPING_MAP
= Collections.emptyMap();
+
+ /** . */
+ private static final Map<String,FilterMetaData> EMPTY_FILTER_MAP =
Collections.emptyMap();
+
+ /** . */
private final PortletApplication10MetaData portletApplicationMD;
/** . */
@@ -132,11 +179,11 @@
PortletApplication20MetaData tmp =
(PortletApplication20MetaData)portletApplicationMD;
if (tmp.getEvents() == null)
{
- tmp.setEvents(new ArrayList<EventDefinitionMetaData>());
+ tmp.setEvents(EMPTY_EVENT_DEFINITION_LIST);
}
if (tmp.getPublicRenderParameters() == null)
{
- tmp.setPublicRenderParameters(new
ArrayList<PublicRenderParameterMetaData>());
+ tmp.setPublicRenderParameters(EMPTY_PUBLIC_RENDER_PARAMETER_LIST);
}
if (tmp.getDefaultNamespace() == null)
{
@@ -151,8 +198,16 @@
}
if (tmp.getListeners() == null)
{
- tmp.setListeners(new ArrayList<ListenerMetaData>());
+ tmp.setListeners(EMPTY_LISTENER_LIST);
}
+ if (tmp.getFilters() == null)
+ {
+ tmp.setFilters(EMPTY_FILTER_MAP);
+ }
+ if (tmp.getFilterMapping() == null)
+ {
+ tmp.setFilterMapping(EMPTY_FILTER_MAPPING_MAP);
+ }
}
}
@@ -160,48 +215,48 @@
{
if (portletMD.getSecurityRoleRef() == null)
{
- portletMD.setSecurityRoleRef(new ArrayList<SecurityRoleRefMetaData>());
+ portletMD.setSecurityRoleRef(EMPPTY_SECURITY_ROLE_REF_LIST);
}
if (portletMD.getPortletApplication().getSecurityConstraints() == null)
{
- portletMD.getPortletApplication().setSecurityConstraints(new
ArrayList<SecurityConstraintMetaData>());
+
portletMD.getPortletApplication().setSecurityConstraints(EMPTY_SECURITY_CONSTRAINT_LIST);
}
if (portletMD.getSupportedLocale() == null)
{
- portletMD.setSupportedLocale(new ArrayList<SupportedLocaleMetaData>());
+ portletMD.setSupportedLocale(EMPTY_SUPPORTED_LOCALE_LIST);
}
for (SupportsMetaData supportsMD : portletMD.getSupports())
{
if (supportsMD.getPortletModes() == null)
{
- supportsMD.setPortletModes(new ArrayList<PortletModeMetaData>());
+ supportsMD.setPortletModes(EMPTY_PORTLET_MODE_LIST);
}
if (supportsMD.getWindowStates() == null)
{
- supportsMD.setWindowStates(new ArrayList<WindowStateMetaData>());
+ supportsMD.setWindowStates(EMPTY_WINDOW_STATE_LIST);
}
}
if (portletMD.getPortletPreferences() == null)
{
- portletMD.setPortletPreferences(new PortletPreferencesMetaData());
+ portletMD.setPortletPreferences(EMPTY_PORTLET_PREFERENCES);
}
if (portletMD.getPortletPreferences().getPortletPreferences() == null)
{
- portletMD.getPortletPreferences().setPortletPreferences(new HashMap<String,
PortletPreferenceMetaData>());
+
portletMD.getPortletPreferences().setPortletPreferences(EMPTY_PORTLET_PREFERENCE_MAP);
}
if (portletMD.getInitParams() == null)
{
- portletMD.setInitParams(new ArrayList<InitParamMetaData>());
+ portletMD.setInitParams(EMPTY_INIT_PARAM_LIST);
}
if (portletMD.getSupportedPublicRenderParameters() == null)
{
- portletMD.setSupportedPublicRenderParameters(new ArrayList<String>());
+ portletMD.setSupportedPublicRenderParameters(EMPTY_STRING_LIST);
}
for (PortletPreferenceMetaData portletPreferenceMD :
portletMD.getPortletPreferences().getPortletPreferences().values())
{
if (portletPreferenceMD.getValue() == null)
{
- portletPreferenceMD.setValue(new ArrayList<String>());
+ portletPreferenceMD.setValue(EMPTY_STRING_LIST);
}
}
@@ -210,11 +265,11 @@
{
if (portletMD.getSupportedProcessingEvent() == null)
{
- portletMD.setSupportedProcessingEvent(new
ArrayList<EventDefinitionReferenceMetaData>());
+
portletMD.setSupportedProcessingEvent(EMPTY_EVENT_DEFINITION_REFERENCE_LIST);
}
if (portletMD.getSupportedPublishingEvent() == null)
{
- portletMD.setSupportedPublishingEvent(new
ArrayList<EventDefinitionReferenceMetaData>());
+
portletMD.setSupportedPublishingEvent(EMPTY_EVENT_DEFINITION_REFERENCE_LIST);
}
}
}
@@ -272,6 +327,7 @@
//
String defaultNamespace = XMLConstants.NULL_NS_URI;
List<ContainerListenerInfo> listeners = Collections.emptyList();
+ Map<String, ContainerFilterInfo> allFilters = new HashMap<String,
ContainerFilterInfo>();
if (this.portletApplicationMD instanceof PortletApplication20MetaData)
{
PortletApplication20MetaData tmp =
(PortletApplication20MetaData)this.portletApplicationMD;
@@ -311,16 +367,16 @@
}
listeners = Collections.unmodifiableList(listeners);
-
//
-// for (FilterMetaData filterMD : tmp.getFilterCollection())
-// {
-// ContainerFilterInfo filter = build(filterMD);
-// }
+ for (FilterMetaData filterMD : tmp.getFilterCollection())
+ {
+ ContainerFilterInfo filter = build(filterMD);
+ allFilters.put(filter.getName(), filter);
+ }
}
//
- return new ContainerPortletApplicationInfo(defaultNamespace, listeners);
+ return new ContainerPortletApplicationInfo(defaultNamespace, allFilters.values(),
listeners);
}
private ContainerListenerInfo build(ListenerMetaData listenerMD)
@@ -339,13 +395,11 @@
initParameters.put(initParamMD.getName(), initParamMD.getValue());
}
- LifeCyclePhase lifeCycle;
-
//
return new ContainerFilterInfo(
filterMD.getFilterName(),
filterMD.getFilterClass(),
- null,
+ Collections.unmodifiableSet(new
HashSet<LifeCyclePhase>(filterMD.getLifecycle())),
filterMD.getDisplayName(),
filterMD.getDescription(),
Collections.unmodifiableMap(initParameters)
@@ -425,6 +479,36 @@
ContainerNavigationInfo containerNavigation =
buildContainerNavigationInfo(portletMD);
//
+ List<String> filters = new ArrayList<String>();
+ for (FilterMappingMetaData filterMappingMD :
((PortletApplication20MetaData)portletApplicationMD).getFilterMapping().values())
+ {
+ for (String portletName : filterMappingMD.getPortletNames())
+ {
+ boolean matches;
+ if (portletName.length() == 0)
+ {
+ // Do smth
+ matches = false;
+ }
+ else if (portletName.endsWith("*"))
+ {
+ String prefix = portletName.substring(0, portletName.length() - 1);
+ matches = portletMD.getPortletName().startsWith(prefix);
+ }
+ else
+ {
+ matches = portletMD.getPortletName().equals(portletName);
+ }
+
+ // Add the filter
+ if (matches)
+ {
+ filters.add(filterMappingMD.getName());
+ }
+ }
+ }
+
+ //
containerPortletInfo = new ContainerPortletInfo(
containerCapabilities,
containerPreferences,
@@ -434,6 +518,7 @@
containerSession,
containerEvents,
containerNavigation,
+ Collections.unmodifiableList(filters),
portletMD.getPortletName(),
portletMD.getPortletClass(),
Collections.unmodifiableMap(initParameters),
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletApplicationInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletApplicationInfo.java 2008-02-02
14:21:03 UTC (rev 9713)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletApplicationInfo.java 2008-02-02
18:26:59 UTC (rev 9714)
@@ -23,6 +23,10 @@
package org.jboss.portal.portlet.impl.info;
import java.util.List;
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.Collections;
+import java.util.Collection;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -37,12 +41,24 @@
/** . */
private final List<ContainerListenerInfo> listeners;
+ /** . */
+ private final Map<String, ContainerFilterInfo> filters;
+
public ContainerPortletApplicationInfo(
String defaultNamespace,
+ Collection<ContainerFilterInfo> filters,
List<ContainerListenerInfo> listeners)
{
+ LinkedHashMap<String, ContainerFilterInfo> tmp = new LinkedHashMap<String,
ContainerFilterInfo>();
+ for (ContainerFilterInfo filter : filters)
+ {
+ tmp.put(filter.getName(), filter);
+ }
+
+ //
this.defaultNamespace = defaultNamespace;
this.listeners = listeners;
+ this.filters = Collections.unmodifiableMap(tmp);
}
public String getDefaultNamespace()
@@ -54,4 +70,9 @@
{
return listeners;
}
+
+ public Map<String, ContainerFilterInfo> getFilters()
+ {
+ return filters;
+ }
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-02-02
14:21:03 UTC (rev 9713)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-02-02
18:26:59 UTC (rev 9714)
@@ -26,8 +26,9 @@
import org.jboss.portal.common.i18n.ResourceBundleManager;
import java.util.Map;
-import java.util.HashMap;
import java.util.Set;
+import java.util.List;
+import java.util.Collections;
/**
* For now implementation that use the portlet container directly.
@@ -78,6 +79,9 @@
/** . */
private final ContainerNavigationInfo navigation;
+ /** . */
+ private final List<String> filterRefs;
+
public ContainerPortletInfo(
ContainerCapabilitiesInfo capabilities,
ContainerPreferencesInfo preferences,
@@ -99,6 +103,7 @@
this.session = session;
this.events = new ContainerEventingInfo();
this.navigation = new ContainerNavigationInfo();
+ this.filterRefs = Collections.emptyList();
this.name = name;
this.className = className;
this.initParameters = initParameters;
@@ -115,6 +120,7 @@
ContainerSessionInfo session,
ContainerEventingInfo events,
ContainerNavigationInfo navigation,
+ List<String> filterRefs,
String name,
String className,
Map<String, String> initParameters,
@@ -129,6 +135,7 @@
this.session = session;
this.events = events;
this.navigation = navigation;
+ this.filterRefs = filterRefs;
this.name = name;
this.className = className;
this.initParameters = initParameters;
@@ -161,6 +168,11 @@
return initParameters.get(name);
}
+ public List<String> getFilterRefs()
+ {
+ return filterRefs;
+ }
+
public ContainerCapabilitiesInfo getCapabilities()
{
return capabilities;
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ClassInstanceLifeCycle.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ClassInstanceLifeCycle.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ClassInstanceLifeCycle.java 2008-02-02
18:26:59 UTC (rev 9714)
@@ -0,0 +1,179 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168;
+
+import org.jboss.portal.portlet.container.PortletInitializationException;
+import org.apache.log4j.Logger;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ClassInstanceLifeCycle<T>
+{
+
+ /** . */
+ private Logger log;
+
+ /** . */
+ private Class<T> expectedClass;
+
+ /** . */
+ private ClassLoader classLoader;
+
+ /** . */
+ private String className;
+
+ /** . */
+ private String type;
+
+ /** . */
+ private T instance;
+
+ public ClassInstanceLifeCycle(
+ Logger log,
+ Class<T> expectedClass,
+ ClassLoader classLoader,
+ String className,
+ String type)
+ {
+ this.log = log;
+ this.expectedClass = expectedClass;
+ this.classLoader = classLoader;
+ this.className = className;
+ this.type = type;
+ }
+
+ public void create() throws PortletInitializationException
+ {
+ T instance;
+ try
+ {
+ Class clazz = classLoader.loadClass(className);
+ if (expectedClass.isAssignableFrom(clazz))
+ {
+ Class<? extends T> castedClass = clazz.asSubclass(expectedClass);
+ Constructor<? extends T> ctor = castedClass.getConstructor();
+ instance = ctor.newInstance();
+ }
+ else
+ {
+ String msg = "Cannot create " + type + " with class " +
className + " because it does not implement the expected interface " +
expectedClass.getName();
+ throw new PortletInitializationException(msg);
+ }
+ }
+ catch (InvocationTargetException e)
+ {
+ String msg = "Cannot create " + type + " with class " +
className + " because the class contructor threw an exception";
+ throw new PortletInitializationException(msg, e.getCause());
+ }
+ catch (IllegalAccessException e)
+ {
+ String msg = "Cannot create " + type + " with class " +
className + " because the class is not accessible";
+ throw new PortletInitializationException(msg, e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ String msg = "Cannot create " + type + " with class " +
className + " because it does not have an no argument constructor";
+ throw new PortletInitializationException(msg, e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ String msg = "Cannot create " + type + " with class " +
className + " because the class cannot be loaded";
+ throw new PortletInitializationException(msg, e);
+ }
+ catch (InstantiationException e)
+ {
+ String msg = "Cannot create " + type + " with class " +
className + " because it cannot be instantiated";
+ throw new PortletInitializationException(msg, e);
+ }
+ catch (Error e)
+ {
+ String msg = "Cannot create " + type + " with class " +
className + " because of an error";
+ throw new PortletInitializationException(msg, e);
+ }
+
+ //
+ final ClassLoader previousLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ //
+ start(instance);
+ }
+ catch (Exception e)
+ {
+ String msg = "The " + type + " threw an exception during
init";
+ throw new PortletInitializationException(msg, e);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(previousLoader);
+ }
+
+ //
+ this.instance = instance;
+ }
+
+ public void destroy()
+ {
+ if (instance == null)
+ {
+ throw new IllegalStateException("No instance created previously");
+ }
+
+ //
+ try
+ {
+ stop(instance);
+ }
+ catch (Error e)
+ {
+ log.error("Stopping the " + type + " threw an error", e);
+ }
+ catch (Exception e)
+ {
+ log.error("Stopping the " + type + " threw an exception",
e);
+ }
+ }
+
+ public T getInstance()
+ {
+ return instance;
+ }
+
+ protected void start(T instance) throws Exception
+ {
+
+ }
+
+ protected void stop(T instance)
+ {
+
+ }
+
+}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2008-02-02
14:21:03 UTC (rev 9713)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2008-02-02
18:26:59 UTC (rev 9714)
@@ -24,25 +24,36 @@
import org.jboss.portal.portlet.impl.jsr168.api.PortletContextImpl;
import org.jboss.portal.portlet.impl.jsr168.api.PortletURLGenerationListenerChain;
+import org.jboss.portal.portlet.impl.jsr168.api.FilterConfigImpl;
import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
import org.jboss.portal.portlet.impl.info.ContainerListenerInfo;
+import org.jboss.portal.portlet.impl.info.ContainerFilterInfo;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletApplicationContext;
import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.PortletInitializationException;
+import org.jboss.portal.portlet.LifeCyclePhase;
import org.apache.log4j.Logger;
import javax.portlet.PortletContext;
import javax.portlet.PortletURLGenerationListener;
+import javax.portlet.filter.PortletFilter;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.EventFilter;
+import javax.portlet.filter.RenderFilter;
+import javax.portlet.filter.ResourceFilter;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Set;
import java.util.List;
import java.util.LinkedList;
import java.util.Collections;
-import java.lang.reflect.Constructor;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -51,6 +62,17 @@
public class PortletApplicationImpl implements PortletApplication
{
+ private static final EnumMap<LifeCyclePhase, Class<? extends
PortletFilter>> phaseToType =
+ new EnumMap<LifeCyclePhase, Class<? extends
PortletFilter>>(LifeCyclePhase.class);
+
+ static
+ {
+ phaseToType.put(LifeCyclePhase.ACTION, ActionFilter.class);
+ phaseToType.put(LifeCyclePhase.EVENT, EventFilter.class);
+ phaseToType.put(LifeCyclePhase.RENDER, RenderFilter.class);
+ phaseToType.put(LifeCyclePhase.RESOURCE, ResourceFilter.class);
+ }
+
/** Logger. */
protected final Logger log;
@@ -81,14 +103,11 @@
/** . */
protected PortletURLGenerationListener urlListener;
+ /** . */
+ protected Map<FilterKey, FilterLifecycle> filters;
+
/**
* Todo remove meta data reference and use info instead.
- *
- * @param info
- * @param metaData
- * @param jbossMetaData
- * @param context
- * @param portletAPIFactory
*/
public PortletApplicationImpl(
ContainerPortletApplicationInfo info,
@@ -145,63 +164,94 @@
public void start() throws Exception
{
+ PortletContextImpl portletContext = new
PortletContextImpl(context.getServletContext());
+
+ //
+ //
List<PortletURLGenerationListener> listeners = Collections.emptyList();
for (ContainerListenerInfo listenerInfo : info.getListeners())
{
- String className = listenerInfo.getClassName();
- ClassLoader classLoader = context.getClassLoader();
try
{
- Class clazz = classLoader.loadClass(className);
- if (PortletURLGenerationListener.class.isAssignableFrom(clazz))
+ String className = listenerInfo.getClassName();
+
+ ClassInstanceLifeCycle<PortletURLGenerationListener> lifeCycle = new
ClassInstanceLifeCycle<PortletURLGenerationListener>(
+ log,
+ PortletURLGenerationListener.class,
+ context.getClassLoader(),
+ className,
+ "listener"
+ );
+
+ //
+ lifeCycle.create();
+
+ //
+ if (listeners.size() == 0)
{
- Constructor ctor = clazz.getConstructor();
- PortletURLGenerationListener listener =
(PortletURLGenerationListener)ctor.newInstance();
- if (listeners.size() == 0)
- {
- listeners = new LinkedList<PortletURLGenerationListener>();
- }
- listeners.add(listener);
+ listeners = new LinkedList<PortletURLGenerationListener>();
}
- else
- {
- log.info("Cannot create filter with class " + className + "
because it does not implement the PortletURLGenerationListener interface");
- }
+
+ //
+ listeners.add(lifeCycle.getInstance());
}
- catch (IllegalAccessException e)
+ catch (PortletInitializationException e)
{
- log.error("Cannot create filter with class " + className + "
because the class is not accessible", e);
+ log.error(e.getMessage(), e);
}
- catch (NoSuchMethodException e)
+ }
+
+ //
+ HashMap<FilterKey, FilterLifecycle> filters = new HashMap<FilterKey,
FilterLifecycle>();
+ for (ContainerFilterInfo filterInfo : info.getFilters().values())
+ {
+ try
{
- log.error("Cannot create filter with class " + className + "
because it does not have an no argument constructor", e);
+ String className = filterInfo.getClassName();
+ FilterLifecycle lifeCycle = new FilterLifecycle(
+ PortletFilter.class,
+ context.getClassLoader(),
+ className,
+ "filter",
+ filterInfo.getName());
+
+ //
+ lifeCycle.create();
+
+ //
+ for (LifeCyclePhase phase : filterInfo.getLifeCycles())
+ {
+ Class<? extends PortletFilter> type = phaseToType.get(phase);
+ FilterKey key = new FilterKey(filterInfo.getName(), type);
+ filters.put(key, lifeCycle);
+ }
}
- catch (ClassNotFoundException e)
+ catch (PortletInitializationException e)
{
- log.error("Cannot create filter with class " + className + "
because the class cannot be loaded", e);
+ log.error(e.getMessage(), e);
}
- catch (InstantiationException e)
- {
- log.error("Cannot create filter with class " + className + "
because it cannot be instantiated", e);
- }
- catch (Error e)
- {
- log.error("Cannot create filter with class " + className + "
because of an error", e);
- }
}
//
this.version = metaData.getVersion();
- this.portletContext = new PortletContextImpl(context.getServletContext());
+ this.portletContext = portletContext;
this.urlListener = listeners.size() == 0 ? null : new
PortletURLGenerationListenerChain(Collections.unmodifiableList(listeners));
-
+ this.filters = filters;
}
public void stop()
{
+ // Stop filters
+ for (FilterLifecycle filter : filters.values())
+ {
+ filter.destroy();
+ }
+
+ //
this.version = null;
this.portletContext = null;
this.urlListener = null;
+ this.filters = null;
}
public String getVersion()
@@ -225,6 +275,20 @@
return null;
}
+ public <T extends PortletFilter> T getFilter(String filterName, Class<T>
phase)
+ {
+ FilterLifecycle lifeCycle = filters.get(new FilterKey(filterName, phase));
+
+ //
+ if (lifeCycle == null)
+ {
+ return null;
+ }
+
+ // Should be ok
+ return phase.cast(lifeCycle.getInstance());
+ }
+
// WebApp implementation
********************************************************************************************
public Set<PortletContainer> getPortletContainers()
@@ -248,4 +312,73 @@
{
return "PortletWebApp[" + metaData.getId() + "]";
}
+
+ private static class FilterKey
+ {
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Class<? extends PortletFilter> phase;
+
+ private FilterKey(String name, Class<? extends PortletFilter> phase)
+ {
+ this.name = name;
+ this.phase = phase;
+ }
+
+ public int hashCode()
+ {
+ return name.hashCode() + name.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof FilterKey)
+ {
+ FilterKey that = (FilterKey)obj;
+ return name.equals(that.name) && phase == that.phase;
+ }
+ return false;
+ }
+ }
+
+ private class FilterLifecycle extends ClassInstanceLifeCycle<PortletFilter>
+ {
+
+ /** . */
+ private final String filterName;
+
+ private FilterLifecycle(
+ Class<PortletFilter> expectedClass,
+ ClassLoader classLoader,
+ String className,
+ String type,
+ String filterName)
+ {
+ super(log, expectedClass, classLoader, className, type);
+
+ //
+ this.filterName = filterName;
+ }
+
+ public void start(PortletFilter instance) throws Exception
+ {
+ FilterConfigImpl config = new FilterConfigImpl(filterName, portletContext);
+
+ //
+ instance.init(config);
+ }
+
+ public void stop(PortletFilter instance)
+ {
+ instance.destroy();
+ }
+ }
+
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-02-02
14:21:03 UTC (rev 9713)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-02-02
18:26:59 UTC (rev 9714)
@@ -39,6 +39,7 @@
import org.jboss.portal.portlet.impl.jsr168.api.EventResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.api.ResourceRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.ResourceResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.FilterChainImpl;
import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
@@ -61,9 +62,27 @@
import javax.portlet.UnavailableException;
import javax.portlet.EventPortlet;
import javax.portlet.ResourceServingPortlet;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.filter.PortletFilter;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.EventFilter;
+import javax.portlet.filter.RenderFilter;
+import javax.portlet.filter.ResourceFilter;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.filter.FilterConfig;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -99,6 +118,21 @@
/** User data constraint. */
protected Set userDataConstraints;
+ /** . */
+ private final Invoker invoker = new Invoker();
+
+ /** . */
+ private List<ActionFilter> actionFilterList;
+
+ /** . */
+ private List<EventFilter> eventFilterList;
+
+ /** . */
+ private List<RenderFilter> renderFilterList;
+
+ /** . */
+ private List<ResourceFilter> resourceFilterList;
+
/**
* The preference validator, this is not exposed as runtime meta data as it is only
used by the JSR 168 portlet
* container implementation.
@@ -201,6 +235,9 @@
this.config = config;
this.started = true;
+ //
+ buildFilterChains();
+
// Let invocation flow in
valve.open();
}
@@ -230,6 +267,37 @@
}
}
+ private void buildFilterChains()
+ {
+ List<ActionFilter> actionFilterList = builderFilterList(ActionFilter.class);
+ List<EventFilter> eventFilterList = builderFilterList(EventFilter.class);
+ List<RenderFilter> renderFilterList = builderFilterList(RenderFilter.class);
+ List<ResourceFilter> resourceFilterList =
builderFilterList(ResourceFilter.class);
+
+ // Add invoker
+ actionFilterList.add(invoker);
+ eventFilterList.add(invoker);
+ renderFilterList.add(invoker);
+ resourceFilterList.add(invoker);
+
+ //
+ this.actionFilterList = Collections.unmodifiableList(actionFilterList);
+ this.eventFilterList = Collections.unmodifiableList(eventFilterList);
+ this.renderFilterList = Collections.unmodifiableList(renderFilterList);
+ this.resourceFilterList = Collections.unmodifiableList(resourceFilterList);
+ }
+
+ private <T extends PortletFilter> List<T> builderFilterList(Class<T>
type)
+ {
+ ArrayList<T> list = new ArrayList<T>();
+ for (String filterRef : info.getFilterRefs())
+ {
+ T filter = application.getFilter(filterRef, type);
+ list.add(filter);
+ }
+ return list;
+ }
+
public void stop()
{
// if the portlet is not started, we shouldn't be trying to stop it...
@@ -419,7 +487,10 @@
dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE,
"ACTION_PHASE");
dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION,
invocation);
- portlet.processAction(req, resp);
+
+ //
+ FilterChainImpl<ActionFilter> chain = new
FilterChainImpl<ActionFilter>(actionFilterList, ActionFilter.class);
+ chain.doFilter(req, resp);
}
finally
{
@@ -446,7 +517,10 @@
dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE,
"RENDER_PHASE");
dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION,
invocation);
- portlet.render(req, resp);
+
+ //
+ FilterChainImpl<RenderFilter> chain = new
FilterChainImpl<RenderFilter>(renderFilterList, RenderFilter.class);
+ chain.doFilter(req, resp);
}
finally
{
@@ -466,17 +540,20 @@
//
PortletAPIFactory factory = application.getPortletAPIFactory();
- EventRequestImpl ereq = factory.createEventRequest(invocation);
- EventResponseImpl eresp = factory.createEventResponse(invocation, ereq);
+ EventRequestImpl req = factory.createEventRequest(invocation);
+ EventResponseImpl resp = factory.createEventResponse(invocation, req);
HttpServletRequest dreq = invocation.getDispatchedRequest();
try
{
dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, ereq);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, eresp);
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, req);
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE,
"EVENT_PHASE");
dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION,
invocation);
- eventPortlet.processEvent(ereq, eresp);
+
+ //
+ FilterChainImpl<EventFilter> chain = new
FilterChainImpl<EventFilter>(eventFilterList, EventFilter.class);
+ chain.doFilter(req, resp);
}
finally
{
@@ -486,7 +563,7 @@
dreq.removeAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE);
dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
}
- return eresp.getResponse();
+ return resp.getResponse();
}
protected PortletInvocationResponse invokeResource(ResourceInvocation invocation)
throws IOException, PortletException
@@ -506,7 +583,10 @@
dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE,
"RESOURCE_SERVING_PHASE");
dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION,
invocation);
- eventPortlet.serveResource(req, resp);
+
+ //
+ FilterChainImpl<ResourceFilter> chain = new
FilterChainImpl<ResourceFilter>(resourceFilterList, ResourceFilter.class);
+ chain.doFilter(req, resp);
}
finally
{
@@ -520,4 +600,39 @@
//
return resp.getResponse();
}
+
+ private class Invoker implements ActionFilter, EventFilter, RenderFilter,
ResourceFilter
+ {
+
+ public void doFilter(ActionRequest req, ActionResponse resp, FilterChain chain)
throws IOException, PortletException
+ {
+ portlet.processAction(req, resp);
+ }
+
+ public void doFilter(EventRequest req, EventResponse resp, FilterChain chain)
throws IOException, PortletException
+ {
+ EventPortlet eventPortlet = (EventPortlet)portlet;
+ eventPortlet.processEvent(req, resp);
+ }
+
+ public void doFilter(RenderRequest req, RenderResponse resp, FilterChain chain)
throws IOException, PortletException
+ {
+ portlet.render(req, resp);
+ }
+
+ public void doFilter(ResourceRequest req, ResourceResponse resp, FilterChain chain)
throws IOException, PortletException
+ {
+ ResourceServingPortlet servingPortlet = (ResourceServingPortlet)portlet;
+ servingPortlet.serveResource(req, resp);
+ }
+
+ public void init(FilterConfig filterConfig) throws PortletException
+ {
+ }
+
+ public void destroy()
+ {
+ }
+ }
+
}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java 2008-02-02
18:26:59 UTC (rev 9714)
@@ -0,0 +1,165 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import javax.portlet.filter.PortletFilter;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.ResourceFilter;
+import javax.portlet.filter.RenderFilter;
+import javax.portlet.filter.EventFilter;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class FilterChainImpl<T extends PortletFilter> implements FilterChain
+{
+
+ /** . */
+ private List<T> filters;
+
+ /** . */
+ private Class<T> phase;
+
+ /** . */
+ private int index;
+
+ public FilterChainImpl(List<T> filters, Class<T> phase)
+ {
+ this.filters = filters;
+ this.phase = phase;
+ this.index = 0;
+ }
+
+ public void doFilter(ActionRequest req, ActionResponse resp) throws IOException,
PortletException
+ {
+ if (!ActionFilter.class.isAssignableFrom(phase))
+ {
+ throw new IllegalStateException();
+ }
+ if (index >= filters.size())
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ int currentIndex = index++;
+ try
+ {
+ PortletFilter filter = filters.get(currentIndex);
+ ActionFilter actionFilter = ActionFilter.class.cast(filter);
+ actionFilter.doFilter(req, resp, this);
+ }
+ finally
+ {
+ index--;
+ }
+ }
+
+ public void doFilter(EventRequest req, EventResponse resp) throws IOException,
PortletException
+ {
+ if (!EventFilter.class.isAssignableFrom(phase))
+ {
+ throw new IllegalStateException();
+ }
+ if (index >= filters.size())
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ int currentIndex = index++;
+ try
+ {
+ PortletFilter filter = filters.get(currentIndex);
+ EventFilter eventFilter = EventFilter.class.cast(filter);
+ eventFilter.doFilter(req, resp, this);
+ }
+ finally
+ {
+ index--;
+ }
+ }
+
+ public void doFilter(RenderRequest req, RenderResponse resp) throws IOException,
PortletException
+ {
+ if (!RenderFilter.class.isAssignableFrom(phase))
+ {
+ throw new IllegalStateException();
+ }
+ if (index >= filters.size())
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ int currentIndex = index++;
+ try
+ {
+ PortletFilter filter = filters.get(currentIndex);
+ RenderFilter renderFilter = RenderFilter.class.cast(filter);
+ renderFilter.doFilter(req, resp, this);
+ }
+ finally
+ {
+ index--;
+ }
+ }
+
+ public void doFilter(ResourceRequest req, ResourceResponse resp) throws IOException,
PortletException
+ {
+ if (!ResourceFilter.class.isAssignableFrom(phase))
+ {
+ throw new IllegalStateException();
+ }
+ if (index >= filters.size())
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ int currentIndex = index++;
+ try
+ {
+ PortletFilter filter = filters.get(currentIndex);
+ ResourceFilter resourceFilter = ResourceFilter.class.cast(filter);
+ resourceFilter.doFilter(req, resp, this);
+ }
+ finally
+ {
+ index--;
+ }
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterConfigImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterConfigImpl.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterConfigImpl.java 2008-02-02
18:26:59 UTC (rev 9714)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.jboss.portal.common.NotYetImplemented;
+
+import javax.portlet.filter.FilterConfig;
+import javax.portlet.PortletContext;
+import java.util.Enumeration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class FilterConfigImpl implements FilterConfig
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final PortletContext context;
+
+ public FilterConfigImpl(String name, PortletContext context)
+ {
+ this.name = name;
+ this.context = context;
+ }
+
+ public String getFilterName()
+ {
+ return name;
+ }
+
+ public PortletContext getPortletContext()
+ {
+ return context;
+ }
+
+ public String getInitParameter(String s)
+ {
+ throw new NotYetImplemented();
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ throw new NotYetImplemented();
+ }
+}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-02 14:21:03 UTC (rev 9713)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-02 18:26:59 UTC (rev 9714)
@@ -16,7 +16,7 @@
<antcall target="tests.call.all"/>
<!--Cleanup-->
- <delete dir="${test.temp.dir}"/>
+ <!--<delete dir="${test.temp.dir}"/>-->
</target>