[gatein-commits] gatein SVN: r6298 - in portal/branches/global-portlet-metadata: component/pc/src/main/java/org/exoplatform/portal/pc and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Apr 20 06:20:50 EDT 2011


Author: hoang_to
Date: 2011-04-20 06:20:49 -0400 (Wed, 20 Apr 2011)
New Revision: 6298

Added:
   portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/GlobalPortletMetaData.java
   portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/
   portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/ActionProcessingPerformanceFilter.java
   portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/EventHandlingPerformanceFilter.java
   portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/RenderPerformanceFilter.java
   portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/ResourceServingPerformanceFilter.java
   portal/branches/global-portlet-metadata/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/conf/gatein/portlet.xml
   portal/branches/global-portlet-metadata/packaging/tomcat/pkg/src/main/resources/tomcat/gatein/conf/portlet.xml
Modified:
   portal/branches/global-portlet-metadata/component/common/src/main/java/conf/configuration-jboss.properties
   portal/branches/global-portlet-metadata/component/common/src/main/java/conf/configuration-tomcat.properties
   portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/ExoPortletApplicationDeployer.java
Log:
Global portlet.xml feature

Modified: portal/branches/global-portlet-metadata/component/common/src/main/java/conf/configuration-jboss.properties
===================================================================
--- portal/branches/global-portlet-metadata/component/common/src/main/java/conf/configuration-jboss.properties	2011-04-20 07:15:24 UTC (rev 6297)
+++ portal/branches/global-portlet-metadata/component/common/src/main/java/conf/configuration-jboss.properties	2011-04-20 10:20:49 UTC (rev 6298)
@@ -58,3 +58,6 @@
 gatein.email.smtp.socketFactory.port=465
 gatein.email.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
 
+#Global portlet.xml
+gatein.portlet.metadata.global=../conf/gatein/portlet.xml
+

Modified: portal/branches/global-portlet-metadata/component/common/src/main/java/conf/configuration-tomcat.properties
===================================================================
--- portal/branches/global-portlet-metadata/component/common/src/main/java/conf/configuration-tomcat.properties	2011-04-20 07:15:24 UTC (rev 6297)
+++ portal/branches/global-portlet-metadata/component/common/src/main/java/conf/configuration-tomcat.properties	2011-04-20 10:20:49 UTC (rev 6298)
@@ -59,4 +59,7 @@
 gatein.email.smtp.starttls.enable=true
 gatein.email.smtp.auth=true
 gatein.email.smtp.socketFactory.port=465
-gatein.email.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
\ No newline at end of file
+gatein.email.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
+
+#Global portlet.xml
+gatein.portlet.metadata.global=../gatein/conf/portlet.xml
\ No newline at end of file

Modified: portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/ExoPortletApplicationDeployer.java
===================================================================
--- portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/ExoPortletApplicationDeployer.java	2011-04-20 07:15:24 UTC (rev 6297)
+++ portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/ExoPortletApplicationDeployer.java	2011-04-20 10:20:49 UTC (rev 6298)
@@ -19,20 +19,30 @@
 
 package org.exoplatform.portal.pc;
 
+import org.apache.log4j.spi.LoggerRepository;
+import org.exoplatform.commons.utils.PropertyManager;
+import org.exoplatform.commons.utils.Safe;
+import org.exoplatform.container.configuration.ConfigurationManager;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
 import org.gatein.pc.mc.PortletApplicationDeployer;
 import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
 import org.gatein.wci.WebApp;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
 
 /**
- * Extends the {@link org.gatein.pc.mc.PortletApplicationDeployer} to configure the resource bundle factory
- * of deployed portlet applications. The resource bundle factory used is
- * {@link org.exoplatform.portal.pc.ExoResourceBundleFactory}.
+ * Extends the {@link org.gatein.pc.mc.PortletApplicationDeployer} to inject configuration metadata
+ * from global portlet.xml and to configure the resource bundle factory of deployed portlet
+ * applications. The resource bundle factory used is {@link org.exoplatform.portal.pc.ExoResourceBundleFactory}.
  *
  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
  * @version $Revision$
  */
 public class ExoPortletApplicationDeployer extends PortletApplicationDeployer
 {
+   private static Logger  LOGGER = LoggerFactory.getLogger(ExoPortletApplicationDeployer.class);
 
    @Override
    protected PortletApplication10MetaData buildPortletApplicationMetaData(WebApp webApp)
@@ -41,7 +51,40 @@
       if (md != null)
       {
          md.setResourceBundleFactoryName(ExoResourceBundleFactory.class.getName());
+         try{
+            GlobalPortletMetaData globalPortletMetaData = loadGlobalMetadata();
+            globalPortletMetaData.merge(md);
+            LOGGER.info("Complete merging global portlet metadata to portlet application " + webApp.getServletContext().getServletContextName());
+         }
+         catch(Exception ex)
+         {
+            if(LOGGER.isDebugEnabled())
+            {
+               LOGGER.debug(ex.getMessage(), ex);
+            }
+         }
       }
       return md;
    }
