Browse Source

Update to use new Service based access-point

Submitted By: "Adam Murdoch" <adammurdoch_ml@yahoo.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270851 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
af9fedaddc
2 changed files with 6 additions and 25 deletions
  1. +2
    -23
      proposal/myrmidon/src/java/org/apache/antlib/core/Property.java
  2. +4
    -2
      proposal/myrmidon/src/java/org/apache/antlib/core/Resources.properties

+ 2
- 23
proposal/myrmidon/src/java/org/apache/antlib/core/Property.java View File

@@ -9,8 +9,6 @@ package org.apache.antlib.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.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
@@ -18,9 +16,7 @@ import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.AbstractContainerTask;
import org.apache.myrmidon.framework.DataType;
import org.apache.myrmidon.interfaces.type.TypeException;
import org.apache.myrmidon.interfaces.type.TypeFactory;
import org.apache.myrmidon.interfaces.type.TypeManager;

/**
* This is the property "task" to declare a binding of a datatype to a name.
@@ -41,24 +37,6 @@ public class Property
private String m_name;
private Object m_value;
private boolean m_localScope = true;
private TypeFactory m_factory;

public void compose( final ComponentManager componentManager )
throws ComponentException
{
super.compose( componentManager );

final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE );
try
{
m_factory = typeManager.getFactory( DataType.ROLE );
}
catch( final TypeException te )
{
final String message = REZ.getString( "property.bad-factory.error" );
throw new ComponentException( message, te );
}
}

public void configure( final Configuration configuration )
throws ConfigurationException
@@ -76,7 +54,8 @@ public class Property
{
try
{
final DataType value = (DataType)m_factory.create( children[ i ].getName() );
final TypeFactory typeFactory = getTypeFactory( DataType.ROLE );
final DataType value = (DataType)typeFactory.create( children[ i ].getName() );
configure( value, children[ i ] );
setValue( value );
}


+ 4
- 2
proposal/myrmidon/src/java/org/apache/antlib/core/Resources.properties View File

@@ -1,4 +1,3 @@
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.
@@ -23,4 +22,7 @@ convert.bad-url.error=Error converting object ({0}) to URL.
getByName.error=Failed to retrieve enum by calling getByName on "{0}". (Reason: {1}).
enum.missing.getByName.error=Enum class "{0}" is missing a public static method named "getByName" that accepts a single string parameter.
enum.missing.getNames.error=Enum class "{0}" is missing a public static method named "getNames" that returns a String array of all enum names.
invalid.enum.error=Invalid value "{0}" for enum, expected one of {1}.
invalid.enum.error=Invalid value "{0}" for enum, expected one of {1}.

if.ifelse-duplicate.error=Can only set one of if/else for If task type.
if.no-condition.error=No condition was specified for If task.

Loading…
Cancel
Save