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/meta/info Type.java
Date Mon, 15 Jul 2002 02:12:24 GMT
mcconnell    2002/07/14 19:12:24

  Modified:    assembly build.xml
               assembly/lib excalibur-configuration-1.0.jar
               assembly/src/etc kernel.xml merlin.html
               assembly/src/java/org/apache/excalibur/merlin
                        DefaultController.java
               assembly/src/java/org/apache/excalibur/merlin/container
                        Container.java DefaultContainer.java
               assembly/src/java/org/apache/excalibur/merlin/kernel
                        DefaultKernel.java Kernel.java
               assembly/src/java/org/apache/excalibur/meta/info Type.java
  Added:       assembly/src/etc overview.gif
               assembly/src/java/org/apache/excalibur/merlin/container
                        ProfileDesignator.java
               assembly/src/java/org/apache/excalibur/merlin/kernel
                        ResourceDesignator.java
               assembly/src/java/org/apache/excalibur/merlin/kernel/doc-files
                        Kernel.gif
  Removed:     assembly/src/etc merlin.gif
               assembly/src/java/org/apache/excalibur/merlin/kernel/doc-files
                        Container.gif DefaultContainer.gif Map.gif UML.gif
  Log:
  addition of resource export capabilities to the kernel
  
  Revision  Changes    Path
  1.21      +5 -1      jakarta-avalon-excalibur/assembly/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/build.xml,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- build.xml	14 Jul 2002 10:42:12 -0000	1.20
  +++ build.xml	15 Jul 2002 02:12:23 -0000	1.21
  @@ -216,7 +216,11 @@
   	  <link href="${avalon.href}" />
   	  <link href="${meta.href}" />
       </javadoc>
  -    <copy todir="${javadoc.root.path}/${ant.project.name}" file="${src}/etc/merlin.gif"/>
  +    <copy todir="${javadoc.root.path}/${ant.project.name}">
  +      <fileset dir="${src}/etc">
  +        <include name="*.gif"/>
  +      </fileset>
  +    </copy>
     </target>
   
     <target name="meta.javadoc" depends="meta.build" >
  
  
  
  1.4       +60 -48    jakarta-avalon-excalibur/assembly/lib/excalibur-configuration-1.0.jar
  
  	<<Binary file>>
  
  
  1.11      +1 -1      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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- kernel.xml	13 Jul 2002 15:35:25 -0000	1.10
  +++ kernel.xml	15 Jul 2002 02:12:23 -0000	1.11
  @@ -21,7 +21,7 @@
      the corresponds to the name of the logging file.
      -->
   
  -   <logging priority="INFO" target="default">
  +   <logging priority="INFO" target="kernel">
         <target name="kernel">
           <file location="kernel.log" />
         </target>
  
  
  
  1.6       +10 -7     jakarta-avalon-excalibur/assembly/src/etc/merlin.html
  
  Index: merlin.html
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/etc/merlin.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- merlin.html	14 Jul 2002 12:11:20 -0000	1.5
  +++ merlin.html	15 Jul 2002 02:12:23 -0000	1.6
  @@ -1,7 +1,7 @@
   <body> 
   <h3>System Overview</h3>
   <p>
  -This package contains work in progress originating from the Merlin container including
a set of services dealing with the definition of a system kernel, container hierarchies, component
assembly, and component deployment and decommissioning.  This package is ALPHA and subject
to change. 
  +This package contains work in progress originating from the Merlin container including
a set of services dealing with the definition of a system kernel, container hierarchies, component
assembly, and component deployment and decommissioning.  
   </p>
   <p>Main components of the framework include:
     <ul>
  @@ -14,7 +14,8 @@
   </p>
   
   <h3>Kernel Model</h3>
  -Merlin seperates the notion of a kernel from the a root container of a container hierachy.
 The kernel provides the framework for overall management including startupoing up, shutting
