use of org.apache.aries.samples.goat.api.RelationshipInfo in project aries by apache.
the class ModelInfoEnhancerService method removeSyntheticServiceArtefactsAndNotifyListeners.
private void removeSyntheticServiceArtefactsAndNotifyListeners(RelationshipInfo r) {
// We need to remove our two relationships and the synthetic
// component
String componentId = constructServiceComponentId(r);
// Do the relationships first
// The registration has type "service registration", and the
// original provider and name
String registrationRelationshipId = SERVICE_REGISTRATION + "/" + r.getName() + "/" + r.getProvidedBy().getId();
RelationshipInfo registrationRelationship = relationships.get(registrationRelationshipId);
// The consumers have type "service usage", and the
// original name, and the new provided by
String usageRelationshipId = SERVICE_USAGE + "/" + r.getName() + "/" + componentId;
RelationshipInfo usageRelationship = relationships.get(usageRelationshipId);
relationships.remove(usageRelationshipId);
relationships.remove(registrationRelationshipId);
for (RelationshipInfoListener listener : rlisteners) {
if (usageRelationship != null) {
listener.removeRelationship(usageRelationship);
}
if (registrationRelationship != null) {
listener.removeRelationship(registrationRelationship);
}
}
ComponentInfo component = components.remove(componentId);
if (component != null) {
// Tell our listeners their service component went away
for (ComponentInfoListener listener : clisteners) {
listener.removeComponent(component);
}
}
}
Aggregations