This commit is contained in:
Lucio Lelii 2010-11-08 19:02:22 +00:00
parent 18271f631c
commit cda4d2f4c0
12 changed files with 563 additions and 403 deletions

View File

@ -3,7 +3,7 @@
Version 0.5
REQUIRED INPUT PROPERTIES
INPUT PROPERTIES
This buildfile assumes that the following properties have or may have been defined in a "build.properties" file
in the configuration directory of the service (or else using the -D flag on the command line).
@ -24,6 +24,9 @@ package.<n>: (optional) The package name of the stubs generated from WSDL and/
etics.build: (optional) Set to 'true', it indicates that build structures and procedures
should be optimised for remote builds in ETICS. If it is omitted, this buildfile will optimise build structures and procedures
for local builds.
full.stubs: (optional) Set to 'false', it excludes auxiliary stub code placed under ${package}/stubs when building the stub distribution.
It is intended to simplify realignment of auxiliary and standard stub in IDE environments in case the latter change in non backwards-compatible ways.
After re-alignment, the property is typically left to its default of 'true' to restore a joint build of all stub code.
-->
@ -83,9 +86,10 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
</if>
<property name="full.stubs" value="true"/>
<property name="stubs.package" value="${package}.${stubs.dir.name}"/>
<property name="stubs.dir.name" value="stubs" /> <!-- auxiliary stub classes -->
<property name="stubs.dir" value="${source.dir}/${package.dir}${stubs.dir.name}" />
<property name="stubs.dir" value="${source.dir}/${package.dir}/${stubs.dir.name}" />
<available file="${stubs.dir}" property="stubs.dir.present"/>
<!-- temporary build locations -->
@ -153,6 +157,12 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
<fileset dir="${schema.dir}"/>
</copy>
<!-- Populates library folder -->
<copy toDir="${build.lib.dir}">
<fileset dir="${lib.location}">
<exclude name="${jarfile.stubs}" />
</fileset>
</copy>
</target>
@ -373,6 +383,13 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
</if>
<var name="mappings" value="${mappings} -N${namespace.6}=${package.6} -N${namespace.6}/service=${package.6}.service -N${namespace.6}/bindings=${package.6}.bindings"/>
</if>
<var name="mappings" value="${mappings} -Nhttp://gcube-system.org/namespaces/common=org.gcube.common"/>
<!-- ADD LATER TO
<var name="mappings" value="${mappings} -x http://gcube-system.org/namespaces/common"/>
-->
</target>
@ -385,7 +402,8 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
</target>
<target name="buildService" depends="processWSDLs" description="compiles service implementation">
<javac srcdir="${source.dir}" destdir="${build.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}">
<javac srcdir="${source.dir}" destdir="${build.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}"> <exclude name="${package.dir}/${stubs.dir.name}/**"/>
<exclude name="${stubs.dir}/**"/>
<classpath>
<fileset dir="${lib.location}">
<include name="**/*.jar" />
@ -401,8 +419,9 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
<target name="jarService" depends="buildService" description="jars service implementation">
<copy todir="${build.class.dir}">
<fileset dir="${source.dir}">
<include name="org/**/*.xsl"/>
<include name="org/**/*.xsd"/>
<include name="org/**/*.xml"/>
<include name="org/**/*.properties"/>
</fileset>
</copy>
<jar jarfile="${build.lib.dir}/${jarfile}" basedir="${build.class.dir}">
@ -429,6 +448,7 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
<!-- Stub Build tasks -->
<target name="buildStubs" depends="processWSDLs,generateStubs" description="build service stubs">
<if name="full.stubs" value="true">
<if name="stubs.dir.present">
<copy toDir="${build.stubs.src.dir}/${package.dir}/${stubs.dir.name}" overwrite="true">
<fileset dir="${stubs.dir}" casesensitive="yes">
@ -436,6 +456,7 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
</fileset>
</copy>
</if>
</if>
<javac srcdir="${build.stubs.src.dir}" destdir="${build.stubs.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}" description="compile stub classes">
<include name="**/*.java" />
<classpath>
@ -451,12 +472,18 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
</fileset>
</classpath>
</javac>
<copy toDir="${build.stubs.class.dir}/META-INF" overwrite="false"><!-- copy configuration info as well -->
<fileset dir="${etc.dir}" casesensitive="yes" />
</copy>
</target>
<target name="jarStubs" depends="buildStubs" description="jar stub classes">
<copy toDir="${build.stubs.class.dir}/META-INF">
<fileset dir="${etc.dir}" casesensitive="yes" />
</copy>
<copy todir="${build.stubs.class.dir}">
<fileset dir="${source.dir}">
<include name="org/**/*.xsd"/>
<include name="org/**/*.properties"/>
</fileset>
</copy>
<jar destfile="${build.lib.dir}/${jarfile.stubs}" basedir="${build.stubs.class.dir}" />
</target>
@ -519,6 +546,24 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
</javadoc>
</target>
<target name="doctests">
<javadoc access="public" author="true" destdir="doc/api" nodeprecated="false"
packagenames="${package}.${stubs.dir.name}.test/*"
nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false"
source="1.5" sourcepath="${build.stubs.src.dir}"
splitindex="true" use="true" version="true"
failonerror="false">
<classpath>
<fileset dir="${lib.location}">
<include name="**/*.jar" />
<exclude name="**/${jarfile.stubs}" />
</fileset>
<fileset dir="${container.dir}/lib">
<include name="*.jar" />
</fileset>
</classpath>
</javadoc>
</target>
<target name="clean">
<delete dir="${build.dir}" quiet="true"/>