+
+   /**
+    * This method is invoked for each portlet application deployment. That is necessary for the moment
+    * to ensure independence between portlet applications
+    *
+    * @return
+    */
+   private GlobalPortletMetaData loadGlobalMetadata() throws Exception
+   {
+      String globalPortletDefPath = PropertyManager.getProperty("gatein.portlet.metadata.global");
+      //TODO: Avoid using File
+      InputStream in = new FileInputStream(new File(globalPortletDefPath));
+      try
+      {
+         return GlobalPortletMetaData.unmarshalling(in);
+      }
+      finally
+      {
+         Safe.close(in);
+      }
+   }
 }

Added: portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/GlobalPortletMetaData.java
===================================================================
--- portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/GlobalPortletMetaData.java	                        (rev 0)
+++ portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/GlobalPortletMetaData.java	2011-04-20 10:20:49 UTC (rev 6298)
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.pc;
+
+import org.gatein.pc.mc.metadata.factory.PortletApplicationModelFactory;
+import org.gatein.pc.mc.metadata.impl.ValueTrimmingFilter;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+import org.gatein.pc.portlet.impl.metadata.common.InitParamMetaData;
+import org.gatein.pc.portlet.impl.metadata.filter.FilterMappingMetaData;
+import org.gatein.pc.portlet.impl.metadata.filter.FilterMetaData;
+import org.gatein.pc.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="hoang281283 at gmail.com">Minh Hoang TO</a>
+ * @date 3/31/11
+ */
+public class GlobalPortletMetaData
+{
+
+   /**
+    *
+    */
+   private final static String EXCLUDE_PARAM_NAME = "org.gatein.portlet.global.exclude";
+
+   private PortletApplication10MetaData wrappedMetaData;
+
+   public GlobalPortletMetaData(PortletApplication10MetaData _wrappedMetaData)
+   {
+      this.wrappedMetaData = _wrappedMetaData;
+   }
+
+   public PortletApplication10MetaData merge(PortletApplication10MetaData tobeMergedMetaData)
+   {
+      if(wrappedMetaData.getCustomPortletModes() != null)
+      {
+         tobeMergedMetaData.getCustomPortletModes().putAll(wrappedMetaData.getCustomPortletModes());
+      }
+
+      if(wrappedMetaData.getCustomWindowStates() != null)
+      {
+         tobeMergedMetaData.getCustomWindowStates().putAll(wrappedMetaData.getCustomWindowStates());
+      }
+
+      if(tobeMergedMetaData instanceof PortletApplication20MetaData && wrappedMetaData instanceof PortletApplication20MetaData)
+      {
+         return merge20MetData((PortletApplication20MetaData)wrappedMetaData, (PortletApplication20MetaData)tobeMergedMetaData);
+      }
+
+      return tobeMergedMetaData;
+
+   }
+
+   public PortletApplication10MetaData merge20MetData(PortletApplication20MetaData globalMetaData, PortletApplication20MetaData tobeMergedMetaData)
+   {
+      mergeFilterMetaData(globalMetaData, tobeMergedMetaData);
+      mergeFilterMapping(globalMetaData, tobeMergedMetaData);
+      mergePublicRenderParameters(globalMetaData, tobeMergedMetaData);
+
+      return tobeMergedMetaData;
+   }
+
+   private void mergeFilterMetaData(PortletApplication20MetaData globalMetaData, PortletApplication20MetaData tobeMergedMetaData)
+   {
+      Map<String, FilterMetaData> globalFilters = globalMetaData.getFilters();
+      Map<String, FilterMetaData> applicationFilters = tobeMergedMetaData.getFilters();
+
+      if(globalFilters != null)
+      {
+         if(applicationFilters == null)
+         {
+            tobeMergedMetaData.setFilters(globalFilters);
+            return;
+         }
+
+         applicationFilters.putAll(globalFilters);
+         tobeMergedMetaData.setFilters(applicationFilters);
+      }
+   }
+
+
+   private void mergeFilterMapping(PortletApplication20MetaData globalMetaData, PortletApplication20MetaData tobeMergedMetaData)
+   {
+      List<FilterMappingMetaData> applicationFilterMappings = tobeMergedMetaData.getFilterMapping();
+      if(applicationFilterMappings == null)
+      {
+         applicationFilterMappings = new ArrayList<FilterMappingMetaData>(3);
+      }
+
+      Map<String, FilterMetaData> globalFilters = globalMetaData.getFilters();
+      if(globalFilters == null)
+      {
+         return;
+      }
+      else
+      {
+         //TODO: Ensure there is no duplicated filter mapping
+         for(String filterName : globalFilters.keySet())
+         {
+            FilterMappingMetaData filterMapping = new FilterMappingMetaData();
+            filterMapping.setName(filterName);
+
+            //TODO: Use this list, examine if there is a bug in PC on the instantiation of filter mappings
+            //List<String> portletsApplyingThisGlobalFilter = findPortletsApplyingGlobalFilter(globalFilters.get(filterName), tobeMergedMetaData);
+
+            List<String> portletsApplyingThisGlobalFilter = new ArrayList<String>(3);
+            portletsApplyingThisGlobalFilter.add("*");
+            filterMapping.setPortletNames(portletsApplyingThisGlobalFilter);
+            applicationFilterMappings.add(filterMapping);
+         }
+
+         tobeMergedMetaData.setFilterMapping(applicationFilterMappings);
+      }
+
+   }
+
+   private void mergePublicRenderParameters(PortletApplication20MetaData globalMetaData, PortletApplication20MetaData tobeMergedMetaData)
+   {
+     //TODO: Wait for the spec of merging public render parameters
+   }
+
+   public static GlobalPortletMetaData unmarshalling(InputStream in) throws Exception
+   {
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      unmarshaller.setNamespaceAware(true);
+      unmarshaller.setSchemaValidation(false);
+      unmarshaller.setValidation(false);
+
+      PortletApplicationModelFactory factory = new PortletApplicationModelFactory();
+
+      PortletApplication10MetaData application10MetaData = (PortletApplication10MetaData)unmarshaller.unmarshal(in, new ValueTrimmingFilter(factory), null);
+
+      return new GlobalPortletMetaData(application10MetaData);
+   }
+
+   /**
+    * Get the list of portlets excluded from global filters
+    *
+    * @param filterMetaData
+    * @return
+    */
+   private List<String> getExcludedPortlets(FilterMetaData filterMetaData)
+   {
+      List<String> portletNames = new ArrayList<String>();
+      InitParamMetaData excludedPortletParam = null;
+
+      for(InitParamMetaData param : filterMetaData.getInitParams())
+      {
+         if(EXCLUDE_PARAM_NAME.equals(param.getName()))
+         {
+            excludedPortletParam = param;
+            break;
+         }
+      }
+
+      if(excludedPortletParam != null)
+      {
+         String[] excludedPortlets = excludedPortletParam.getValue().split(",");
+         for(String excludedPortlet : excludedPortlets)
+         {
+            portletNames.add(excludedPortlet.trim());
+         }
+      }
+
+      return portletNames;
+   }
+
+   /**
+    * Returns a list of names of portlets (defined in the portletApplication) that apply the portlet filter filterMetaData
+    *
+    * @param filterMetaData
+    * @param portletApplication
+    * @return
+    */
+   private List<String> findPortletsApplyingGlobalFilter(FilterMetaData filterMetaData, PortletApplication20MetaData portletApplication)
+   {
+      List<String> listOfEscapedPortlets = getExcludedPortlets(filterMetaData);
+      Map<String, PortletMetaData> portletsInApplication = portletApplication.getPortlets();
+
+      List<String> returnedList = new ArrayList<String>(3);
+
+      for(String portletName : portletsInApplication.keySet())
+      {
+         if(!listOfEscapedPortlets.contains(portletName))
+         {
+            returnedList.add(portletName);
+         }
+      }
+
+      return returnedList;
+   }
+
+}

