ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/embeddor Embeddor.java
Date Sat, 23 Mar 2002 23:41:27 GMT
donaldp     02/03/23 15:41:27

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/frontends
                        CLIMain.java EmbeddedAnt.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
               proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/embeddor
                        Embeddor.java
  Log:
  Made embeddor not implement the framework lifecycle stages
  
  Revision  Changes    Path
  1.33      +5 -5      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java
  
  Index: CLIMain.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- CLIMain.java	23 Mar 2002 10:16:35 -0000	1.32
  +++ CLIMain.java	23 Mar 2002 23:41:27 -0000	1.33
  @@ -8,12 +8,12 @@
   package org.apache.myrmidon.frontends;
   
   import java.io.BufferedReader;
  -import java.io.InputStreamReader;
   import java.io.File;
  +import java.io.InputStreamReader;
   import java.util.ArrayList;
  +import java.util.HashMap;
   import java.util.List;
   import java.util.Map;
  -import java.util.HashMap;
   import org.apache.avalon.excalibur.cli.CLArgsParser;
   import org.apache.avalon.excalibur.cli.CLOption;
   import org.apache.avalon.excalibur.cli.CLOptionDescriptor;
  @@ -32,7 +32,7 @@
    * to run project.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.32 $ $Date: 2002/03/23 10:16:35 $
  + * @version $Revision: 1.33 $ $Date: 2002/03/23 23:41:27 $
    */
   public class CLIMain
   {
  @@ -311,7 +311,7 @@
   
               // Setup logging
               final BasicLogger logger = new BasicLogger( "[myrmidon] ", m_priority );
  -            m_embedded.setLogger( logger );
  +            m_embedded.enableLogging( logger );
   
               if( m_dryRun )
               {
  @@ -380,7 +380,7 @@
       private void executeBuild() throws Exception
       {
           //actually do the build ...
  -        final String[] targets = (String[])m_targets.toArray( new String[m_targets.size()
] );
  +        final String[] targets = (String[])m_targets.toArray( new String[ m_targets.size()
] );
           m_embedded.executeTargets( targets );
       }
   
  
  
  
  1.2       +31 -19    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/EmbeddedAnt.java
  
  Index: EmbeddedAnt.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/EmbeddedAnt.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EmbeddedAnt.java	23 Mar 2002 10:16:35 -0000	1.1
  +++ EmbeddedAnt.java	23 Mar 2002 23:41:27 -0000	1.2
  @@ -10,8 +10,12 @@
   import java.io.File;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  +import org.apache.avalon.framework.activity.Disposable;
  +import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.framework.activity.Startable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.logger.Logger;
  +import org.apache.avalon.framework.parameters.Parameterizable;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
  @@ -24,13 +28,14 @@
    * executing a project.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.1 $ $Date: 2002/03/23 10:16:35 $
  + * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  + * @version $Revision: 1.2 $ $Date: 2002/03/23 23:41:27 $
    */
   public class EmbeddedAnt
       extends AbstractLogEnabled
   {
  -    private final static Resources REZ
  -        = ResourceManager.getPackageResources( EmbeddedAnt.class );
  +    private final static Resources REZ =
  +        ResourceManager.getPackageResources( EmbeddedAnt.class );
   
       private static final String DEFAULT_EMBEDDOR_CLASS =
           "org.apache.myrmidon.components.embeddor.DefaultEmbeddor";
  @@ -41,19 +46,11 @@
       private ProjectListener m_listener;
       private Parameters m_workspaceProps = new Parameters();
       private Parameters m_builderProps = new Parameters();
  -    private Parameters m_embeddorProps = new Parameters();
  +    private Parameters m_embeddorParameters = new Parameters();
       private ClassLoader m_sharedClassLoader;
       private Embeddor m_embeddor;
   
       /**
  -     * Sets the logger to use.
  -     */
  -    public void setLogger( final Logger logger )
  -    {
  -        enableLogging( logger );
  -    }
  -
  -    /**
        * Sets the project file to execute.  Default is 'build.ant'.
        */
       public void setProjectFile( final String projectFile )
  @@ -117,7 +114,7 @@
       public void setEmbeddorProperty( final String name, final Object value )
       {
           // TODO - Make properties Objects, not Strings
  -        m_embeddorProps.setParameter( name, (String)value );
  +        m_embeddorParameters.setParameter( name, (String)value );
       }
   
       /**
  @@ -164,8 +161,14 @@
           {
               if( m_embeddor != null )
               {
  -                m_embeddor.stop();
  -                m_embeddor.dispose();
  +                if( m_embeddor instanceof Startable )
  +                {
  +                    ( (Startable)m_embeddor ).stop();
  +                }
  +                if( m_embeddor instanceof Disposable )
  +                {
  +                    ( (Disposable)m_embeddor ).dispose();
  +                }
               }
           }
           finally
  @@ -204,7 +207,7 @@
        */
       private void checkHomeDir() throws Exception
       {
  -        final String home = m_embeddorProps.getParameter( "myrmidon.home" );
  +        final String home = m_embeddorParameters.getParameter( "myrmidon.home" );
           final File homeDir = ( new File( home ) ).getAbsoluteFile();
           if( !homeDir.isDirectory() )
           {
  @@ -229,9 +232,18 @@
           {
               m_embeddor = createEmbeddor();
               setupLogger( m_embeddor );
  -            m_embeddor.parameterize( m_embeddorProps );
  -            m_embeddor.initialize();
  -            m_embeddor.start();
  +            if( m_embeddor instanceof Parameterizable )
  +            {
  +                ( (Parameterizable)m_embeddor ).parameterize( m_embeddorParameters );
  +            }
  +            if( m_embeddor instanceof Initializable )
  +            {
  +                ( (Initializable)m_embeddor ).initialize();
  +            }
  +            if( m_embeddor instanceof Startable )
  +            {
  +                ( (Startable)m_embeddor ).start();
  +            }
           }
           return m_embeddor;
       }
  
  
  
  1.38      +5 -4      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java
  
  Index: DefaultEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- DefaultEmbeddor.java	23 Mar 2002 10:16:35 -0000	1.37
  +++ DefaultEmbeddor.java	23 Mar 2002 23:41:27 -0000	1.38
  @@ -20,6 +20,7 @@
   import org.apache.avalon.framework.CascadingException;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.framework.activity.Startable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.parameters.Parameterizable;
   import org.apache.avalon.framework.parameters.Parameters;
  @@ -30,6 +31,7 @@
   import org.apache.myrmidon.interfaces.builder.ProjectBuilder;
   import org.apache.myrmidon.interfaces.classloader.ClassLoaderManager;
   import org.apache.myrmidon.interfaces.configurer.Configurer;
  +import org.apache.myrmidon.interfaces.converter.ConverterRegistry;
   import org.apache.myrmidon.interfaces.deployer.Deployer;
   import org.apache.myrmidon.interfaces.deployer.DeploymentException;
   import org.apache.myrmidon.interfaces.deployer.TypeDeployer;
  @@ -43,7 +45,6 @@
   import org.apache.myrmidon.interfaces.type.TypeFactory;
   import org.apache.myrmidon.interfaces.type.TypeManager;
   import org.apache.myrmidon.interfaces.workspace.Workspace;
  -import org.apache.myrmidon.interfaces.converter.ConverterRegistry;
   import org.apache.myrmidon.listeners.ProjectListener;
   
   /**
  @@ -51,11 +52,11 @@
    * Instantiate this to embed inside other applications.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.37 $ $Date: 2002/03/23 10:16:35 $
  + * @version $Revision: 1.38 $ $Date: 2002/03/23 23:41:27 $
    */
   public class DefaultEmbeddor
       extends AbstractLogEnabled
  -    implements Embeddor
  +    implements Embeddor, Parameterizable, Initializable, Startable, Disposable
   {
       private final static Resources REZ =
           ResourceManager.getPackageResources( DefaultEmbeddor.class );
  @@ -284,7 +285,7 @@
        * Creates a component.
        */
       private Object createComponent( final Class roleType,
  -                                  final String defaultImpl )
  +                                    final String defaultImpl )
           throws Exception
       {
           final Object component = createService( roleType, defaultImpl );
  
  
  
  1.10      +1 -6      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java
  
  Index: Embeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Embeddor.java	23 Mar 2002 09:07:16 -0000	1.9
  +++ Embeddor.java	23 Mar 2002 23:41:27 -0000	1.10
  @@ -7,10 +7,6 @@
    */
   package org.apache.myrmidon.interfaces.embeddor;
   
  -import org.apache.avalon.framework.activity.Disposable;
  -import org.apache.avalon.framework.activity.Initializable;
  -import org.apache.avalon.framework.activity.Startable;
  -import org.apache.avalon.framework.parameters.Parameterizable;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.myrmidon.interfaces.model.Project;
   import org.apache.myrmidon.interfaces.workspace.Workspace;
  @@ -20,10 +16,9 @@
    * Interface through which you embed Myrmidon into applications.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.9 $ $Date: 2002/03/23 09:07:16 $
  + * @version $Revision: 1.10 $ $Date: 2002/03/23 23:41:27 $
    */
   public interface Embeddor
  -    extends Parameterizable, Initializable, Startable, Disposable
   {
       String ROLE = Embeddor.class.getName();
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message