public ExternalComponentInstanceGroup onlyExternals() { final ExternalComponentInstanceGroup externalInstances = new ExternalComponentInstanceGroup(); for (final T instance: this) { if (instance.isExternal()) { externalInstances.add(instance.asExternal()); } } return externalInstances; }
public void externalComponentInstancesToPOJO(List<net.cloudml.core.ExternalComponentInstance> componentInstances) { int counter = 0; for (net.cloudml.core.ExternalComponentInstance kc: componentInstances) { externalComponentInstanceToPOJO((net.cloudml.core.ExternalComponentInstance) kc); counter++; } assert counter == model.getComponentInstances().onlyExternals().size(); assert externalComponentInstances.size() == counter; }
setExternalServices(new ExternalComponentInstanceGroup(diff.getAddedECs()).onlyExternals()); setAllEnvVarComponent(targetModel); prepareComponents(new ComponentInstanceGroup(diff.getAddedComponents()), targetModel.getRelationshipInstances());
public Deployment scaleOut(ExternalComponentInstance eci, Provider provider){ if(eci.isVM()){ scaleOut(eci.asVM(),provider); return currentModel; }else{ Deployment targetModel=cloneCurrentModel(); ExternalComponentInstance eci2=targetModel.getComponentInstances().onlyExternals().firstNamed(eci.getName()); ExternalComponent ec=eci2.getType().asExternal(); ec.setProvider(provider); eci2.setStatus(ComponentInstance.State.STOPPED); dep.deploy(targetModel); return targetModel; } }
public net.cloudml.core.CloudMLModel toKMF(Deployment deploy) { kDeploy.setName(deploy.getName()); convertProperties(deploy,kDeploy,factory); providersToKmf(deploy.getProviders().toList()); externalComponentToKmf(deploy.getComponents().onlyExternals().toList()); internalComponentsToKmf(deploy.getComponents().onlyInternals().toList()); externalComponentInstanceToKmf(deploy.getComponentInstances().onlyExternals().toList()); internalComponentInstancesToKmf(deploy.getComponentInstances().onlyInternals().toList()); executesToKmf(deploy.getExecuteInstances().toList()); relationshipsToKmf(deploy.getRelationships()); relationshipInstancesToKmf(deploy.getRelationshipInstances().toList()); return kDeploy; }
setExternalServices(new ExternalComponentInstanceGroup(diff.getAddedECs()).onlyExternals()); setAllEnvVarComponent(currentModel); prepareComponents(new ComponentInstanceGroup(diff.getAddedComponents()), targetModel.getRelationshipInstances());
@Override public void handle(Burst command){ dispatch(new Message(command, Category.INFORMATION, "Bursting out External Component: " + command.getEcId()+" to "+ command.getProviderID())); VMInstance vmi = deploy.getComponentInstances().onlyVMs().withID(command.getEcId()); Provider p=deploy.getProviders().firstNamed(command.getProviderID()); if(p == null){ dispatch(new Message(command, Category.ERROR, "Cannot find a Provider with this ID!")); return; } if (vmi == null) { ExternalComponentInstance eci=deploy.getComponentInstances().onlyExternals().firstNamed(command.getEcId()); if(eci == null){ dispatch(new Message(command, Category.ERROR, "Cannot find a External component with this ID!")); }else{ deployer.scaleOut(eci,p); } } else { deployer.scaleOut(vmi,p); } }