View File

@ -142,6 +142,10 @@
<xsd:element name="setCloudVMsRequestMessage" type="xsd:int"/>
<xsd:element name="getCloudVMsResponseMessage" type="xsd:int"/>
<xsd:element name="getCloudVMsRequestMessage" type="coretypes:VOID"/>
<xsd:element name="isUseCloudResponseMessage" type="xsd:boolean"/>
<xsd:element name="isUseCloudRequestMessage" type="coretypes:VOID"/>
@ -240,6 +244,13 @@
<part name="response" element="tns:setCloudVMsResponseMessage"/>
</message>
<message name="GetCloudVMsInputMessage">
<part name="request" element="tns:getCloudVMsRequestMessage"/>
</message>
<message name="GetCloudVMsOutputMessage">
<part name="response" element="tns:getCloudVMsResponseMessage"/>
</message>
<message name="IsUseCloudInputMessage">
<part name="request" element="tns:isUseCloudRequestMessage"/>
</message>
@ -355,6 +366,11 @@
<output message="tns:SetCloudVMsOutputMessage"/>
</operation>
<operation name="getCloudVMs">
<input message="tns:GetCloudVMsInputMessage"/>
<output message="tns:GetCloudVMsOutputMessage"/>
</operation>
<operation name="isUseCloud">
<input message="tns:IsUseCloudInputMessage"/>
<output message="tns:IsUseCloudOutputMessage"/>

View File

