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/antlib/runtime Resources.properties Import.java Facility.java ConverterDef.java
Date Fri, 25 Jan 2002 11:27:21 GMT
donaldp     02/01/25 03:27:21

  Modified:    proposal/myrmidon/src/java/org/apache/antlib/runtime
                        Resources.properties Import.java Facility.java
                        ConverterDef.java
  Log:
  Update to use new getService() method for retrienving sertvices
  
  Submitted By: "Adam Murdoch" <adammurdoch_ml@yahoo.com>
  
  Revision  Changes    Path
  1.2       +0 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/Resources.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Resources.properties	17 Dec 2001 08:48:57 -0000	1.1
  +++ Resources.properties	25 Jan 2002 11:27:21 -0000	1.2
  @@ -4,7 +4,6 @@
   converterdef.no-lib.error=Must specify the lib parameter.
   converterdef.no-register.error=Failed to register converter {0}.
   
  -facility.no-factory.error=Unable to retrieve AspectHandler factory from TypeManager.
   facility.no-create.error=Failed to create aspect handler of type {0}.
   facility.multi-element.error=Expected one sub-element to configure facility.
   facility.no-namespace.error=Must specify namespace parameter.
  
  
  
  1.5       +2 -12     jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/Import.java
  
  Index: Import.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/Import.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Import.java	20 Jan 2002 17:32:57 -0000	1.4
  +++ Import.java	25 Jan 2002 11:27:21 -0000	1.5
  @@ -10,9 +10,6 @@
   import java.io.File;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.Composable;
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.interfaces.deployer.Deployer;
  @@ -25,19 +22,11 @@
    */
   public class Import
       extends AbstractTask
  -    implements Composable
   {
       private final static Resources REZ =
           ResourceManager.getPackageResources( Import.class );
   
       private File m_lib;
  -    private Deployer m_deployer;
  -
  -    public void compose( final ComponentManager componentManager )
  -        throws ComponentException
  -    {
  -        m_deployer = (Deployer)componentManager.lookup( Deployer.ROLE );
  -    }
   
       public void setLib( final File lib )
       {
  @@ -55,7 +44,8 @@
   
           try
           {
  -            m_deployer.deploy( m_lib );
  +            final Deployer deployer = (Deployer)getService( Deployer.class );
  +            deployer.deploy( m_lib );
           }
           catch( final DeploymentException de )
           {
  
  
  
  1.5       +5 -30     jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/Facility.java
  
  Index: Facility.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/Facility.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Facility.java	20 Jan 2002 17:32:57 -0000	1.4
  +++ Facility.java	25 Jan 2002 11:27:21 -0000	1.5
  @@ -9,9 +9,6 @@
   
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  @@ -19,9 +16,7 @@
   import org.apache.myrmidon.aspects.AspectHandler;
   import org.apache.myrmidon.framework.AbstractContainerTask;
   import org.apache.myrmidon.interfaces.aspect.AspectManager;
  -import org.apache.myrmidon.interfaces.type.TypeException;
   import org.apache.myrmidon.interfaces.type.TypeFactory;
  -import org.apache.myrmidon.interfaces.type.TypeManager;
   
   /**
    * Task that definesMethod to register a single converter.
  @@ -30,7 +25,7 @@
    */
   public class Facility
       extends AbstractContainerTask
  -    implements Composable, Configurable
  +    implements Configurable
   {
       private final static Resources REZ =
           ResourceManager.getPackageResources( Facility.class );
  @@ -38,28 +33,6 @@
       private String m_namespace;
       private AspectHandler m_aspectHandler;
   
  -    private AspectManager m_aspectManager;
  -    private TypeFactory m_factory;
  -
  -    public void compose( final ComponentManager componentManager )
  -        throws ComponentException
  -    {
  -        super.compose( componentManager );
  -
  -        m_aspectManager = (AspectManager)componentManager.lookup( AspectManager.ROLE );
  -
  -        final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE
);
  -        try
  -        {
  -            m_factory = typeManager.getFactory( AspectHandler.ROLE );
  -        }
  -        catch( final TypeException te )
  -        {
  -            final String message = REZ.getString( "facility.no-factory.error" );
  -            throw new ComponentException( message, te );
  -        }
  -    }
  -
       public void configure( final Configuration configuration )
           throws ConfigurationException
       {
  @@ -77,7 +50,8 @@
           {
               try
               {
  -                m_aspectHandler = (AspectHandler)m_factory.create( children[ 0 ].getName()
);
  +                final TypeFactory typeFactory = getTypeFactory( AspectHandler.ROLE );
  +                m_aspectHandler = (AspectHandler)typeFactory.create( children[ 0 ].getName()
);
               }
               catch( final Exception e )
               {
  @@ -109,6 +83,7 @@
               throw new TaskException( message );
           }
   
  -        m_aspectManager.addAspectHandler( m_namespace, m_aspectHandler );
  +        final AspectManager aspectManager = (AspectManager)getService( AspectManager.class
);
  +        aspectManager.addAspectHandler( m_namespace, m_aspectHandler );
       }
   }
  
  
  
  1.5       +4 -15     jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java
  
  Index: ConverterDef.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ConverterDef.java	20 Jan 2002 17:32:57 -0000	1.4
  +++ ConverterDef.java	25 Jan 2002 11:27:21 -0000	1.5
  @@ -11,9 +11,6 @@
   import java.net.URL;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.Composable;
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.converter.Converter;
  @@ -28,7 +25,6 @@
    */
   public class ConverterDef
       extends AbstractTask
  -    implements Composable
   {
       private final static Resources REZ =
           ResourceManager.getPackageResources( ConverterDef.class );
  @@ -37,15 +33,6 @@
       private String m_destinationType;
       private File m_lib;
       private String m_classname;
  -    private ConverterRegistry m_converterRegistry;
  -    private TypeManager m_typeManager;
  -
  -    public void compose( final ComponentManager componentManager )
  -        throws ComponentException
  -    {
  -        m_converterRegistry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.ROLE
);
  -        m_typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE );
  -    }
   
       public void setLib( final File lib )
       {
  @@ -93,13 +80,15 @@
   
           try
           {
  -            m_converterRegistry.registerConverter( m_classname, m_sourceType, m_destinationType
);
  +            final ConverterRegistry converterRegistry = (ConverterRegistry)getService(
ConverterRegistry.class );
  +            converterRegistry.registerConverter( m_classname, m_sourceType, m_destinationType
);
   
               final URL url = m_lib.toURL();
               final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[]{url} );
               factory.addNameClassMapping( m_classname, m_classname );
   
  -            m_typeManager.registerType( Converter.ROLE, m_classname, factory );
  +            final TypeManager typeManager = (TypeManager)getService( TypeManager.class
);
  +            typeManager.registerType( Converter.ROLE, m_classname, factory );
           }
           catch( final Exception e )
           {
  
  
  

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