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/libs/runtime Resources.properties ConverterDef.java Facility.java Import.java
Date Thu, 30 Aug 2001 07:36:25 GMT
donaldp     01/08/30 00:36:25

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/libs/core
                        Echo.java Property.java StringToByteConverter.java
                        StringToClassConverter.java
                        StringToDoubleConverter.java
                        StringToFileConverter.java
                        StringToFloatConverter.java
                        StringToIntegerConverter.java
                        StringToLongConverter.java
                        StringToShortConverter.java
                        StringToURLConverter.java
               proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime
                        ConverterDef.java Facility.java Import.java
  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/libs/core
                        Resources.properties
               proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime
                        Resources.properties
  Log:
  i18n'ed the tasks.
  
  Revision  Changes    Path
  1.2       +1 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/Echo.java
  
  Index: Echo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/Echo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Echo.java	2001/06/17 01:36:56	1.1
  +++ Echo.java	2001/08/30 07:36:25	1.2
  @@ -15,7 +15,7 @@
    *
    * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
    */
  -public class Echo 
  +public class Echo
       extends AbstractTask
   {
       private String      m_message;
  
  
  
  1.2       +15 -5     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/Property.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Property.java	2001/06/27 01:50:37	1.1
  +++ Property.java	2001/08/30 07:36:25	1.2
  @@ -7,6 +7,8 @@
    */
   package org.apache.myrmidon.libs.core;
   
  +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;
  @@ -32,6 +34,9 @@
       extends AbstractContainerTask
       implements Configurable
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( Property.class );
  +
       private String              m_name;
       private Object              m_value;
       private boolean             m_localScope     = true;
  @@ -46,7 +51,8 @@
           try { m_factory = typeManager.getFactory( DataType.ROLE ); }
           catch( final TypeException te )
           {
  -            throw new ComponentException( "Unable to retrieve factory from TypeManager",
te );
  +            final String message = REZ.getString( "property.bad-factory.error" );
  +            throw new ComponentException( message, te );
           }
       }
   
  @@ -72,7 +78,8 @@
               }
               catch( final Exception e )
               {
  -                throw new ConfigurationException( "Unable to set datatype", e );
  +                final String message = REZ.getString( "property.no-set.error" );
  +                throw new ConfigurationException( message, e );
               }
           }
       }
  @@ -87,7 +94,8 @@
       {
           if( null != m_value )
           {
  -            throw new TaskException( "Value can not be set multiple times" );
  +            final String message = REZ.getString( "property.multi-set.error" );
  +            throw new TaskException( message );
           }
   
           m_value = value;
  @@ -103,12 +111,14 @@
       {
           if( null == m_name )
           {
  -            throw new TaskException( "Name must be specified" );
  +            final String message = REZ.getString( "property.no-name.error" );
  +            throw new TaskException( message );
           }
   
           if( null == m_value )
           {
  -            throw new TaskException( "Value must be specified" );
  +            final String message = REZ.getString( "property.no-value.error" );
  +            throw new TaskException( message );
           }
   
           if( m_localScope )
  
  
  
  1.2       +9 -4      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToByteConverter.java
  
  Index: StringToByteConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToByteConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToByteConverter.java	2001/06/16 03:28:52	1.1
  +++ StringToByteConverter.java	2001/08/30 07:36:25	1.2
  @@ -7,6 +7,8 @@
    */
   package org.apache.myrmidon.libs.core;
   
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.context.Context;
   import org.apache.myrmidon.converter.AbstractConverter;
   import org.apache.myrmidon.converter.ConverterException;
  @@ -19,20 +21,23 @@
   public class StringToByteConverter
       extends AbstractConverter
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( StringToByteConverter.class );
  +
       public StringToByteConverter()
       {
           super( String.class, Byte.class );
       }
   
  -    public Object convert( final Object original, final Context context )
  +    public Object convert( final Object object, final Context context )
           throws ConverterException
       {
  -        try { return new Byte( (String)original ); }
  +        try { return new Byte( (String)object ); }
           catch( final NumberFormatException nfe )
           {
  -            throw new ConverterException( "Error formatting object", nfe );
  +            final String message = REZ.getString( "convert.bad-byte.error", object );
  +            throw new ConverterException( message, nfe );
           }
  -
       }
   }
   
  
  
  
  1.2       +9 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToClassConverter.java
  
  Index: StringToClassConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToClassConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToClassConverter.java	2001/06/16 03:28:52	1.1
  +++ StringToClassConverter.java	2001/08/30 07:36:25	1.2
  @@ -7,6 +7,8 @@
    */
   package org.apache.myrmidon.libs.core;
   
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.context.Context;
   import org.apache.myrmidon.converter.AbstractConverter;
   import org.apache.myrmidon.converter.ConverterException;
  @@ -19,19 +21,23 @@
   public class StringToClassConverter
       extends AbstractConverter
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( StringToClassConverter.class );
  +
       public StringToClassConverter()
       {
           super( String.class, Class.class );
       }
   
  -    public Object convert( final Object original, final Context context )
  +    public Object convert( final Object object, final Context context )
           throws ConverterException
       {
           //TODO: Should we use ContextClassLoader here???
  -        try { return Class.forName( (String)original ); }
  +        try { return Class.forName( (String)object ); }
           catch( final Exception e )
           {
  -            throw new ConverterException( "Error converting to class type", e );
  +            final String message = REZ.getString( "convert.bad-class.error", object );
  +            throw new ConverterException( message, e );
           }
       }
   }
  
  
  
  1.2       +9 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToDoubleConverter.java
  
  Index: StringToDoubleConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToDoubleConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToDoubleConverter.java	2001/06/16 03:28:52	1.1
  +++ StringToDoubleConverter.java	2001/08/30 07:36:25	1.2
  @@ -7,6 +7,8 @@
    */
   package org.apache.myrmidon.libs.core;
   
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.context.Context;
   import org.apache.myrmidon.converter.AbstractConverter;
   import org.apache.myrmidon.converter.ConverterException;
  @@ -19,18 +21,22 @@
   public class StringToDoubleConverter
       extends AbstractConverter
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( StringToDoubleConverter.class );
  +
       public StringToDoubleConverter()
       {
           super( String.class, Double.class );
       }
   
  -    public Object convert( final Object original, final Context context )
  +    public Object convert( final Object object, final Context context )
           throws ConverterException
       {
  -        try { return new Double( (String)original ); }
  +        try { return new Double( (String)object ); }
           catch( final NumberFormatException nfe )
           {
  -            throw new ConverterException( "Error formatting object", nfe );
  +            final String message = REZ.getString( "convert.bad-double.error", object );
  +            throw new ConverterException( message, nfe );
           }
       }
   }
  
  
  
  1.2       +9 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToFileConverter.java
  
  Index: StringToFileConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToFileConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToFileConverter.java	2001/06/16 03:28:52	1.1
  +++ StringToFileConverter.java	2001/08/30 07:36:25	1.2
  @@ -8,6 +8,8 @@
   package org.apache.myrmidon.libs.core;
   
   import java.io.File;
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.context.Context;
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
  @@ -22,22 +24,26 @@
   public class StringToFileConverter
       extends AbstractConverter
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( StringToFileConverter.class );
  +
       public StringToFileConverter()
       {
           super( String.class, File.class );
       }
   
  -    public Object convert( final Object original, final Context context )
  +    public Object convert( final Object object, final Context context )
           throws ConverterException
       {
           try
           {
               final TaskContext taskContext = (TaskContext)context;
  -            return taskContext.resolveFile( (String)original );
  +            return taskContext.resolveFile( (String)object );
           }
           catch( final TaskException te )
           {
  -            throw new ConverterException( "Error resolving file during conversion", te
);
  +            final String message = REZ.getString( "convert.bad-file.error", object );
  +            throw new ConverterException( message, te );
           }
       }
   }
  
  
  
  1.2       +9 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToFloatConverter.java
  
  Index: StringToFloatConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToFloatConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToFloatConverter.java	2001/06/16 03:28:52	1.1
  +++ StringToFloatConverter.java	2001/08/30 07:36:25	1.2
  @@ -7,6 +7,8 @@
    */
   package org.apache.myrmidon.libs.core;
   
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.context.Context;
   import org.apache.myrmidon.converter.AbstractConverter;
   import org.apache.myrmidon.converter.ConverterException;
  @@ -19,18 +21,22 @@
   public class StringToFloatConverter
       extends AbstractConverter
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( StringToFloatConverter.class );
  +
       public StringToFloatConverter()
       {
           super( String.class, Float.class );
       }
   
  -    public Object convert( final Object original, final Context context )
  +    public Object convert( final Object object, final Context context )
           throws ConverterException
       {
  -        try { return new Float( (String)original ); }
  +        try { return new Float( (String)object ); }
           catch( final NumberFormatException nfe )
           {
  -            throw new ConverterException( "Error formatting object", nfe );
  +            final String message = REZ.getString( "convert.bad-float.error", object );
  +            throw new ConverterException( message, nfe );
           }
       }
   }
  
  
  
  1.2       +9 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToIntegerConverter.java
  
  Index: StringToIntegerConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToIntegerConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToIntegerConverter.java	2001/06/16 03:28:52	1.1
  +++ StringToIntegerConverter.java	2001/08/30 07:36:25	1.2
  @@ -7,6 +7,8 @@
    */
   package org.apache.myrmidon.libs.core;
   
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.context.Context;
   import org.apache.myrmidon.converter.AbstractConverter;
   import org.apache.myrmidon.converter.ConverterException;
  @@ -19,18 +21,22 @@
   public class StringToIntegerConverter
       extends AbstractConverter
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( StringToFloatConverter.class );
  +
       public StringToIntegerConverter()
       {
           super( String.class, Integer.class );
       }
   
  -    public Object convert( final Object original, final Context context )
  +    public Object convert( final Object object, final Context context )
           throws ConverterException
       {
  -        try { return new Integer( (String)original ); }
  +        try { return new Integer( (String)object ); }
           catch( final NumberFormatException nfe )
           {
  -            throw new ConverterException( "Error formatting object", nfe );
  +            final String message = REZ.getString( "convert.bad-integer.error", object );
  +            throw new ConverterException( message, nfe );
           }
       }
   }
  
  
  
  1.2       +9 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToLongConverter.java
  
  Index: StringToLongConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToLongConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToLongConverter.java	2001/06/16 03:28:53	1.1
  +++ StringToLongConverter.java	2001/08/30 07:36:25	1.2
  @@ -7,6 +7,8 @@
    */
   package org.apache.myrmidon.libs.core;
   
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.context.Context;
   import org.apache.myrmidon.converter.AbstractConverter;
   import org.apache.myrmidon.converter.ConverterException;
  @@ -19,18 +21,22 @@
   public class StringToLongConverter
       extends AbstractConverter
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( StringToLongConverter.class );
  +
       public StringToLongConverter()
       {
           super( String.class, Long.class );
       }
   
  -    public Object convert( final Object original, final Context context )
  +    public Object convert( final Object object, final Context context )
           throws ConverterException
       {
  -        try { return new Long( (String)original ); }
  +        try { return new Long( (String)object ); }
           catch( final NumberFormatException nfe )
           {
  -            throw new ConverterException( "Error formatting object", nfe );
  +            final String message = REZ.getString( "convert.bad-long.error", object );
  +            throw new ConverterException( message, nfe );
           }
       }
   }
  
  
  
  1.2       +9 -4      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToShortConverter.java
  
  Index: StringToShortConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToShortConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToShortConverter.java	2001/06/16 03:28:53	1.1
  +++ StringToShortConverter.java	2001/08/30 07:36:25	1.2
  @@ -7,6 +7,8 @@
    */
   package org.apache.myrmidon.libs.core;
   
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.context.Context;
   import org.apache.myrmidon.converter.AbstractConverter;
   import org.apache.myrmidon.converter.ConverterException;
  @@ -19,20 +21,23 @@
   public class StringToShortConverter
       extends AbstractConverter
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( StringToShortConverter.class );
  +
       public StringToShortConverter()
       {
           super( String.class, Short.class );
       }
   
  -    public Object convert( final Object original, final Context context )
  +    public Object convert( final Object object, final Context context )
           throws ConverterException
       {
  -        try { return new Short( (String)original ); }
  +        try { return new Short( (String)object ); }
           catch( final NumberFormatException nfe )
           {
  -            throw new ConverterException( "Error formatting object", nfe );
  +            final String message = REZ.getString( "convert.bad-short.error", object );
  +            throw new ConverterException( message, nfe );
           }
  -
       }
   }
   
  
  
  
  1.2       +9 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToURLConverter.java
  
  Index: StringToURLConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/StringToURLConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToURLConverter.java	2001/06/16 03:28:53	1.1
  +++ StringToURLConverter.java	2001/08/30 07:36:25	1.2
  @@ -9,6 +9,8 @@
   
   import java.net.MalformedURLException;
   import java.net.URL;
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.context.Context;
   import org.apache.myrmidon.converter.AbstractConverter;
   import org.apache.myrmidon.converter.ConverterException;
  @@ -21,18 +23,22 @@
   public class StringToURLConverter
       extends AbstractConverter
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( StringToURLConverter.class );
  +
       public StringToURLConverter()
       {
           super( String.class, URL.class );
       }
   
  -    public Object convert( final Object original, final Context context )
  +    public Object convert( final Object object, final Context context )
           throws ConverterException
       {
  -        try { return new URL( (String)original ); }
  +        try { return new URL( (String)object ); }
           catch( final MalformedURLException mue )
           {
  -            throw new ConverterException( "Error formatting object", mue );
  +            final String message = REZ.getString( "convert.bad-url.error", object );
  +            throw new ConverterException( message, mue );
           }
   
       }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  property.bad-factory.error=Unable to retrieve DataType factory from TypeManager.
  property.no-set.error=Unable to set datatype.
  property.multi-set.error=Value can not be set multiple times.
  property.no-name.error=Name must be specified.
  property.no-value.error=Value must be specified.
  
  convert.bad-byte.error=Error converting object ({0}) to Byte.
  convert.bad-class.error=Error converting object ({0}) to Class.
  convert.bad-double.error=Error converting object ({0}) to Double.
  convert.bad-file.error=Error converting object ({0}) to File.
  convert.bad-float.error=Error converting object ({0}) to Float.
  convert.bad-integer.error=Error converting object ({0}) to Integer.
  convert.bad-long.error=Error converting object ({0}) to Long.
  convert.bad-short.error=Error converting object ({0}) to Short.
  convert.bad-url.error=Error converting object ({0}) to URL.
  
  
  1.3       +15 -5     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime/ConverterDef.java
  
  Index: ConverterDef.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime/ConverterDef.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConverterDef.java	2001/07/08 07:18:26	1.2
  +++ ConverterDef.java	2001/08/30 07:36:25	1.3
  @@ -10,6 +10,8 @@
   import java.io.File;
   import java.net.MalformedURLException;
   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;
  @@ -29,6 +31,9 @@
       extends AbstractTask
       implements Composable
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( ConverterDef.class );
  +
       private String              m_sourceType;
       private String              m_destinationType;
       private File                m_lib;
  @@ -68,19 +73,23 @@
       {
           if( null == m_classname )
           {
  -            throw new TaskException( "Must specify classname parameter" );
  +            final String message = REZ.getString( "converterdef.no-classname.error" );
  +            throw new TaskException( message );
           }
           else if( null == m_sourceType )
           {
  -            throw new TaskException( "Must specify the source-type parameter" );
  +            final String message = REZ.getString( "converterdef.no-source.error" );
  +            throw new TaskException( message );
           }
           else if( null == m_destinationType )
           {
  -            throw new TaskException( "Must specify the destination-type parameter" );
  +            final String message = REZ.getString( "converterdef.no-destination.error" );
  +            throw new TaskException( message );
           }
           else if( null == m_lib )
           {
  -            throw new TaskException( "Must specify the lib parameter" );
  +            final String message = REZ.getString( "converterdef.no-lib.error" );
  +            throw new TaskException( message );
           }
   
           try
  @@ -95,7 +104,8 @@
           }
           catch( final Exception e )
           {
  -            throw new TaskException( "Failed to register converter " + m_classname, e );
  +            final String message = REZ.getString( "converterdef.no-register.error", m_classname
);
  +            throw new TaskException( message, e );
           }
       }
   }
  
  
  
  1.2       +24 -16    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime/Facility.java
  
  Index: Facility.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime/Facility.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Facility.java	2001/06/10 12:54:55	1.1
  +++ Facility.java	2001/08/30 07:36:25	1.2
  @@ -10,19 +10,21 @@
   import java.io.File;
   import java.net.MalformedURLException;
   import java.net.URL;
  -import org.apache.avalon.framework.configuration.Configurable;
  -import org.apache.avalon.framework.configuration.Configuration;
  -import org.apache.avalon.framework.configuration.ConfigurationException;
  +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;
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.aspects.AspectHandler;
   import org.apache.myrmidon.components.aspect.AspectManager;
  -import org.apache.myrmidon.components.type.TypeFactory;
   import org.apache.myrmidon.components.type.TypeException;
  +import org.apache.myrmidon.components.type.TypeFactory;
   import org.apache.myrmidon.components.type.TypeManager;
  -import org.apache.myrmidon.aspects.AspectHandler;
   import org.apache.myrmidon.framework.AbstractContainerTask;
   
   /**
  @@ -32,26 +34,30 @@
    */
   public class Facility
       extends AbstractContainerTask
  -    implements Composable, Configurable 
  +    implements Composable, Configurable
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( Facility.class );
  +
       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 )
           {
  -            throw new ComponentException( "Unable to retrieve factory from TypeManager",
te );
  +            final String message = REZ.getString( "facility.no-factory.error" );
  +            throw new ComponentException( message, te );
           }
       }
   
  @@ -68,7 +74,7 @@
   
           final Configuration[] children = configuration.getChildren();
   
  -        if( 1 == children.length ) 
  +        if( 1 == children.length )
           {
               try
               {
  @@ -76,16 +82,17 @@
               }
               catch( final Exception e )
               {
  -                throw new ConfigurationException( "Failed to create aspect handler of type
'" + 
  -                                                  children[ 0 ].getName() + "'", e );
  +                final String message = 
  +                    REZ.getString( "facility.no-create.error", children[ 0 ].getName()
);
  +                throw new ConfigurationException( message, e );
               }
  -            
  +
               configure( m_aspectHandler, children[ 0 ] );
           }
           else
           {
  -            throw new ConfigurationException( "Expected one sub-element to " + 
  -                                              "configure facility" );
  +            final String message = REZ.getString( "facility.multi-element.error" );
  +            throw new ConfigurationException( message );
           }
       }
   
  @@ -99,7 +106,8 @@
       {
           if( null == m_namespace )
           {
  -            throw new TaskException( "Must specify namespace parameter" );
  +            final String message = REZ.getString( "facility.no-namespace.error" );
  +            throw new TaskException( message );
           }
   
           m_aspectManager.addAspectHandler( m_namespace, m_aspectHandler );
  
  
  
  1.2       +9 -2      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime/Import.java
  
  Index: Import.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime/Import.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Import.java	2001/06/27 01:50:38	1.1
  +++ Import.java	2001/08/30 07:36:25	1.2
  @@ -7,6 +7,8 @@
    */
   package org.apache.myrmidon.libs.runtime;
   
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import java.io.File;
   import java.net.MalformedURLException;
   import java.net.URL;
  @@ -27,6 +29,9 @@
       extends AbstractTask
       implements Composable
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( Import.class );
  +
       private File        m_lib;
       private Deployer    m_deployer;
   
  @@ -46,7 +51,8 @@
       {
           if( null == m_lib )
           {
  -            throw new TaskException( "Must specify lib parameter" );
  +            final String message = REZ.getString( "import.no-lib.error" );
  +            throw new TaskException( message );
           }
   
           try
  @@ -55,7 +61,8 @@
           }
           catch( final DeploymentException de )
           {
  -            throw new TaskException( "Error importing tasklib", de );
  +            final String message = REZ.getString( "import.no-deploy.error" );
  +            throw new TaskException( message, de );
           }
       }
   }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  converterdef.no-classname.error=Must specify classname parameter.
  converterdef.no-source.error=Must specify the source-type parameter.
  converterdef.no-destination.error=Must specify the destination-type parameter.
  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.
  
  import.no-lib.error=Must specify lib parameter.
  import.no-deploy.error=Error importing tasklib.
  
  

Mime
View raw message