@ -38,7 +38,7 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
logger.info("notification received for genericResource "+id+" and operation "+operation);
if (id.compareTo(this.functionalityResourceId)==0 && (operation.compareTo("update")==0)){
if ((operation.compareTo("update")==0) && id.compareTo(this.functionalityResourceId)==0){
logger.trace("notification received for functionalityResource with id "+id+" in scope "+scope.toString());
KGCUBEGenericFunctionalityResource resource= new KGCUBEGenericFunctionalityResource();
resource.load(new StringReader(profile));
@ -54,6 +54,7 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
FunctionalityHandler functionalityHandler= new FunctionalityHandler();
KGCUBEGenericFunctionalityResource functResource=new KGCUBEGenericFunctionalityResource();
functResource.load(new StringReader(profile));
this.functionalityResourceId=functResource.getID();
functionalityHandler.add(functResource);
} else
if (ServiceContext.getContext().getSecondaryTypeGenericResourceRequired().contains(genericResource.getSecondaryType()))

View File

@ -10,18 +10,20 @@ import org.gcube.vremanagement.vremodeler.stubs.deployreport.DeployReport;
public class ModelerPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<ModelerResource>{
protected void onLoad(ModelerResource resource, ObjectInputStream ois) throws Exception {
protected synchronized void onLoad(ModelerResource resource, ObjectInputStream ois) throws Exception {
super.onLoad(resource, ois);
resource.setId((String)ois.readObject());
resource.setDeployReport((DeployReport)ois.readObject());
resource.setUseCloud(ois.readBoolean());
if (resource.isUseCloud())resource.setNumberOfVMsForCloud(ois.readInt());
}
protected void onStore(ModelerResource resource,ObjectOutputStream oos) throws Exception {
protected synchronized void onStore(ModelerResource resource,ObjectOutputStream oos) throws Exception {
super.onStore(resource, oos);
oos.writeObject(resource.getId());
oos.writeObject(resource.getDeployReport());
oos.writeBoolean(resource.isUseCloud());
if (resource.isUseCloud())oos.writeInt(resource.getNumberOfVMsForCloud());
}
}

View File

@ -23,6 +23,7 @@ public class ModelerResource extends GCUBEWSResource {
this.setId((String) args[0]);
this.deployReport=null;
this.isUseCloud=false;
this.numberOfVMsForCloud=-1;
}

View File

@ -98,11 +98,6 @@ public class ModelerService {
*/
public GHNList getGHNs(VOID var) throws GCUBEFault{
logger.trace("getGHNs method");
try {
if (getResource().isUseCloud()) throw new GCUBEFault("deply on cloud is selected, the ghns cannot be returned");
} catch (ResourceException e1) {
throw new GCUBEFault(e1);
}
ResultSet res;
ArrayList<String> relatedGHN=new ArrayList<String>();
try{
@ -511,10 +506,21 @@ public class ModelerService {
getResource().store();
}
public boolean isUseCloud() throws Exception{
/**
*
* @param r VOID
* @return
* @throws Exception
*/
public boolean isUseCloud(VOID r) throws Exception{
return getResource().isUseCloud();
}
/**
*
* @param numberOfVMs
* @throws Exception
*/
public void setCloudVMs(int numberOfVMs) throws Exception{
ModelerResource resource = getResource();
if (!resource.isUseCloud()) throw new Exception("the number of VMs cannot be set, you are not using cloud deployement");
@ -522,4 +528,16 @@ public class ModelerService {
resource.store();
}
/**
*
* @param r VOID
* @return
* @throws Exception
*/
public int getCloudVMs(VOID r) throws Exception{
ModelerResource resource = getResource();
if (!resource.isUseCloud()) throw new Exception("the number of VMs cannot be returned, you are not using cloud deployement");
return resource.getNumberOfVMsForCloud();
}
}

View File

@ -62,6 +62,7 @@ public class ServiceContext extends GCUBEServiceContext{
ISNotifier notifier= GHNContext.getImplementation(ISNotifier.class);
for (GCUBEScope scope : ServiceContext.getContext().getInstance().getScopes().values()){
if (scope.isInfrastructure()) continue;
ServiceContext.getContext().setScope(scope);
ArrayList<String> genResList= new ArrayList<String>();

View File

@ -3,7 +3,6 @@ package org.gcube.vremanagement.vremodeler.impl.deploy;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.java.dev.jaxb.array.StringArray;
import org.apache.axis.client.Call;
@ -15,6 +14,7 @@ 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{
@ -54,9 +54,8 @@ public class DeployGHNsOnCloud{
((Stub) eolus)._setProperty(Call.PASSWORD_PROPERTY, password);
//filling the report
List<State> ghnsStates=new ArrayList<State>(numberOfVMs);
Collections.fill(ghnsStates, State.Running);
this.report.setDeployingState(ghnsStates);
report.setDeployingState(new State[numberOfVMs]);
Arrays.fill(report.getDeployingState(), State.Waiting);
VM[] hostnames=createVMs(eolus);
configureAndStartContainers(eolus, hostnames);
@ -81,38 +80,51 @@ public class DeployGHNsOnCloud{
StringArray vnets = new StringArray();
vnets.setItem(nets);
//TODO: change this code
//TODO: change this code to support more VMs templates
String template=eolus.getTemplates().getItem()[0];
logger.trace("got the template: "+template);
VM[] vmsNames= new VM[numberOfVMs];
//the first VM will be set with limited resource (1Gb of ram) for the RM
eolus.createVM(template, vreName+"ResourceManager", 2, 1024, vnets);
vmsNames[0]= new VM(vreName+"ResourceManager");
logger.trace("creating the first VM for ResourceManager "+vreName+"ResourceManager");
report.getDeployingState()[0]=State.Running;
//the others VMs will be created with 2 GB of ram
for (int i=1; i<numberOfVMs; i++){
eolus.createVM(template, vreName+i, 2, 2048, vnets);
vmsNames[i]= new VM(vreName+"ResourceManager");
vmsNames[i]= new VM(vreName+i);
report.getDeployingState()[i]=State.Running;
logger.trace("creating the VM"+i+" "+ vreName+i);
}
logger.trace("checking the VMs Availability");
//waiting few seconds
Thread.sleep(10000);
Thread.sleep(30000);
//check if the VMs are ready
boolean[] arrayCheck= new boolean[numberOfVMs];
Arrays.fill(arrayCheck, false);
while (!and(arrayCheck)){
//waiting few seconds
Thread.sleep(30000);
//TODO: this cycle cannot continue forever
for (int i=0; i<numberOfVMs; i++){
try{
if (arrayCheck[i]) continue;
if(eolus.getVMStatus(vmsNames[i].getName()).equalsIgnoreCase("running")){
String vmState= eolus.getVMStatus(vmsNames[i].getName());
if(vmState.equalsIgnoreCase("running")){
arrayCheck[i]=true;
vmsNames[i].setIp(eolus.getVMIP(vmsNames[i].getName()));
//report.getDeployingState().set(i, State.Finished);
logger.trace("the VM "+vmsNames[i].getName()+" is RUNNING with ip "+vmsNames[i].getIp());
}
//else if(!vmState.equalsIgnoreCase("staging"));
}catch (Exception e) {
//if one fails i cannot continue
logger.error("error deploying "+vmsNames[i].getName());
report.getDeployingState().set(i, State.Failed);
logger.error("error deploying "+vmsNames[i].getName(),e);
report.getDeployingState()[i]=State.Failed;
throw e;
}
}
@ -124,26 +136,44 @@ public class DeployGHNsOnCloud{
private void configureAndStartContainers(Eolus eolus, VM[] hostnames) throws Exception {
String[] scopes=ServiceContext.getContext().getScope().toString().split("/");
String cmdtorun = "configureGHN.sh "+scopes[1]+" "+scopes[2];
logger.trace("configuring ghns with command "+cmdtorun);
String[] res;
for (int i=1; i<hostnames.length; i++){
for (int i=0; i<hostnames.length; i++){
res = eolus.execCMD(cmdtorun, hostnames[i].getName()).getItem();
if (res.length > 2)
this.report.getDeployingState().set(i, State.Failed);
logger.trace("configuring the GHN on host for VM "+hostnames[i].getName()+" got the following report:");
logger.trace("std output "+res[0]);
//terrible... waiting for enhancement
if (res.length > 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<hostnames.length; i++){
Thread startcontainerthread = new startContainer(eolus,hostnames[i].getName());
startcontainerthread.start();
}
}
private void checkGHNAvailability(VM[] hostnames) throws Exception{
boolean[] arrayCheck= new boolean[hostnames.length];
Arrays.fill(arrayCheck, false);
while (!and(arrayCheck)){
logger.trace("checking published GHNs");
Thread.sleep(40000);
ResultSet queryRes;
for (int i=0; i<hostnames.length; i++){
if (arrayCheck[i]) continue;
queryRes= DBInterface.queryDB("select id from ghn where host='"+hostnames[i].getIp()+"'");
queryRes= DBInterface.queryDB("select id from ghn where host LIKE '"+hostnames[i].getIp()+"%'");
if (queryRes.next()) {
hostnames[i].setGhnId(queryRes.getString(1));
logger.trace("the host "+hostnames[i].getName()+" has been retrieved with ghn id "+hostnames[i].getGhnId());
arrayCheck[i]=true;
this.report.getDeployingState().set(i, State.Finished);
this.report.getDeployingState()[i]= State.Finished;
DBInterface.ExecuteUpdate("update GHN set isoncloud='true' where id='"+hostnames[i].getGhnId()+"'");
}
}
@ -166,33 +196,64 @@ public class DeployGHNsOnCloud{
private String name;
private String ghnId;
/**
*
* @param name
*/
public VM(String name) {
super();
this.ip=null;
this.ghnId=null;
this.name = name;
}
/**
*
* @return the ip
*/
public String getIp() {
return ip;
}
/**
*
* @param ip the VM's ip
*/
public void setIp(String ip) {
this.ip = ip;
}
/**
*
* @return the VM name
*/
public String getName() {
return name;
}
/**
*
* @param name the VM name
*/
public void setName(String name) {
this.name = name;
}
/**
*
* @return the ghn ID
*/
public String getGhnId() {
return ghnId;
}
/**
*
* @param ghnId
*/
public void setGhnId(String ghnId) {
this.ghnId = ghnId;
}
}
}

View File

@ -62,19 +62,18 @@ public class DeployVRE extends Thread{
private GCUBEScope startingScope;
private String vreName=null;
private CollectionResourceCreation collectionResourceCreation;
private DeployReport report;
public DeployVRE(String resourceId, GCUBEScope scope) throws GCUBEFault, Exception{
this.resourceId=resourceId;
this.startingScope= scope;
this.report= new DeployReport();
try{
ResultSet resGenericInfo = DBInterface.queryDB("select VRE.name from VRE where VRE.id='"+this.resourceId+"'; ");
if (!resGenericInfo.next()) {
throw new GCUBEFault("The VRE with ID "+this.resourceId+" cannot be retrieved on the DB");
}
vreName= resGenericInfo.getString(1);
System.out.println(vreName);
}catch (Exception e) {
logger.error("error retrieving the VRE Name",e);
throw e;
@ -91,6 +90,8 @@ public class DeployVRE extends Thread{
*/
public void run(){
try {
getResource().setDeployReport(new DeployReport());
//reports initialization
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Running);
@ -98,15 +99,16 @@ public class DeployVRE extends Thread{
GHNstoUse ghnsToUse=null;
if (getResource().isUseCloud()){
DeployGHNsOnCloud ghnOnCloud = new DeployGHNsOnCloud(getResource().getNumberOfVMsForCloud(), vreName);
this.report.setCloudDeployingReport(ghnOnCloud.getReport());
getResource().getDeployReport().setCloudDeployingReport(ghnOnCloud.getReport());
try{
ghnsToUse = ghnOnCloud.run();
}catch (Exception e) {
logger.error("error creating VMs on cloud",e);
this.report.getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
getResource().getDeployReport().getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
throw new Exception("error creating VMs on cloud",e);
}
}else {
this.report.getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Skipped);
getResource().getDeployReport().getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Skipped);
ResultSet resRelatedGHN=DBInterface.queryDB("select VRERELATEDGHN.ghnid, GHN.domain, VRERELATEDGHN.ISCANDIDATE from VRERELATEDGHN, GHN where GHN.id=VRERELATEDGHN.ghnid and VRERELATEDGHN.vreid='"+this.resourceId+"' ORDER BY GHN.host; ");
ghnsToUse = new GHNstoUse();
while (resRelatedGHN.next()) {
@ -116,9 +118,9 @@ public class DeployVRE extends Thread{
}
}
if (!deployManagerOnVRE(ghnsToUse.candidateForRM)){
if (deployManagerOnVRE(ghnsToUse.candidateForRM)){
if (!createVRE(ghnsToUse.getGhns())){
if (createVRE(ghnsToUse.getGhns())){
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished+"' WHERE VRE.id='"+this.resourceId+"';");
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished);
getResource().store();
@ -151,7 +153,6 @@ public class DeployVRE extends Thread{
private boolean deployManagerOnVRE(String candidateGhnId) throws GCUBEFault, ResourceException{
String vreName= null;
try {
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='Deploying' WHERE VRE.id='"+this.resourceId+"';");
} catch (Exception e) {
@ -188,7 +189,9 @@ public class DeployVRE extends Thread{
arp.setServices(services);
arp.setTargetScope(this.scope+"/"+vreName);
String reportId=resourceManagerPT.addResources(arp);
logger.trace("the report id for Rm is "+reportId);
//waiting few seconds
Thread.currentThread().sleep(60000);
int attempt=0;
do{
Thread.currentThread().sleep(20000);
@ -198,10 +201,10 @@ public class DeployVRE extends Thread{
getResource().store();
}while (!isDeploymentStatusFinished(report) && attempt<10);
}catch(Exception e){e.printStackTrace(); throw e;}
}catch(Exception e){logger.error("error deploying RM on VRE",e); throw e;}
logger.trace("report step 1: "+report);
logger.info("is something failed in the first step?"+isSomethingFailed(report));
return isSomethingFailed(report);
return !isSomethingFailed(report);
}
};
@ -218,7 +221,6 @@ public class DeployVRE extends Thread{
logger.error("DeployingVRE step 1 -- failed "+e);
return false;
}
this.vreName= vreName;
collectionResourceCreation= new CollectionResourceCreation(this.resourceId, this.vreName);
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished);
getResource().store();
@ -294,6 +296,8 @@ public class DeployVRE extends Thread{
String report=null;
String reportId=rmPortType.createScope(scopeParameter);
logger.trace("the report id for Rm is "+reportId);
int reportAttempt=0;
do{
try{
@ -309,7 +313,7 @@ public class DeployVRE extends Thread{
logger.info("is something failed in the second step?"+isSomethingFailed(report));
logger.trace("report step 2: "+report);
return isSomethingFailed(report);
return !isSomethingFailed(report);
}

View File

@ -33,6 +33,8 @@ public class GHNHandler implements ResourceHandler<GCUBEHostingNode> {
}
private void insert(GCUBEHostingNode ghn) throws Exception {
//GHN(ID VARCHAR NOT NULL PRIMARY KEY,HOST VARCHAR,SECURITY VARCHAR,UPTIME VARCHAR,MAINMEMORYVA VARCHAR,MAINMEMORYVS VARCHAR,LOCALAS VARCHAR,LOCATION VARCHAR,COUNTRY VARCHAR,DOMAIN VARCHAR, ISONCLOUD BOOLEAN)
ArrayList<String> row= new ArrayList<String>(10);
String id= ghn.getID();
row.add(id);

View File

@ -1,9 +1,6 @@
package org.gcube.vremanagement.vremodeler.stubs.deployreport;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class GHNonCloudReport implements Serializable {
/**
@ -13,11 +10,10 @@ public class GHNonCloudReport implements Serializable {
private State state;
private List<State> deployingState= new ArrayList<State>();
private State[] deployingState;
public GHNonCloudReport() {
this.state= State.Waiting;
Collections.fill(this.deployingState, State.Waiting);
}
@ -29,11 +25,11 @@ public class GHNonCloudReport implements Serializable {
this.state = state;
}
public List<State> getDeployingState() {
public State[] getDeployingState() {
return deployingState;
}
public void setDeployingState(List<State> deployingState) {
public void setDeployingState(State[] deployingState) {
this.deployingState = deployingState;
}
}

View File

@ -1,22 +1,17 @@
package org.gcube.vremanagement.vremodeler.test;
import java.util.Date;
import java.util.List;
import java.util.Calendar;
import org.apache.axis.message.addressing.EndpointReferenceType;
import org.apache.axis.types.URI;
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.informationsystem.client.AtomicCondition;
import org.gcube.common.core.informationsystem.client.ISClient;
import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
import org.gcube.common.core.resources.GCUBERunningInstance;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.core.types.VOID;
import org.gcube.vremanagement.vremodeler.stubs.CollectionArray;
import org.gcube.vremanagement.vremodeler.stubs.CollectionList;
import org.gcube.vremanagement.vremodeler.stubs.FunctionalityIDArray;
import org.gcube.vremanagement.vremodeler.stubs.GHNArray;
import org.gcube.vremanagement.vremodeler.stubs.ModelerFactoryPortType;
import org.gcube.vremanagement.vremodeler.stubs.ModelerServicePortType;
import org.gcube.vremanagement.vremodeler.stubs.VREDescription;
import org.gcube.vremanagement.vremodeler.stubs.service.ModelerFactoryServiceAddressingLocator;
import org.gcube.vremanagement.vremodeler.stubs.service.ModelerServiceAddressingLocator;
@ -31,10 +26,11 @@ public class ModelerTest {
GCUBERIQuery riquery= client.getQuery(GCUBERIQuery.class);
riquery.addAtomicConditions(new AtomicCondition("//ServiceName", "VREModeler"));
List<GCUBERunningInstance> results=client.execute(riquery, GCUBEScope.getScope(args[0]));
*/
ModelerFactoryServiceAddressingLocator mfal =new ModelerFactoryServiceAddressingLocator();
EndpointReferenceType epr= results.get(0).getAccessPoint().getEndpoint("gcube/vremanagement/vremodeler/ModelerFactoryService");
System.out.println(epr);
/*EndpointReferenceType epr= results.get(0).getAccessPoint().getEndpoint("gcube/vremanagement/vremodeler/ModelerFactoryService");
System.out.println(epr);*/
EndpointReferenceType epr= new EndpointReferenceType(new URI("http://nb-lelii.isti.cnr.it:8080/wsrf/services/gcube/vremanagement/vremodeler/ModelerFactoryService"));
ModelerFactoryPortType mfptp= mfal.getModelerFactoryPortTypePort(epr);
mfptp = GCUBERemotePortTypeContext.getProxy(mfptp, GCUBEScope.getScope(args[0]));
@ -43,40 +39,57 @@ public class ModelerTest {
ModelerServiceAddressingLocator msal= new ModelerServiceAddressingLocator();
ModelerServicePortType msptp=msal.getModelerServicePortTypePort(eprModelerRes);
msptp = GCUBERemotePortTypeContext.getProxy(msptp, GCUBEScope.getScope(args[0]));
System.out.println("creation requested");
VRERequest vreReq= new VRERequest();
vreReq.setStartTime(new Date().getTime());
vreReq.setEndTime(new Date().getTime());
vreReq.setVREDescription("desc");
vreReq.setVREDesigner("Lucio");
vreReq.setVREManager("Lucio");
vreReq.setVREName("test");
msptp.setVREModel(vreReq);
System.out.println("first call done");
System.out.println(msptp.getGHNs(new VOID()));
/*
CollectionArray ca= new CollectionArray();
ca.setCollectionElement(new String[]{"e60f6340-e970-11dd-bb52-d1724dda0823"});
msptp.setCollection(ca);
VREDescription vreReq= new VREDescription();
Calendar cal= Calendar.getInstance();
vreReq.setStartTime(Calendar.getInstance());
cal.add(Calendar.MONTH, 1);
vreReq.setEndTime(cal);
vreReq.setDescription("desc");
vreReq.setDesigner("Lucio");
vreReq.setManager("Lucio");
vreReq.setName("testCloud");
msptp.setDescription(vreReq);
System.out.println("description set");
CollectionList cl=msptp.getCollection(new VOID());
System.out.println("collection list is null?"+(cl.getList()==null));
for(int i=0; i< cl.getList().length; i++)
System.out.println(i+" - "+cl.getList(i));
msptp.setCollection(new CollectionArray(new String[]{cl.getList(0).getId()}));
System.out.println("collection set");
FunctionalityIDArray fida= new FunctionalityIDArray();
fida.setFunctionalityIDElement(new String[]{"0"});
msptp.setFunctionality(fida);
GHNArray ghnArray= new GHNArray();
ghnArray.setGHNElement(new String[]{"64033f00-ea3a-11dd-af49-d0586efd3870","29b7ff70-ea3a-11dd-810a-d18bf0285315"});
msptp.setGHNs(ghnArray);
System.out.println("functionality set");
System.out.println("-"+msptp.checkStatus(new VOID()).getReports(0)+"-");
msptp.setUseCloud(true);
msptp.setCloudVMs(2);
//msptp.setUseCloud(false);
//msptp.setGHNs(new GHNArray(new String[]{"af63ccc0-d6a7-11df-b524-ba33a5c87470","73ceb130-e844-11df-a7f0-e529e2191760"},"af63ccc0-d6a7-11df-b524-ba33a5c87470"));
msptp.deployVRE(new VOID());
*/
for (int i=0; i<200; i++){
Thread.sleep(30000);
System.out.println("report is:");
System.out.println(msptp.checkStatus(new VOID()));
}
}catch(Exception e){e.printStackTrace();}
}