Added: portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/ActionProcessingPerformanceFilter.java
===================================================================
--- portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/ActionProcessingPerformanceFilter.java	                        (rev 0)
+++ portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/ActionProcessingPerformanceFilter.java	2011-04-20 10:20:49 UTC (rev 6298)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.pc.filter;
+
+import java.io.IOException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.filter.FilterConfig;
+
+/**
+ * @author <a href="hoang281283 at gmail.com">Minh Hoang TO</a>
+ * @date 4/5/11
+ */
+public class ActionProcessingPerformanceFilter implements ActionFilter
+{
+
+   public void init(FilterConfig filterConfig) throws PortletException
+   {
+   }
+
+   public void doFilter(ActionRequest request, ActionResponse response, FilterChain chain) throws IOException, PortletException
+   {
+   }
+
+   public void destroy()
+   {
+   }
+}

Added: portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/EventHandlingPerformanceFilter.java
===================================================================
--- portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/EventHandlingPerformanceFilter.java	                        (rev 0)
+++ portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/EventHandlingPerformanceFilter.java	2011-04-20 10:20:49 UTC (rev 6298)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.pc.filter;
+
+import java.io.IOException;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletException;
+import javax.portlet.filter.EventFilter;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.filter.FilterConfig;
+
+/**
+ * @author <a href="hoang281283 at gmail.com">Minh Hoang TO</a>
+ * @date 4/5/11
+ */
+public class EventHandlingPerformanceFilter implements EventFilter
+{
+
+   public void init(FilterConfig filterConfig) throws PortletException
+   {
+   }
+
+   public void doFilter(EventRequest request, EventResponse response, FilterChain chain) throws IOException, PortletException
+   {
+   }
+
+   public void destroy()
+   {
+   }
+}

