sgoeschl    2005/02/16 03:30:36

  Modified:    testcontainer/xdocs changes.xml
               testcontainer/src/java/org/apache/fulcrum/testcontainer
                        YAAFIContainer.java
  Log:
  Synchronizing the current development mit Fulcrum YAAFI
  
  Revision  Changes    Path
  1.10      +11 -5     jakarta-turbine-fulcrum/testcontainer/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/testcontainer/xdocs/changes.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- changes.xml       9 Feb 2005 22:56:38 -0000       1.9
  +++ changes.xml       16 Feb 2005 11:30:36 -0000      1.10
  @@ -7,9 +7,15 @@
     </properties>
   
     <body>
  -     <release version="1.0.5" date="">    
  -    </release>       
  -     <release version="1.0.4" date="2004-11-24">    
  +    <release version="1.0.5-dev" date="as in CVS">    
  +      <action dev="sgoeschl" type="change">
  +        Changed the implementation wo work with fulcrum-yaafi 1.0.4-dev
  +        since the initalization changed.
  +      </action>             
  +    </release>     
  +    <release version="1.0.5" date="">    
  +    </release>  
  +    <release version="1.0.4" date="2004-11-24">    
         <action dev="epugh" type="add">
           By default use Yaafi as the Test container, but you can swap to ECM 
for
           more "real" testing if required by doing 
<code>containerType=CONTAINER_ECM;</code>.
  @@ -23,13 +29,13 @@
           are pulled from.
         </action>
       </release>     
  -     <release version="1.0-alpha-2" date="in cvs">       
  +    <release version="1.0-alpha-2" date="in cvs">       
         <action dev="epugh" type="add">
           Add additional context value urn:avalon:home to be more
           Merlin friendly.
         </action>
       </release>  
  -     <release version="1.0-alpha-2" date="02-13-2004">
  +    <release version="1.0-alpha-2" date="02-13-2004">
         <action dev="epugh" type="add">
           allow setup method of subclasses to throw exceptions if they want..
         </action>
  
  
  
  1.4       +28 -38    
jakarta-turbine-fulcrum/testcontainer/src/java/org/apache/fulcrum/testcontainer/YAAFIContainer.java
  
  Index: YAAFIContainer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-fulcrum/testcontainer/src/java/org/apache/fulcrum/testcontainer/YAAFIContainer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- YAAFIContainer.java       13 Dec 2004 12:59:16 -0000      1.3
  +++ YAAFIContainer.java       16 Feb 2005 11:30:36 -0000      1.4
  @@ -16,16 +16,17 @@
    */
   import java.io.File;
   
  +import org.apache.avalon.framework.activity.Disposable;
  +import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.logger.ConsoleLogger;
  -import org.apache.avalon.framework.logger.Logger;
  +import org.apache.avalon.framework.service.ServiceException;
   import org.apache.fulcrum.yaafi.framework.container.ServiceContainer;
  -import org.apache.fulcrum.yaafi.framework.container.ServiceContainerImpl;
  -import org.apache.fulcrum.yaafi.framework.factory.ServiceManagerFactory;
  -import org.apache.fulcrum.yaafi.service.servicemanager.ServiceManagerService;
  +import 
org.apache.fulcrum.yaafi.framework.factory.ServiceContainerConfiguration;
  +import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerFactory;
  +
   
   
   /**
  @@ -36,28 +37,20 @@
    */
   public class YAAFIContainer extends AbstractLogEnabled implements Container
   {
  +    /** The YAAFI configuration */
  +    private ServiceContainerConfiguration config;
   
       /** Component manager */
       private ServiceContainer manager;
   
  -    /** Configuration file name */
  -    private String configFileName;
  -
  -    /** Role file name */
  -    private String roleFileName;
  -
  -    /** Parameters file name */
  -    private String parametersFileName;
  -
  -
       /**
        * Constructor
        */
       public YAAFIContainer()
       {
           // org.apache.log4j.BasicConfigurator.configure();
  -        this.manager = new ServiceContainerImpl();
           this.enableLogging( new ConsoleLogger( ConsoleLogger.LEVEL_DEBUG ) );
  +        this.config = new ServiceContainerConfiguration();
       }
   
       /**
  @@ -66,13 +59,17 @@
        * @param configFileName Name of the component configuration file
        * @param roleFileName Name of the role configuration file
        */
  -    public void startup(String configFileName, String roleFileName, String 
parametersFileName )
  +    public void startup(
  +        String configFileName,
  +        String roleFileName,
  +        String parametersFileName )
       {
           getLogger().debug("Starting container...");
   
  -        this.configFileName = configFileName;
  -        this.roleFileName = roleFileName;
  -        this.parametersFileName = parametersFileName;
  +        this.config.setComponentConfigurationLocation( configFileName );
  +        this.config.setComponentRolesLocation( roleFileName );
  +        this.config.setParametersLocation( parametersFileName );
  +        this.config.setLogger( new ConsoleLogger( ConsoleLogger.LEVEL_DEBUG 
) );
   
           File configFile = new File(configFileName);
   
  @@ -97,6 +94,7 @@
       // -------------------------------------------------------------
       // Avalon lifecycle interfaces
       // -------------------------------------------------------------
  +
       /**
        * Initializes the container
        *
  @@ -104,20 +102,8 @@
        */
       public void initialize() throws Exception
       {
  -        DefaultContext context = new DefaultContext();
  -        String absolutePath = new File("").getAbsolutePath();
  -        context.put(COMPONENT_APP_ROOT, absolutePath);
  -        context.put(URN_AVALON_HOME, new File( new 
File("").getAbsolutePath() ) );
  -        context.put(URN_AVALON_TEMP, new File( 
System.getProperty("java.io.tmpdir",absolutePath) ) );
  -
  -        Logger logger = new ConsoleLogger( ConsoleLogger.LEVEL_DEBUG );
  -
  -        this.manager = ServiceManagerFactory.create(
  -            logger,
  -            this.roleFileName,
  -            this.configFileName,
  -            this.parametersFileName,
  -            context
  +        this.manager = ServiceContainerFactory.create(
  +            this.config
               );
       }
   
  @@ -127,9 +113,13 @@
       public void dispose()
       {
           getLogger().debug("Disposing of container...");
  -        this.manager.dispose();
  +        if( this.manager != null )
  +        {
  +            this.manager.dispose();
  +        }
           getLogger().info("YaffiContainer has been disposed.");
       }
  +
       /**
        * Returns an instance of the named component
        *
  @@ -140,7 +130,6 @@
       {
           try
           {
  -            //return 
ServiceManagerService.getServiceManager().lookup(roleName);
               return this.manager.lookup(roleName);
           }
           catch( Exception e )
  @@ -149,6 +138,7 @@
               throw new ComponentException(roleName,msg,e);
           }
       }
  +
       /**
        * Releases the component implementing the Component interface. This
        * interface is depracted but still around in Fulcrum
  @@ -157,8 +147,9 @@
        */
       public void release(Component component)
       {
  -        ServiceManagerService.getServiceManager().release(component);
  +        this.manager.release(component);
       }
  +
       /**
        * Releases the component
        *
  @@ -166,7 +157,6 @@
        */
       public void release(Object component)
       {
  -        //ServiceManagerService.getServiceManager().release(component);
           this.manager.release(component);
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to