private InternalComponentInstance findClient(Deployment container) throws IllegalStateException { final InternalComponentInstance clientComponent = container.getComponentInstances().onlyInternals().firstNamed(client); if (clientComponent == null) { final String error = String.format("Unable to find the internal component instance '%s'", client); throw new IllegalStateException(error); } return clientComponent; } }
@Override public void handle(ViewComponentInstance command) { if (isDeploymentLoaded()) { final ComponentInstance instance = deploy.getComponentInstances().onlyInternals().firstNamed(command.getComponentId()); if (instance == null) { final String text = String.format("No artefact instance with ID \"%s\"", command.getComponentId()); final Message message = new Message(command, Category.ERROR, text); dispatch(message); } else { final ComponentInstanceData data = new ComponentInstanceData(command, instance); dispatch(data); } } else { reportNoDeploymentLoaded(command); } }
@Override public InternalComponentInstance applyTo(Deployment target) { final String instanceName = getLibrary().createUniqueComponentInstanceName(target, type); InternalComponentInstanceBuilder builder = anInternalComponentInstance() .named(instanceName) .ofType(type.getName()) .hostedBy(host.getName()); builder.integrateIn(target); InternalComponentInstance instance = target.getComponentInstances().onlyInternals().firstNamed(instanceName); resolveDependencies(target, instance); return instance; }
@Override public ComponentInstance applyTo(Deployment target) { ComponentInstance result=null; if(instance.isInternal()){ final String instanceName = getLibrary().createUniqueComponentInstanceName(target, instance.asInternal().getType()); InternalComponentInstanceBuilder builder = anInternalComponentInstance() .named(instanceName) .ofType(instance.asInternal().getType().getName()) .hostedBy(host.getName()); builder.integrateIn(target); result = target.getComponentInstances().onlyInternals().firstNamed(instanceName); } if(instance.isExternal()){ result=getLibrary().provision(target, instance.getType()); } return result; }