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/extensions ExtensionManager.java
Date Mon, 26 Nov 2001 09:35:57 GMT
donaldp     01/11/26 01:35:57

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/components/builder
                        DefaultProjectBuilder.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/components/extensions
                        DefaultExtensionManager.java
               proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/extensions
                        ExtensionManager.java
  Log:
  First cut at the ExtensionManagers component. This is something that will manage the set
of "Optional Packages" that task libraries can choose to depend upon.
  
  Revision  Changes    Path
  1.17      +4 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java
  
  Index: DefaultProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DefaultProjectBuilder.java	2001/11/19 12:37:25	1.16
  +++ DefaultProjectBuilder.java	2001/11/26 09:35:57	1.17
  @@ -16,10 +16,11 @@
   import javax.xml.parsers.SAXParserFactory;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  +import org.apache.avalon.excalibur.util.StringUtil;
   import org.apache.avalon.framework.ExceptionUtil;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  -import org.apache.avalon.framework.configuration.SAXConfigurationHandler;
  +import org.apache.avalon.framework.configuration.ClassicSAXConfigurationHandler;
   import org.apache.avalon.framework.logger.AbstractLoggable;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.log.Logger;
  @@ -75,7 +76,7 @@
               return result;
           }
   
  -        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
  +        final ClassicSAXConfigurationHandler handler = new ClassicSAXConfigurationHandler();
   
           process( systemID, handler );
   
  @@ -92,7 +93,7 @@
       }
   
       protected void process( final URL systemID,
  -                            final SAXConfigurationHandler handler )
  +                            final ClassicSAXConfigurationHandler handler )
           throws Exception
       {
           final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
  
  
  
  1.13      +24 -17    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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultEmbeddor.java	2001/11/19 12:37:25	1.12
  +++ DefaultEmbeddor.java	2001/11/26 09:35:57	1.13
  @@ -30,6 +30,7 @@
   import org.apache.myrmidon.interfaces.deployer.Deployer;
   import org.apache.myrmidon.interfaces.deployer.DeploymentException;
   import org.apache.myrmidon.interfaces.executor.Executor;
  +import org.apache.myrmidon.interfaces.extensions.ExtensionManager;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
   import org.apache.myrmidon.interfaces.model.Project;
   import org.apache.myrmidon.interfaces.role.RoleManager;
  @@ -57,6 +58,7 @@
       private TypeManager              m_typeManager;
       private MasterConverter          m_converter;
       private ConverterRegistry        m_converterRegistry;
  +    private ExtensionManager         m_extensionManager;
   
       private Executor                 m_executor;
       private Configurer               m_configurer;
  @@ -197,6 +199,7 @@
        */
       public void dispose()
       {
  +        m_extensionManager = null;
           m_aspectManager = null;
           m_roleManager = null;
           m_converterRegistry = null;
  @@ -228,26 +231,20 @@
           defaults.setParameter( "myrmidon.lib.path", "lib" );
   
           //create all the default properties for components
  -        defaults.setParameter( AspectManager.ROLE,
  -                               "org.apache.myrmidon.components.aspect.DefaultAspectManager"
);
  -        defaults.setParameter( RoleManager.ROLE,
  -                               "org.apache.myrmidon.components.role.DefaultRoleManager"
);
  -        defaults.setParameter( MasterConverter.ROLE,
  -                               "org.apache.myrmidon.components.converter.DefaultMasterConverter"
);
  -        defaults.setParameter( ConverterRegistry.ROLE,
  -                               "org.apache.myrmidon.components.converter.DefaultConverterRegistry"
);
  -        defaults.setParameter( TypeManager.ROLE,
  -                               "org.apache.myrmidon.components.type.DefaultTypeManager"
);
  +        final String PREFIX = "org.apache.myrmidon.components.";
  +        defaults.setParameter( AspectManager.ROLE, PREFIX + "aspect.DefaultAspectManager"
);
  +        defaults.setParameter( RoleManager.ROLE, PREFIX + "role.DefaultRoleManager" );
  +        defaults.setParameter( MasterConverter.ROLE, PREFIX + "converter.DefaultMasterConverter"
);
  +        defaults.setParameter( ConverterRegistry.ROLE, PREFIX + "converter.DefaultConverterRegistry"
);
  +        defaults.setParameter( TypeManager.ROLE, PREFIX + "type.DefaultTypeManager" );
           defaults.setParameter( Executor.ROLE,
                                  //"org.apache.myrmidon.components.executor.DefaultExecutor"
);
                                  //"org.apache.myrmidon.components.executor.PrintingExecutor"
);
  -                               "org.apache.myrmidon.components.executor.AspectAwareExecutor"
);
  -        defaults.setParameter( Workspace.ROLE,
  -                               "org.apache.myrmidon.components.workspace.DefaultWorkspace"
);
  -        defaults.setParameter( Deployer.ROLE,
  -                               "org.apache.myrmidon.components.deployer.DefaultDeployer"
);
  -        defaults.setParameter( Configurer.ROLE,
  -                               "org.apache.myrmidon.components.configurer.DefaultConfigurer"
);
  +                               PREFIX + "executor.AspectAwareExecutor" );
  +        defaults.setParameter( Workspace.ROLE, PREFIX + "workspace.DefaultWorkspace" );
  +        defaults.setParameter( Deployer.ROLE, PREFIX + "deployer.DefaultDeployer" );
  +        defaults.setParameter( Configurer.ROLE, PREFIX + "configurer.DefaultConfigurer"
);
  +        defaults.setParameter( ExtensionManager.ROLE, PREFIX + "extensions.DefaultExtensionManager"
);
   
           return defaults;
       }
  @@ -269,6 +266,7 @@
           //Following components required when Myrmidon allows user deployment of tasks etal.
           componentManager.put( RoleManager.ROLE, m_roleManager );
           componentManager.put( Deployer.ROLE, m_deployer );
  +        componentManager.put( ExtensionManager.ROLE, m_extensionManager );
   
           //Following components used when want to types (ie tasks/mappers etc)
           componentManager.put( TypeManager.ROLE, m_typeManager );
  @@ -296,6 +294,9 @@
           component = getParameter( ConverterRegistry.ROLE );
           m_converterRegistry = (ConverterRegistry)createComponent( component, ConverterRegistry.class
);
   
  +        component = getParameter( ExtensionManager.ROLE );
  +        m_extensionManager = (ExtensionManager)createComponent( component, ExtensionManager.class
);
  +
           component = getParameter( MasterConverter.ROLE );
           m_converter = (MasterConverter)createComponent( component, MasterConverter.class
);
   
  @@ -326,6 +327,7 @@
       private void setupComponents()
           throws Exception
       {
  +        setupComponent( m_extensionManager );
           setupComponent( m_roleManager );
           setupComponent( m_aspectManager );
           setupComponent( m_converterRegistry );
  @@ -349,6 +351,11 @@
           if( component instanceof Composable )
           {
               ((Composable)component).compose( m_componentManager );
  +        }
  +
  +        if( component instanceof Parameterizable )
  +        {
  +            ((Parameterizable)component).parameterize( m_parameters );
           }
   
           if( component instanceof Initializable )
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/extensions/DefaultExtensionManager.java
  
  Index: DefaultExtensionManager.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE file.
   */
  package org.apache.myrmidon.components.extensions;
  
  import java.io.File;
  import org.apache.avalon.excalibur.extension.DefaultPackageRepository;
  import org.apache.avalon.excalibur.util.StringUtil;
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.logger.Loggable;
  //import org.apache.avalon.framework.logger.LogEnabled;
  //import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.parameters.ParameterException;
  import org.apache.avalon.framework.parameters.Parameterizable;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.myrmidon.interfaces.extensions.ExtensionManager;
  import org.apache.log.Logger;
  
  /**
   * PhoenixPackageRepository
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2001/11/26 09:35:57 $
   */
  public class DefaultExtensionManager
      extends DefaultPackageRepository
      implements Loggable, Parameterizable, Initializable, Disposable, ExtensionManager
  {
      private Logger m_logger;
  
      private String m_path;
  
      public DefaultExtensionManager()
      {
          super( new File[ 0 ] );
      }
  
      //enableLogging
      public void setLogger( final Logger logger )
      {
          m_logger = logger;
      }
  
      public void parameterize( final Parameters parameters )
          throws ParameterException
      {
          final String phoenixHome = parameters.getParameter( "myrmidon.home" );
          final String defaultExtPath = phoenixHome + File.separator + "ext";
          m_path = parameters.getParameter( "myrmidon.ext.path", defaultExtPath );
      }
  
      public void initialize()
          throws Exception
      {
          final String[] pathElements = StringUtil.split( m_path, "|" );
  
          final File[] dirs = new File[ pathElements.length ];
          for( int i = 0; i < dirs.length; i++ )
          {
              dirs[ i ] = new File( pathElements[ i ] );
          }
  
          setPath( dirs );
  
          scanPath();
      }
  
      public void dispose()
      {
          clearCache();
      }
  
      protected void debug( final String message )
      {
          m_logger.debug( message );
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/extensions/ExtensionManager.java
  
  Index: ExtensionManager.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE file.
   */
  package org.apache.myrmidon.interfaces.extensions;
  
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.excalibur.extension.PackageRepository;
  
  /**
   * PackageRepository
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2001/11/26 09:35:57 $
   */
  public interface ExtensionManager
      extends PackageRepository, Component
  {
      String ROLE = "org.apache.myrmidon.interfaces.extensions.ExtensionManager";
  }
  
  
  

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