down, extensions management, and other system wide facilities.  The Melin implementation provides
a utility class {@link org.apache.excalibur.merlin.Main} that handles establish of a kernel
based on a single command line argument.</p>
  +Merlin seperates the notion of a kernel from a container.  A kernal manages resources (Objects)
whereas a container manages services (Objects that serve as service providers and consumers).
 The Merlin implementation provides a default kernal that manages a container hierachy.  The
kernel provides the framework for overall management including startup, shutting down, extensions
management, and other system wide facilities.  The Melin implementation provides a utility
class {@link org.apache.excalibur.merlin.Main} that handles establish of a kernel based on
a single command line argument.</p>
  +
   <p>A merlin kernel is created using a kernel model ({@link org.apache.excalibur.merlin.model.KernelDescriptor}).
 The model may be defined programatically or through an XML file.  A kernel XML file contains
the defintion of kernal execution parameters and a root container.</P>
   <p><i>Minimilist kernel defintion.</i></p>
   <pre>
  @@ -30,13 +31,15 @@
     &lt;/kernel&gt;
   </pre>
   
  +<p>The function of the kernel is to provide a set of bootstap services and context
entries to the container it is managing, and subsequently publish establish entries and services
(derived from container deployment) towards kernel clients.</p>
  +<p><i>Kernel to Container conceptual relationship.</i></p>
  +<p><image src="overview.gif" border="0"/></p>
  +
   <h3>Container Model</h3>
  -<p>The Merlin system provides support for a cascading container model.  This model
enables applications to better seperate classes as each container is associated with its own
classloader.  Merlin will handle resolsolution of service dependecies for component contained
in containers by looking for explicitly declared solutions commencing within the local container,
and working progressively up the hierachy.  If not explict solutions are resolved, Merlin
will attempt to build an implicit solution based on components declared in the respective
container classpath declarations.</p>
  -<p><i>Example container hierachy.</i></p>
  -<p><image src="merlin.gif" border="0"/></p>
  +<p>The Merlin system provides support for a cascading container model.  This model
enables applications to seperate classes as each container is associated with its own classloader.
 Merlin will handle resolution of service dependecies for components contained in containers
by looking for explicitly declared solutions commencing within the local container, and working
progressively up the container hierachy.  If no explict solutions are resolved, Merlin will
attempt to build an implicit solution based on components declared in the respective container
classpath declarations.</p>
   
   <h3>Deployment Model</h3>
  -Components types deployed under this framework must be declared as formal component types
using a &lt;classname&gt;.xinfo descriptor as defined by the <a href="{$docRoot}/../meta/index.html"
target="_top">Avalon Meta Model</a>. Components types may also deployed with default
profile criteria and configuration information.</p>
  +Components types deployed under this framework must be declared as formal component types
using a &lt;classname&gt;.xinfo descriptor as defined by the <a href="{$docRoot}/../../meta/index.html"
target="_top">Avalon Meta Model</a>. Components types may also deployed with default
profile criteria and configuration information.</p>
   
   <ul>
     <li>&lt;classname&gt;.xinfo
  @@ -85,7 +88,7 @@
   
   <h3>Current Status</h3>
   <p>
  -The implementation provides full support for hierachical containers and profiles management
including resolution of dependecies cross containers. Processing of singleton components throught
the component lifecycle is in place.  For a list of TO-DO items, please refer to the README
document.
  +The implementation provides full support for hierachical containers and profiles management
