portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine SpringEngine.java PicoEngine.java Engine.java AbstractEngine.java
Date Sun, 01 Aug 2004 15:46:02 GMT
weaver      2004/08/01 08:46:02

  Modified:    portal/src/java/org/apache/jetspeed/engine SpringEngine.java
                        PicoEngine.java Engine.java AbstractEngine.java
  Log:
  Engine now extends org.apache.pluto.services.factory.FactoryManagerService.  We now assemble
Pluto factories with spring.
  
  Revision  Changes    Path
  1.4       +9 -5      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/SpringEngine.java
  
  Index: SpringEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/SpringEngine.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SpringEngine.java	20 Jul 2004 16:35:26 -0000	1.3
  +++ SpringEngine.java	1 Aug 2004 15:46:02 -0000	1.4
  @@ -20,10 +20,12 @@
   import java.util.ArrayList;
   
   import javax.naming.NamingException;
  +import javax.servlet.ServletConfig;
   
   import org.apache.commons.configuration.Configuration;
   import org.apache.jetspeed.components.ComponentManager;
   import org.apache.jetspeed.components.SpringComponentManager;
  +import org.apache.jetspeed.components.factorybeans.ServletConfigFactoryBean;
   
   /**
    * <p>
  @@ -52,12 +54,13 @@
        * @throws ClassNotFoundException
        * @throws NamingException
        */
  -    protected ComponentManager initComponents( Configuration configuration ) throws IOException,
