donaldp 01/08/29 09:01:51
Modified:
proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace
DefaultTaskContext.java Resources.properties
Log:
i18n'ed TaskContext implementation.
Revision Changes Path
1.2 +24 -15
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java
Index: DefaultTaskContext.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultTaskContext.java 2001/08/29 15:48:00 1.1
+++ DefaultTaskContext.java 2001/08/29 16:01:51 1.2
@@ -9,6 +9,8 @@
import java.io.File;
import java.util.Map;
+import org.apache.avalon.excalibur.i18n.ResourceManager;
+import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.avalon.excalibur.property.PropertyException;
import org.apache.avalon.excalibur.property.PropertyUtil;
@@ -27,6 +29,9 @@
extends DefaultContext
implements TaskContext
{
+ private static final Resources REZ =
+ ResourceManager.getPackageResources( DefaultTaskContext.class );
+
/**
* Constructor for Context with no parent contexts.
*/
@@ -61,7 +66,8 @@
try { return (JavaVersion)get( JAVA_VERSION ); }
catch( final ContextException ce )
{
- throw new IllegalStateException( "No JavaVersion in Context" );
+ final String message = REZ.getString( "no-version.error" );
+ throw new IllegalStateException( message );
}
}
@@ -76,7 +82,8 @@
try { return (String)get( NAME ); }
catch( final ContextException ce )
{
- throw new IllegalStateException( "No Name in Context" );
+ final String message = REZ.getString( "no-name.error" );
+ throw new IllegalStateException( message );
}
}
@@ -90,7 +97,8 @@
try { return (File)get( BASE_DIRECTORY ); }
catch( final ContextException ce )
{
- throw new IllegalStateException( "No Base Directory in Context"
);
+ final String message = REZ.getString( "no-dir.error" );
+ throw new IllegalStateException( message );
}
}
@@ -151,8 +159,8 @@
{
if( null == getParent() )
{
- throw new TaskException( "Can't set a property with parent
scope when context " +
- " has no parent" );
+ final String message = REZ.getString( "no-parent.error" );
+ throw new TaskException( message );
}
else
{
@@ -172,7 +180,8 @@
}
else
{
- throw new IllegalStateException( "Unknown property scope! (" +
scope + ")" );
+ final String message = REZ.getString( "bad-scope.error", scope );
+ throw new IllegalStateException( message );
}
}
@@ -208,21 +217,21 @@
{
if( BASE_DIRECTORY.equals( name ) && !( value instanceof File ) )
{
- throw new TaskException( "Property " + BASE_DIRECTORY +
- " must have a value of type " +
- File.class.getName() );
+ final String message =
+ REZ.getString( "bad-property.error", BASE_DIRECTORY,
File.class.getName() );
+ throw new TaskException( message );
}
else if( NAME.equals( name ) && !( value instanceof String ) )
{
- throw new TaskException( "Property " + NAME +
- " must have a value of type " +
- String.class.getName() );
+ final String message =
+ REZ.getString( "bad-property.error", NAME,
String.class.getName() );
+ throw new TaskException( message );
}
else if( JAVA_VERSION.equals( name ) && !( value instanceof
JavaVersion ) )
{
- throw new TaskException( "Property " + JAVA_VERSION +
- " must have a value of type " +
- JavaVersion.class.getName() );
+ final String message =
+ REZ.getString( "bad-property.error", JAVA_VERSION,
JavaVersion.class.getName() );
+ throw new TaskException( message );
}
}
}
1.2 +9 -1
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/Resources.properties
Index: Resources.properties
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/Resources.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Resources.properties 2001/08/29 15:34:58 1.1
+++ Resources.properties 2001/08/29 16:01:51 1.2
@@ -8,4 +8,12 @@
skip-target.notice=Skipping target {0} as it does not satisfy condition.
condition-eval.error=Error evaluating Condition for target {0}.
exec-target.notice=Executing target {0}.
-exec-task.notice=Executing task {0}.
\ No newline at end of file
+exec-task.notice=Executing task {0}.
+
+#DefaultTaskContext
+no-version.error=No JavaVersion in Context.
+no-name.error=No Name in Context.
+no-dir.error=No Base Directory in Context.
+no-parent.error=Can't set a property with parent scope when context has no
parent.
+bad-scope.error=Unknown property scope! ({0}).
+bad-property.error=Property {0} must have a value of type {1}.
\ No newline at end of file