private void addExecutes(){ addedExecutes = new ArrayList<ExecuteInstance>(targetDM.getExecuteInstances()); addedExecutes.removeAll(matchingExecutes.values()); for (ExecuteInstance ei : addedExecutes) { int i = currentDM.getComponentInstances().toList().indexOf(ei.getRequiredEnd().getOwner().get()); if (i >= 0) { ComponentInstance a = currentDM.getComponentInstances().toList().get(i); ei.setRequiredEnd(((InternalComponentInstance) a).getRequiredExecutionPlatform()); } i = currentDM.getComponentInstances().toList().indexOf(ei.getProvidedEnd().getOwner().get()); if (i >= 0) { ComponentInstance a = currentDM.getComponentInstances().toList().get(i); int j = a.getProvidedExecutionPlatforms().toList().indexOf(ei.getProvidedEnd()); List<ProvidedExecutionPlatformInstance> l = a.getProvidedExecutionPlatforms().toList(); ei.setProvidedEnd(l.get(j)); } } }
private void addRelationships() { addedRelationships = new ArrayList<RelationshipInstance>(targetDM.getRelationshipInstances()); addedRelationships.removeAll(matchingRelationships.values()); for (RelationshipInstance ni : addedRelationships) { int i = currentDM.getComponentInstances().toList().indexOf(ni.getRequiredEnd().getOwner().get()); if (i >= 0) { ComponentInstance a = currentDM.getComponentInstances().toList().get(i); if (a.isInternal()) { int j = ((InternalComponentInstance) a).getRequiredPorts().toList().indexOf(ni.getRequiredEnd()); ni.setRequiredEnd(((InternalComponentInstance) a).getRequiredPorts().toList().get(j)); } } i = currentDM.getComponentInstances().toList().indexOf(ni.getProvidedEnd().getOwner().get()); if (i >= 0) { ComponentInstance a = currentDM.getComponentInstances().toList().get(i); int j = a.getProvidedPorts().toList().indexOf(ni.getProvidedEnd()); List<ProvidedPortInstance> l = a.getProvidedPorts().toList(); ni.setProvidedEnd(l.get(j)); } } }
@Override public void handle(ListComponentInstances command) { if (isDeploymentLoaded()) { final Collection<ComponentInstance<? extends Component>> instances = deploy.getComponentInstances().toList(); final ComponentInstanceList data = new ComponentInstanceList(command, instances); dispatch(new Message(command, Category.INFORMATION, data.toString())); dispatch(data); } else { reportNoDeploymentLoaded(command); } }