use of org.apache.aries.samples.goat.info.RelationshipInfoImpl in project aries by apache.
the class ModelInfoEnhancerService method updateSyntheticServiceArtefactsAndNotifyListeners.
private void updateSyntheticServiceArtefactsAndNotifyListeners(RelationshipInfo r) {
// We need to update our two relationships and the synthetic
// component
// Hopefully the thing which changed won't prevent us
// from finding our relationship
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();
RelationshipInfoImpl registrationRelationship = (RelationshipInfoImpl) relationships.get(registrationRelationshipId);
registrationRelationship.setName(r.getName());
registrationRelationship.setRelationshipAspects(r.getRelationshipAspects());
// The consumers have type "service usage", and the
// original name, and the new provided by
String usageRelationshipId = SERVICE_USAGE + "/" + r.getName() + "/" + componentId;
RelationshipInfoImpl usageRelationship = (RelationshipInfoImpl) relationships.get(usageRelationshipId);
// The consumers may have changed, so we update the usage relationship
usageRelationship.setConsumedBy(r.getConsumedBy());
usageRelationship.setName(r.getName());
usageRelationship.setRelationshipAspects(r.getRelationshipAspects());
for (RelationshipInfoListener listener : rlisteners) {
if (usageRelationship != null) {
listener.updateRelationship(usageRelationship);
}
if (registrationRelationship != null) {
listener.updateRelationship(registrationRelationship);
}
}
ComponentInfo component = components.get(componentId);
if (component != null) {
// Tell our listeners their service component was updated
for (ComponentInfoListener listener : clisteners) {
listener.updateComponent(component);
}
}
}
Aggregations