@@ -51,6 +51,58 @@ public class ClassicConfigurer
m_converter = (Converter)serviceManager.lookup( Converter.ROLE );
m_converter = (Converter)serviceManager.lookup( Converter.ROLE );
}
}
/**
* Configure an object based on a configuration in a particular context.
* This configuring can be done in different ways for different
* configurers.
*
* The implementation of this method should only use the methods
* specified by the supplied class. It is an error for the specified
* class not to be a base class or interface compatible with specified
* object.
*
* @param object the object
* @param clazz the Class object to use during configuration
* @param configuration the configuration
* @param context the Context
* @exception ConfigurationException if an error occurs
*/
public void configureElement( Object object,
Class clazz,
Configuration configuration,
TaskContext context )
throws ConfigurationException
{
throw new UnsupportedOperationException();
}
/**
* Configure named attribute of object in a particular context.
* This configuring can be done in different ways for different
* configurers.
*
* The implementation of this method should only use the methods
* specified by the supplied class. It is an error for the specified
* class not to be a base class or interface compatible with specified
* object.
*
* @param object the object
* @param clazz the Class object to use during configuration
* @param name the attribute name
* @param value the attribute value
* @param context the Context
* @exception ConfigurationException if an error occurs
*/
public void configureAttribute( Object object,
Class clazz,
String name,
String value,
TaskContext context )
throws ConfigurationException
{
throw new UnsupportedOperationException();
}
/**
/**
* Configure a task based on a configuration in a particular context.
* Configure a task based on a configuration in a particular context.
* This configuring can be done in different ways for different
* This configuring can be done in different ways for different
@@ -65,8 +117,8 @@ public class ClassicConfigurer
* @exception ConfigurationException if an error occurs
* @exception ConfigurationException if an error occurs
*/
*/
public void configureElement( final Object object,
public void configureElement( final Object object,
final Configuration configuration,
final TaskContext context )
final Configuration configuration,
final TaskContext context )
throws ConfigurationException
throws ConfigurationException
{
{
if( DEBUG )
if( DEBUG )
@@ -106,7 +158,7 @@ public class ClassicConfigurer
getLogger().debug( message );
getLogger().debug( message );
}
}
c onfigureAttribute( object, name, value, context );
doC onfigureAttribute( object, name, value, context );
}
}
final Configuration[] children = configuration.getChildren();
final Configuration[] children = configuration.getChildren();
@@ -122,7 +174,7 @@ public class ClassicConfigurer
getLogger().debug( message );
getLogger().debug( message );
}
}
c onfigureElement( object, child, context );
doC onfigureElement( object, child, context );
}
}
final String content = configuration.getValue( null );
final String content = configuration.getValue( null );
@@ -155,12 +207,12 @@ public class ClassicConfigurer
* @exception ConfigurationException if an error occurs
* @exception ConfigurationException if an error occurs
*/
*/
public void configureAttribute( final Object object,
public void configureAttribute( final Object object,
final String name,
final String value,
final TaskContext context )
final String name,
final String value,
final TaskContext context )
throws ConfigurationException
throws ConfigurationException
{
{
c onfigureAttribute( object, name, value, context );
doC onfigureAttribute( object, name, value, context );
}
}
/**
/**
@@ -179,10 +231,10 @@ public class ClassicConfigurer
setValue( object, "addContent", content, context );
setValue( object, "addContent", content, context );
}
}
private void c onfigureAttribute( final Object object,
final String name,
final String value,
final TaskContext context )
private void doC onfigureAttribute( final Object object,
final String name,
final String value,
final TaskContext context )
throws ConfigurationException
throws ConfigurationException
{
{
final String methodName = getMethodNameFor( name );
final String methodName = getMethodNameFor( name );
@@ -431,9 +483,9 @@ public class ClassicConfigurer
return sb.toString();
return sb.toString();
}
}
private void c onfigureElement( final Object object,
final Configuration configuration,
final TaskContext context )
private void doC onfigureElement( final Object object,
final Configuration configuration,
final TaskContext context )
throws ConfigurationException
throws ConfigurationException
{
{
final String name = configuration.getName();
final String name = configuration.getName();
@@ -474,7 +526,7 @@ public class ClassicConfigurer
try
try
{
{
final Object created = method.invoke( object, new Object[ 0 ] );
final Object created = method.invoke( object, new Object[ 0 ] );
c onfigureElement( created, configuration, context );
doC onfigureElement( created, configuration, context );
}
}
catch( final ConfigurationException ce )
catch( final ConfigurationException ce )
{
{
@@ -498,7 +550,7 @@ public class ClassicConfigurer
final Class clazz = method.getParameterTypes()[ 0 ];
final Class clazz = method.getParameterTypes()[ 0 ];
final Object created = clazz.newInstance();
final Object created = clazz.newInstance();
c onfigureElement( created, configuration, context );
doC onfigureElement( created, configuration, context );
method.invoke( object, new Object[]{created} );
method.invoke( object, new Object[]{created} );
}
}
catch( final ConfigurationException ce )
catch( final ConfigurationException ce )