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/registry ComponentDefinition.java DefaultRegistry.java Profile.java ServiceRegistry.java
Date Fri, 05 Jul 2002 08:50:24 GMT
mcconnell    2002/07/05 01:50:24

  Modified:    assembly/src/java/org/apache/excalibur/merlin/kernel
                        Container.java DefaultContainer.java
                        DefaultKernel.java Kernel.java
               assembly/src/java/org/apache/excalibur/merlin/registry
                        ComponentDefinition.java DefaultRegistry.java
                        Profile.java ServiceRegistry.java
  Log:
  internal cleanup
  
  Revision  Changes    Path
  1.4       +10 -8     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/Container.java
  
  Index: Container.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/Container.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Container.java	4 Jul 2002 09:01:34 -0000	1.3
  +++ Container.java	5 Jul 2002 08:50:23 -0000	1.4
  @@ -9,6 +9,9 @@
   package org.apache.excalibur.merlin.kernel;
   
   import org.apache.excalibur.containerkit.verifier.VerifyException;
  +import org.apache.excalibur.containerkit.metainfo.DependencyDescriptor;
  +import org.apache.excalibur.merlin.registry.Profile;
  +import org.apache.excalibur.merlin.registry.UnresolvedProviderException;
   
   /**
    * A service that provides support for the management of a set of component types
  @@ -20,13 +23,12 @@
   {
    
      /**
  -    * Request the startup of the kernel.
  +    * Return the profile of an installed component matching a dependency.
  +    * @param dependency a consumer component dependecy declaration
  +    * @return the supplier profile
  +    * @exception UnresolvedProviderException if no provider available
       */
  -    void startup() throws Exception;
  -
  -   /**
  -    * Request the shutdown of the kernel.
  -    */
  -    void shutdown();
  +    Profile getProvider( DependencyDescriptor dependency ) 
  +      throws UnresolvedProviderException;
   
   }
  
  
  
  1.6       +28 -11    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultContainer.java
  
  Index: DefaultContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultContainer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultContainer.java	4 Jul 2002 19:49:27 -0000	1.5
  +++ DefaultContainer.java	5 Jul 2002 08:50:23 -0000	1.6
  @@ -36,6 +36,7 @@
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.activity.Executable;
  +import org.apache.avalon.framework.activity.Startable;
   import org.apache.avalon.framework.CascadingRuntimeException;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.DefaultConfiguration;
  @@ -69,6 +70,8 @@
   
   import org.apache.excalibur.merlin.registry.DefaultRegistry;
   import org.apache.excalibur.containerkit.verifier.VerifyException;
  +import org.apache.excalibur.merlin.registry.Profile;
  +import org.apache.excalibur.merlin.registry.UnresolvedProviderException;
   
   /**
    * Default container implementation that manages a registry of componet providers and 
  @@ -77,7 +80,7 @@
    * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
    * @version $Revision$ $Date$
    */
  -public class DefaultContainer extends DefaultRegistry implements Container
  +public class DefaultContainer extends DefaultRegistry implements Container, Startable
   {
       //=======================================================================
       // state
  @@ -114,18 +117,16 @@
       */
       public void contextualize( Context context ) throws ContextException
       {
  +        super.contextualize( context );
           m_classloader = (ContainerClassLoader) context.get( CLASSLOADER_KEY );
  +        m_map = (DependencyMap) context.get( MAP_KEY );
           try
           {
  -            m_map = (DependencyMap) context.get( MAP_KEY );
               m_parent = (Container) context.get( CONTAINER_KEY );
  -            super.contextualize( context );
           }
           catch( ContextException e )
           {
  -            DefaultContext c = new DefaultContext( context );
  -            c.put( CONTAINER_KEY, this );
  -            super.contextualize( c );
  +            // root container
           }
       }
   
  @@ -187,7 +188,23 @@
       // Container
       //=======================================================================
   
  -    public void startup() throws Exception
  +   /**
  +    * Return the profile of an installed component matching a dependency.
  +    * @param dependency a consumer component dependency declaration
  +    * @return the supplier profile
  +    * @exception UnresolvedProviderException if no provider available
  +    */
  +    //public Profile getProvider( DependencyDescriptor dependency ) 
  +    //  throws UnresolvedProviderException
  +    //{
  +    //    throw new UnresolvedProviderException( "not implemented",  dependency );
  +    //}
  +
  +    //======================================================================
  +    // Startable
  +    //======================================================================
  +
  +    public void start() throws Exception
       {
   
           //
  @@ -204,11 +221,11 @@
           Iterator iterator = m_containers.iterator();
           while( iterator.hasNext() )
           {
  -            ((Container)iterator.next()).startup();
  +            ((Startable)iterator.next()).start();
           }
       }
   
  -    public void shutdown()
  +    public void stop() throws Exception
       {
   
           //
  @@ -220,7 +237,7 @@
           Iterator iterator = m_containers.iterator();
           while( iterator.hasNext() )
           {
  -            ((Container)iterator.next()).shutdown();
  +            ((Startable)iterator.next()).stop();
           }
           ComponentMetaData[] shutdown = m_map.getShutdownGraph();
           for( int i=0; i<shutdown.length; i++ )
  
  
  
  1.5       +11 -3     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultKernel.java	4 Jul 2002 09:01:35 -0000	1.4
  +++ DefaultKernel.java	5 Jul 2002 08:50:23 -0000	1.5
  @@ -29,6 +29,7 @@
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.excalibur.configuration.ConfigurationUtil;
  +import org.apache.avalon.framework.CascadingRuntimeException;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.logger.AvalonFormatter;
  @@ -136,11 +137,18 @@
   
       public void startup() throws Exception
       {
  -        m_container.startup();
  +        m_container.start();
       }
   
       public void shutdown()
       {
  -        m_container.shutdown();
  +        try
  +        {
  +            m_container.stop();
  +        }
  +        catch( Throwable e )
  +        {
  +            throw new CascadingRuntimeException("Unexpected error while stopping.", e );
  +        }
       }
   }
  
  
  
  1.4       +11 -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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Kernel.java	4 Jul 2002 09:01:35 -0000	1.3
  +++ Kernel.java	5 Jul 2002 08:50:23 -0000	1.4
  @@ -13,7 +13,16 @@
    * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
    * @version $Revision$ $Date$
    */
  -public interface Kernel extends Container
  +public interface Kernel
   {
  +   /**
  +    * Request the startup of the kernel.
  +    */
  +    void startup() throws Exception;
  +
  +   /**
  +    * Request the shutdown of the kernel.
  +    */
  +    void shutdown();
   
   }
  
  
  
  1.5       +4 -3      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/registry/ComponentDefinition.java
  
  Index: ComponentDefinition.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/registry/ComponentDefinition.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ComponentDefinition.java	4 Jul 2002 09:01:35 -0000	1.4
  +++ ComponentDefinition.java	5 Jul 2002 08:50:24 -0000	1.5
  @@ -29,6 +29,7 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  +import org.apache.avalon.framework.configuration.DefaultConfiguration;
   import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.Version;
   import org.apache.excalibur.containerkit.metainfo.ContextDescriptor;
  @@ -128,7 +129,7 @@
           if( m_criteria.length == 0 )
           {
               // create an implicit profile
  -            Profile profile = new Profile( m_registry, this );
  +            Profile profile = m_registry.buildProfile( this, new DefaultConfiguration("component")
 );
               m_profiles.put( profile.getName(), profile );
           }
           else
  @@ -136,7 +137,7 @@
               // use the explicit profiles
               for( int i=0; i<m_criteria.length; i++ )
               {
  -                Profile profile = new Profile( m_registry, this, m_criteria[i] );
  +                Profile profile = m_registry.buildProfile( this, m_criteria[i]  );
                   m_profiles.put( profile.getName(), profile );
               }
           }
  
  
  
  1.10      +106 -47   jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/registry/DefaultRegistry.java
  
  Index: DefaultRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/registry/DefaultRegistry.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultRegistry.java	4 Jul 2002 09:01:36 -0000	1.9
  +++ DefaultRegistry.java	5 Jul 2002 08:50:24 -0000	1.10
  @@ -52,6 +52,7 @@
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.service.DefaultServiceManager;
   import org.apache.avalon.framework.service.ServiceException;
  +import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.avalon.framework.Version;
   import org.apache.avalon.framework.ExceptionUtil;
   import org.apache.avalon.excalibur.extension.PackageRepository;
  @@ -77,6 +78,7 @@
   import org.apache.excalibur.merlin.kernel.Container;
   import org.apache.excalibur.merlin.kernel.ContainerClassLoader;
   import org.apache.excalibur.merlin.kernel.Verifiable;
  +import org.apache.excalibur.configuration.ContextFactory;
   
   /**
    * Provides support for the maintenance of a registry of 
  @@ -149,6 +151,9 @@
   
       private Hashtable m_profileMapping = new Hashtable();
   
  +   /**
  +    * Hashtable of all installed profiles keyed by profile name.
  +    */
       private Hashtable m_profiles = new Hashtable();
   
       private DependencyMap m_map;
  @@ -189,8 +194,15 @@
       {
           m_context = context;
           m_classloader = (ContainerClassLoader) context.get( CLASSLOADER_KEY );
  -        m_parent = (Container) context.get( CONTAINER_KEY );
           m_map = (DependencyMap) context.get( MAP_KEY );
  +        try
  +        {
  +            m_parent = (Container) context.get( CONTAINER_KEY );
  +        }
  +        catch( ContextException e )
  +        {
  +            // root container
  +        }
       }
   
       //=======================================================================
  @@ -228,7 +240,8 @@
           {
               //
               // register all of the the component providers implied by the classpath
  -            // manifest declarations
  +            // manifest declarations as potential component type without resolution
  +            // of dependencies
               //
   
               for( int i=0; i<blocks.length; i++ )
  @@ -238,39 +251,46 @@
                   m_services.register( classname );
               }
   
  +        }
  +        catch( Throwable e )
  +        {
  +            final String error = "Internal registry candidate registation failure.";
  +            throw new RegistryException( error, e );
  +        }
  +
  +        Configuration[] entries = m_config.getChildren( "component" );
  +        try
  +        {
               //
               // for all of the components declared in the application profiles,
  -            // install each one in the service repository - the side effect of 
  -            // this is the buildup of the m_profiles table that will be used to 
  -            // construct the application context
  +            // register each one in the service repository
               //
   
  -            Configuration[] entries = m_config.getChildren( "component" );
               for( int i=0; i<entries.length; i++ )
               {
  -                final Configuration factory = entries[i];
  -                final String name = factory.getAttribute("name");
  -                final String classname = factory.getAttribute("class");
  -
  +                final Configuration entry = entries[i];
  +                final String classname = entry.getAttribute("class");
                   getLogger().debug("component configuration");
  -                getLogger().debug( ConfigurationUtil.list( factory ) );
  -                Profile profile = m_services.install( classname, name );
  -                populate( m_map, profile );
  -                //listProfile( profile );
  +                getLogger().debug( ConfigurationUtil.list( entry ) );
  +                ComponentType type = m_services.register( classname );
               }
   
               //
  -            // if its a container we need to instantiate it and verify it.
  +            // for all of the component profiles declared in the container,
  +            // install each of them
               //
   
  -            if( m_config.getName().equals("containers"))
  +            for( int i=0; i<entries.length; i++ )
               {
  -                getLogger().debug(
  -                  "nested containers (" 
  -                  + entries.length 
  -                  + ") pending validation."
  -                );
  +                final Configuration entry = entries[i];
  +                final String classname = entry.getAttribute("class");
  +                ComponentType type = m_services.getComponentType( classname );
  +                Profile profile = buildProfile( type, entry );
  +                install( profile );
  +
  +                //listProfile( profile );
               }
  +
           }
           catch( Throwable e )
           {
  @@ -279,6 +299,40 @@
           }
       }
   
  +    Profile buildProfile( ComponentType type, Configuration criteria ) 
  +      throws ConfigurationException, UnresolvedProviderException
  +    {
  +        String name = criteria.getAttribute("name",null);
  +        DependencyMetaData[] dependencies = resolveDependencies( type );
  +        Parameters params = Parameters.fromConfiguration( criteria.getChild("parameters")
);
  +        Configuration config = criteria.getChild("configuration");
  +        Context context = ContextFactory.createContextFromConfiguration( 
  +          null, criteria.getChild("context") );
  +        return new Profile( name, dependencies, params, config, type, context );
  +    }
  +
  +    private DependencyMetaData[] resolveDependencies( ComponentType type ) 
  +      throws UnresolvedProviderException
  +    {
  +        Vector vector = new Vector();
  +        DependencyDescriptor[] deps = type.getComponentInfo().getDependencies();
  +        for( int i=0; i<deps.length; i++ )
  +        {
  +            if( !deps[i].isOptional() )
  +            {
  +                final String role = deps[i].getRole();
  +                final Profile provider = getProvider( deps[i] );
  +                DependencyMetaData data = new DependencyMetaData( 
  +                  role, 
  +                  provider.getName() 
  +                );
  +                vector.add( data );
  +            }
  +        }
  +        return (DependencyMetaData[]) 
  +           vector.toArray( new DependencyMetaData[0] );
  +    }
  +
       //=======================================================================
       // Executable
       //=======================================================================
  @@ -316,6 +370,19 @@
       //=======================================================================
   
      /**
  +    * Return the privider for a dependency.
  +    * @param dependency a consumer component dependecy declaration
  +    * @return the installed supplier profile
  +    */
  +    public Profile getProvider( DependencyDescriptor dependency ) 
  +      throws UnresolvedProviderException
  +    {
  +        Profile profile = getCandidateProfile( dependency );
  +        install( profile );
  +        return profile;
  +    }
  +
  +   /**
       * Return the preferred profile for a depedency.
       * @param dependency a consumer component dependecy declaration
       * @return the preferred candidate supplier profile
  @@ -323,7 +390,19 @@
       public Profile getCandidateProfile( DependencyDescriptor dependency ) 
         throws UnresolvedProviderException
       {
  -        return m_services.getCandidateProfile( dependency );
  +        //try
  +        //{
  +            return m_services.getCandidateProfile( dependency );
  +        //}
  +        //catch( UnresolvedProviderException upe )
  +        //{
  +            // in this case, we can try to locate a service provider 
  +            // in the parent container
  +
  +        //    if( m_parent != null )
  +        //      return m_parent.getProvider( dependency );
  +        //    throw upe;
  +        //}
       }
   
      /**
  @@ -343,34 +422,14 @@
       */
       void install( Profile profile )
       {
  -        m_services.install( profile );
  +        m_profiles.put( profile.getName(), profile );
  +        m_map.add( profile );
       }
   
       //=======================================================================
       // implementation
       //=======================================================================
   
  -    private void populate( DependencyMap map, Profile profile )
  -    {
  -        map.add( profile );
  -        DependencyMetaData[] dependencies = profile.getDependencies();
  -        for( int j=0; j<dependencies.length; j++ )
  -        {
  -            populate( map, dependencies[j] );
  -        }
  -    }
  -
  -    private void populate( DependencyMap map, DependencyMetaData dependency )
  -    {
  -        Profile profile = m_services.getInstalledProfile( dependency.getProviderName()
);
  -        map.add( profile );
  -        DependencyMetaData[] dependencies = profile.getDependencies();
  -        for( int j=0; j<dependencies.length; j++ )
  -        {
  -            populate( map, dependencies[j] );
  -        }
  -    }
  -
      /**
       * Test if the registry can resolve a request for a component with the supplied classname
       * @param classname a component or service class name
  @@ -455,8 +514,8 @@
           DependencyMetaData[] dependencies = profile.getDependencies();
           for( int j=0; j<dependencies.length; j++ )
           {
  -            Profile p = m_services.getInstalledProfile( dependencies[j].getProviderName()
);
  -            listProfile( p, reported );
  +            Profile dependent = (Profile) m_profiles.get( dependencies[j].getProviderName()
);
  +            listProfile( dependent, reported );
           }
       }
   
  
  
  
  1.6       +7 -75     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/registry/Profile.java
  
  Index: Profile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/registry/Profile.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Profile.java	4 Jul 2002 09:01:36 -0000	1.5
  +++ Profile.java	5 Jul 2002 08:50:24 -0000	1.6
  @@ -68,75 +68,17 @@
    */
   public class Profile extends ComponentMetaData 
   {
  -    private static String getAbstractName( Configuration profile )
  -    {
  -        return profile.getAttribute("name",null);
  -    }
  -
  -    private static DependencyMetaData[] getDependencyMetaData( 
  -      final DefaultRegistry registry, final ComponentType type ) 
  -      throws UnresolvedProviderException
  -    {
  -        Vector vector = new Vector();
  -        DependencyDescriptor[] deps = type.getComponentInfo().getDependencies();
  -        for( int i=0; i<deps.length; i++ )
  -        {
  -            if( !deps[i].isOptional() )
  -            {
  -                final String role = deps[i].getRole();
  -                final Profile provider = registry.getCandidateProfile( deps[i] );
  -                DependencyMetaData data = new DependencyMetaData( 
  -                  role, 
  -                  provider.getName() 
  -                );
  -                vector.add( data );
  -            }
  -        }
  -        return (DependencyMetaData[]) vector.toArray( new DependencyMetaData[0] );
  -    }
   
       private final ComponentType m_type;
   
  -    private final Configuration m_profile;
  -
  -    private final DefaultRegistry m_registry;
  -
  -   /**
  -    * Creation of a default profile.
  -    * @param type the component type that this profile is qualifying
  -    */
  -    public Profile( final DefaultRegistry registry, final ComponentType type )
  -       throws ConfigurationException, UnresolvedProviderException
  +    private final Context m_context;
   
  +    public Profile( String name, DependencyMetaData[] dependencies, Parameters params,

  +      Configuration config, ComponentType type, Context context )
       {
  -        this( registry, type, new DefaultConfiguration("profile") );
  -    }
  -
  -   /**
  -    * Creation of a profile of a component type. The 
  -    * configuration is a profile instance containing criteria for for the 
  -    * profiles default configuration, parameters and content.
  -    * 
  -    * @param type the component type that this profile is qualifying
  -    * @param profile a configuration instance possibly containing a context, 
  -    *   parameters and configuration element.
  -    * @param name the profile name
  -    */
  -    public Profile( 
  -      final DefaultRegistry registry, final ComponentType type, final Configuration profile
)
  -      throws ConfigurationException, UnresolvedProviderException
  -    {
  -        super( 
  -          getAbstractName( profile ), 
  -          getDependencyMetaData( registry, type ), 
  -          Parameters.fromConfiguration( profile.getChild("paramerters") ),
  -          profile.getChild("configuration"),
  -          type.getComponentInfo() 
  -        );
  +        super( name, dependencies, params, config, type.getComponentInfo() );
           m_type = type;
  -        m_profile = profile;
  -        m_registry = registry;
  -        m_registry.install( this );
  +        m_context = context;
       }
   
      /**
  @@ -154,17 +96,7 @@
       */
       public Context getContext( Context parent )
       {
  -        try
  -        {
  -            Configuration criteria = m_profile.getChild("context");
  -            return ContextFactory.createContextFromConfiguration( parent, criteria );
  -        }
  -        catch( Throwable e )
  -        {
  -            throw new ProfileRuntimeException( 
  -              "Unexpected error while creating context.", e );
  -        }
  -
  +        return m_context;
       }
       
       public String toString()
  
  
  
  1.6       +16 -63    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/registry/ServiceRegistry.java
  
  Index: ServiceRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/registry/ServiceRegistry.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ServiceRegistry.java	4 Jul 2002 09:01:36 -0000	1.5
  +++ ServiceRegistry.java	5 Jul 2002 08:50:24 -0000	1.6
  @@ -58,11 +58,6 @@
       */
       private Hashtable m_types = new Hashtable();
   
  -   /**
  -    * The set of installed profiles keyed by profile name.
  -    */
  -    private Hashtable m_installed = new Hashtable();
  -
       private DependencyMap m_map;
   
       //=======================================================================
  @@ -122,51 +117,6 @@
       }
   
      /**
  -    * Install a provider and return the profile.  The side effect of this operation
  -    * is the resolution of profiles for the runtime application context based on dependecies
  -    * declared by the component identified by the classname. 
  -    *
  -    * @param classname the classname of the provider to install
  -    * @param name the component profile to use for the provider
  -    */
  -    public Profile install( String classname, String name ) throws Exception
  -    {
  -        return install( register( classname ).getProfile( name ) );
  -    }
  -
  -   /**
  -    * Install a provider and return the profile.
  -    * @param classname the classname of the provider to install
  -    * @param name the component profile to use for the provider
  -    */
  -    public Profile install( Profile profile )
  -    {
  -        if( m_installed.get( profile.getName() ) != null )
  -          return profile;
  -        m_installed.put( profile.getName(), profile ); 
  -        return profile;  
  -    }
  -
  -   /**
  -    * Return the set of profiles representing the application scope.
  -    * @return the installed profiles
  -    */
  -    public Profile[] getInstalledProfiles()
  -    {
  -        return (Profile[]) m_installed.values().toArray( new Profile[0] );
  -    }
  -
  -   /**
  -    * Returns a named profile.
  -    * @return the named profile
  -    */
  -    public Profile getInstalledProfile( String name )
  -    {
  -        return (Profile) m_installed.get( name );
  -    }
  -
  -
  -   /**
       * Returns the set of component types know to the registry.
       * @return the set of component types registered with the registry
       */
  @@ -195,20 +145,24 @@
           return (ComponentType) m_types.get( classname );
       }
   
  +   /**
  +    * Returns the set of candidate profiles matching the service description.
  +    * @param service the service designator qualifying candidate providers
  +    * @return the set of candidates
  +    */
       public Profile[] getProfiles( ServiceDesignator service )
       {
   
  -        getLogger().debug("getting profiles for service: " + service );
  -        Vector vector = new Vector();
  -        getProfiles( m_map, vector );
  +        ServiceTable table = getTable( service );
  +        if( table == null )
  +          throw new IllegalArgumentException("unknown service designator");
   
           //
           // before argregating profiles, make sure that all of the components
           // getProfiles() operation has been invoked - which ensures that 
  -        // the type has been properly initialized (yes - it sucks but it works).
  +        // the type has been properly initialized
           //
   
  -        ServiceTable table = getTable( service );
           ComponentType[] types = table.getTypes();
           for( int i=0; i<types.length; i++ )
           {
  @@ -225,12 +179,11 @@
           //
           // with the pre-init of profiles complete, we can go ahead and get the 
           // set of available profiles in the knowlege that everything is behaving 
  -        // consitently
  +        // consistently
           //
   
  +        Vector vector = new Vector();
           ComponentType[] components = table.getTypes();
  -        //getLogger().debug("located table: = " 
  -        //  + table + ", size: " + ", " + components.length );
           for( int i=0; i<components.length; i++ )
           {
               try
  @@ -251,10 +204,10 @@
           return (Profile[]) vector.toArray( new Profile[0] );
       }
   
  -    private void getProfiles( DependencyMap map, Vector vector )
  -    {
  -        // not implemented yet
  -    }
  +    //private void getProfiles( DependencyMap map, Vector vector )
  +    //{
  +    //    // not implemented yet
  +    //}
   
       public Profile getCandidateProfile( DependencyDescriptor dependency )
           throws UnresolvedProviderException
  
  
  

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