Added: portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/RenderPerformanceFilter.java
===================================================================
--- portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/RenderPerformanceFilter.java	                        (rev 0)
+++ portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/RenderPerformanceFilter.java	2011-04-20 10:20:49 UTC (rev 6298)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.pc.filter;
+
+import java.io.IOException;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.filter.FilterConfig;
+import javax.portlet.filter.RenderFilter;
+
+/**
+ * A filter connecting to various services to serve performance info of rendering
+ *
+ * @author <a href="hoang281283 at gmail.com">Minh Hoang TO</a>
+ * @date 4/4/11
+ */
+public class RenderPerformanceFilter implements RenderFilter
+{
+   FilterConfig filterConfig;
+
+   public void init(FilterConfig filterConfig) throws PortletException
+   {
+      this.filterConfig = filterConfig;
+   }
+
+   public void doFilter(RenderRequest request, RenderResponse response, FilterChain chain) throws IOException, PortletException
+   {
+      long startTime = System.currentTimeMillis();
+
+      String portletName = "";
+      PortletConfig portletConfig = (PortletConfig)request.getAttribute("javax.portlet.config");
+
+      if(portletConfig != null)
+      {
+         portletName = portletConfig.getPortletName();
+      }
+
+      String portletWindowID = portletName + "-" + request.getWindowID();
+
+      chain.doFilter(request, response);
+
+      long endTime = System.currentTimeMillis();
+
+      System.out.println("RENDERING PORTLET " + portletWindowID + " TAKES " + (endTime - startTime) + " MILLISECONDS");
+
+   }
+
+   public void destroy()
+   {
+   }
+}

Added: portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/ResourceServingPerformanceFilter.java
===================================================================
--- portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/ResourceServingPerformanceFilter.java	                        (rev 0)
+++ portal/branches/global-portlet-metadata/component/pc/src/main/java/org/exoplatform/portal/pc/filter/ResourceServingPerformanceFilter.java	2011-04-20 10:20:49 UTC (rev 6298)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.pc.filter;
+
+import java.io.IOException;
+import javax.portlet.PortletException;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.filter.FilterConfig;
+import javax.portlet.filter.ResourceFilter;
+
+/**
+ * @author <a href="hoang281283 at gmail.com">Minh Hoang TO</a>
+ * @date 4/5/11
+ */
+public class ResourceServingPerformanceFilter implements ResourceFilter
+{
+   public void init(FilterConfig filterConfig) throws PortletException
+   {
+   }
+
+   public void doFilter(ResourceRequest request, ResourceResponse response, FilterChain chain) throws IOException, PortletException
+   {
+   }
+
+   public void destroy()
+   {
+   }
+}

