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/deployer Resources.properties DefaultDeployer.java
Date Wed, 29 Aug 2001 06:28:26 GMT
donaldp     01/08/28 23:28:26

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer
                        DefaultDeployer.java
  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer
                        Resources.properties
  Log:
  i18n continues on.
  
  Revision  Changes    Path
  1.4       +46 -17    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultDeployer.java
  
  Index: DefaultDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultDeployer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultDeployer.java	2001/06/17 10:35:36	1.3
  +++ DefaultDeployer.java	2001/08/29 06:28:26	1.4
  @@ -30,6 +30,8 @@
   import org.apache.myrmidon.converter.Converter;
   import org.xml.sax.SAXException;
   import org.xml.sax.XMLReader;
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   
   /**
    * This class deploys a .tsk file into a registry.
  @@ -40,6 +42,9 @@
       extends AbstractLoggable
       implements Deployer, Initializable, Composable
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( DefaultDeployer.class );
  +
       private final static String TYPE_DESCRIPTOR = "META-INF/ant-types.xml";
   
       private ConverterRegistry            m_converterRegistry;
  @@ -80,7 +85,10 @@
           {
               final URL url = (URL)enum.nextElement();
               parser.parse( url.toString() );
  -            getLogger().debug( "deploying " + url );
  +
  +            final String message = REZ.getString( "url-deploy.notice", url );
  +            getLogger().debug( message );
  +
               deployFromDescriptor( handler.getConfiguration(), classLoader, url );
           }
       }
  @@ -88,7 +96,11 @@
       public void deploy( final File file )
           throws DeploymentException
       {
  -        getLogger().info( "Deploying AntLib file (" + file + ")" );
  +        if( getLogger().isInfoEnabled() )
  +        {
  +            final String message = REZ.getString( "file-deploy.notice", file );
  +            getLogger().info( message );
  +        }
   
           checkFile( file );
   
  @@ -108,7 +120,8 @@
           }
           catch( final Exception e )
           {
  -            throw new DeploymentException( "Error deploying library", e );
  +            final String message = REZ.getString( "deploy-lib.error" );
  +            throw new DeploymentException( message, e );
           }
       }
   
  @@ -137,11 +150,13 @@
           }
           catch( final ConfigurationException ce )
           {
  -            throw new DeploymentException( "Malformed taskdefs.xml", ce );
  +            final String message = REZ.getString( "bad-descriptor.error" );
  +            throw new DeploymentException( message, ce );
           }
           catch( final Exception e )
           {
  -            throw new DeploymentException( "Failed to deploy " + name, e );
  +            final String message = REZ.getString( "deploy-converter.error", name );
  +            throw new DeploymentException( message, e );
           }
       }
   
  @@ -171,11 +186,13 @@
           }
           catch( final ConfigurationException ce )
           {
  -            throw new DeploymentException( "Malformed taskdefs.xml", ce );
  +            final String message = REZ.getString( "bad-descriptor.error" );
  +            throw new DeploymentException( message, ce );
           }
           catch( final Exception e )
           {
  -            throw new DeploymentException( "Failed to deploy " + name, e );
  +            final String message = REZ.getString( "deploy-type.error", name );
  +            throw new DeploymentException( message, e );
           }
       }
   
  @@ -213,7 +230,8 @@
           }
           catch( final Exception e )
           {
  -            throw new DeploymentException( "Error deploying library from " + url, e );
  +            final String message = REZ.getString( "deploy-lib.error", url );
  +            throw new DeploymentException( message, e );
           }
       }
   
  @@ -239,7 +257,8 @@
   
           if( null == name )
           {
  -            throw new DeploymentException( "RoleManager does not know name for role " +
role );
  +            final String message = REZ.getString( "unknown-name4role.error", role );
  +            throw new DeploymentException( message );
           }
   
           return name;
  @@ -252,7 +271,8 @@
   
           if( null == role )
           {
  -            throw new DeploymentException( "RoleManager does not know role for name " +
name );
  +            final String message = REZ.getString( "unknown-role4name.error", name );
  +            throw new DeploymentException( message );
           }
   
           return role;
  @@ -263,14 +283,14 @@
       {
           if( !file.exists() )
           {
  -            throw new DeploymentException( "Could not find application archive at " +
  -                                           file );
  +            final String message = REZ.getString( "no-file.error", file );
  +            throw new DeploymentException( message );
           }
   
           if( file.isDirectory() )
           {
  -            throw new DeploymentException( "Could not find application archive at " +
  -                                           file + " as it is a directory." );
  +            final String message = REZ.getString( "file-is-dir.error", file );
  +            throw new DeploymentException( message );
           }
       }
   
  @@ -287,8 +307,12 @@
           factory.addNameClassMapping( name, name );
           m_typeManager.registerType( Converter.ROLE, name, factory );
   
  -        getLogger().debug( "Registered converter " + name + " that converts from " +
  -                           source + " to " + destination );
  +        if( getLogger().isDebugEnabled() )
  +        {
  +            final String message = 
  +                REZ.getString( "register-converter.notice", name, source, destination );
  +            getLogger().debug( message );
  +        }
       }
   
       private void handleType( final String role,
  @@ -302,6 +326,11 @@
           factory.addNameClassMapping( name, className );
           m_typeManager.registerType( role, name, factory );
   
  -        getLogger().debug( "Registered " + role + "/" + name + " as " + className );
  +        if( getLogger().isDebugEnabled() )
  +        {
  +            final String message = 
  +                REZ.getString( "register-role.notice", role, name, className );
  +            getLogger().debug( message );
  +        }
       }
   }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  register-converter.notice=Registered converter {0} that converts from {1} to {2}.
  register-role.notice=Registered {0}/{1} as {2}.
  
  url-deploy.notice=Deploying {0}.
  file-deploy.notice=Deploying AntLib file ({0}).
  deploy-lib.error=Error deploying library from {0}.
  deploy-converter.error=Failed to deploy {0} converter.
  bad-descriptor.error=Malformed descriptor.
  deploy-type.error=Failed to deploy {0} type.
  unknown-name4role.error=RoleManager does not know name for role {0}.
  unknown-role4name.error=RoleManager does not know role for name {0}.
  no-file.error=Could not find application archive at {0}.
  file-is-dir.error=Could not find application archive at {0} as it is a directory.
  
  

Mime
View raw message