public Deployment(String name) { super(name); this.providers = new LocalProviderGroup(); this.components = new LocalComponentGroup(); this.componentInstances = new LocalComponentInstanceGroup<ComponentInstance<? extends Component>>(); this.relationships = new LocalRelationshipGroup(); this.relationshipInstances = new LocalRelationshipInstanceGroup(); this.executeInstances = new LocalExecuteInstanceGroup(); this.clouds = new LocalCloudGroup(); this.resourcePoolInstances=new LocalResourcePoolGroup(); }
private Boolean isPaaS2PaaS(RelationshipInstance bi){ if(bi.getRequiredEnd().getOwner().get().isInternal()){ if(bi.getProvidedEnd().getOwner().get().isInternal()){ if(!bi.getRequiredEnd().getOwner().get().asInternal().externalHost().isVM() && !bi.getProvidedEnd().getOwner().get().asInternal().externalHost().isVM()){ return true; } } } return false; }
@Override public String toString() { return "VMInstance: " + getName() + " Type:" + getType().getName() + "{\n" + "minRam:" + (getType()).getMinRam() + "\n" + "minCore" + (getType()).getMinCores() + "\n" + "minDisk" + (getType()).getMinStorage() + "\n" + "OS" + (getType()).getOs() + "\n" + "location" + (getType()).getLocation() + "\n" + "publicAdress" + getPublicAddress() + "\n" + "groupName" + (getType()).getGroupName(); }
private int nbVMFromProvider(Provider p){ int n=0; for(VMInstance v: currentModel.getComponentInstances().onlyVMs()){ if(v.getType().getProvider().equals(p)) n++; } return n; }
@Override public String toString() { return "NodeInstance: "+name+" Type:"+type.getName()+"{\n" + "minRam:" + type.getMinRam()+"\n"+ "minCore" + type.getMinCore()+"\n"+ "minDisk" + type.getMinDisk()+"\n"+ "OS" + type.getOS()+"\n"+ "location" + type.getLocation()+"\n"+ "publicAdress" + getPublicAddress()+"\n"+ "groupName" + type.getGroupName(); }
private void unconfigureRelationship(RelationshipInstance b) { if (!b.getRequiredEnd().getType().isLocal()) { RequiredPortInstance client = b.getRequiredEnd(); ProvidedPortInstance server = b.getProvidedEnd(); Resource clientResource = b.getType().getClientResource(); Resource serverResource = b.getType().getServerResource(); //client resources unconfigureWithIP(clientResource, client); //server resources unconfigureWithIP(serverResource, server); } }
private void unconfigureWithIP(Resource r, ArtefactPortInstance i) { Connector jc; if(r != null){ NodeInstance ownerNode = i.getOwner().getDestination(); Node n=ownerNode.getType(); jc=ConnectorFactory.createConnector(n.getProvider()); //jc=new JCloudsConnector(n.getProvider().getName(), n.getProvider().getLogin(), n.getProvider().getPasswd()); jc.execCommand(ownerNode.getId(), r.getStopResourceCommand(),"ubuntu",n.getPrivateKey());; jc.closeConnection(); } }
private void unconfigureBinding(BindingInstance b) { if(b.getClient().getType().getIsRemote()){ ClientPortInstance client=b.getClient(); ServerPortInstance server=b.getServer(); Resource clientResource=b.getType().getClientResource(); Resource serverResource=b.getType().getServerResource(); //client resources unconfigureWithIP(clientResource,client); //server resources unconfigureWithIP(serverResource,server); } }
public boolean isBetween(String demanderName, String demandName, String providerName, String providedName) { return this.getRequiredEnd().getOwner().get().isNamed(demanderName) && this.getRequiredEnd().isNamed(demandName) && this.getProvidedEnd().getOwner().get().isNamed(providerName) && this.getProvidedEnd().isNamed(providedName); }
/** * Create the node described by the given NodeInstance object * * @param a */ public void createNode(NodeInstance a) { Provider p = a.getType().getProvider(); JCloudsConnector jc = new JCloudsConnector(p.getName(), p.getLogin(), p.getPasswd()); jc.createInstance(a); jc.closeConnection(); }
@Override public boolean equals(Object other) { if (other instanceof ArtefactInstance) { ArtefactInstance otherArt = (ArtefactInstance) other; Boolean match= name.equals(otherArt.getName()) && type.equals(otherArt.getType()); if(destination != null) return name.equals(otherArt.getName()) && type.equals(otherArt.getType()) && destination.equals(otherArt.getDestination()); else return match && (otherArt.getDestination() == null); } else { return false; } }
@Override public boolean equals(Object other) { if (other != null && other instanceof ExternalComponent) { ExternalComponent otherComp = (ExternalComponent) other; return isNamed(otherComp.getName()) && this.provider.isNamed(((ExternalComponent) other).getProvider().getName()); } else { return false; } }
public InternalComponentInstance(String name, InternalComponent type) { super(name, type); requiredPortInstances = instantiateAllRequiredPorts(type); requiredExecutionPlatformInstance = type.getRequiredExecutionPlatform().instantiate(); requiredExecutionPlatformInstance.getOwner().set(this); this.status = State.UNINSTALLED; }
private PuppetResource findPuppetResource(ComponentInstance ci){ for(Resource r: ci.getType().getResources()){ if(r instanceof PuppetResource){ if(skeleton == null) skeleton=(PuppetResource)r; return (PuppetResource)r; } } return null; }
public InternalComponent(String name, RequiredExecutionPlatform requiredExecutionPlatform) { super(name); this.requiredPorts = new LocalRequiredPortGroup(); setRequiredExecutionPlatform(requiredExecutionPlatform); }
public void addProvidedExecutionPlatforms(ProvidedExecutionPlatform... platforms) { for (ProvidedExecutionPlatform platform: platforms) { unlessNewAndValidPlatform(platform); this.providedExecutionPlatforms.add(platform); } }