avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container Container.java DefaultContainer.java
Date Fri, 02 Aug 2002 12:31:01 GMT
mcconnell    2002/08/02 05:31:01

  Modified:    assembly/demo/src/java/org/apache/excalibur/playground
                        EmbeddedDemo.java
               assembly/src/etc kernel.xml
               assembly/src/java/org/apache/excalibur/merlin/container
                        Container.java DefaultContainer.java
  Log:
  progress on embedded demonstration
  
  Revision  Changes    Path
  1.2       +38 -1     jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/EmbeddedDemo.java
  
  Index: EmbeddedDemo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/EmbeddedDemo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EmbeddedDemo.java	2 Aug 2002 06:29:20 -0000	1.1
  +++ EmbeddedDemo.java	2 Aug 2002 12:31:01 -0000	1.2
  @@ -17,9 +17,11 @@
   
   import org.apache.excalibur.merlin.kernel.Kernel;
   import org.apache.excalibur.merlin.kernel.DefaultKernel;
  +import org.apache.excalibur.merlin.container.Container;
   import org.apache.excalibur.merlin.model.ContainerDescriptor;
   import org.apache.excalibur.merlin.model.ClasspathDescriptor;
   import org.apache.excalibur.merlin.assembly.ContainerManager;
  +import org.apache.excalibur.meta.info.Type;
   
   /**
    * This is a minimal demonstration component that implements the 
  @@ -34,6 +36,7 @@
   
       private File m_home;
       private Context m_context;
  +    private Container m_container;
   
       public void contextualize( Context context ) throws ContextException
       {
  @@ -48,11 +51,45 @@
       public void initialize() throws Exception
       {
           getLogger().info("initialize");
  -        m_kernel = new DefaultKernel();
  +
  +        ClassLoader classloader;
  +        try
  +        {
  +            classloader = (ClassLoader) m_context.get("classloader");
  +            getLogger().info("classloader " + classloader );
  +        }
  +        catch( Throwable e )
  +        {
  +            getLogger().error("classloader access didn't work.", e );
  +        }
  +
  +        // ###################################################################
  +        // Need to create a formal interface (or at least review the API) for
  +        // ContainerManager and document this as a publically accessible class
  +        // via a standard context key.  The classloader should be usable as a
  +        // context argument to the creation of a new kernel so we get access
  +        // to all of the classes in our current classloder.
  +        // ###################################################################
  +
  +        //
  +        // create the kernel and get the root container
  +        //
  +
  +        m_kernel = new DefaultKernel( );
           m_kernel.enableLogging( getLogger().getChildLogger( "my-kernel" ) );
           m_kernel.contextualize( m_context );
           m_kernel.configure( new DefaultConfiguration( "kernel", null ) );
           m_kernel.initialize();
  +        m_container = m_kernel.getRootContainer();
  +
  +        //
  +        // create and add a profile to the container
  +        //
  +
  +        Type type = m_container.getType( "org.apache.excalibur.playground.SimpleComponent"
);
  +        getLogger().info("TYPE: " + type );
  +        //Profile profile = new Profile();
  +
       }
   
       //=======================================================================
  
  
  
  1.21      +3 -8      jakarta-avalon-excalibur/assembly/src/etc/kernel.xml
  
  Index: kernel.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/etc/kernel.xml,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- kernel.xml	2 Aug 2002 06:36:09 -0000	1.20
  +++ kernel.xml	2 Aug 2002 12:31:01 -0000	1.21
  @@ -27,13 +27,11 @@
         </target>
      </logging>
   
  -   <!--
      <categories priority="INFO">
        <category priority="WARN"  name="logging" />
        <category priority="WARN"  name="loader" />
        <category priority="INFO"  name="export" />
      </categories>
  -   -->
   
      <!--
      Declaration of installed extension directories.
  @@ -58,14 +56,10 @@
        for completness. 
        -->
   
  -       <!--
  -     <categories>
  +     <categories priority="INFO">
          <category priority="WARN"  name="loader" />
  -       <category priority="DEBUG"  name="loader.assembly" />
  -       <category priority="WARN"  name="demo-ext" />
  -       <category priority="WARN"  name="exploit-ext" />
  +       <category priority="WARN"  name="loader.assembly" />
        </categories>
  -       -->
   
        <!--
        Declaration of the classpath for this container.
  @@ -80,6 +74,7 @@
        <component name="embedded-kernel" class="org.apache.excalibur.playground.EmbeddedDemo"
activation="true">
           <context>
             <import key="avalon:home" name="avalon:home"/>
  +          <import key="classloader" name="classloader"/>
           </context>
        </component>
   
  
  
  
  1.8       +7 -1      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/Container.java
  
  Index: Container.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/Container.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Container.java	30 Jul 2002 13:49:07 -0000	1.7
  +++ Container.java	2 Aug 2002 12:31:01 -0000	1.8
  @@ -11,6 +11,7 @@
   import org.apache.excalibur.merlin.model.Profile;
   import org.apache.excalibur.merlin.model.Resource;
   import org.apache.excalibur.meta.info.ReferenceDescriptor;
  +import org.apache.excalibur.meta.info.Type;
   import org.apache.excalibur.merlin.Verifiable;
   import org.apache.excalibur.merlin.Controller;
   
  @@ -39,5 +40,10 @@
       * @return the set of available resources
       */
       Resource[] getResources();
  +
  +    Type getType( String classname );
  +
  +    public void include( Profile profile ) throws Exception;
  +
   
   }
  
  
  
  1.20      +13 -1     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/DefaultContainer.java
  
  Index: DefaultContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/DefaultContainer.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultContainer.java	2 Aug 2002 06:36:10 -0000	1.19
  +++ DefaultContainer.java	2 Aug 2002 12:31:01 -0000	1.20
  @@ -67,6 +67,7 @@
   import org.apache.excalibur.merlin.assembly.TypeManager;
   import org.apache.excalibur.merlin.assembly.ContainerManager;
   import org.apache.excalibur.merlin.assembly.DefaultLoggerManager;
  +import org.apache.excalibur.merlin.container.Container;
   import org.apache.excalibur.merlin.model.ContainerDescriptor;
   import org.apache.excalibur.merlin.model.ClasspathDescriptor;
   import org.apache.excalibur.merlin.model.Profile;
  @@ -394,6 +395,17 @@
               }
           }
           return (Resource[]) list.toArray( new Resource[0] );
  +    }
  +
  +    public Type getType( String classname )
  +    {
  +        return m_manager.getType( classname );
  +    }
  +
  +    public void include( Profile profile ) throws Exception
  +    {
  +        m_manager.addProfile( profile );
  +        m_manager.assemble( new Profile[]{ profile } );
       }
   
       //=======================================================================
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message