Browse Source

Update to latest converter architecture

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271490 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
ecbd9e5237
5 changed files with 12 additions and 10 deletions
  1. +8
    -6
      proposal/myrmidon/src/java/org/apache/antlib/vfile/StringToFileObjectConverter.java
  2. +1
    -1
      proposal/myrmidon/src/test/org/apache/myrmidon/components/configurer/StringToMyRole1Converter.java
  3. +1
    -1
      proposal/myrmidon/src/test/org/apache/myrmidon/components/deployer/TestConverter1.java
  4. +1
    -1
      proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/StringToMyRole1Converter.java
  5. +1
    -1
      proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/TestConverter1.java

+ 8
- 6
proposal/myrmidon/src/java/org/apache/antlib/vfile/StringToFileObjectConverter.java View File

@@ -22,7 +22,8 @@ import org.apache.myrmidon.converter.ConverterException;
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
* @ant:converter source="java.lang.String" destination="org.apache.aut.vfs.FileObject" * @ant:converter source="java.lang.String" destination="org.apache.aut.vfs.FileObject"
*/ */
public class StringToFileObjectConverter extends AbstractConverter
public class StringToFileObjectConverter
extends AbstractConverter
{ {
private final static Resources REZ = private final static Resources REZ =
ResourceManager.getPackageResources( StringToFileObjectConverter.class ); ResourceManager.getPackageResources( StringToFileObjectConverter.class );
@@ -35,22 +36,23 @@ public class StringToFileObjectConverter extends AbstractConverter
/** /**
* Converts a String into a FileObject. * Converts a String into a FileObject.
*/ */
protected Object convert( Object original, Context context )
protected Object convert( final Object original, final Object context )
throws ConverterException throws ConverterException
{ {
final String fileUri = (String)original;
final String uri = (String)original;
final TaskContext taskContext = (TaskContext)context; final TaskContext taskContext = (TaskContext)context;


try try
{ {
final FileSystemManager manager = (FileSystemManager)taskContext.getService( FileSystemManager.class );
final FileSystemManager manager =
(FileSystemManager)taskContext.getService( FileSystemManager.class );


// TODO - change TaskContext.getBaseDirectory() to return a FileObject // TODO - change TaskContext.getBaseDirectory() to return a FileObject
return manager.resolveFile( taskContext.getBaseDirectory(), fileUri );
return manager.resolveFile( taskContext.getBaseDirectory(), uri );
} }
catch( Exception e ) catch( Exception e )
{ {
final String message = REZ.getString( "bad-convert-string-to-file.error", fileUri );
final String message = REZ.getString( "bad-convert-string-to-file.error", uri );
throw new ConverterException( message, e ); throw new ConverterException( message, e );
} }
} }


+ 1
- 1
proposal/myrmidon/src/test/org/apache/myrmidon/components/configurer/StringToMyRole1Converter.java View File

@@ -24,7 +24,7 @@ public class StringToMyRole1Converter
super( String.class, MyRole1.class ); super( String.class, MyRole1.class );
} }


protected Object convert( Object original, Context context )
protected Object convert( Object original, Object context )
throws ConverterException throws ConverterException
{ {
return new MyType1(); return new MyType1();


+ 1
- 1
proposal/myrmidon/src/test/org/apache/myrmidon/components/deployer/TestConverter1.java View File

@@ -22,7 +22,7 @@ public class TestConverter1
/** /**
* Convert original to destination type. * Convert original to destination type.
*/ */
public Object convert( Class destination, Object original, Context context )
public Object convert( Class destination, Object original, Object context )
throws ConverterException throws ConverterException
{ {
return new TestType1(); return new TestType1();


+ 1
- 1
proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/StringToMyRole1Converter.java View File

@@ -24,7 +24,7 @@ public class StringToMyRole1Converter
super( String.class, MyRole1.class ); super( String.class, MyRole1.class );
} }


protected Object convert( Object original, Context context )
protected Object convert( Object original, Object context )
throws ConverterException throws ConverterException
{ {
return new MyType1(); return new MyType1();


+ 1
- 1
proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/TestConverter1.java View File

@@ -22,7 +22,7 @@ public class TestConverter1
/** /**
* Convert original to destination type. * Convert original to destination type.
*/ */
public Object convert( Class destination, Object original, Context context )
public Object convert( Class destination, Object original, Object context )
throws ConverterException throws ConverterException
{ {
return new TestType1(); return new TestType1();


Loading…
Cancel
Save