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/components/type RoleManager.java
Date Sun, 03 Jun 2001 08:21:22 GMT
donaldp     01/06/03 01:21:22

  Modified:    proposal/myrmidon/src/java/org/apache/ant/modules/core
                        AbstractTypeDefinition.java RegisterConverter.java
                        RegisterDataType.java RegisterTasklet.java
                        RegisterTasklib.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer
                        DefaultTskDeployer.java TskDeployer.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor
                        MyrmidonEmbeddor.java
  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer
                        DefaultRoleManager.java RoleManager.java
  Removed:     proposal/myrmidon/src/java/org/apache/myrmidon/components/type
                        RoleManager.java
  Log:
  Simplify deployment so that it uses files instead of URLs and does not name deployments.
  
  Moved RoleManager and separated interface/implementation into deployer package.
  
  Revision  Changes    Path
  1.2       +5 -12     jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/AbstractTypeDefinition.java
  
  Index: AbstractTypeDefinition.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/AbstractTypeDefinition.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractTypeDefinition.java	2001/06/02 08:40:49	1.1
  +++ AbstractTypeDefinition.java	2001/06/03 08:21:19	1.2
  @@ -8,8 +8,6 @@
   package org.apache.ant.modules.core;
   
   import java.io.File;
  -import java.net.MalformedURLException;
  -import java.net.URL;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
  @@ -69,9 +67,9 @@
                                       "lib parameter" );
           }
   
  -        final URL url = getURL( m_lib );
  +        final File file = getFile( m_lib );
   
  -        registerResource( m_name, m_classname, url );
  +        registerResource( m_name, m_classname, file );
       }
   
       protected final TskDeployer getDeployer()
  @@ -84,17 +82,12 @@
           return m_typeManager;
       }
   
  -    private final URL getURL( final String libName )
  +    private final File getFile( final String libName )
           throws TaskException
       {
           if( null != libName )
           {
  -            final File lib = getContext().resolveFile( libName );
  -            try { return lib.toURL(); }
  -            catch( final MalformedURLException mue )
  -            {
  -                throw new TaskException( "Malformed task-lib parameter " + m_lib, mue );
  -            }
  +            return getContext().resolveFile( libName );
           }
           else
           {
  @@ -102,6 +95,6 @@
           }
       }
   
  -    protected abstract void registerResource( String name, String classname, URL url )
  +    protected abstract void registerResource( String name, String classname, File file
)
           throws TaskException;
   }
  
  
  
  1.14      +16 -17    jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterConverter.java
  
  Index: RegisterConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterConverter.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- RegisterConverter.java	2001/06/03 05:31:16	1.13
  +++ RegisterConverter.java	2001/06/03 08:21:19	1.14
  @@ -76,10 +76,10 @@
               throw new TaskException( "Must specify classname parameter" );
           }
   
  -        final URL url = getURL( m_lib );
  -
           boolean isFullyDefined = true;
   
  +        final File file = getFile( m_lib );
  +
           if( null == m_sourceType && null == m_destinationType )
           {
               isFullyDefined = false;
  @@ -90,7 +90,7 @@
                                        "parameters when supplying a name" );
           }
   
  -        if( !isFullyDefined && null == url )
  +        if( !isFullyDefined && null == file )
           {
               throw new TaskException( "Must supply parameter if not fully specifying converter"
);
           }
  @@ -99,22 +99,26 @@
           {
               try
               {
  -                m_tskDeployer.deployConverter( m_classname, url.toString(), url );
  +                m_tskDeployer.deployConverter( m_classname, file );
               }
               catch( final DeploymentException de )
               {
                   throw new TaskException( "Failed deploying " + m_classname +
  -                                         " from " + url, de );
  +                                         " from " + file, de );
               }
           }
           else
           {
  -            m_converterRegistry.registerConverter( m_classname, m_sourceType, m_destinationType
);
  -
  -            final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[] { url
} );
  -            factory.addNameClassMapping( m_classname, m_classname );
  +            try
  +            {
  +                m_converterRegistry.registerConverter( m_classname, m_sourceType, m_destinationType
);
   
  -            try { m_typeManager.registerType( Converter.ROLE, m_classname, factory ); }
  +                final URL url = file.toURL();
  +                final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[] {
url } );
  +                factory.addNameClassMapping( m_classname, m_classname );
  +                
  +                m_typeManager.registerType( Converter.ROLE, m_classname, factory ); 
  +            }
               catch( final Exception e )
               {
                   throw new TaskException( "Failed to register converter " + m_classname,
e );
  @@ -122,17 +126,12 @@
           }
       }
   
  -    private URL getURL( final String libName )
  +    private File getFile( final String libName )
           throws TaskException
       {
           if( null != libName )
           {
  -            final File lib = getContext().resolveFile( libName );
  -            try { return lib.toURL(); }
  -            catch( final MalformedURLException mue )
  -            {
  -                throw new TaskException( "Malformed task-lib parameter " + m_lib, mue );
  -            }
  +            return getContext().resolveFile( libName );
           }
           else
           {
  
  
  
  1.9       +12 -7     jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterDataType.java
  
  Index: RegisterDataType.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterDataType.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RegisterDataType.java	2001/06/03 05:31:17	1.8
  +++ RegisterDataType.java	2001/06/03 08:21:19	1.9
  @@ -7,6 +7,7 @@
    */
   package org.apache.ant.modules.core;
   
  +import java.io.File;
   import java.net.URL;
   import org.apache.myrmidon.api.DataType;
   import org.apache.myrmidon.api.TaskException;
  @@ -23,25 +24,29 @@
   {
       protected void registerResource( final String name,
                                        final String className,
  -                                     final URL url )
  +                                     final File file )
           throws TaskException
       {
           if( null == className )
           {
  -            try { getDeployer().deployDataType( name, url.toString(), url ); }
  +            try { getDeployer().deployDataType( name, file ); }
               catch( final DeploymentException de )
               {
  -                throw new TaskException( "Failed deploying " + name + " from " + url, de
);
  +                throw new TaskException( "Failed deploying " + name + " from " + file,
de );
               }
           }
           else
           {
  -            final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[] { url
} );
  -            factory.addNameClassMapping( name, className );
  -            try { getTypeManager().registerType( DataType.ROLE, name, factory ); }
  +            try
  +            {
  +                final URL url = file.toURL();
  +                final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[] {
url } );
  +                factory.addNameClassMapping( name, className );
  +                getTypeManager().registerType( DataType.ROLE, name, factory ); 
  +            }
               catch( final Exception e )
               {
  -                throw new TaskException( "Failed registering " + name + " from " + url,
e );
  +                throw new TaskException( "Failed registering " + name + " from " + file,
e );
               }
           }
       }
  
  
  
  1.10      +12 -7     jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterTasklet.java
  
  Index: RegisterTasklet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterTasklet.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RegisterTasklet.java	2001/06/03 05:31:17	1.9
  +++ RegisterTasklet.java	2001/06/03 08:21:19	1.10
  @@ -7,6 +7,7 @@
    */
   package org.apache.ant.modules.core;
   
  +import java.io.File;
   import java.net.URL;
   import org.apache.myrmidon.api.Task;
   import org.apache.myrmidon.api.TaskException;
  @@ -23,25 +24,29 @@
   {
       protected void registerResource( final String name,
                                        final String className,
  -                                     final URL url )
  +                                     final File file )
           throws TaskException
       {
           if( null == className )
           {
  -            try { getDeployer().deployTask( name, url.toString(), url ); }
  +            try { getDeployer().deployTask( name, file ); }
               catch( final DeploymentException de )
               {
  -                throw new TaskException( "Failed deploying " + name + " from " + url, de
);
  +                throw new TaskException( "Failed deploying " + name + " from " + file,
de );
               }
           }
           else
           {
  -            final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[] { url
} );
  -            factory.addNameClassMapping( name, className );
  -            try { getTypeManager().registerType( Task.ROLE, name, factory ); }
  +            try 
  +            { 
  +                final URL url = file.toURL();
  +                final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[] {
url } );
  +                factory.addNameClassMapping( name, className );
  +                getTypeManager().registerType( Task.ROLE, name, factory ); 
  +            }
               catch( final Exception e )
               {
  -                throw new TaskException( "Failed registering " + name + " from " + url,
e );
  +                throw new TaskException( "Failed registering " + name + " from " + file,
e );
               }
           }
       }
  
  
  
  1.10      +2 -7      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterTasklib.java
  
  Index: RegisterTasklib.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterTasklib.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RegisterTasklib.java	2001/06/03 05:03:14	1.9
  +++ RegisterTasklib.java	2001/06/03 08:21:19	1.10
  @@ -51,16 +51,11 @@
   
           URL url = null;
   
  -        final File lib = getContext().resolveFile( m_lib );
  -        try { url = lib.toURL(); }
  -        catch( final MalformedURLException mue )
  -        {
  -            throw new TaskException( "Malformed task-lib parameter " + m_lib, mue );
  -        }
  +        final File file = getContext().resolveFile( m_lib );
   
           try
           {
  -            m_tskDeployer.deploy( url.toString(), url );
  +            m_tskDeployer.deploy( file );
           }
           catch( final DeploymentException de )
           {
  
  
  
  1.11      +41 -57    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultTskDeployer.java
  
  Index: DefaultTskDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultTskDeployer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultTskDeployer.java	2001/06/03 05:31:17	1.10
  +++ DefaultTskDeployer.java	2001/06/03 08:21:20	1.11
  @@ -47,17 +47,9 @@
       private DefaultConfigurationBuilder  m_configurationBuilder = new DefaultConfigurationBuilder();
       private ConverterRegistry            m_converterRegistry;
       private TypeManager                  m_typeManager;
  +    private RoleManager                  m_roleManager;
   
       /**
  -     * Default constructor.
  -     */
  -    public DefaultTskDeployer()
  -    {
  -        //m_autoUndeploy = true;
  -        //m_type = "Task";
  -    }
  -
  -    /**
        * Retrieve relevent services needed to deploy.
        *
        * @param componentManager the ComponentManager
  @@ -68,42 +60,29 @@
       {
           m_converterRegistry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.ROLE
);
           m_typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE );
  +        m_roleManager = (RoleManager)componentManager.lookup( RoleManager.ROLE );
       }
   
  -    public void deploy( final String location, final URL url )
  +    public void deploy( final File file )
           throws DeploymentException
       {
  -        //checkDeployment( location, url );
  -        final File file = getFileFor( url );
  +        getLogger().info( "Deploying AntLib file (" + file + ")" );
   
  -        getLogger().info( "Deploying AntLib file (" + file + ") as " + location );
  -        deployFromFile( location, file );
  -    }
  +        final URL url = getURL( file );
   
  -    /**
  -     * Deploy a file.
  -     * Eventually this should be cached for performance reasons.
  -     *
  -     * @param location the location
  -     * @param file the file
  -     * @exception DeploymentException if an error occurs
  -     */
  -    protected void deployFromFile( final String location, final File file )
  -        throws DeploymentException
  -    {
           final ZipFile zipFile = getZipFileFor( file );
  -
  -        URL url = null;
  -
           try
           {
  -            try { url = file.toURL(); }
  -            catch( final MalformedURLException mue )
  -            {
  -                throw new DeploymentException( "Unable to form url", mue );
  -            }
  -            loadResources( zipFile, location, url );
  +            loadResources( zipFile, url );
           }
  +        catch( final DeploymentException de )
  +        {
  +            throw de;
  +        }
  +        catch( final Exception e )
  +        {
  +            throw new DeploymentException( "Error deploying library", e );
  +        }       
           finally
           {
               try { zipFile.close(); }
  @@ -111,10 +90,10 @@
           }
       }
   
  -    private void loadResources( final ZipFile zipFile, final String location, final URL
url )
  -        throws DeploymentException
  +    private void loadResources( final ZipFile zipFile, final URL url )
  +        throws Exception
       {
  -        final Configuration taskdefs = loadConfiguration( zipFile, TSKDEF_FILE );
  +        final Configuration taskdefs = getDescriptor( zipFile );
           final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[] { url } );
   
           try
  @@ -141,18 +120,13 @@
           {
               throw new DeploymentException( "Malformed taskdefs.xml", ce );
           }
  -        catch( final Exception e )
  -        {
  -            throw new DeploymentException( "Failed to deploy " + location, e );
  -        }
       }
   
  -    public void deployConverter( String name, String location, URL url )
  +    public void deployConverter( final String name, final File file )
           throws DeploymentException
       {
  -        //checkDeployment( location, url );
  -        final ZipFile zipFile = getZipFileFor( getFileFor( url ) );
  -        final Configuration taskdefs = loadConfiguration( zipFile, TSKDEF_FILE );
  +        final ZipFile zipFile = getZipFileFor( file );
  +        final Configuration taskdefs = getDescriptor( zipFile );
   
           try
           {
  @@ -161,6 +135,7 @@
               {
                   if( converters[ i ].getAttribute( "classname" ).equals( name ) )
                   {
  +                    final URL url = getURL( file );
                       final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[]
{ url } );
                       handleConverter( converters[ i ], url, factory );
                       break;
  @@ -177,13 +152,11 @@
           }
       }
   
  -    public void deployDataType( final String name, final String location, final URL url
)
  +    public void deployDataType( final String name, final File file )
           throws DeploymentException
       {
  -        //checkDeployment( location, url );
  -        final ZipFile zipFile = getZipFileFor( getFileFor( url ) );
  -        final Configuration datatypedefs =
  -            loadConfiguration( zipFile, TSKDEF_FILE );
  +        final ZipFile zipFile = getZipFileFor( file );
  +        final Configuration datatypedefs = getDescriptor( zipFile );
   
           try
           {
  @@ -192,6 +165,7 @@
               {
                   if( datatypes[ i ].getAttribute( "name" ).equals( name ) )
                   {
  +                    final URL url = getURL( file );
                       final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[]
{ url } );
                       handleDataType( datatypes[ i ], url, factory );
                       break;
  @@ -208,12 +182,11 @@
           }
       }
   
  -    public void deployTask( final String name, final String location, final URL url )
  +    public void deployTask( final String name, final File file )
           throws DeploymentException
       {
  -        //checkDeployment( location, url );
  -        final ZipFile zipFile = getZipFileFor( getFileFor( url ) );
  -        final Configuration taskdefs = loadConfiguration( zipFile, TSKDEF_FILE );
  +        final ZipFile zipFile = getZipFileFor( file );
  +        final Configuration taskdefs = getDescriptor( zipFile );
   
           try
           {
  @@ -222,6 +195,7 @@
               {
                   if( tasks[ i ].getAttribute( "name" ).equals( name ) )
                   {
  +                    final URL url = getURL( file );
                       final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[]
{ url } );
                       handleTask( tasks[ i ], url, factory );
                       break;
  @@ -265,10 +239,10 @@
        * @return the Configuration
        * @exception DeploymentException if an error occurs
        */
  -    private Configuration loadConfiguration( final ZipFile zipFile, final String filename
)
  +    private Configuration getDescriptor( final ZipFile zipFile )
           throws DeploymentException
       {
  -        return buildConfiguration( loadResourceStream( zipFile, filename ) );
  +        return buildConfiguration( loadResourceStream( zipFile, TSKDEF_FILE ) );
       }
   
       /**
  @@ -401,6 +375,16 @@
               throw new DeploymentException( "Error reading " + filename +
                                              " from " + zipFile.getName(),
                                              ioe );
  +        }
  +    }
  +
  +    private URL getURL( final File file )
  +        throws DeploymentException
  +    {
  +        try { return file.toURL(); }
  +        catch( final MalformedURLException mue )
  +        {
  +            throw new DeploymentException( "Unable to form url", mue );
           }
       }
   }
  
  
  
  1.4       +7 -8      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/TskDeployer.java
  
  Index: TskDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/TskDeployer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TskDeployer.java	2001/06/03 05:03:16	1.3
  +++ TskDeployer.java	2001/06/03 08:21:20	1.4
  @@ -7,7 +7,7 @@
    */
   package org.apache.myrmidon.components.deployer;
   
  -import java.net.URL;
  +import java.io.File;
   import org.apache.avalon.framework.component.Component;
   
   /**
  @@ -21,22 +21,21 @@
       String ROLE = "org.apache.myrmidon.components.deployer.TskDeployer";
   
       /**
  -     * Deploy a resource indicate by url to location.
  +     * Deploy a library.
        *
  -     * @param location the location to deploy to
  -     * @param url the url of deployment
  +     * @param file the file deployment
        * @exception DeploymentException if an error occurs
        */
  -    void deploy( String location, URL url )
  +    void deploy( File file )
           throws DeploymentException;
   
  -    void deployConverter( String name, String location, URL url )
  +    void deployConverter( String name, File file )
           throws DeploymentException;
   
  -    void deployDataType( String name, String location, URL url )
  +    void deployDataType( String name, File file )
           throws DeploymentException;
   
  -    void deployTask( String name, String location, URL url )
  +    void deployTask( String name, File file )
           throws DeploymentException;
   }
   
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultRoleManager.java
  
  Index: DefaultRoleManager.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.deployer;
  
  import java.util.HashMap;
  
  /**
   * Interface to manage roles and mapping to shorthand names.
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   * @author <a href="mailto:ricardo@apache,org">Ricardo Rocha</a>
   * @author <a href="mailto:giacomo@apache,org">Giacomo Pati</a>
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   * @version CVS $Revision: 1.1 $ $Date: 2001/06/03 08:21:20 $
   */
  public class DefaultRoleManager
      implements RoleManager
  {
      /** Parent <code>RoleManager</code> for nested resolution */
      private final RoleManager  m_parent;
  
      /** Map for name to role mapping */
      private final HashMap      m_names = new HashMap();
  
      /** Map for role to name mapping */
      private final HashMap      m_roles = new HashMap();
  
      /**
       *  constructor--this RoleManager has no parent.
       */
      public DefaultRoleManager()
      {
          this( null );
      }
  
      /**
       * Alternate constructor--this RoleManager has the specified
       * parent.
       *
       * @param parent The parent <code>RoleManager</code>.
       */
      public DefaultRoleManager( final RoleManager parent )
      {
          m_parent = parent;
      }
  
      /**
       * Find Role name based on shorthand name.
       *
       * @param name the shorthand name
       * @return the role
       */
      public String getRoleForName( final String name )
      {
          final String role = (String)m_names.get( name );
  
          if( null == role && null != m_parent )
          {
              return m_parent.getRoleForName( name );
          }
  
          return role;
      }
  
      /**
       * Find name based on role.
       *
       * @param role the role
       * @return the name
       */
      public String getNameForRole( final String role )
      {
          final String name = (String)m_roles.get( role );
  
          if( null == name && null != m_parent )
          {
              return m_parent.getNameForRole( name );
          }
  
          return name;
      }
  
      /**
       * Add a mapping between name and role
       *
       * @param name the shorthand name
       * @param role the role
       * @exception IllegalArgumentException if an name is already mapped to a different role
       */
      public void addNameRoleMapping( final String name, final String role )
          throws IllegalArgumentException
      {
          final String oldRole = (String)m_names.get( name );
  
          if( null != oldRole && oldRole.equals( role ) )
          {
              throw new IllegalArgumentException( "Name already mapped to another role ("
+
                                                  oldRole + ")" );
          }
  
          m_names.put( name, role );
          m_roles.put( role, name );
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/RoleManager.java
  
  Index: RoleManager.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.deployer;
  
  import org.apache.avalon.framework.component.Component;
  
  /**
   * Interface to manage roles and mapping to shorthand names.
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   * @author <a href="mailto:ricardo@apache,org">Ricardo Rocha</a>
   * @author <a href="mailto:giacomo@apache,org">Giacomo Pati</a>
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   * @version CVS $Revision: 1.1 $ $Date: 2001/06/03 08:21:20 $
   */
  public interface RoleManager
      extends Component
  {
      String ROLE = "org.apache.myrmidon.components.deployer.RoleManager";
  
     /**
       * Find Role name based on shorthand name.
       *
       * @param shorthandName the shorthand name
       * @return the role
       */
      String getRoleForName( String shorthandName );
  
      /**
       * Find name based on role.
       *
       * @param role the role
       * @return the name
       */
      String getNameForRole( String role );
  }
  
  
  
  1.17      +11 -2     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/MyrmidonEmbeddor.java
  
  Index: MyrmidonEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/MyrmidonEmbeddor.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- MyrmidonEmbeddor.java	2001/06/03 05:03:16	1.16
  +++ MyrmidonEmbeddor.java	2001/06/03 08:21:21	1.17
  @@ -24,6 +24,7 @@
   import org.apache.myrmidon.components.builder.ProjectBuilder;
   import org.apache.myrmidon.components.configurer.Configurer;
   import org.apache.myrmidon.components.deployer.TskDeployer;
  +import org.apache.myrmidon.components.deployer.RoleManager;
   import org.apache.myrmidon.components.deployer.DeploymentException;
   import org.apache.myrmidon.components.executor.Executor;
   import org.apache.myrmidon.components.manager.ProjectManager;
  @@ -42,6 +43,7 @@
       private ProjectManager           m_projectManager;
       private ProjectBuilder           m_builder;
       private TskDeployer              m_deployer;
  +    private RoleManager              m_roleManager;
   
       private TypeManager              m_typeManager;
       private MasterConverter          m_converter;
  @@ -133,8 +135,8 @@
        * @exception Exception if an error occurs
        */
       public void dispose()
  -        throws Exception
       {
  +        m_roleManager = null;
           m_converterRegistry = null;
           m_converter = null;
           m_executor = null;
  @@ -166,6 +168,8 @@
           defaults.setParameter( "myrmidon.lib.path", "lib" );
   
           //create all the default properties for components
  +        defaults.setParameter( RoleManager.ROLE,
  +                               "org.apache.myrmidon.components.deployer.DefaultRoleManager"
);
           defaults.setParameter( MasterConverter.ROLE,
                                  "org.apache.myrmidon.components.converter.DefaultMasterConverter"
);
           defaults.setParameter( ConverterRegistry.ROLE,
  @@ -202,6 +206,7 @@
           componentManager.put( ProjectBuilder.ROLE, m_builder );
   
           //Following components required when Myrmidon allows user deployment of tasks etal.
  +        componentManager.put( RoleManager.ROLE, m_roleManager );
           componentManager.put( TskDeployer.ROLE, m_deployer );
   
           //Following components used when want to types (ie tasks/mappers etc)
  @@ -237,6 +242,9 @@
           component = getParameter( TypeManager.ROLE );
           m_typeManager = (TypeManager)createComponent( component, TypeManager.class );
   
  +        component = getParameter( RoleManager.ROLE );
  +        m_roleManager = (RoleManager)createComponent( component, RoleManager.class );
  +
           component = getParameter( TskDeployer.ROLE );
           m_deployer = (TskDeployer)createComponent( component, TskDeployer.class );
   
  @@ -258,6 +266,7 @@
       private void setupComponents()
           throws Exception
       {
  +        setupComponent( m_roleManager );
           setupComponent( m_converterRegistry );
           setupComponent( m_converter );
           setupComponent( m_executor );
  @@ -452,7 +461,7 @@
               try
               {
                   final File file = files[ i ].getCanonicalFile();
  -                deployer.deploy( name, file.toURL() );
  +                deployer.deploy( file );
               }
               catch( final DeploymentException de )
               {
  
  
  

Mime
View raw message