private Context setupContext( final Configuration conf, final Context parentContext )
throws Exception
{
//FIXME(GP): This method should setup the Context object according to the
// configuration spec.
final DefaultContext context = new OverridableContext( parentContext );
final Configuration[] confs = conf.getChildren( "entry" );
for( int i = 0; i < confs.length; i++ )
{
final String key = confs[ i ].getAttribute( "name" );
final String value = confs[ i ].getAttribute( "value", null );
if( value == null )
{
String clazz = confs[ i ].getAttribute( "class" );
Object obj = getClass().getClassLoader().loadClass( clazz ).newInstance();
context.put( key, obj );
if( getLogger().isInfoEnabled() )
{
getLogger().info( "FortressTestCase: added an instance of class "
+ clazz + " to context entry " + key );
}
}
else
{
context.put( key, value );
if( getLogger().isInfoEnabled() )
{
getLogger().info( "FortressTestCase: added value \"" + value
+ "\" to context entry " + key );
}
}
}
addContext( context );
context.makeReadOnly();
return context;
}