portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shins...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl DeployPortletAppEventListener.java
Date Sun, 19 Sep 2004 22:28:10 GMT
shinsuke    2004/09/19 15:28:10

  Modified:    commons/src/java/org/apache/jetspeed/factory
                        JetspeedPortletFactoryProxy.java
               components/portlet-factory/src/java/org/apache/jetspeed/factory
                        JetspeedPortletFactory.java
               jetspeed-api/src/java/org/apache/jetspeed/factory
                        PortletFactory.java
               portal/src/java/org/apache/jetspeed/deployment/impl
                        DeployPortletAppEventListener.java
  Log:
  Fixed JS2-122.
  http://issues.apache.org/jira/browse/JS2-122
  
  Revision  Changes    Path
  1.3       +4 -3      jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/factory/JetspeedPortletFactoryProxy.java
  
  Index: JetspeedPortletFactoryProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/factory/JetspeedPortletFactoryProxy.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JetspeedPortletFactoryProxy.java	19 Aug 2004 17:29:22 -0000	1.2
  +++ JetspeedPortletFactoryProxy.java	19 Sep 2004 22:28:10 -0000	1.3
  @@ -98,12 +98,13 @@
        * 
        * Adds a ClassLoader to the search path, <code>classLoaders</code>, of
the JetspeedPortletFactory.
        *
  +     * @param paId
        * @param cl
        */
  -    public static void addClassLoader(ClassLoader cl)
  +    public static void addClassLoader(String paId, ClassLoader cl)
       {
           verifyState();
  -        portletFactory.addClassLoader(cl);
  +        portletFactory.addClassLoader(paId, cl);
       }
       
       public static void reset()
  
  
  
  1.4       +24 -12    jakarta-jetspeed-2/components/portlet-factory/src/java/org/apache/jetspeed/factory/JetspeedPortletFactory.java
  
  Index: JetspeedPortletFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/portlet-factory/src/java/org/apache/jetspeed/factory/JetspeedPortletFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JetspeedPortletFactory.java	15 Sep 2004 22:51:02 -0000	1.3
  +++ JetspeedPortletFactory.java	19 Sep 2004 22:28:10 -0000	1.4
  @@ -16,7 +16,7 @@
   package org.apache.jetspeed.factory;
   
   import java.io.FileNotFoundException;
  -import java.util.ArrayList;
  +import java.util.HashMap;
   import java.util.Iterator;
   
   import javax.portlet.Portlet;
  @@ -48,8 +48,8 @@
   {
   
       private PortletCache portletCache;
  -    private final ArrayList classLoaders;
       private static final Log log = LogFactory.getLog(JetspeedPortletFactory.class);
  +    private final HashMap classLoaderMap;
   
       /**
        * 
  @@ -58,7 +58,7 @@
       {
           super();
           this.portletCache = portletCache;
  -        classLoaders = new ArrayList(); 
  +        classLoaderMap = new HashMap();
       }
   
       /**
  @@ -71,16 +71,18 @@
        *
        * @param cl
        */
  -    public void addClassLoader( ClassLoader cl )
  +    public void addClassLoader(String paId, ClassLoader cl)
       {
  -        synchronized(classLoaders)
  +        if (paId != null && !paId.equals(""))
           {
  -            if (!classLoaders.contains(cl))
  +            synchronized (classLoaderMap)
               {
  -            classLoaders.add(cl);
  +                if (classLoaderMap.get(paId) == null)
  +                {
  +                    classLoaderMap.put(paId, cl);
  +                }
               }
           }
  -        
       }
   
       /**
  @@ -109,10 +111,10 @@
           }
           catch (ClassNotFoundException e)
           {
  -            synchronized(classLoaders)
  +            synchronized (classLoaderMap)
               {
  -                Iterator itr = classLoaders.iterator();
  -                while(itr.hasNext() && portlet == null)
  +                Iterator itr = classLoaderMap.values().iterator();
  +                while (itr.hasNext() && portlet == null)
                   {
                       ClassLoader cl = (ClassLoader) itr.next();
                       try
  @@ -155,6 +157,7 @@
           String portletName = portletDefinition.getId().toString();
           //String portletName = portletDefinition.getName();
           String className = portletDefinition.getClassName(); 
  +        String paId = portletDefinition.getPortletApplicationDefinition().getWebApplicationDefinition().getId().toString();
   
           try
           {                        
  @@ -172,7 +175,16 @@
                   throw new FileNotFoundException("Could not located portlet "+className+"
in any classloader.");
               }
               
  +            ClassLoader cl = (ClassLoader) classLoaderMap.get(paId);
  +            if (cl != null)
  +            {
  +                ((PortletDefinitionCtrl) portletDefinition).setPortletClassLoader(cl);
  +            }
  +            else
  +            {
               ((PortletDefinitionCtrl) portletDefinition).setPortletClassLoader(portlet.getClass().getClassLoader());
  +            }
  +      
               ServletContext servletContext = servletConfig.getServletContext();
               PortletContext portletContext = 
                           PortalAccessor.createPortletContext(servletContext, 
  
  
  
  1.2       +2 -2      jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/factory/PortletFactory.java
  
  Index: PortletFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/factory/PortletFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortletFactory.java	1 Aug 2004 15:41:50 -0000	1.1
  +++ PortletFactory.java	19 Sep 2004 22:28:10 -0000	1.2
  @@ -35,7 +35,7 @@
    */
   public interface PortletFactory
   {
  -    void addClassLoader( ClassLoader cl );
  +    void addClassLoader(String paId, ClassLoader cl);
   
       Portlet loadPortletClass( String className ) throws InstantiationException, IllegalAccessException;
   
  
  
  
  1.18      +19 -4     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java
  
  Index: DeployPortletAppEventListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DeployPortletAppEventListener.java	16 Aug 2004 18:31:19 -0000	1.17
  +++ DeployPortletAppEventListener.java	19 Sep 2004 22:28:10 -0000	1.18
  @@ -21,6 +21,7 @@
   import org.apache.jetspeed.deployment.DeploymentException;
   import org.apache.jetspeed.deployment.DeploymentObject;
   import org.apache.jetspeed.factory.PortletFactory;
  +import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
   import org.apache.jetspeed.tools.pamanager.PortletApplicationManagement;
   import org.apache.jetspeed.util.DirectoryHelper;
   import org.apache.jetspeed.util.FileSystemHelper;
  @@ -214,7 +215,9 @@
                   appNameToFile.put(deploymentObj.getPath(), id);
                   if (isLocal)
                   {                
  -                    portletFactory.addClassLoader(paWar.createClassloader(getClass().getClassLoader()));
  +                    portletFactory.addClassLoader(
  +                        registry.getPortletApplicationByIdentifier(id).getId().toString(),
  +                        paWar.createClassloader(getClass().getClassLoader()));
                   }
                   else
                   {
  @@ -223,7 +226,9 @@
                           ClassLoader classloader = createPortletClassloader(getClass().getClassLoader(),
id);
                           if (classloader != null)
                           {
  -                            portletFactory.addClassLoader(classloader);
  +                            portletFactory.addClassLoader(
  +                                registry.getPortletApplicationByIdentifier(id).getId().toString(),
  +                                classloader);
                           }
                       }
                       catch (IOException e1)
  @@ -243,7 +248,13 @@
                   {
                       log.info(fileName + " will be registered as a local portlet applicaiton.");
                   
                       pam.register(paWar);
  -                    portletFactory.addClassLoader(paWar.createClassloader(getClass().getClassLoader()));
  +                    MutablePortletApplication mpa = registry.getPortletApplicationByIdentifier(id);
  +                    if (mpa != null)
  +                    {
  +                        portletFactory.addClassLoader(
  +                            mpa.getId().toString(),
  +                            paWar.createClassloader(getClass().getClassLoader()));
  +                    }
                   }
                   else
                   {
  @@ -254,7 +265,11 @@
                           ClassLoader classloader = createPortletClassloader(getClass().getClassLoader(),
id);
                           if (classloader != null)
                           {
  -                            portletFactory.addClassLoader(classloader);
  +                            MutablePortletApplication mpa = registry.getPortletApplicationByIdentifier(id);
  +                            if (mpa != null)
  +                            {
  +                                portletFactory.addClassLoader(mpa.getId().toString(), classloader);
  +                            }
                           }
                       }
                       catch (IOException e1)
  
  
  

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


Mime
View raw message