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/06/23 20:29:48 UTC

cvs commit: jakarta-jetspeed-2/components/cm/src/java/org/apache/jetspeed/components ComponentAssemblyTestCase.java ContainerManagement.java ComponentManager.java ComponentAwareTestSuite.java

weaver      2004/06/23 11:29:48

  Modified:    components/cm/src/java/org/apache/jetspeed/components
                        ComponentAssemblyTestCase.java
                        ContainerManagement.java ComponentManager.java
  Removed:     components/cm/src/java/org/apache/jetspeed/components
                        ComponentAwareTestSuite.java
  Log:
  refactored component manager.  No longer extends NanoCOntainer.  Instead, it builds up nano internally.
  
  Revision  Changes    Path
  1.5       +5 -8      jakarta-jetspeed-2/components/cm/src/java/org/apache/jetspeed/components/ComponentAssemblyTestCase.java
  
  Index: ComponentAssemblyTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/cm/src/java/org/apache/jetspeed/components/ComponentAssemblyTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ComponentAssemblyTestCase.java	10 Mar 2004 07:54:49 -0000	1.4
  +++ ComponentAssemblyTestCase.java	23 Jun 2004 18:29:48 -0000	1.5
  @@ -16,8 +16,6 @@
   package org.apache.jetspeed.components;
   
   import java.io.File;
  -import org.picocontainer.defaults.ObjectReference;
  -import org.picocontainer.defaults.SimpleReference;
   
   import junit.framework.TestCase;
   
  @@ -85,12 +83,11 @@
           String applicationRoot = getApplicationRoot(getBaseProject(), getRelativePath());
           File containerAssembler = new File(applicationRoot + "/assembly/" + getTestName() + getAssemblyScriptType());
           assertTrue(containerAssembler.exists());
  -        componentManager = new  ComponentManager(containerAssembler);
  -        ObjectReference rootContainerRef = new SimpleReference();       
  -                            
  -        componentManager.getContainerBuilder().buildContainer(rootContainerRef, null, "TEST_SCOPE");
           
  -        assertNotNull(rootContainerRef.get());
  +        componentManager = new  ComponentManager(containerAssembler, null, "TEST_SCOPE");     
  +        
  +        
  +        assertNotNull(componentManager.getRootContainer());
               
       }
       
  
  
  
  1.3       +3 -1      jakarta-jetspeed-2/components/cm/src/java/org/apache/jetspeed/components/ContainerManagement.java
  
  Index: ContainerManagement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/cm/src/java/org/apache/jetspeed/components/ContainerManagement.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContainerManagement.java	8 Mar 2004 00:42:51 -0000	1.2
  +++ ContainerManagement.java	23 Jun 2004 18:29:48 -0000	1.3
  @@ -34,6 +34,8 @@
       
       Collection getContainers();
       
  +    void stop();
  +    
       // void addContainer(String containerName, MutablePicoContainer container);
       
       // void removeContainer(String containerName);
  
  
  
  1.6       +42 -80    jakarta-jetspeed-2/components/cm/src/java/org/apache/jetspeed/components/ComponentManager.java
  
  Index: ComponentManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/cm/src/java/org/apache/jetspeed/components/ComponentManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ComponentManager.java	6 Jun 2004 01:48:52 -0000	1.5
  +++ ComponentManager.java	23 Jun 2004 18:29:48 -0000	1.6
  @@ -17,7 +17,6 @@
   
   import java.io.File;
   import java.io.IOException;
  -import java.io.Reader;
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Iterator;
  @@ -39,75 +38,33 @@
    * @version $Id$
    *
    */
  -public class ComponentManager extends NanoContainer implements ComponentManagement, ContainerManagement
  -{
  -    private MutablePicoContainer rootContainer;
  -
  -    /**
  -     * @param arg0
  -     * @param arg1
  -     * @param arg2
  -     * @throws java.io.IOException
  -     * @throws java.lang.ClassNotFoundException
  -     */
  -    public ComponentManager(File arg0, PicoContainer arg1, ClassLoader arg2) throws IOException, ClassNotFoundException
  -    {
  -        super(arg0, arg1, arg2);        
  -    }
  -
  -    /**
  -     * @param arg0
  -     * @param arg1
  -     * @throws java.io.IOException
  -     * @throws java.lang.ClassNotFoundException
  -     */
  -    public ComponentManager(File arg0, PicoContainer arg1) throws IOException, ClassNotFoundException
  -    {
  -        super(arg0, arg1);        
  -    }
  -
  -    /**
  -     * @param arg0
  -     * @throws java.io.IOException
  -     * @throws java.lang.ClassNotFoundException
  -     */
  -    public ComponentManager(File arg0) throws IOException, ClassNotFoundException
  -    {
  -        super(arg0);        
  -    }
  -
  -    /**
  -     * @param arg0
  -     * @param arg1
  -     * @param arg2
  -     * @throws java.lang.ClassNotFoundException
  -     */
  -    public ComponentManager(Reader arg0, String arg1, ClassLoader arg2) throws ClassNotFoundException
  -    {
  -        super(arg0, arg1, arg2);        
  -    }
  -
  -    /**
  -     * @param arg0
  -     * @param arg1
  -     * @throws java.lang.ClassNotFoundException
  -     */
  -    public ComponentManager(Reader arg0, String arg1) throws ClassNotFoundException
  -    {
  -        super(arg0, arg1);        
  -    }
  -
  -    /**
  -     * @param arg0
  -     * @param arg1
  -     * @param arg2
  -     * @param arg3
  -     * @throws java.lang.ClassNotFoundException
  -     */
  -    public ComponentManager(Reader arg0, String arg1, PicoContainer arg2, ClassLoader arg3) throws ClassNotFoundException
  -    {
  -        super(arg0, arg1, arg2, arg3);
  -        
  +public class ComponentManager implements ComponentManagement, ContainerManagement
  +{    
  +    protected ScriptedContainerBuilder containerBuilder;
  +    protected ObjectReference rootContainerRef;
  +    protected MutablePicoContainer rootContainer;
  +
  +    /**
  +     * 
  +     * @param assemblyFile
  +     * @param parent
  +     * @param scope
  +     * @throws IOException
  +     * @throws ClassNotFoundException
  +     */
  +    public ComponentManager( File assemblyFile, PicoContainer parent, String scope) throws IOException, ClassNotFoundException 
  +    {
  +        rootContainerRef = new SimpleReference();
  +        NanoContainer nano = new NanoContainer(assemblyFile);
  +        ObjectReference parentRef = null;
  +        if(parent != null)
  +        {
  +            parentRef = new SimpleReference();
  +            parentRef.set(parent);            
  +        }
  +        containerBuilder = nano.getContainerBuilder();
  +        containerBuilder.buildContainer(rootContainerRef, parentRef, scope); 
  +        this.rootContainer = (MutablePicoContainer) rootContainerRef.get();
       }
   
       /**
  @@ -120,15 +77,7 @@
       }
   
       public MutablePicoContainer getRootContainer()
  -    {
  -        if(rootContainer == null)
  -        {
  -            ObjectReference containerRef = new SimpleReference();
  -            ScriptedContainerBuilder scb = this.getContainerBuilder();
  -            scb.buildContainer(containerRef, null, "jetspeed");
  -            rootContainer = (MutablePicoContainer) containerRef.get();            
  -        }
  -        
  +    {       
           return rootContainer;
       }
   
  @@ -172,4 +121,17 @@
           return list;
       }
   
  +    /**
  +     * <p>
  +     * stop
  +     * </p>
  +     *
  +     * @see org.apache.jetspeed.components.ContainerManagement#stop()
  +     * 
  +     */
  +    public void stop()
  +    {
  +        containerBuilder.killContainer(rootContainerRef);
  +
  +    }
   }
  
  
  

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