package org.gcube.vremanagement.vremodeler.impl.deploy; import java.sql.ResultSet; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import net.java.dev.jaxb.array.StringArray; import org.apache.axis.client.Call; import org.apache.axis.client.Stub; import org.gcube.common.core.utils.logging.GCUBELog; import org.gcube.vremanagement.vremodeler.db.DBInterface; import org.gcube.vremanagement.vremodeler.impl.ServiceContext; import org.gcube.vremanagement.vremodeler.stubs.deployreport.GHNonCloudReport; import org.gcube.vremanagement.vremodeler.stubs.deployreport.State; import org.uoa.eolus.Eolus; import org.uoa.eolus.EolusServiceLocator; import org.uoa.eolus.startContainer; public class DeployGHNsOnCloud{ private static GCUBELog logger= new GCUBELog(DeployGHNsOnCloud.class); int numberOfVMs; private String vreName; private GHNonCloudReport report; public DeployGHNsOnCloud(int numberOfVMs, String vreName) { super(); this.numberOfVMs = numberOfVMs; this.vreName= vreName; this.report= new GHNonCloudReport(); this.report.setState(State.Waiting); } public GHNonCloudReport getReport() { return report; } /** * * @return * @throws Exception */ public GHNstoUse run() throws Exception{ this.report.setState(State.Running); String username = "gcube"; String password = "gcube.cloud.2010"; EolusServiceLocator servicelocator = new EolusServiceLocator(); Eolus eolus = servicelocator.getEolusPort(); ((Stub) eolus)._setProperty(Call.USERNAME_PROPERTY, username); ((Stub) eolus)._setProperty(Call.PASSWORD_PROPERTY, password); //filling the report report.setDeployingState(new State[numberOfVMs]); Arrays.fill(report.getDeployingState(), State.Waiting); VM[] hostnames=createVMs(eolus); configureAndStartContainers(eolus, hostnames); //waiting few seconds for GHN registration Thread.sleep(60000); checkGHNAvailability(hostnames); //now we can be sure that the GHNs are registered on the IS //and the return type can be created GHNstoUse ghnToUse= new GHNstoUse(); ghnToUse.setCandidateForRM(hostnames[0].getGhnId()); List ghns= new ArrayList(hostnames.length-1); for (int i=1; i 2) { this.report.getDeployingState()[i]= State.Failed; logger.trace("std error "+res[1]); } } //waiting few seconds before start the container Thread.sleep(60000); //starting the containers for (int i=0; i