You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by do...@apache.org on 2001/04/14 14:12:50 UTC

cvs commit: jakarta-avalon-phoenix/src/java/org/apache/phoenix/engine PhoenixKernel.java

donaldp     01/04/14 05:12:50

  Modified:    src/java/org/apache/phoenix/engine PhoenixKernel.java
  Log:
  Updated Phoenix kernel to conform to latest avalonapi.
  
  * Removed extra layer for creating ServerApplication
  * Updated prepareApplication to use current interface
  
  Revision  Changes    Path
  1.3       +32 -18    jakarta-avalon-phoenix/src/java/org/apache/phoenix/engine/PhoenixKernel.java
  
  Index: PhoenixKernel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/phoenix/engine/PhoenixKernel.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PhoenixKernel.java	2001/04/12 12:23:59	1.2
  +++ PhoenixKernel.java	2001/04/14 12:12:50	1.3
  @@ -12,6 +12,7 @@
   import org.apache.avalon.atlantis.AbstractKernel;
   import org.apache.avalon.atlantis.Application;
   import org.apache.avalon.atlantis.Kernel;
  +import org.apache.avalon.camelot.ContainerException;
   import org.apache.avalon.camelot.Entry;
   import org.apache.avalon.configuration.Configurable;
   import org.apache.log.LogKit;
  @@ -37,7 +38,6 @@
       public PhoenixKernel()
       {
           m_entryClass = ServerApplicationEntry.class;
  -        m_applicationClass = Application.class;
       }
   
       public void init()
  @@ -49,8 +49,16 @@
           super.init();
       }
   
  -    protected Application newApplication( final String name, final Entry entry )
  -        throws Exception
  +    /**
  +     * Create a new application for kernel.
  +     *
  +     * @param name the name of application
  +     * @param entry the entry corresponding to application
  +     * @return the new Application
  +     * @exception ContainerException if an error occurs
  +     */
  +    protected Application createApplicationFor( String name, Entry entry )
  +        throws ContainerException
       {
           //It is here where you could return new EASServerApplication()
           //if you wanted to host multiple different types of apps
  @@ -65,30 +73,36 @@
        * @param name the name of application
        * @param entry the application entry
        * @param application the application instance
  -     * @exception Exception if an error occurs
  +     * @exception ContainerException if an error occurs
        */
  -    protected void prepareApplication( final String name,
  -                                       final Entry entry,
  -                                       final Application application )
  -        throws Exception
  +    protected void prepareApplication( final String name, final Entry entry )
  +        throws ContainerException
       {
  +        final Application application = (Application)entry.getInstance();
           final ServerApplicationEntry saEntry = (ServerApplicationEntry)entry;
   
           setupLogger( application, LogKit.getLoggerFor( name ) );
   
  -        if( application instanceof Contextualizable )
  +        try
           {
  -            ((Contextualizable)application).contextualize( saEntry.getContext() );
  +            if( application instanceof Contextualizable )
  +            {
  +                ((Contextualizable)application).contextualize( saEntry.getContext() );
  +            }
  +            
  +            if( application instanceof Composer )
  +            {
  +                ((Composer)application).compose( saEntry.getComponentManager() );
  +            }
  +
  +            if( application instanceof Configurable )
  +            {
  +                ((Configurable)application).configure( saEntry.getConfiguration() );
  +            }
           }
  -
  -        if( application instanceof Composer )
  -        {
  -            ((Composer)application).compose( saEntry.getComponentManager() );
  -        }
  -
  -        if( application instanceof Configurable )
  +        catch( final Exception e )
           {
  -            ((Configurable)application).configure( saEntry.getConfiguration() );
  +            throw new ContainerException( "Error preparing Application", e );
           }
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org