use of org.apache.aries.blueprint.mutable.MutableRegistrationListener in project aries by apache.
the class AbstractPropertyPlaceholder method processServiceMetadata.
protected Metadata processServiceMetadata(ServiceMetadata component) {
try {
if (component instanceof MutableServiceMetadata) {
processingStack.add("Service Component->");
((MutableServiceMetadata) component).setServiceComponent((Target) processMetadata(component.getServiceComponent()));
} else {
printWarning(component, "Service Component");
processingStack.add("Service Component->");
processMetadata(component.getServiceComponent());
}
} finally {
processingStack.removeLast();
}
List<MapEntry> entries = new ArrayList<MapEntry>(component.getServiceProperties());
if (!!!entries.isEmpty()) {
try {
if (component instanceof MutableServiceMetadata) {
processingStack.add("Service Properties->");
MutableServiceMetadata msm = (MutableServiceMetadata) component;
for (MapEntry entry : entries) {
msm.removeServiceProperty(entry);
}
for (MapEntry entry : processMapEntries(entries)) {
msm.addServiceProperty(entry);
}
} else {
printWarning(component, "Service Properties");
processingStack.add("Service Properties->");
processMapEntries(entries);
}
} finally {
processingStack.removeLast();
}
}
for (RegistrationListener listener : component.getRegistrationListeners()) {
Target listenerComponent = listener.getListenerComponent();
try {
processingStack.add("Registration Listener " + listenerComponent + "->");
if (listener instanceof MutableRegistrationListener) {
((MutableRegistrationListener) 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, "Service Registration Listener");
processMetadata(listenerComponent);
}
} finally {
processingStack.removeLast();
}
}
return component;
}
Aggregations