{
Validate.notNull(roleConfiguration,"roleConfiguration");
Validate.notNull(logger,"logger");
ArrayList result = new ArrayList();
ServiceComponent serviceComponent = null;
// create an appropriate instance of role configuration parser
RoleConfigurationParser roleConfigurationParser =
this.createRoleConfigurationParser();
// extract the role entries
RoleEntry[] roleEntryList = roleConfigurationParser.parse(roleConfiguration);
// get the default interceptors defined for the container
ArrayList defaultInterceptorList = this.getDefaultInterceptorServiceList();
// create the service components based on the role entries
for ( int i=0; i<roleEntryList.length; i++ )
{
try
{
// add the default interceptors to all role entries
RoleEntry roleEntry = roleEntryList[i];
if( this.hasDynamicProxies() )
{
roleEntry.addInterceptors(defaultInterceptorList);
}
else
{
roleEntry.setHasDynamicProxy(false);
}
serviceComponent = new AvalonServiceComponentImpl(
roleEntry,
this.getLogger(),
logger,
this.readWriteLock
);
result.add( serviceComponent );
}
catch( Throwable t )
{
String msg = "Failed to load the service " + serviceComponent.getName();
this.getLogger().error( msg, t );
throw new ConfigurationException( msg, t );
}
}