public List<RequiredPortInstance> findClients() { final RelationshipInstanceGroup relationships = getDeployment().getRelationshipInstances().whereEitherEndIs(this); if (relationships.isEmpty()) { final String message = String.format("provided port '%s' is not yet bound to any client", getQualifiedName()); throw new IllegalArgumentException(message); } final List<RequiredPortInstance> clients = new ArrayList<RequiredPortInstance>(); for (RelationshipInstance relationship : relationships) { clients.add(relationship.getRequiredEnd()); } return clients; }
protected void configureBindingOfImpactedComponents(Set<ComponentInstance> listOfAllComponentImpacted, Map<InternalComponentInstance, InternalComponentInstance> duplicatedGraph){ for(InternalComponentInstance ici: duplicatedGraph.values()){ for(ProvidedPortInstance ppi: ici.getProvidedPorts()){ RelationshipInstanceGroup rig=currentModel.getRelationshipInstances().whereEitherEndIs(ppi); manageDuplicatedRelationships(rig, listOfAllComponentImpacted); } for(RequiredPortInstance rpi: ici.getRequiredPorts()){ RelationshipInstanceGroup rig=currentModel.getRelationshipInstances().whereEitherEndIs(rpi); manageDuplicatedRelationships(rig, listOfAllComponentImpacted); } } }
public ProvidedPortInstance findServerPort() { final RelationshipInstanceGroup relationships = getDeployment().getRelationshipInstances().whereEitherEndIs(this); if (relationships.isEmpty()) { final String message = String.format("client port '%s' is not yet bound to any server", getName()); throw new IllegalArgumentException(message); } return relationships.toList().get(0).getProvidedEnd(); }
@Override public Void applyTo(Deployment deployment) { RelationshipInstanceGroup bindings = deployment.getRelationshipInstances().whereEitherEndIs(port); for(RelationshipInstance binding: bindings) { deployment.getRelationshipInstances().remove(binding); } return NOTHING; }
public boolean isBound() { return !getDeployment().getRelationshipInstances().whereEitherEndIs(this).isEmpty(); }