/** * Retrieve the resources associated to an InternalComponent * * @param x the internalComponent we want to retrieve the resource * @param owner the externalComponent on which the resources will be * downloaded * @param jc the connector used to trigger the commands */ private void executeRetrieveCommand(InternalComponentInstance x, VMInstance owner, Connector jc) { unlessNotNull("Cannot retrieve resources of null!", x, owner, jc); for (Resource r : x.getType().getResources()) { if (!r.getRetrieveCommand().equals("")) { if (r.getRequireCredentials()) jc.execCommand(owner.getId(), CloudMLQueryUtil.cloudmlStringRecover(r.getRetrieveCommand(), r, x) + " " + owner.getType().getProvider().getCredentials().getLogin() + "" + owner.getType().getProvider().getCredentials().getPassword(), "ubuntu", owner.getType().getPrivateKey()); else executeCommand(owner, jc, CloudMLQueryUtil.cloudmlStringRecover(r.getRetrieveCommand(), r, x)); } } }
if(server.getRetrieveCommand() != null && !server.getRetrieveCommand().equals("")) jcServer.execCommand(ownerVMServer.getId(), CloudMLQueryUtil.cloudmlStringRecover(server.getRetrieveCommand(), server, bi) + " \"" + ipAddress + "\" \"" + destinationIpAddress + "\" " + destinationPortNumber, "ubuntu", VMserver.getPrivateKey()); if(client.getRetrieveCommand() != null && !client.getRetrieveCommand().equals("")) jcClient.execCommand(ownerVMClient.getId(), CloudMLQueryUtil.cloudmlStringRecover(client.getRetrieveCommand(), client, bi) + " \"" + ipAddress + "\" \"" + destinationIpAddress + "\" " + destinationPortNumber, "ubuntu", VMClient.getPrivateKey());
private void setResourceProperties(Resource r, net.cloudml.core.Resource kr){ kr.setName(r.getName()); kr.setInstallCommand(r.getInstallCommand()); kr.setDownloadCommand(r.getRetrieveCommand()); kr.setConfigureCommand(r.getConfigureCommand()); kr.setStartCommand(r.getStartCommand()); kr.setStopCommand(r.getStopCommand()); kr.setRequireCredentials(r.getRequireCredentials()); kr.setExecuteLocally(r.getExecuteLocally()); convertProperties(r,kr,factory); String kup = ""; for (Map.Entry<String, String> up: r.getUploadCommand().entrySet()) { kup += up.getKey() + " " + up.getValue() + ";"; } kr.setUploadCommand(kup); }
jc = ConnectorFactory.createIaaSConnector(n.getProvider()); jc.execCommand(ownerVM.getId(), r.getRetrieveCommand(), "ubuntu", n.getPrivateKey()); if (r.getConfigureCommand() != null) { String configurationCommand = r.getConfigureCommand() + " \"" + ipAddress + "\" \"" + destinationIpAddress + "\" " + destinationPortNumber;
return; // ignore configuration if there is no resource at all if(clientResource.getRetrieveCommand() != null && !clientResource.getRetrieveCommand().equals("")) jcClient.execCommand(ownerVMClient.getId(), clientResource.getRetrieveCommand() + " \"" + ipAddress + "\" \"" + destinationIpAddress + "\" " + destinationPortNumber, "ubuntu", VMClient.getPrivateKey()); if(clientResource.getConfigureCommand() != null && !clientResource.getConfigureCommand().equals("")){ String configurationCommand = clientResource.getConfigureCommand() + " \"" + ipAddress + "\" \"" + destinationIpAddress + "\" " + destinationPortNumber;
cr.setInstallCommand(relationship.getClientResource().getInstallCommand()); if (relationship.getClientResource().getRetrieveCommand() != null) { cr.setDownloadCommand(relationship.getClientResource().getRetrieveCommand()); cr.setInstallCommand(relationship.getServerResource().getInstallCommand()); if (relationship.getServerResource().getRetrieveCommand() != null) { cr.setDownloadCommand(relationship.getServerResource().getRetrieveCommand());