/** * Configure and start SaaS artefacts * @param dm a deployment model * @throws MalformedURLException */ private void configureSaas(List<ArtefactInstance> artefacts) { Connector jc; for(ArtefactInstance x : artefacts){ if(!alreadyStarted.contains(x)){ NodeInstance ownerNode = x.getDestination(); Node n=ownerNode.getType(); jc=ConnectorFactory.createConnector(n.getProvider()); //jc=new JCloudsConnector(n.getProvider().getName(), n.getProvider().getLogin(), n.getProvider().getPasswd()); String configurationCommand=x.getType().getResource().getConfigurationResourceCommand(); String startCommand= x.getType().getResource().getStartResourceCommand(); configureAndStart(jc, n, ownerNode, configurationCommand, startCommand); alreadyStarted.add(x); jc.closeConnection(); } } }
/** * Build the paas of an artefact instance * @param x An artefactInstance * @throws MalformedURLException */ private void buildPaas(ArtefactInstance x, List<BindingInstance> bindings) { NodeInstance ownerNode = x.getDestination(); Node n=ownerNode.getType(); Connector jc; jc=ConnectorFactory.createConnector(n.getProvider()); //jc=new JCloudsConnector(n.getProvider().getName(), n.getProvider().getLogin(), n.getProvider().getPasswd()); for(BindingInstance bi : bindings){ if(!bi.getClient().getType().getIsOptional() && x.getRequired().contains(bi.getClient())){ ServerPortInstance p=bi.getServer(); NodeInstance owner=p.getOwner().getDestination(); if(owner == null) owner=ownerNode; if(!alreadyDeployed.contains(p.getOwner())){ jc.execCommand(owner.getId(), p.getOwner().getType().getResource().getRetrievingResourceCommand() ,"ubuntu",n.getPrivateKey()); jc.execCommand(owner.getId(), p.getOwner().getType().getResource().getDeployingResourceCommand(),"ubuntu",n.getPrivateKey()); String configurationCommand=p.getOwner().getType().getResource().getConfigurationResourceCommand(); String startCommand=p.getOwner().getType().getResource().getStartResourceCommand(); configureAndStart(jc, n, owner, configurationCommand, startCommand); alreadyDeployed.add(p.getOwner()); alreadyStarted.add(p.getOwner()); } } } jc.closeConnection(); }
kr.setRetrievingCommand(a.getResource().getRetrievingResourceCommand()); kr.setConfigurationCommand(a.getResource().getConfigurationResourceCommand()); kr.setStartCommand(a.getResource().getStartResourceCommand()); kr.setStopCommand(a.getResource().getStopResourceCommand()); cr.setConfigurationCommand(b.getClientResource().getConfigurationResourceCommand()); if (b.getClientResource().getStartResourceCommand() != null) { cr.setStartCommand(b.getClientResource().getStartResourceCommand()); cr.setConfigurationCommand(b.getServerResource().getConfigurationResourceCommand()); if (b.getServerResource().getStartResourceCommand() != null) { cr.setStartCommand(b.getServerResource().getStartResourceCommand());