{
realm.loadClass( descriptor.getImplementation() );
}
catch ( ClassNotFoundException e )
{
throw new ComponentInstantiationException( "Could not load implementation class for component "
+ descriptor.getHumanReadableKey() + " from class realm " + realm, e );
}
catch ( LinkageError e )
{
throw new ComponentInstantiationException( "Could not load implementation class for component "
+ descriptor.getHumanReadableKey() + " from class realm " + realm, e );
}
}
ObjectRecipe recipe = new ObjectRecipe( implClass,
factoryMethod,
constructorArgNames,
constructorArgTypes);
recipe.allow(Option.FIELD_INJECTION);
recipe.allow(Option.PRIVATE_PROPERTIES);
// MapOrientedComponents don't get normal injection
if (!MapOrientedComponent.class.isAssignableFrom( implClass )) {
for (ComponentRequirement requirement : descriptor.getRequirements() ) {
String name = requirement.getFieldName();
RequirementRecipe requirementRecipe = new RequirementRecipe(descriptor, requirement, getContainer(), name == null);
if (name != null) {
recipe.setProperty(name, requirementRecipe);
} else {
recipe.setAutoMatchProperty(requirement.getRole(), requirementRecipe);
}
}
// add configuration data
if (shouldConfigure(descriptor )) {
PlexusConfiguration configuration = descriptor.getConfiguration();
if (configuration != null) {
for (String name : configuration.getAttributeNames()) {
String value;
try {
value = configuration.getAttribute(name);
} catch (PlexusConfigurationException e) {
throw new ComponentInstantiationException("Error getting value for attribute " + name, e);
}
name = fromXML(name);
recipe.setProperty(name, value);
}
for (PlexusConfiguration child : configuration.getChildren()) {