portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r756049 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/ components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/ components/jetspeed-registry/s...
Date Thu, 19 Mar 2009 15:40:29 GMT
Author: woonsan
Date: Thu Mar 19 15:40:28 2009
New Revision: 756049

URL: http://svn.apache.org/viewvc?rev=756049&view=rev
Log:
JS2-871: Upgrade Pluto container
- Adds Jetspeed implementation for FilterManagerService interface for simple optimization

Added:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterChain.java
  (with props)
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterConfig.java
  (with props)
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManager.java
  (with props)
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManagerService.java
  (with props)
Removed:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/FilterManagerImpl.java
Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortletURLListenerService.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ListenerImpl.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/Filter.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/Listener.java
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterChain.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterChain.java?rev=756049&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterChain.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterChain.java
Thu Mar 19 15:40:28 2009
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.container.services;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventPortlet;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceServingPortlet;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.EventFilter;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.filter.RenderFilter;
+import javax.portlet.filter.ResourceFilter;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.om.portlet.Filter;
+
+public class JetspeedFilterChain implements FilterChain
+{
+    private static final Log LOG = LogFactory.getLog(JetspeedFilterChain.class);
+    
+    private List<Filter> filterList = new ArrayList<Filter>();
+    private String lifeCycle;
+    Portlet portlet;
+    EventPortlet eventPortlet;
+    ResourceServingPortlet resourceServingPortlet;
+    ClassLoader loader;
+    PortletContext portletContext;
+    int filterListIndex = 0;
+
+    public JetspeedFilterChain(String lifeCycle){
+        this.lifeCycle = lifeCycle;
+    }
+    public void processFilter(PortletRequest req, PortletResponse res, ClassLoader loader,
EventPortlet eventPortlet, PortletContext portletContext) throws IOException, PortletException{
+        this.eventPortlet = eventPortlet;
+        this.loader = loader;
+        this.portletContext = portletContext;
+        doFilter((EventRequest)req,(EventResponse) res);
+    }
+    public void processFilter(PortletRequest req, PortletResponse res, ClassLoader loader,
ResourceServingPortlet resourceServingPortlet, PortletContext portletContext) throws IOException,
PortletException{
+        this.resourceServingPortlet = resourceServingPortlet;
+        this.loader = loader;
+        this.portletContext = portletContext;
+        doFilter((ResourceRequest)req,(ResourceResponse) res);
+    }
+    
+    public void processFilter(PortletRequest req, PortletResponse res, ClassLoader loader,
Portlet portlet, PortletContext portletContext) throws IOException, PortletException{
+        this.portlet = portlet;
+        this.loader = loader;
+        this.portletContext = portletContext;
+        if (lifeCycle.equals(PortletRequest.ACTION_PHASE)){
+            doFilter((ActionRequest)req,(ActionResponse) res);
+        }
+        else if (lifeCycle.equals(PortletRequest.RENDER_PHASE)){
+            doFilter((RenderRequest)req, (RenderResponse)res);
+        }
+    }
+    
+    public void addFilter(Filter filter){
+        filterList.add(filter);
+    }
+    
+    public void doFilter(ActionRequest request, ActionResponse response) throws IOException,
PortletException {
+        if (filterListIndex <filterList.size()){
+            Filter filter = filterList.get(filterListIndex);
+            filterListIndex++;
+            try {
+                ActionFilter actionFilter = (ActionFilter) filter.getFilterInstance(loader);
+                JetspeedFilterConfig filterConfig = new JetspeedFilterConfig(filter.getFilterName(),filter.getInitParams(),portletContext);
+                actionFilter.init(filterConfig);
+                actionFilter.doFilter(request, response, this);
+                actionFilter.destroy();
+            } catch (InstantiationException e) {
+                LOG.error("Failed to instantiate the filter: " + filter.getFilterClass());
+            } catch (IllegalAccessException e) {
+                LOG.error("Illegal access to the filter: " + filter.getFilterClass());
+            } catch (ClassNotFoundException e) {
+                LOG.error("Cannot find the filter class: " + filter.getFilterClass());
+            }
+        }
+        else{
+            portlet.processAction(request, response);
+        }
+    }
+    
+    public void doFilter(EventRequest request, EventResponse response) throws IOException,
PortletException {
+        if (filterListIndex <filterList.size()){
+            Filter filter = filterList.get(filterListIndex);
+            filterListIndex++;
+            try {
+                EventFilter eventFilter = (EventFilter) filter.getFilterInstance(loader);
+                JetspeedFilterConfig filterConfig = new JetspeedFilterConfig(filter.getFilterName(),filter.getInitParams(),portletContext);
+                eventFilter.init(filterConfig);
+                eventFilter.doFilter(request, response, this);
+                eventFilter.destroy();
+            } catch (InstantiationException e) {
+                LOG.error("Failed to instantiate the filter: " + filter.getFilterClass());
+            } catch (IllegalAccessException e) {
+                LOG.error("Illegal access to the filter: " + filter.getFilterClass());
+            } catch (ClassNotFoundException e) {
+                LOG.error("Cannot find the filter class: " + filter.getFilterClass());
+            }
+        }
+        else{
+            eventPortlet.processEvent(request, response);
+        }
+    }
+
+    public void doFilter(RenderRequest request, RenderResponse response) throws IOException,
PortletException {
+        if (filterListIndex <filterList.size()){
+            Filter filter = filterList.get(filterListIndex);
+            filterListIndex++;
+            try {
+                RenderFilter renderFilter = (RenderFilter) filter.getFilterInstance(loader);
+                JetspeedFilterConfig filterConfig = new JetspeedFilterConfig(filter.getFilterName(),filter.getInitParams(),portletContext);
+                renderFilter.init(filterConfig);
+                renderFilter.doFilter(request, response, this);
+                renderFilter.destroy();
+            } catch (InstantiationException e) {
+                LOG.error("Failed to instantiate the filter: " + filter.getFilterClass());
+            } catch (IllegalAccessException e) {
+                LOG.error("Illegal access to the filter: " + filter.getFilterClass());
+            } catch (ClassNotFoundException e) {
+                LOG.error("Cannot find the filter class: " + filter.getFilterClass());
+            }
+        }
+        else{
+            portlet.render(request, response);
+        }
+    }
+
+    public void doFilter(ResourceRequest request, ResourceResponse response) throws IOException,
PortletException {
+        if (filterListIndex <filterList.size()){
+            Filter filter = filterList.get(filterListIndex);
+            filterListIndex++;
+            try {
+                ResourceFilter resourceFilter = (ResourceFilter) filter.getFilterInstance(loader);
+                JetspeedFilterConfig filterConfig = new JetspeedFilterConfig(filter.getFilterName(),filter.getInitParams(),portletContext);
+                resourceFilter.init(filterConfig);
+                resourceFilter.doFilter(request, response, this);
+                resourceFilter.destroy();
+            } catch (InstantiationException e) {
+                LOG.error("Failed to instantiate the filter: " + filter.getFilterClass());
+            } catch (IllegalAccessException e) {
+                LOG.error("Illegal access to the filter: " + filter.getFilterClass());
+            } catch (ClassNotFoundException e) {
+                LOG.error("Cannot find the filter class: " + filter.getFilterClass());
+            }
+        }
+        else{
+            resourceServingPortlet.serveResource(request, response);
+        }
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterChain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterChain.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterChain.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterConfig.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterConfig.java?rev=756049&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterConfig.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterConfig.java
Thu Mar 19 15:40:28 2009
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.container.services;
+
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Vector;
+
+import javax.portlet.PortletContext;
+import javax.portlet.filter.FilterConfig;
+
+import org.apache.pluto.container.om.portlet.InitParam;
+
+public class JetspeedFilterConfig implements FilterConfig
+{
+    private final String filterName;
+    private final List<? extends InitParam> initParameters;
+    private final PortletContext portletContext;
+
+    public JetspeedFilterConfig(String filterName, List<? extends InitParam> initParameters,
PortletContext portletContext){
+        this.filterName = filterName;
+        this.initParameters = initParameters;
+        this.portletContext = portletContext;
+    }
+
+    /**
+     * @see javax.portlet.filter.FilterConfig#getFilterName()
+     */
+    public String getFilterName() {
+        return filterName;
+    }
+
+    /**
+     * @see javax.portlet.filter.FilterConfig#getInitParameter(java.lang.String)
+     */
+    public String getInitParameter(String name) {
+        if (initParameters != null) {
+            for (InitParam initParameter2 : initParameters) {
+                if (initParameter2.getParamName().equals(name)){
+                    return initParameter2.getParamValue();
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * @see javax.portlet.filter.FilterConfig#getInitParameterNames()
+     */
+    public Enumeration<String> getInitParameterNames() {
+        Vector<String> enum1 = new Vector<String>();
+        if ( initParameters != null ) {
+            for(InitParam ip : this.initParameters ) {
+                enum1.add(ip.getParamName());
+            }
+        }
+        return enum1.elements();
+    }
+
+    /**
+     * @see javax.portlet.filter.FilterConfig#getPortletContext()
+     */
+    public PortletContext getPortletContext() {
+        return portletContext;
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterConfig.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterConfig.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManager.java?rev=756049&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManager.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManager.java
Thu Mar 19 15:40:28 2009
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.container.services;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.portlet.EventPortlet;
+import javax.portlet.Portlet;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.ResourceServingPortlet;
+
+import org.apache.jetspeed.om.portlet.Filter;
+import org.apache.jetspeed.om.portlet.FilterMapping;
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.pluto.container.FilterManager;
+
+public class JetspeedFilterManager implements FilterManager{
+    private JetspeedFilterChain filterchain;
+    private PortletApplication portletApp;
+    private String portletName;
+    private String lifeCycle;
+    
+    public JetspeedFilterManager(PortletApplication portletApp, String portletName, String
lifeCycle){
+        this.portletApp = portletApp;
+        this.portletName =  portletName;
+        this.lifeCycle = lifeCycle;
+        filterchain = new JetspeedFilterChain(lifeCycle);
+        initFilterChain();
+    }
+    
+    private void initFilterChain(){
+        List<? extends FilterMapping> filterMappingList = portletApp.getFilterMappings();
+        if (filterMappingList!= null){
+            for (FilterMapping filterMapping : filterMappingList) {
+                if (isFilter(filterMapping, portletName)){
+                    //the filter is specified for the portlet, check the filter for the lifecycle
+                    List<? extends Filter> filterList = portletApp.getFilters();
+                    for (Filter filter : filterList) {
+                        //search for the filter in the filter
+                        if (filter.getFilterName().equals(filterMapping.getFilterName())){
+                            //check the lifecycle
+                            if (isLifeCycle(filter, lifeCycle)){
+                                //the filter match to the portlet and has the specified lifecycle
-> add to chain
+                                filterchain.addFilter(filter);
+                            }
+                        }
+                    }
+                }
+            }
+        }   
+    }
+    
+    public void processFilter(PortletRequest req, PortletResponse res, ClassLoader loader,
EventPortlet eventPortlet,PortletContext portletContext)throws PortletException, IOException{
+        filterchain.processFilter(req, res, loader, eventPortlet, portletContext);
+    }
+    
+    public void processFilter(PortletRequest req, PortletResponse res, ClassLoader loader,
ResourceServingPortlet resourceServingPortlet,PortletContext portletContext)throws PortletException,
IOException{
+        filterchain.processFilter(req, res, loader, resourceServingPortlet, portletContext);
+    }
+    
+    public void processFilter(PortletRequest req, PortletResponse res, ClassLoader loader,
Portlet portlet,PortletContext portletContext) throws PortletException, IOException{
+        filterchain.processFilter(req, res, loader, portlet, portletContext);
+    }
+    
+    private boolean isLifeCycle(Filter filter, String lifeCycle){
+        List <String> lifeCyclesList = filter.getLifecycles();
+        for (String string : lifeCyclesList) {
+            if (string.equals(lifeCycle))
+                return true;
+        }
+        return false;
+    }
+    
+    private boolean isFilter(FilterMapping filterMapping,String portletName){
+        List <String> portletNamesList = filterMapping.getPortletNames();
+        for (String portletNameFromFilterList : portletNamesList) {
+            if (portletNameFromFilterList.endsWith("*")){
+                if (portletNameFromFilterList.length()==1){
+                    //if name contains only *
+                    return true;
+                }
+                portletNameFromFilterList = portletNameFromFilterList.substring(0, portletNameFromFilterList.length()-1);
+                if (portletName.length()>= portletNameFromFilterList.length()){
+                    if (portletName.substring(0, portletNameFromFilterList.length()).equals(portletNameFromFilterList)){
+                        return true;
+                    }
+                }
+            }
+            else if (portletNameFromFilterList.equals(portletName))
+                return true;
+        }
+        return false;
+    }
+    
+
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManagerService.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManagerService.java?rev=756049&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManagerService.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManagerService.java
Thu Mar 19 15:40:28 2009
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.container.services;
+
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.pluto.container.FilterManager;
+import org.apache.pluto.container.FilterManagerService;
+import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
+
+public class JetspeedFilterManagerService implements FilterManagerService
+{
+    public FilterManager getFilterManager(PortletApplicationDefinition portletAppDD, String
portletName, String lifeCycle)
+    {
+        return new JetspeedFilterManager((PortletApplication) portletAppDD, portletName,
lifeCycle);
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManagerService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManagerService.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedFilterManagerService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortletURLListenerService.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortletURLListenerService.java?rev=756049&r1=756048&r2=756049&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortletURLListenerService.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortletURLListenerService.java
Thu Mar 19 15:40:28 2009
@@ -42,7 +42,7 @@
         if (portletURLFilterList != null){
             for (Listener listener : portletURLFilterList) {
                 try {
-                    listeners.add(listener.getListenerInstance());
+                    listeners.add(listener.getListenerInstance(Thread.currentThread().getContextClassLoader()));
                 } catch (ClassNotFoundException e) {
                     String message = "The listener class isn't found: " + listener.getListenerClass();
                     LOG.error(message);

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.java?rev=756049&r1=756048&r2=756049&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.java
Thu Mar 19 15:40:28 2009
@@ -22,12 +22,13 @@
 import java.util.List;
 import java.util.Locale;
 
+import javax.portlet.filter.PortletFilter;
+
 import org.apache.jetspeed.om.portlet.Description;
 import org.apache.jetspeed.om.portlet.DisplayName;
 import org.apache.jetspeed.om.portlet.Filter;
 import org.apache.jetspeed.om.portlet.FilterLifecycle;
 import org.apache.jetspeed.om.portlet.InitParam;
-import org.apache.jetspeed.om.portlet.SupportedPublicRenderParameter;
 import org.apache.jetspeed.util.JetspeedLocale;
 
 /**
@@ -42,6 +43,7 @@
     protected List<InitParam> initParams;
     protected List<Description> descriptions;
     protected List<DisplayName> displayNames;
+    protected PortletFilter filterInstance;
     
     public Description getDescription(Locale locale)
     {
@@ -181,4 +183,15 @@
         initParams.add(param);
         return param;
     }
+    
+    public PortletFilter getFilterInstance(ClassLoader loader) throws InstantiationException,
IllegalAccessException, ClassNotFoundException 
+    {
+        if (this.filterInstance == null) 
+        {
+            Class<? extends Object> clazz = loader.loadClass(getFilterClass());
+            this.filterInstance = (PortletFilter) clazz.newInstance();
+        }
+        
+        return this.filterInstance;
+    }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ListenerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ListenerImpl.java?rev=756049&r1=756048&r2=756049&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ListenerImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ListenerImpl.java
Thu Mar 19 15:40:28 2009
@@ -107,11 +107,10 @@
         return d;
     }
     
-    public PortletURLGenerationListener getListenerInstance() throws ClassNotFoundException,
InstantiationException, IllegalAccessException 
+    public PortletURLGenerationListener getListenerInstance(ClassLoader loader) throws ClassNotFoundException,
InstantiationException, IllegalAccessException 
     {
         if (this.listenerInstance == null) 
         {
-            ClassLoader loader = Thread.currentThread().getContextClassLoader();
             Class<? extends Object> clazz = loader.loadClass(getListenerClass());
             this.listenerInstance = (PortletURLGenerationListener) clazz.newInstance();
         }

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/Filter.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/Filter.java?rev=756049&r1=756048&r2=756049&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/Filter.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/Filter.java
Thu Mar 19 15:40:28 2009
@@ -19,6 +19,8 @@
 import java.util.List;
 import java.util.Locale;
 
+import javax.portlet.filter.PortletFilter;
+
 /**
  * 
  * @version $Id$
@@ -37,4 +39,6 @@
 	InitParam getInitParam(String paramName);
 	List<InitParam> getInitParams();
 	InitParam addInitParam(String paramName);
+	
+	PortletFilter getFilterInstance(ClassLoader loader) throws InstantiationException, IllegalAccessException,
ClassNotFoundException;
 }
\ No newline at end of file

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/Listener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/Listener.java?rev=756049&r1=756048&r2=756049&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/Listener.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/Listener.java
Thu Mar 19 15:40:28 2009
@@ -36,5 +36,5 @@
     List<DisplayName> getDisplayNames();
     DisplayName addDisplayName(String lang);
     
-    PortletURLGenerationListener getListenerInstance() throws ClassNotFoundException, InstantiationException,
IllegalAccessException;
+    PortletURLGenerationListener getListenerInstance(ClassLoader loader) throws ClassNotFoundException,
InstantiationException, IllegalAccessException;
 }
\ No newline at end of file

Modified: portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml?rev=756049&r1=756048&r2=756049&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml
Thu Mar 19 15:40:28 2009
@@ -30,7 +30,7 @@
       <constructor-arg><ref bean="PortalContext"/></constructor-arg>
       <constructor-arg><ref bean="org.apache.pluto.services.EventCoordinationService"/></constructor-arg>
       <constructor-arg><ref bean="org.apache.pluto.container.PortletRequestContextService"/></constructor-arg>
-      <constructor-arg><null/></constructor-arg>
+      <constructor-arg><ref bean="org.apache.pluto.container.FilterManagerService"/></constructor-arg>
       <constructor-arg><ref bean="org.apache.pluto.container.PortletURLListenerService"/></constructor-arg>
     </bean>
     
@@ -64,8 +64,8 @@
       <constructor-arg><ref bean="DynamicTitleService"/></constructor-arg>
  
     </bean>
     
-    <bean id='org.apache.pluto.services.FilterManager'
-          class='org.apache.jetspeed.container.providers.FilterManagerImpl'>
+    <bean id="org.apache.pluto.container.FilterManagerService"
+          class="org.apache.jetspeed.container.services.JetspeedFilterManagerService">
       <meta key="j2:cat" value="default" />       
     </bean>
     



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message