ClassNotFoundException,
  +    protected ComponentManager initComponents( Configuration configuration, ServletConfig
servletConfig ) throws IOException, ClassNotFoundException,
               NamingException
       {
           
  -         String relativeApplicationRoot = getRealPath("/");
  -         String absApplicationRoot = new File(relativeApplicationRoot).getCanonicalPath();
  +        ServletConfigFactoryBean.setServletConfig(servletConfig);
  +        String relativeApplicationRoot = getRealPath("/");
  +        String absApplicationRoot = new File(relativeApplicationRoot).getCanonicalPath();
           // String absoluteApplicationRoot = new File(relativeApplicationRoot).getCanonicalPath();
           System.setProperty("applicationRoot", absApplicationRoot);
           ArrayList configs = new ArrayList();
  @@ -67,7 +70,8 @@
                       "/WEB-INF/assembly/pooled-datasource-support.xml"));
           }
           configs.add("file:///"+absApplicationRoot + configuration.getString("jetspeed.spring.xml",
"/WEB-INF/assembly/jetspeed-spring.xml"));
  -       
  +        configs.add("file:///"+absApplicationRoot + configuration.getString("pluto-factories.xml",
"/WEB-INF/assembly/pluto-factories.xml"));
  +        
           ComponentManager cm = new SpringComponentManager((String[])configs.toArray(new
String[configs.size()]), null);
           
           return cm;
  
  
  
  1.3       +3 -2      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/PicoEngine.java
  
  Index: PicoEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/PicoEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PicoEngine.java	20 Jul 2004 16:35:26 -0000	1.2
  +++ PicoEngine.java	1 Aug 2004 15:46:02 -0000	1.3
  @@ -19,6 +19,7 @@
   import java.io.IOException;
   
   import javax.naming.NamingException;
  +import javax.servlet.ServletConfig;
   
   import org.apache.commons.configuration.Configuration;
   import org.apache.jetspeed.components.ComponentManager;
  @@ -38,7 +39,7 @@
    */
   public class PicoEngine extends AbstractEngine implements Engine
   {
  -    protected ComponentManager initComponents( Configuration configuration )
  +    protected ComponentManager initComponents( Configuration configuration, ServletConfig
servletConfig )
               throws IOException, ClassNotFoundException, NamingException
       {
           String applicationRoot = getRealPath("/");
  
  
  
  1.7       +3 -1      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/Engine.java
  
  Index: Engine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/Engine.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Engine.java	31 Jul 2004 20:05:28 -0000	1.6
  +++ Engine.java	1 Aug 2004 15:46:02 -0000	1.7
  @@ -24,6 +24,7 @@
   import org.apache.jetspeed.pipeline.Pipeline;
   import org.apache.jetspeed.request.RequestContext;
   import org.apache.pluto.PortletContainerException;
  +import org.apache.pluto.services.factory.FactoryManagerService;
   
   
   /**
  @@ -32,7 +33,7 @@
    * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
    * @version $Id$
    */
  -public interface Engine extends JetspeedEngineConstants 
  +public interface Engine extends JetspeedEngineConstants, FactoryManagerService 
   {
       /**
        * Initializes the engine with a commons configuration, starting all early initable
services.
  @@ -116,6 +117,7 @@
       public RequestContext getCurrentRequestContext();
   
       public ComponentManager getComponentManager();
  +    
       
   
   }
  
  
  
  1.4       +21 -12    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/AbstractEngine.java
  
  Index: AbstractEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/AbstractEngine.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractEngine.java	20 Jul 2004 16:35:26 -0000	1.3
  +++ AbstractEngine.java	1 Aug 2004 15:46:02 -0000	1.4
  @@ -42,13 +42,13 @@
   import org.apache.jetspeed.pipeline.descriptor.PipelineDescriptor;
   import org.apache.jetspeed.pipeline.descriptor.XmlReader;
   import org.apache.jetspeed.request.RequestContext;
  -import org.apache.jetspeed.services.factory.FactoryManager;
  -import org.apache.jetspeed.services.information.InformationProviderManager;
  -import org.apache.jetspeed.services.information.InformationProviderServiceService;
   import org.apache.log4j.PropertyConfigurator;
   import org.apache.ojb.broker.util.ClassHelper;
   import org.apache.pluto.PortletContainer;
   import org.apache.pluto.PortletContainerException;
  +import org.apache.pluto.factory.Factory;
  +import org.apache.pluto.services.ContainerService;
  +import org.apache.pluto.services.factory.FactoryManagerService;
   import org.apache.pluto.services.information.InformationProviderService;
   
   
  @@ -141,7 +141,7 @@
               //
               // bootstrap the initable services
               //
  -            componentManager = initComponents(configuration);
  +            componentManager = initComponents(configuration, config);
               log.info("Components initialization complete");
               initServices();
               log.info("Service initialization complete");
  @@ -196,12 +196,9 @@
                       .getComponent(PortletContainer.class);
               JetspeedContainerServices environment = new JetspeedContainerServices();
               environment.addService(ContainerLogAdaptor.getService());
  -            environment.addService(FactoryManager.getService());
  -            InformationProviderServiceService ips = InformationProviderManager
  -                    .getService();
  -            ips.init(config, null);
  +            environment.addServiceForClass(FactoryManagerService.class, this);
               environment.addServiceForClass(InformationProviderService.class,
  -                    ips);
  +                    (ContainerService)getComponentManager().getComponent(InformationProviderService.class));
               //TODO !!! Pluto has changed this siganture There is now a
               // container unique id string and Properties.
               // WE need to figure what these are really for.
  @@ -339,7 +336,7 @@
        * @throws ClassNotFoundException
        * @throws NamingException
        */
  -    protected abstract ComponentManager initComponents( Configuration configuration )
  +    protected abstract ComponentManager initComponents( Configuration configuration, ServletConfig
servletConfig )
       throws IOException, ClassNotFoundException, NamingException;
   
       private void initServices() throws CPSInitializationException
  @@ -482,5 +479,17 @@
       {
           return this.componentManager;
       }
  -
  +    /**
  +     * <p>
  +     * getFactory
  +     * </p>
  +     *
  +     * @see org.apache.pluto.services.factory.FactoryManagerService#getFactory(java.lang.Class)
  +     * @param theClass
  +     * @return
  +     */
  +    public Factory getFactory( Class theClass )
  +    {        
  +        return (Factory) getComponentManager().getComponent(theClass);
  +    }
   }
  
  
  

---------------------------------------------------------------------
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