including resolution of dependencies cross containers. Processing of singleton components
throught the component lifecycle is in place.  For a list of TO-DO items, please refer to
the README document. This package is ALPHA and and as such is subject to change. 
   </p>
   
   </body>
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/src/etc/overview.gif
  
  	<<Binary file>>
  
  
  1.2       +10 -1     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/DefaultController.java
  
  Index: DefaultController.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/DefaultController.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultController.java	13 Jul 2002 00:09:44 -0000	1.1
  +++ DefaultController.java	15 Jul 2002 02:12:24 -0000	1.2
  @@ -28,6 +28,7 @@
   import org.apache.excalibur.merlin.kernel.DefaultLoggerManager;
   import org.apache.excalibur.merlin.kernel.ContainerClassLoader;
   import org.apache.excalibur.merlin.kernel.KernelException;
  +import org.apache.excalibur.merlin.kernel.ResourceDesignator;
   import org.apache.excalibur.merlin.model.builder.XMLKernelCreator;
   import org.apache.excalibur.merlin.model.KernelDescriptor;
   import org.apache.excalibur.merlin.model.ClasspathDescriptor;
  @@ -241,6 +242,14 @@
               final String error = "Unexpected initialization failure.";
               throw new ControllerException( error, e );
           }
  +
  +        ResourceDesignator[] resources = m_kernel.getResources();
  +        System.out.println("\nExportable service list:\n");
  +        for( int i=0; i<resources.length; i++ )
  +        {
  +            System.out.println("  " + resources[i].getPath() );
  +        }
  +        System.out.println("\n");
   
           m_status = INITIALIZED;
       }
  
  
  
  1.3       +8 -5      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Container.java	14 Jul 2002 10:45:30 -0000	1.2
  +++ Container.java	15 Jul 2002 02:12:24 -0000	1.3
  @@ -41,15 +41,18 @@
       * Get a service instance.
       * @param profile the service provider constraint information
       */
  -    public Object lookup( Profile profile );
  +    Object lookup( Profile profile );
   
      /**
       * Notification by a client that it no longer requies an object.
       * @param provider the key to the provider instance
       */
  -    public void release( Object object );
  -
  -
  +    void release( Object object );
   
  +   /**
  +    * Returns the path name of this container.
  +    * @return the container's path
  +    */
  +    String getPath();
   
   }
  
  
  
  1.9       +46 -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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultContainer.java	14 Jul 2002 10:43:45 -0000	1.8
  +++ DefaultContainer.java	15 Jul 2002 02:12:24 -0000	1.9
  @@ -73,6 +73,7 @@
   import org.apache.excalibur.merlin.model.builder.ProfileBuilder;
   import org.apache.excalibur.merlin.kernel.ContainerClassLoader;
   import org.apache.excalibur.merlin.kernel.DefaultLoggerManager;
  +import org.apache.excalibur.merlin.kernel.ResourceDesignator;
   import org.apache.excalibur.merlin.Verifiable;
   import org.apache.excalibur.merlin.Controller;
   import org.apache.log.Hierarchy;
  @@ -164,6 +165,7 @@
       private ProfileRegistry m_profiles; 
   
       private Hashtable m_profileToObjectMap = new Hashtable();
  +    private ArrayList m_designators = new ArrayList();
   
       private ProfileBuilder m_builder = new ProfileBuilder();
   
  @@ -259,6 +261,8 @@
               throw new AssemblyException( error, e );
           }
   
  +        setupResources( m_designators );
  +
           getLogger().debug("subsidiary container creation");
           ContainerDescriptor[] containers = m_descriptor.getContainers();
           for( int i=0; i<containers.length; i++ )
  @@ -451,6 +455,47 @@
          // only dealing with singletons for now
       }
   
  +    public String getPath()
  +    {
  +        if( m_parent == null ) return "/" + m_descriptor.getName();
  +        return m_parent.getPath() + "/" + m_descriptor.getName();
  +    }
  +
  +   /**
  +    * Return the set of exportable services from this container.
  +    * @return the exporable service descriptors
  +    */
  +    public ResourceDesignator[] getResources()
  +    {
  +        ArrayList list = new ArrayList();
  +        getResources( list );
  +        return (ResourceDesignator[]) list.toArray( new ResourceDesignator[0] );
  +    }
  +
  +    protected void getResources( List list )
  +    {
  +        list.addAll( m_designators );
  +        Iterator iterator = m_containers.iterator();
  +        while( iterator.hasNext() )
  +        {
  +            ((DefaultContainer)iterator.next()).getResources( list );
  +        }
  +    }
  +
  +   /**
  +    * Return the set of exportable services from this container.
  +    * @return the exporable service descriptors
  +    */
  +    private void setupResources( List list )
  +    {
  +        Profile[] profiles = m_map.getStartupGraph();
  +        for( int i=0; i<profiles.length; i++ )
  +        {
  +            Profile profile = profiles[i];
  +            String name = getPath() + "/" + profile.getName();
  +            m_designators.add( new ProfileDesignator( name, profile, m_helper, m_provider
) );
  +        }
  +    }
   
       //=======================================================================
       // Disposable
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ProfileDesignator.java
  
  Index: ProfileDesignator.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.merlin.container;
  
  import org.apache.excalibur.merlin.model.Profile;
  import org.apache.excalibur.merlin.kernel.ResourceDesignator;
  import org.apache.excalibur.meta.info.ServiceDescriptor;
  
  /**
   * Opaque type that maps a path to a profile.
   *
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2002/07/15 02:12:24 $
   */
  class ProfileDesignator implements ResourceDesignator
  {
  
      /**
       * The path of the profile designator.
       */
      private final String m_path;
  
      /**
       * The profile that disignator refers to.
       */
      private final Profile m_profile;
  
      /**
       * A singleton reference to the instantiated service.
       */
      private Object m_service;
  
      /**
       * The lifecycle helper.
       */
      private final LifecycleHelper m_helper;
  
      /**
       * The resource provider.
       */
      private final ResourceProvider m_provider;
  
      /**
       * Create a profile designator instance.
       *
       * @param path the path of the profile designator
       * @param profile the profile
       * @param helper the lifecycle helper
       * @param provider the resource provider
       */
      ProfileDesignator( final String path,
                             final Profile profile,
                             final LifecycleHelper helper,
                             final ResourceProvider provider )
      {
          if( null == path )
          {
              throw new NullPointerException( "path" );
          }
          if( null == profile )
          {
              throw new NullPointerException( "profile" );
          }
          if( null == helper )
          {
              throw new NullPointerException( "helper" );
          }
          if( null == provider )
          {
              throw new NullPointerException( "provider" );
          }
  
          m_path = path;
          m_profile = profile;
          m_helper = helper;
          m_provider = provider;
      }
  
      /**
       * Returns the path of the resource.
       *
       * @return the simbolic path of the resource
       */
      public String getPath()
      {
          return m_path;
      }
  
      /**
       * Returns the service descriptor.
       *
       * @return the service descriptor
       */
      public ServiceDescriptor[] getServices()
      {
          return m_profile.getType().getServices();
      }
  
      /**
       * Return the resource instance.
       *
       * @return the profile
       */
      public Object getInstance() throws Exception
      {
          if( m_service == null )
            m_service = m_helper.startup( m_path, m_profile, m_provider );
          return m_service;
      }
  
      public String toString()
      {
          return "ProfileResource: " + getPath();
      }
  }
  
  
  
  1.15      +23 -1     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.java
  
  Index: DefaultKernel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DefaultKernel.java	13 Jul 2002 13:39:00 -0000	1.14
  +++ DefaultKernel.java	15 Jul 2002 02:12:24 -0000	1.15
  @@ -14,6 +14,7 @@
   import java.net.URL;
   import java.net.JarURLConnection;
   import java.net.URLClassLoader;
  +import java.util.ArrayList;
   import java.util.List;
   import java.util.LinkedList;
   import java.util.Hashtable;
  @@ -63,6 +64,7 @@
   import org.apache.excalibur.meta.info.ServiceDescriptor;
   import org.apache.excalibur.meta.info.DependencyDescriptor;
   import org.apache.excalibur.meta.info.ServiceDesignator;
  +import org.apache.excalibur.meta.info.EntryDescriptor;
   import org.apache.excalibur.merlin.model.KernelDescriptor;
   import org.apache.excalibur.merlin.model.DirsetDescriptor;
   import org.apache.excalibur.merlin.model.Profile;
  @@ -104,6 +106,16 @@
   
       private ClassLoader m_classloader;
   
  +   /**
  +    * The context entries available from the kernel post startup.
  +    */
  +    private ArrayList m_entries = new ArrayList();
  +
  +   /**
  +    * The service descriptor collection established dynamically by the kernel post startup.
  +    */
  +    private ArrayList m_services = new ArrayList();
  +
       //=======================================================================
       // Contextualizable
       //=======================================================================
  @@ -245,4 +257,14 @@
           m_container.shutdown();
           getLogger().info("shutdown complete");
       }
  +
  +    //=======================================================================
  +    // Kernel
  +    //=======================================================================
  +
  +    public ResourceDesignator[] getResources()
  +    {
  +        return m_container.getResources();
  +    }
  +
   }
  
  
  
  1.8       +15 -2     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/Kernel.java
  
  Index: Kernel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/Kernel.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Kernel.java	12 Jul 2002 16:04:18 -0000	1.7
  +++ Kernel.java	15 Jul 2002 02:12:24 -0000	1.8
  @@ -9,12 +9,25 @@
   package org.apache.excalibur.merlin.kernel;
   
   import org.apache.excalibur.merlin.Controller;
  +import org.apache.excalibur.meta.info.ServiceDescriptor;
  +import org.apache.excalibur.meta.info.EntryDescriptor;
   
   /**
  - * A service that provides support for the hosting of multiple containers.
  + * A service that provides support for the establishment of services and service context.
  + * <p><b>UML</b></p>
  + * <p><image src="doc-files/Kernel.gif" border="0"/></p>
  + *
    * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
    * @version $Revision$ $Date$
    */
   public interface Kernel extends Controller
   {
  +
  +    /**
  +     * Return the set of resources that this kernel is capable of providing.
  +     *
  +     * @return the set of resource designators
  +     */
  +    ResourceDesignator[] getResources();
  +    
   }
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/ResourceDesignator.java
  
  Index: ResourceDesignator.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.merlin.kernel;
  
  import org.apache.excalibur.meta.info.ServiceDescriptor;
  
  /**
   * Interface implemented by object capable of supply a resources.
   *
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2002/07/15 02:12:24 $
   */
  public interface ResourceDesignator
  {
  
      /**
       * Returns the designated resource path.
       *
       * @return the resource path
       */
      String getPath();
  
      /**
       * Returns the resource descriptor.
       *
       * @return the descriptor
       */
      ServiceDescriptor[] getServices();
  
      /**
       * Return the resource instance.
       *
       * @return the profile
       */
      Object getInstance() throws Exception;
  
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/doc-files/Kernel.gif
  
  	<<Binary file>>
  
  
  1.5       +7 -7      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/Type.java
  
  Index: Type.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/Type.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Type.java	12 Jul 2002 17:15:13 -0000	1.4
  +++ Type.java	15 Jul 2002 02:12:24 -0000	1.5
  @@ -97,10 +97,10 @@
       }
   
       /**
  -     * Return the ContextDescriptor for Component, may be null.
  +     * Return the ContextDescriptor for component, may be null.
        * If null then this component does not implement Contextualizable.
        *
  -     * @return the ContextDescriptor for Component, may be null.
  +     * @return the ContextDescriptor for component, may be null.
        */
       public ContextDescriptor getContext()
       {
  @@ -108,9 +108,9 @@
       }
   
       /**
  -     * Return the set of Services that this Component is capable of providing.
  +     * Return the set of Services that this component is capable of providing.
        *
  -     * @return the set of Services that this Component is capable of providing.
  +     * @return the set of Services that this component is capable of providing.
        */
       public ServiceDescriptor[] getServices()
       {
  @@ -118,9 +118,9 @@
       }
   
       /**
  -     * Return the set of Dependencies that this Component requires to operate.
  +     * Return the set of Dependencies that this component requires to operate.
        *
  -     * @return the set of Dependencies that this Component requires to operate.
  +     * @return the set of Dependencies that this component requires to operate.
        */
       public DependencyDescriptor[] getDependencies()
       {
  
  
  

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