You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by we...@apache.org on 2004/07/20 18:35:27 UTC

cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine SpringEngine.java PicoEngine.java AbstractEngine.java

weaver      2004/07/20 09:35:27

  Modified:    portal/src/java/org/apache/jetspeed/engine SpringEngine.java
                        PicoEngine.java AbstractEngine.java
  Log:
  Make the contract for AbstractEngine.initComponents() abstract method more apparent by requiring it to return a
  ComponentManager interface.
  
  Revision  Changes    Path
  1.3       +7 -6      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SpringEngine.java	20 Jul 2004 16:05:03 -0000	1.2
  +++ SpringEngine.java	20 Jul 2004 16:35:26 -0000	1.3
  @@ -22,10 +22,8 @@
   import javax.naming.NamingException;
   
   import org.apache.commons.configuration.Configuration;
  +import org.apache.jetspeed.components.ComponentManager;
   import org.apache.jetspeed.components.SpringComponentManager;
  -import org.apache.jetspeed.components.datasource.DatasourceComponent;
  -import org.apache.jetspeed.components.jndi.JNDIComponent;
  -import org.springframework.beans.factory.xml.XmlBeanFactory;
   
   /**
    * <p>
  @@ -49,11 +47,12 @@
        * 
        * @see org.apache.jetspeed.engine.AbstractEngine#initComponents(org.apache.commons.configuration.Configuration)
        * @param configuration
  +     * @return
        * @throws IOException
        * @throws ClassNotFoundException
        * @throws NamingException
        */
  -    protected void initComponents( Configuration configuration ) throws IOException, ClassNotFoundException,
  +    protected ComponentManager initComponents( Configuration configuration ) throws IOException, ClassNotFoundException,
               NamingException
       {
           
  @@ -69,7 +68,9 @@
           }
           configs.add("file:///"+absApplicationRoot + configuration.getString("jetspeed.spring.xml", "/WEB-INF/assembly/jetspeed-spring.xml"));
          
  -        componentManager = new SpringComponentManager((String[])configs.toArray(new String[configs.size()]), null);
  +        ComponentManager cm = new SpringComponentManager((String[])configs.toArray(new String[configs.size()]), null);
  +        
  +        return cm;
       }
   
   }
  
  
  
  1.2       +8 -5      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PicoEngine.java	20 Jul 2004 13:55:11 -0000	1.1
  +++ PicoEngine.java	20 Jul 2004 16:35:26 -0000	1.2
  @@ -21,6 +21,7 @@
   import javax.naming.NamingException;
   
   import org.apache.commons.configuration.Configuration;
  +import org.apache.jetspeed.components.ComponentManager;
   import org.apache.jetspeed.components.PicoComponentManager;
   import org.apache.jetspeed.components.datasource.DatasourceComponent;
   import org.apache.jetspeed.components.jndi.JNDIComponent;
  @@ -37,7 +38,7 @@
    */
   public class PicoEngine extends AbstractEngine implements Engine
   {
  -    protected void initComponents( Configuration configuration )
  +    protected ComponentManager initComponents( Configuration configuration )
               throws IOException, ClassNotFoundException, NamingException
       {
           String applicationRoot = getRealPath("/");
  @@ -49,17 +50,17 @@
           MutablePicoContainer bootContainer = new DefaultPicoContainer();        
           bootContainer.registerComponentInstance("portal_configuration", configuration);
                 
  -        componentManager = new  PicoComponentManager(containerAssembler, bootContainer, "PORTAL_SCOPE");
  +        ComponentManager cm = new  PicoComponentManager(containerAssembler, bootContainer, "PORTAL_SCOPE");
           
           try
           {
               if (useInternalJNDI)
               {
  -                JNDIComponent jndi = (JNDIComponent) componentManager
  +                JNDIComponent jndi = (JNDIComponent) cm
                           .getComponent(JNDIComponent.class);
                   if (jndi != null)
                   {
  -                    DatasourceComponent ds = (DatasourceComponent) componentManager
  +                    DatasourceComponent ds = (DatasourceComponent) cm
                               .getComponent(DatasourceComponent.class);
                       if (ds != null)
                       {
  @@ -74,6 +75,8 @@
           {
               // skip for now
           }
  +        
  +        return cm;
   
       }
   }
  
  
  
  1.3       +18 -4     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractEngine.java	20 Jul 2004 15:29:33 -0000	1.2
  +++ AbstractEngine.java	20 Jul 2004 16:35:26 -0000	1.3
  @@ -73,7 +73,7 @@
       private Pipeline defaultPipeline = null;
       private Class pipelineClass = null;
       private HashMap pipelines = new HashMap();
  -    protected ComponentManager componentManager = null;
  +    private ComponentManager componentManager = null;
           private static final Log log = LogFactory.getLog(PicoEngine.class);
       private static final Log console = LogFactory.getLog(CONSOLE_LOGGER);
       /** stores the most recent RequestContext on a per thread basis */
  @@ -141,7 +141,7 @@
               //
               // bootstrap the initable services
               //
  -            initComponents(configuration);
  +            componentManager = initComponents(configuration);
               log.info("Components initialization complete");
               initServices();
               log.info("Service initialization complete");
  @@ -325,7 +325,21 @@
           return base.concat(path);
       }
       
  -    protected abstract void initComponents( Configuration configuration )
  +    /**
  +     * 
  +     * <p>
  +     * initComponents
  +     * </p>
  +     * Main responsibility of the subclassed implementation of this method
  +     * is to provide a <code>ComponentManager</code> implementation for the 
  +     * Engine.
  +     *
  +     * @param configuration Usually jetspeed.properties
  +     * @throws IOException
  +     * @throws ClassNotFoundException
  +     * @throws NamingException
  +     */
  +    protected abstract ComponentManager initComponents( Configuration configuration )
       throws IOException, ClassNotFoundException, NamingException;
   
       private void initServices() throws CPSInitializationException
  
  
  

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