Added: portal/branches/global-portlet-metadata/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/conf/gatein/portlet.xml
===================================================================
--- portal/branches/global-portlet-metadata/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/conf/gatein/portlet.xml	                        (rev 0)
+++ portal/branches/global-portlet-metadata/packaging/jboss-as5/pkg/src/main/resources/jboss/server/default/conf/gatein/portlet.xml	2011-04-20 10:20:49 UTC (rev 6298)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2009 eXo Platform SAS.
+    
+    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.
+
+-->
+<portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
+
+  <filter>
+    <filter-name>RenderPerformanceFilter</filter-name>
+    <filter-class>org.exoplatform.portal.pc.filter.RenderPerformanceFilter</filter-class>
+    <lifecycle>RENDER_PHASE</lifecycle>
+    <init-params>
+      <init-param>
+        <name>org.gatein.portlet.global.exclude</name>
+        <value>DashboardPortlet,TabbedDashboardPortlet,GadgetPortlet</value>
+      </init-param>
+    </init-params>
+  </filter>
+
+  <filter>
+    <filter-name>ActionProcessingPerformanceFilter</filter-name>
+    <filter-class>org.exoplatform.portal.pc.filter.ActionProcessingPerformanceFilter</filter-class>
+    <lifecycle>ACTION_PHASE</lifecycle>
+  </filter>
+
+  <filter>
+    <filter-name>EventHandlingPerformanceFilter</filter-name>
+    <filter-class>org.exoplatform.portal.pc.filter.EventHandlingPerformanceFilter</filter-class>
+    <lifecycle>EVENT_PHASE</lifecycle>
+  </filter>
+
+  <filter>
+    <filter-name>ResourceServingPerformanceFilter</filter-name>
+    <filter-class>org.exoplatform.portal.pc.filter.ResourceServingPerformanceFilter</filter-class>
+    <lifecycle>RESOURCE_PHASE</lifecycle>
+  </filter>
+
+</portlet-app>

Added: portal/branches/global-portlet-metadata/packaging/tomcat/pkg/src/main/resources/tomcat/gatein/conf/portlet.xml
===================================================================
--- portal/branches/global-portlet-metadata/packaging/tomcat/pkg/src/main/resources/tomcat/gatein/conf/portlet.xml	                        (rev 0)
+++ portal/branches/global-portlet-metadata/packaging/tomcat/pkg/src/main/resources/tomcat/gatein/conf/portlet.xml	2011-04-20 10:20:49 UTC (rev 6298)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2009 eXo Platform SAS.
+    
+    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.
+
+-->
+<portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
+
+  <filter>
+    <filter-name>RenderPerformanceFilter</filter-name>
+    <filter-class>org.exoplatform.portal.pc.filter.RenderPerformanceFilter</filter-class>
+    <lifecycle>RENDER_PHASE</lifecycle>
+    <init-params>
+      <init-param>
+        <name>org.gatein.portlet.global.exclude</name>
+        <value>DashboardPortlet,TabbedDashboardPortlet,GadgetPortlet</value>
+      </init-param>
+    </init-params>
+  </filter>
+
+  <filter>
+    <filter-name>ActionProcessingPerformanceFilter</filter-name>
+    <filter-class>org.exoplatform.portal.pc.filter.ActionProcessingPerformanceFilter</filter-class>
+    <lifecycle>ACTION_PHASE</lifecycle>
+  </filter>
+
+  <filter>
+    <filter-name>EventHandlingPerformanceFilter</filter-name>
+    <filter-class>org.exoplatform.portal.pc.filter.EventHandlingPerformanceFilter</filter-class>
+    <lifecycle>EVENT_PHASE</lifecycle>
+  </filter>
+
+  <filter>
+    <filter-name>ResourceServingPerformanceFilter</filter-name>
+    <filter-class>org.exoplatform.portal.pc.filter.ResourceServingPerformanceFilter</filter-class>
+    <lifecycle>RESOURCE_PHASE</lifecycle>
+  </filter>
+
+</portlet-app>



More information about the gatein-commits mailing list