use of org.osgi.service.blueprint.reflect.ValueMetadata in project aries by apache.
the class AbstractPropertyPlaceholder method processServiceReferenceMetadata.
private Metadata processServiceReferenceMetadata(ServiceReferenceMetadata component) {
if (component instanceof MutableServiceReferenceMetadata) {
ValueMetadata valueMetadata = ((MutableServiceReferenceMetadata) component).getExtendedFilter();
if (valueMetadata != null) {
((MutableServiceReferenceMetadata) component).setExtendedFilter(doProcessValueMetadata(valueMetadata));
}
}
for (ReferenceListener listener : component.getReferenceListeners()) {
Target listenerComponent = listener.getListenerComponent();
try {
processingStack.add("Reference Listener " + listenerComponent + "->");
if (listener instanceof MutableReferenceListener) {
((MutableReferenceListener) listener).setListenerComponent((Target) processMetadata(listenerComponent));
} else {
//Say that we can't change this listener, but continue processing
//If the value is mutable then we may be ok!
printWarning(listener, "Reference Binding Listener");
processMetadata(listenerComponent);
}
} finally {
processingStack.removeLast();
}
}
return component;
}
use of org.osgi.service.blueprint.reflect.ValueMetadata in project aries by apache.
the class RecipeBuilder method createReferenceRecipe.
private ReferenceRecipe createReferenceRecipe(ReferenceMetadata metadata) {
ValueRecipe filterRecipe = null;
if (metadata instanceof ExtendedReferenceMetadata) {
ValueMetadata filterMetadata = ((ExtendedServiceReferenceMetadata) metadata).getExtendedFilter();
if (filterMetadata != null) {
filterRecipe = (ValueRecipe) getValue(filterMetadata, null);
}
}
CollectionRecipe listenersRecipe = null;
if (metadata.getReferenceListeners() != null) {
listenersRecipe = new CollectionRecipe(getName(null), ArrayList.class, Object.class.getName());
for (ReferenceListener listener : metadata.getReferenceListeners()) {
listenersRecipe.add(createRecipe(listener));
}
}
ReferenceRecipe recipe = new ReferenceRecipe(getName(metadata.getId()), blueprintContainer, metadata, filterRecipe, listenersRecipe, getDependencies(metadata));
return recipe;
}
use of org.osgi.service.blueprint.reflect.ValueMetadata in project aries by apache.
the class AbstractPropertyPlaceholder method processMetadata.
protected Metadata processMetadata(Metadata metadata) {
try {
if (metadata instanceof BeanMetadata) {
BeanMetadata bmd = (BeanMetadata) metadata;
processingStack.add("Bean named " + bmd.getId() + "->");
return processBeanMetadata(bmd);
} else if (metadata instanceof CollectionMetadata) {
CollectionMetadata cmd = (CollectionMetadata) metadata;
processingStack.add("Collection of type " + cmd.getCollectionClass() + "->");
return processCollectionMetadata(cmd);
} else if (metadata instanceof MapMetadata) {
processingStack.add("Map->");
return processMapMetadata((MapMetadata) metadata);
} else if (metadata instanceof PropsMetadata) {
processingStack.add("Properties->");
return processPropsMetadata((PropsMetadata) metadata);
} else if (metadata instanceof ValueMetadata) {
processingStack.add("Value->");
return processValueMetadata((ValueMetadata) metadata);
} else {
processingStack.add("Unknown Metadata " + metadata + "->");
return metadata;
}
} finally {
processingStack.removeLast();
}
}
Aggregations