leosimons    01/04/17 04:32:42

  Modified:    proposal/4.0/src/java/org/apache/phoenix Start.java
               proposal/4.0/src/java/org/apache/phoenix/engine
                        PhoenixEmbeddor.java PhoenixKernel.java
               proposal/4.0/src/java/org/apache/phoenix/engine/applications
                        DefaultServerApplication.java
                        DefaultServerApplicationFactory.java
               proposal/4.0/src/java/org/apache/phoenix/engine/facilities
                        ApplicationManagerImpl.java ClassManagerImpl.java
                        ConfigurationManagerImpl.java LogManagerImpl.java
                        ManagerImpl.java SecurityManagerImpl.java
                        ThreadManagerImpl.java
  Removed:     proposal/4.0/src/java/org/apache/phoenix Restart.java
               proposal/4.0/src/java/org/apache/phoenix/applications
                        Application.java ApplicationException.java
                        ServerApplication.java
                        ServerApplicationFactory.java
               proposal/4.0/src/java/org/apache/phoenix/core Block.java
                        BlockContext.java Embeddor.java Kernel.java
                        ServerKernel.java
               proposal/4.0/src/java/org/apache/phoenix/facilities
                        ApplicationManager.java ClassManager.java
                        ConfigurationManager.java Facility.java
                        LogManager.java Manager.java SecurityManager.java
                        ThreadManager.java
  Log:
  - moving interfaces to avalon.atlantis.
  - removing redundant methods.
  - updating to interruptable/executable.
  - improved exception handling.
  - removal of duplicated logging.
  - some more fixes.
  
  Revision  Changes    Path
  1.4       +20 -27    
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/Start.java
  
  Index: Start.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/Start.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Start.java        2001/04/06 15:41:24     1.3
  +++ Start.java        2001/04/17 11:31:17     1.4
  @@ -15,6 +15,9 @@
   import javax.management.MBeanServer;
   
   import org.apache.framework.lifecycle.Disposable;
  +import org.apache.framework.parameters.Parameters;
  +import org.apache.framework.parameters.ParameterException;
  +import org.apache.framework.parameters.Parametizable;
   import org.apache.framework.context.Context;
   import org.apache.framework.context.DefaultContext;
   import org.apache.framework.configuration.Configuration;
  @@ -28,7 +31,7 @@
   import org.apache.avalon.util.cli.CLOption;
   import org.apache.avalon.util.cli.CLUtil;
   
  -import org.apache.phoenix.core.Embeddor;
  +import org.apache.avalon.atlantis.core.Embeddor;
   import org.apache.phoenix.engine.PhoenixEmbeddor;
   
   import org.apache.log.LogKit;
  @@ -73,7 +76,6 @@
       // monitor these for status changes
       private static boolean singleton = false;
       private static boolean shutdown = false;
  -    private static boolean restart = false;
   
       // command line options
       private static final int       DEBUG_LOG_OPT        = 'd';
  @@ -118,14 +120,6 @@
       /// LIFECYCLE METHODS ///
       /////////////////////////
       /**
  -     * Shuts down and immediately restarts the server using the
  -     * same settings.
  -     */
  -    public void restart()
  -    {
  -        this.restart = true;
  -    }
  -    /**
        * Shuts down the server.
        */
       public void dispose()
  @@ -162,30 +156,29 @@
           this.parseCommandLineOptions( args );
           this.createEmbeddor();
   
  -        final DefaultContext ctx = new DefaultContext();
  -            ctx.put( "kernel-class", this.kernelClass );
  -            ctx.put( "deployer-class", this.deployerClass );
  -            ctx.put( "mBeanServer-class", this.mBeanServerClass );
  -            ctx.put( "kernel-configuration-source", this.configurationSource );
  -            ctx.put( "log-destination", this.logDestination );
  -            ctx.put( "application-source", this.applicationSource );
  -        final Configuration conf = new DefaultConfiguration("phoenix","localhost");
  +        final Parameters parameters = new Parameters();
  +            parameters.setParameter( "kernel-class", this.kernelClass );
  +            parameters.setParameter( "deployer-class", this.deployerClass );
  +            parameters.setParameter( "mBeanServer-class", this.mBeanServerClass );
  +            parameters.setParameter( "kernel-configuration-source", 
this.configurationSource );
  +            parameters.setParameter( "log-destination", this.logDestination );
  +            parameters.setParameter( "application-source", this.applicationSource );
   
           // run Embeddor lifecycle
  -        this.embeddor.contextualize(ctx);
  -        this.embeddor.configure(conf);
  +        this.embeddor.parametize( parameters );
           this.embeddor.init();
   
  +        this.embeddor.start();
  +
           while( !this.shutdown )
           {
  -            while( !this.restart )
  -            {
  -                this.embeddor.run();
  -            }
  -            this.embeddor.restart();
  -            this.restart = false;
  +            // loop
  +
  +            // wait() for shutdown() to take action...
  +            try { synchronized( this ) { wait(); } }
  +            catch( final InterruptedException e ) {}
           }
  -        embeddor.dispose();
  +        embeddor.stop();
           System.exit( 0 );
       }
       //////////////////////
  
  
  
  1.5       +150 -261  
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/PhoenixEmbeddor.java
  
  Index: PhoenixEmbeddor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/PhoenixEmbeddor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PhoenixEmbeddor.java      2001/04/16 14:10:08     1.4
  +++ PhoenixEmbeddor.java      2001/04/17 11:31:43     1.5
  @@ -10,19 +10,27 @@
   import javax.management.MBeanServer;
   import java.io.File;
   
  -import org.apache.framework.configuration.Configurable;
  -import org.apache.framework.context.Contextualizable;
  -import org.apache.framework.component.Composer;
   import org.apache.framework.logger.Loggable;
  -import org.apache.framework.lifecycle.Suspendable;
  -import org.apache.framework.lifecycle.Resumable;
  +
  +import org.apache.framework.parameters.Parameters;
  +import org.apache.framework.parameters.ParameterException;
   
   import org.apache.framework.context.Context;
  -import org.apache.framework.configuration.Configuration;
  -import org.apache.framework.configuration.ConfigurationException;
   import org.apache.framework.context.DefaultContext;
  +import org.apache.framework.context.ContextualizationException;
  +
   import org.apache.framework.component.DefaultComponentManager;
  +import org.apache.framework.component.Composer;
  +import org.apache.framework.component.ComponentException;
  +
  +import org.apache.framework.configuration.Configurable;
  +import org.apache.framework.configuration.Configuration;
  +import org.apache.framework.configuration.ConfigurationException;
   import org.apache.framework.configuration.DefaultConfigurationBuilder;
  +import org.apache.framework.lifecycle.StartException;
  +import org.apache.framework.lifecycle.StopException;
  +import org.apache.framework.lifecycle.InitializationException;
  +
   import org.apache.framework.CascadingException;
   
   import org.apache.avalon.camelot.Container;
  @@ -30,9 +38,9 @@
   import org.apache.avalon.camelot.Entry;
   import org.apache.avalon.camelot.Deployer;
   
  -import org.apache.phoenix.facilities.Manager;
  -import org.apache.phoenix.core.Kernel;
  -import org.apache.phoenix.core.Embeddor;
  +import org.apache.avalon.atlantis.facilities.Manager;
  +import org.apache.avalon.atlantis.core.Kernel;
  +import org.apache.avalon.atlantis.core.Embeddor;
   import org.apache.phoenix.engine.facilities.ManagerImpl;
   
   import org.apache.log.format.AvalonLogFormatter;
  @@ -41,6 +49,7 @@
   import org.apache.log.LogKit;
   import org.apache.log.Priority;
   import org.apache.log.LogTarget;
  +import org.apache.framework.logger.AbstractLoggable;
   
   /**
    *
  @@ -50,14 +59,14 @@
    * with threading stuff.
    * - fix imports.
    *
  - * @author <a href="[EMAIL PROTECTED]">Leo Simons</a>
  - * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Federico Barbieri</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
  + * @author <a href="[EMAIL PROTECTED]">Leo Simons</a>
    */
   public class PhoenixEmbeddor
  -    implements Embeddor, Suspendable, Resumable
  +    extends AbstractLoggable implements Embeddor
   {
  -    private Context         context;
  +    private Parameters         parameters;
   
       private Logger          logger;
       private Deployer        deployer;
  @@ -86,8 +95,7 @@
       /////////////////////////
       /**
        * Make sure to provide all the neccessary information through
  -     * this context. All information it needs consists of strings.
  -     * These are also indexed using strings. Neccessary are:
  +     * the parameters. Neccessary are:
        * <ul>
        * <li><b>kernel-class</b>, the classname of the
        * org.apache.phoenix.core.Kernel to be used.</li>
  @@ -110,37 +118,20 @@
        * When ommited, no applications are loaded.</li>
        * </ul>
        */
  -    public void contextualize( Context context )
  +    public void parametize( Parameters parameters )
  +        throws ParameterException
       {
  -        this.context = context;
  +        this.parameters = parameters;
       }
       /**
  -     * Currently unused, but Embeddor extends it so call anyway
  -     * using a dummy configuration.
  -     */
  -    public void configure( Configuration configuration )
  -        throws ConfigurationException
  -    {
  -        // TODO
  -    }
  -    /**
        * Creates the core handlers - logger, deployer, Manager and
        * Kernel. Note that these are not set up properly until you have
        * called the <code>run()</code> method.
        */
       public void init()
  -        throws Exception
  +        throws InitializationException
       {
  -        this.createLogger();
  -        try { this.createDeployer(); }
  -        catch( Exception e ) { logger.fatalError( "Unable to create deployer!", e );
  -                               throw new CascadingException( "Unable to create 
deployer!", e ); }
  -        try { this.createManager(); }
  -        catch( Exception e ) { logger.fatalError( "Unable to create manager!", e );
  -                               throw new CascadingException( "Unable to create 
manager!", e ); }
  -        try { this.createKernel(); }
  -        catch( Exception e ) { logger.fatalError( "Unable to create kernel!", e );
  -                               throw new CascadingException( "Unable to create 
kernel!", e ); }
  +        this.createComponents();
       }
       /**
        * This is the main method of the embeddor. It sets up the core
  @@ -151,130 +142,76 @@
        * finished, as well as all the applications running in it, it
        * is shut down, after which the PhoenixEmbeddor is as well.
        */
  -    public void run()
  +    public void start() throws StartException
       {
           // setup core handler components
  -        this.setupLogger();
  -        try { this.setupDeployer(); }
  -        catch( Exception e ) {  logger.fatalError("Unable to setup deployer!", e);
  -                                System.exit( 1 ); }
  -        try { this.setupManager(); }
  -        catch( Exception e ) {  logger.fatalError("Unable to setup manager!", e);
  -                                System.exit( 1 ); }
  -        try { this.setupKernel(); }
  -        catch( Exception e ) {  logger.fatalError("Unable to setup kernel!", e);
  -                                System.exit( 1 ); }
  +        this.setupComponents();
  +        // deploy facilities and applications
  +        this.runDeployer();
   
  -        try
  +        kernel.start();
  +        // loop until <code>Shutdown</code> is created.
  +        while( this.shutdown )
           {
  -            kernel.start();
  +            // loop
   
  -            // loop until <code>Shutdown</code> is created.
  -            while( !this.shutdown )
  -            {
  -                // loop
  -                while( !this.restart && !this.suspend )
  -                {
  -                    // the run() method in the kernel should
  -                    // call wait(), or this doesn't work very
  -                    // well...
  -                    kernel.run();
  -                    // wait() for shutdown(), restart() or
  -                    // suspend() to take action...
  -                    try { synchronized( this ) { wait(); } }
  -                    catch (InterruptedException e) {}
  -                }
  -                if( this.restart )
  -                {
  -                    handleRestart();
  -                }
  -                else if( this.suspend )
  -                {
  -                    handleSuspend();
  -                }
  -            }
  -            // we can stop everything now...
  -            handleDispose();
  -        }
  -        catch ( Exception e )
  -        {
  -            // whoops!
  -            this.logger.fatalError("There was a fatal error while running 
phoenix.", e );
  -            System.exit( 1 );
  +            // wait() for shutdown() to take action...
  +            try { synchronized( this ) { wait(); } }
  +            catch( final InterruptedException e ) {}
           }
  +        // we can shut everything down now...
  +        handleShutdown();
       }
   
       /**
  -     * This stops and then restarts the Embeddor,
  -     * re-creating the logger, deployer, Manager
  -     * and Kernel in the process.
  -     */
  -    public void restart()
  -    {
  -        this.restart = true;
  -        synchronized( this ) { notifyAll(); }
  -    }
  -    /**
        * Shut down the Embeddor together with the
        * Logger, Deployer, Manager and Kernel.
        */
  -    public void dispose()
  +    public void stop()
       {
           this.shutdown = true;
           synchronized( this ) { notifyAll(); }
       }
  +
  +    //////////////////////
  +    /// HELPER METHODS ///
  +    //////////////////////
       /**
  -     * Suspend both the Embeddor and its Manager.
  -     * If the Kernel does not support suspend,
  -     * this shuts down the Kernel and all
  -     * Applications running in it. This is not
  -     * recommended!
  +     * Creates all required core components.
        */
  -    public void suspend()
  +    private void createComponents() throws InitializationException
       {
  -        this.suspend = true;
  -        synchronized( this ) { notifyAll(); }
  +        try { this.createLogger(); }
  +        catch( Exception e ) {  logger.fatalError( "Unable to create logger!", e );
  +                                throw new InitializationException( "Unable to 
create logger!", e ); }
  +        try { this.createDeployer(); }
  +        catch( Exception e ) { logger.fatalError( "Unable to create deployer!", e );
  +                               throw new InitializationException( "Unable to create 
deployer!", e ); }
  +        try { this.createManager(); }
  +        catch( Exception e ) { logger.fatalError( "Unable to create manager!", e );
  +                               throw new InitializationException( "Unable to create 
manager!", e ); }
  +        try { this.createKernel(); }
  +        catch( Exception e ) { logger.fatalError( "Unable to create kernel!", e );
  +                               throw new InitializationException( "Unable to create 
kernel!", e ); }
       }
       /**
  -     * Resume both the Embeddor and its Manager.
  -     * If the Kernel does not support suspend, it
  -     * has to be re-created and re-setup. This
  -     * happens now.
  +     * Sets up all the core components.
        */
  -    public void resume()
  +    private void setupComponents() throws StartException
       {
  -        try
  -        {
  -            if( this.kernelSupportsSuspend )
  -            {
  -                manager.resume();
  -                ((Resumable)kernel).resume();
  -
  -                this.suspend = false;
  -                synchronized( this ) { notifyAll(); }
  -            } else
  -            {
  -                this.createKernel();
  -                this.setupKernel();
  -
  -                manager.resume();
  -                kernel.start();
  -
  -                this.suspend = false;
  -                synchronized( this ) { notifyAll(); }
  -            }
  -        }
  -        catch( Exception e )
  -        {
  -            // this is bad...
  -            logger.fatalError( "A fatal error occured while resuming. Phoenix will 
exit.", e );
  -            System.exit( 1 );
  -        }
  +        try { this.setupLogger(); }
  +        catch( Exception e ) {  logger.fatalError( "Unable to setup logger!", e );
  +                                throw new StartException( "Unable to setup 
logger!", e ); }
  +        try { this.setupDeployer(); }
  +        catch( Exception e ) {  logger.fatalError( "Unable to setup deployer!", e );
  +                                throw new StartException( "Unable to setup 
deployer!",e ); }
  +        try { this.setupManager(); }
  +        catch( Exception e ) {  logger.fatalError( "Unable to setup manager!", e );
  +                                throw new StartException( "Unable to setup 
manager!",e ); }
  +        try { this.setupKernel(); }
  +        catch( Exception e ) {  logger.fatalError( "Unable to setup kernel!", e );
  +                                throw new StartException( "Unable to setup 
kernel!",e ); }
       }
  -
  -    //////////////////////
  -    /// HELPER METHODS ///
  -    //////////////////////
       /**
        * Uses <code>org.apache.log.LogKit</code> to create a new
        * logger using "Phoenix" as its category, DEBUG as its
  @@ -287,13 +224,14 @@
       {
           try
           {
  -            final FileOutputLogTarget logTarget = new FileOutputLogTarget( 
(String)this.context.get( "log-destination" ) );
  +            final String logDest = this.parameters.getParameter( "log-destination", 
"" );
  +            final FileOutputLogTarget logTarget = new FileOutputLogTarget( logDest 
);
               final AvalonLogFormatter formatter = new AvalonLogFormatter();
               formatter.setFormat( "%{time} [%7.7{priority}] <<%{category}>> " +
                                    "(%{context}): %{message}\\n%{throwable}" );
               logTarget.setFormatter( formatter );
   
  -            LogKit.addLogTarget( (String)this.context.get( "log-destination" ), 
logTarget );
  +            LogKit.addLogTarget( logDest, logTarget );
               this.logger = LogKit.createLogger( LogKit.createCategory( "Phoenix", 
Priority.DEBUG ),
                                               new LogTarget[] { logTarget } );
               this.logger.info( "Loader started" );
  @@ -315,46 +253,57 @@
        */
       private void createDeployer() throws ConfigurationException
       {
  +        final String className = this.parameters.getParameter( "deployer-class", 
null );
           try
           {
               Thread.currentThread().setContextClassLoader( 
getClass().getClassLoader() );
  -            this.deployer = (Deployer)Class.forName( (String)this.context.get( 
"deployer-class" ) ).newInstance();
  -            this.deployerContext = new DefaultContext();
  +            this.deployer = (Deployer)Class.forName( className ).newInstance();
           }
           catch( final Exception e )
           {
               throw new ConfigurationException( "Failed to create Deployer of class " 
+
  -                                              (String)this.context.get( 
"deployer-class" ), e );
  +                                              className, e );
           }
       }
       /**
        * Sets up the Deployer. If it is Loggable, it gets a reference
  -     * to the Embeddor's logger. If it is Contextualizable it is
  -     * passed a Context. If it is a Composer it is given a
  +     * to the Embeddor's logger. If it is a Composer it is given a
        * ComponentManager which references the Kernel, cast to a
        * Container.
  -     * The deployer is now used to load the applications from the
  -     * default-facilities-location specified in Context.
  -     * TODO: load facilities from .fars as well.
        */
       private void setupDeployer() throws Exception
       {
  -        if( this.deployer instanceof Loggable )
  -        {
  -            ((Loggable)this.deployer).setLogger( this.logger );
  -        }
  -        if( this.deployer instanceof Contextualizable )
  -        {
  -            ((Contextualizable)this.deployer).contextualize( 
(Context)this.deployerContext );
  -        }
  +        setupLogger( this.deployer );
  +
           if( this.deployer instanceof Composer )
           {
               final DefaultComponentManager componentManager = new 
DefaultComponentManager();
               componentManager.put( "org.apache.avalon.camelot.Container", 
(Container)this.kernel );
               ((Composer)this.deployer).compose( componentManager );
  +        }
  +    }
  +    /**
  +     * Runs the deployer. This expands and installs all the .sar and .far
  +     * files from their respective directories.
  +     * TODO: handle Facilities.
  +     */
  +    private void runDeployer() throws StartException
  +    {
  +        final String defaultAppsLocation =
  +            this.parameters.getParameter( "applications-directory", null );
  +
  +        if( null != defaultAppsLocation )
  +        {
  +            final File directory = new File( defaultAppsLocation );
  +            try
  +            {
  +                CamelotUtil.deployFromDirectory( this.deployer, directory, ".sar" );
  +            }
  +            catch( Exception e )
  +            {
  +                throw new StartException( "Unable to deploy applications from 
"+defaultAppsLocation, e );
  +            }
           }
  -        final File directory = new File( (String)this.context.get( 
"default-apps-location" ) );
  -        CamelotUtil.deployFromDirectory( deployer, directory, ".sar" );
   
           // TODO: load facilities from .fars
           // final File directory2 = new File( (String)this.context.get( 
"default-facilities-location" ) );
  @@ -385,7 +334,7 @@
        * Deployer just loaded. Have Deployer put those in
        * managerContext.
        */
  -    private void setupManager()
  +    private void setupManager() throws StartException
       {
           this.manager = new ManagerImpl();
           setupLogger( this.manager );
  @@ -394,7 +343,14 @@
           this.managerContext.put("org.apache.framework.atlantis.core.Embeddor", this 
);
           this.managerContext.put("org.apache.framework.atlantis.core.Kernel", 
this.kernel );
           this.managerContext.put("org.apache.avalon.camelot.Deployer", this.deployer 
);
  -        this.manager.contextualize( this.managerContext );
  +        try
  +        {
  +            this.manager.contextualize( this.managerContext );
  +        }
  +        catch( Exception ce )
  +        {
  +            throw new StartException( "Unable to contextualize Manager.", ce );
  +        }
       }
       /**
        * Creates the Kernel. The class used is the kernel-class
  @@ -402,15 +358,16 @@
        */
       private void createKernel() throws ConfigurationException
       {
  +        final String className = this.parameters.getParameter( "kernel-class", null 
);
           try
           {
               Thread.currentThread().setContextClassLoader( 
getClass().getClassLoader() );
  -            this.kernel = (Kernel)Class.forName( (String)this.context.get( 
"kernel-class" ) ).newInstance();
  -            this.kernelContext = new DefaultContext();
  -        } catch( final Exception e )
  +            this.kernel = (Kernel)Class.forName( className ).newInstance();
  +        }
  +        catch( final Exception e )
           {
               throw new ConfigurationException( "Failed to create Kernel of class " +
  -                                              (String)this.context.get( 
"kernel-class" ), e );
  +                                              className, e );
           }
       }
       /**
  @@ -419,124 +376,56 @@
        * on that.
        * TODO: add checking for Recontextualizable and Reconfigurable.
        */
  -    private void setupKernel()
  +    private void setupKernel() throws StartException
       {
  -        if( this.kernel instanceof Loggable )
  -        {
  -            ((Loggable)this.kernel).setLogger( this.logger );
  -        }
  -        if( this.kernel instanceof Contextualizable )
  -        {
  -            this.kernelContext.put( "org.apache.phoenix.facilities.Manager", 
this.manager );
  -            ((Contextualizable)this.kernel).contextualize( 
(Context)this.kernelContext );
  -        }
  +        setupLogger( this.kernel );
  +
           if( this.kernel instanceof Configurable )
           {
  -            try {
  -                this.kernelConfiguration = (new 
DefaultConfigurationBuilder()).build(
  -                   (String)this.context.get( "kernel-configuration-source" ) );
  -                ((Configurable)this.kernel).configure( this.kernelConfiguration );
  -            }
  -            catch ( Exception se )
  +            final DefaultConfigurationBuilder builder = new 
DefaultConfigurationBuilder();
  +            final String kernelConfigLocation =
  +                this.parameters.getParameter( "kernel-configuration-source", null );
  +            try
               {
  -                // it's okay; we don't use this yet anyway...
  +                final Configuration configuration = builder.build( 
kernelConfigLocation );
  +                ((Configurable)this.kernel).configure( configuration );
               }
  +            catch( Exception e ) { throw new StartException(
  +                        "Unable to configuration kernel from 
"+kernelConfigLocation, e ); }
           }
  -        if( ( this.kernel instanceof Suspendable ) && ( this.kernel instanceof 
Resumable ) )
  -        {
  -            this.kernelSupportsSuspend = true;
  -        }
   
  -        try {
  -            this.kernel.init();
  -        } catch ( Exception e )
  -        {
  -            this.logger.log( Priority.FATAL_ERROR,
  -                "There was a fatal error; phoenix could not be started", e );
  -            System.exit( 1 );
  -        }
  -    }
  -
  -    /**
  -     * Shuts down all components, dereferences them, does garbage-collect
  -     * and then re-initializes and runs the core components.
  -     */
  -    private void handleRestart() throws Exception
  -    {
  -        this.restart = false;
  -
  -        kernel.stop();
  -        kernel.dispose();
  -        manager.stop();
  -        manager.dispose();
  -
  -        logger = null;
  -        kernel = null;
  -        manager = null;
  -        mBeanServer = null;
  -        deployer = null;
  -        System.gc(); // make sure resources are released
  -
           try
           {
  -            // re-initialise
  -            this.init();
  -            this.setupLogger();
  -            this.setupDeployer();
  -            this.setupManager();
  -            this.setupKernel();
  +            this.kernel.init();
           }
  -        catch( Exception e )
  +        catch( final Exception e )
           {
  -            // this is bad...
  -            logger.fatalError( "A fatal error occured while restarting. Phoenix 
will exit.", e );
  -            System.exit( 1 );
  +            throw new StartException( "There was a fatal error; phoenix could not 
be started", e );
           }
  -        kernel.start();
       }
  +
       /**
  -     * Suspends the manager, and if possible, the Kernel.
  -     * If the Kernel is not Suspendable, it is disposed
  -     * of and recreated when resume() is called.
  +     * Stop()s and disposes() the Kernel and Manager, dereferences
  +     * the other components and calls garbage-collect.
        */
  -    private void handleSuspend() throws Exception
  +    private void handleShutdown()
       {
  -        //this.suspend = false;
  -
  -        if( this.kernelSupportsSuspend )
  -        {
  -            ((Suspendable)kernel).suspend();
  -        } else
  +        try
           {
  -            // the kernel does not support suspend,
  -            // thus, we must destroy and then
  -            // re-create it.
               kernel.stop();
               kernel.dispose();
  +            manager.stop();
  +
               kernel = null;
  -            System.gc(); // make sure resources are released
  +            manager = null;
  +            mBeanServer = null;
  +            deployer = null;
           }
  -
  -        // wait for resume
  -        try { synchronized( this ) { wait(); } }
  -        catch (InterruptedException e) {}
  -    }
  -    /**
  -     * Stop()s and disposes() the Kernel and Manager, dereferences
  -     * the other components and calls garbage-collect.
  -     */
  -    private void handleDispose() throws Exception
  -    {
  -        kernel.stop();
  -        kernel.dispose();
  -        manager.stop();
  -        manager.dispose();
  -
  -        kernel = null;
  -        manager = null;
  -        mBeanServer = null;
  -        deployer = null;
  +        catch( Exception e )
  +        {
  +            this.logger.error( "There was an error while attempting to shut down 
phoenix", e );
  +        }
  +        logger = null;
           System.gc(); // make sure resources are released
       }
  -
   }
  
  
  
  1.4       +5 -6      
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/PhoenixKernel.java
  
  Index: PhoenixKernel.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/PhoenixKernel.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PhoenixKernel.java        2001/04/06 15:41:28     1.3
  +++ PhoenixKernel.java        2001/04/17 11:31:44     1.4
  @@ -11,15 +11,14 @@
   
   import org.apache.framework.context.Context;
   import org.apache.framework.configuration.Configuration;
  -import org.apache.framework.lifecycle.Suspendable;
  -import org.apache.framework.lifecycle.Resumable;
  +import org.apache.framework.lifecycle.Interruptable;
   
   import org.apache.avalon.camelot.Container;
   import org.apache.avalon.camelot.ContainerException;
   import org.apache.avalon.camelot.Entry;
   
  -import org.apache.phoenix.applications.Application;
  -import org.apache.phoenix.core.ServerKernel;
  +import org.apache.avalon.atlantis.applications.Application;
  +import org.apache.avalon.atlantis.core.ServerKernel;
   
   import org.apache.log.Logger;
   
  @@ -27,9 +26,9 @@
    * This is the default Kernel for Phoenix. It uses Camelot for container/
    * deployer stuff.
    *
  - * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Leo Simons</a>
    */
  -public class PhoenixKernel implements ServerKernel, Suspendable, Resumable
  +public class PhoenixKernel implements ServerKernel, Interruptable
       // and thus implements Application, Runnable, Initializable, Startable,
       // Stoppable, Disposable, Container, Component, Loggable, Kernel,
       // Contextualizable and ServerApplication
  
  
  
  1.4       +1 -1      
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/applications/DefaultServerApplication.java
  
  Index: DefaultServerApplication.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/applications/DefaultServerApplication.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultServerApplication.java     2001/04/06 15:41:28     1.3
  +++ DefaultServerApplication.java     2001/04/17 11:31:50     1.4
  @@ -16,7 +16,7 @@
   import org.apache.avalon.camelot.ContainerException;
   import org.apache.avalon.camelot.Entry;
   
  -import org.apache.phoenix.applications.ServerApplication;
  +import org.apache.avalon.atlantis.applications.ServerApplication;
   
   import org.apache.log.Logger;
   
  
  
  
  1.2       +24 -2     
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/applications/DefaultServerApplicationFactory.java
  
  Index: DefaultServerApplicationFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/applications/DefaultServerApplicationFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultServerApplicationFactory.java      2001/04/06 15:41:29     1.1
  +++ DefaultServerApplicationFactory.java      2001/04/17 11:31:52     1.2
  @@ -7,16 +7,38 @@
    */
   package org.apache.phoenix.engine.applications;
   
  -import org.apache.phoenix.applications.ServerApplication;
  -import org.apache.phoenix.applications.ServerApplicationFactory;
  +import org.apache.avalon.atlantis.applications.ServerApplication;
  +import org.apache.avalon.atlantis.applications.ServerApplicationFactory;
   
  +import org.apache.framework.context.Context;
  +import org.apache.framework.component.ComponentManager;
  +import org.apache.framework.configuration.Configuration;
  +
   /**
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Leo Simons</a>
    */
   public class DefaultServerApplicationFactory implements ServerApplicationFactory
   {
  +    public DefaultServerApplicationFactory()
  +    {
  +    }
       public ServerApplication getApplication()
  +    {
  +        return null;
  +    }
  +    public ServerApplication getApplication( Context context )
  +    {
  +        return null;
  +    }
  +    public ServerApplication getApplication( Context context,
  +        ComponentManager componentManager )
  +    {
  +        return null;
  +    }
  +    public ServerApplication getApplication( Context context,
  +        ComponentManager componentManager,
  +        Configuration configuration )
       {
           return null;
       }
  
  
  
  1.2       +1 -1      
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ApplicationManagerImpl.java
  
  Index: ApplicationManagerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ApplicationManagerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ApplicationManagerImpl.java       2001/04/06 15:41:30     1.1
  +++ ApplicationManagerImpl.java       2001/04/17 11:31:58     1.2
  @@ -7,7 +7,7 @@
    */
   package org.apache.phoenix.engine.facilities;
   
  -import org.apache.phoenix.facilities.ApplicationManager;
  +import org.apache.avalon.atlantis.facilities.ApplicationManager;
   
   /**
    *
  
  
  
  1.2       +1 -1      
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ClassManagerImpl.java
  
  Index: ClassManagerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ClassManagerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClassManagerImpl.java     2001/04/06 15:41:30     1.1
  +++ ClassManagerImpl.java     2001/04/17 11:32:00     1.2
  @@ -6,7 +6,7 @@
    * the LICENSE file.
    */
   package org.apache.phoenix.engine.facilities;
  -import org.apache.phoenix.facilities.ClassManager;
  +import org.apache.avalon.atlantis.facilities.ClassManager;
   
   /**
    *
  
  
  
  1.2       +1 -1      
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ConfigurationManagerImpl.java
  
  Index: ConfigurationManagerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ConfigurationManagerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConfigurationManagerImpl.java     2001/04/06 15:41:30     1.1
  +++ ConfigurationManagerImpl.java     2001/04/17 11:32:02     1.2
  @@ -7,7 +7,7 @@
    */
   package org.apache.phoenix.engine.facilities;
   
  -import org.apache.phoenix.facilities.ConfigurationManager;
  +import org.apache.avalon.atlantis.facilities.ConfigurationManager;
   
   /**
    *
  
  
  
  1.2       +1 -1      
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/LogManagerImpl.java
  
  Index: LogManagerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/LogManagerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LogManagerImpl.java       2001/04/06 15:41:30     1.1
  +++ LogManagerImpl.java       2001/04/17 11:32:03     1.2
  @@ -7,7 +7,7 @@
    */
   package org.apache.phoenix.engine.facilities;
   
  -import org.apache.phoenix.facilities.LogManager;
  +import org.apache.avalon.atlantis.facilities.LogManager;
   
   /**
    *
  
  
  
  1.3       +3 -3      
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ManagerImpl.java
  
  Index: ManagerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ManagerImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ManagerImpl.java  2001/04/16 14:09:38     1.2
  +++ ManagerImpl.java  2001/04/17 11:32:05     1.3
  @@ -10,9 +10,9 @@
   import javax.management.MBeanServer;
   import javax.management.ObjectName;
   
  -import org.apache.phoenix.facilities.Manager;
  -import org.apache.phoenix.core.Kernel;
  -import org.apache.phoenix.core.Embeddor;
  +import org.apache.avalon.atlantis.facilities.Manager;
  +import org.apache.avalon.atlantis.core.Kernel;
  +import org.apache.avalon.atlantis.core.Embeddor;
   import org.apache.framework.context.Context;
   import org.apache.framework.context.ContextException;
   import org.apache.framework.configuration.Configuration;
  
  
  
  1.2       +1 -1      
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/SecurityManagerImpl.java
  
  Index: SecurityManagerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/SecurityManagerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SecurityManagerImpl.java  2001/04/06 15:41:30     1.1
  +++ SecurityManagerImpl.java  2001/04/17 11:32:06     1.2
  @@ -7,7 +7,7 @@
    */
   package org.apache.phoenix.engine.facilities;
   
  -import org.apache.phoenix.facilities.SecurityManager;
  +import org.apache.avalon.atlantis.facilities.SecurityManager;
   
   /**
    *
  
  
  
  1.2       +1 -1      
jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ThreadManagerImpl.java
  
  Index: ThreadManagerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-phoenix/proposal/4.0/src/java/org/apache/phoenix/engine/facilities/ThreadManagerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ThreadManagerImpl.java    2001/04/06 15:41:30     1.1
  +++ ThreadManagerImpl.java    2001/04/17 11:32:08     1.2
  @@ -7,7 +7,7 @@
    */
   package org.apache.phoenix.engine.facilities;
   
  -import org.apache.phoenix.facilities.ThreadManager;
  +import org.apache.avalon.atlantis.facilities.ThreadManager;
   
   /**
    *
  
  
  

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

Reply via email to