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 Main.java
Date Wed, 03 Jul 2002 01:01:22 GMT
mcconnell    2002/07/02 18:01:22

  Modified:    assembly/src/java/org/apache/excalibur/merlin/registry
                        Main.java
  Log:
  registry creation now simplified with optional dependecies and optional context
  
  Revision  Changes    Path
  1.2       +13 -58    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/registry/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/registry/Main.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Main.java	1 Jul 2002 04:27:15 -0000	1.1
  +++ Main.java	3 Jul 2002 01:01:22 -0000	1.2
  @@ -93,22 +93,19 @@
   
           DefaultRegistry registry = new DefaultRegistry();
   
  -        // create a configuration object containing the kernel profile
  +        // get a configuration object containing the kernel profile
           // from which we can establish the logger and extensions directory
   
           String path = null;
           Configuration config = null;
           if( args.length > 0 )
  -          path = args[0];
  -        if( path == null )
           {
  -            // FIX ME
  -            // the following does not make sense - we need at least a target component
  -            config = new DefaultConfiguration("merlin", null );
  +            path = args[0];
  +            config = getProfile( new File( path ) );
           }
           else
           {
  -            config = getProfile( new File( path ) );
  +            throw new RuntimeException("Missing kernel configuration path argument.");
           }
   
           // create a bootstrap logger - this needs to be replaced with
  @@ -138,71 +135,29 @@
               System.exit(0);
           }
   
  -        // FIX ME - change this so that the DefaultRegistry uses the 
  -        // context classloader as a default value if none declared as a context
  -        // (i.e. make contextualization optional)
  -
  -        // supply a context object with the classloader
  +        // we now have the configuration and logger - we can go ahead and build the 
  +        // context (optional) and create the registry component.
    
           ClassLoader parent = Thread.currentThread().getContextClassLoader();
           DefaultContext context = new DefaultContext();
  -        context.put( DefaultRegistry.CLASSLOADER_KEY, parent );
  -        try
  -        {
  -            registry.contextualize( context );
  -        }
  -        catch( Throwable e )
  -        {
  -            main.error("Unexpected error while supply registry context.", e);
  -            System.exit(0);
  -        }
  -
  -        // FIX ME - change this so that the DefaultRegistry creates an empty
  -        // extensions repository if none supplied - also, move this to 
  -        // context and declare it as optional
  -
  -        // supply an service object with the type repository
  -
  +        context.put( Registry.CLASSLOADER_KEY, parent );
           PackageRepository extensions = new DefaultPackageRepository( 
  -          Fileset.expandExtensions( config.getChild("extensions") ) );
  -        try
  -        {
  -            DefaultServiceManager manager = new DefaultServiceManager();
  -            manager.put( PackageRepository.ROLE, extensions );
  -            registry.service( manager );
  -        }
  -        catch( Throwable e )
  -        {
  -            main.error("Unexpected error while servicing the registry.", e );
  -            System.exit(0);
  -        }
  -
  -        // configure the registry
  +          Fileset.expandExtensions( config.getChild( "extensions" ) ) );
  +        context.put( Registry.EXTENSIONS_KEY, extensions );
   
           try
           {
  +            registry.contextualize( context );
               registry.configure( config.getChild("registry") );
  -        }
  -        catch( Throwable e )
  -        {
  -            main.error("Unexpected error while configuring the registry.", e );
  -            System.exit(0);
  -        }
  -        
  -        // initialize the registry 
  -
  -        try
  -        {
  -            main.debug("initialization");
               registry.initialize( );
           }
           catch( Throwable e )
           {
  -            main.error("Unexpected error during registry initialization.", e);
  +            main.error("Unexpected error while processing registry lifecycle.", e);
               System.exit(0);
           }
   
  -        // type registry demo
  +        // invoke the registry demo
   
           try
           {
  
  
  

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