}
}
private void processMapOrientedComponent(ComponentDescriptor<?> descriptor, MapOrientedComponent mapOrientedComponent, ClassRealm realm) throws ComponentInstantiationException {
MutablePlexusContainer container = getContainer();
for (ComponentRequirement requirement : descriptor.getRequirements()) {
String role = requirement.getRole();
String hint = requirement.getRoleHint();
String mappingType = requirement.getFieldMappingType();
try
{
// if the hint is not empty (and not default), we don't care about mapping type...
// it's a single-value, not a collection.
Object value;
if (StringUtils.isNotEmpty(hint) && !hint.equals(PlexusConstants.PLEXUS_DEFAULT_HINT)) {
value = container.lookup(role, hint);
} else if ("single".equals(mappingType)) {
value = container.lookup(role, hint);
} else if ("map".equals(mappingType)) {
value = container.lookupMap(role);
} else if ("set".equals(mappingType)) {
value = new HashSet<Object>(container.lookupList(role));
} else {
value = container.lookup(role, hint);
}
mapOrientedComponent.addComponentRequirement(requirement, value);
}
catch ( ComponentLookupException e )
{
throw new ComponentInstantiationException( "Error looking up requirement of MapOrientedComponent ", e );
}
catch ( ComponentConfigurationException e )
{
throw new ComponentInstantiationException( "Error adding requirement to MapOrientedComponent ", e );
}
}
MapConverter converter = new MapConverter();
ConverterLookup converterLookup = new DefaultConverterLookup();
DefaultExpressionEvaluator expressionEvaluator = new DefaultExpressionEvaluator();
PlexusConfiguration configuration = container.getConfigurationSource().getConfiguration( descriptor );
if ( configuration != null )
{
try
{