Cloud deploying added
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/VREModeler@31102 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1fb4562a45
commit
7b998911c3
|
@ -4,5 +4,6 @@
|
|||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/GCORELIB"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/VreModelerDependecies"/>
|
||||
<classpathentry kind="lib" path="/Users/lucio/workspace/Dependencies/VREModeler/eolus-gcore.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CREATE CACHED TABLE COLLECTION(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR,DESCRIPTION VARCHAR,MEMBERS VARCHAR,CREATION VARCHAR,LASTUPDATE VARCHAR)
|
||||
CREATE CACHED TABLE 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)
|
||||
CREATE CACHED TABLE 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)
|
||||
CREATE CACHED TABLE MCOLLECTION(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR,DESCRIPTION VARCHAR,RELATEDCOLLECTIONID VARCHAR NOT NULL,CONSTRAINT SYS_FK_50 FOREIGN KEY(RELATEDCOLLECTIONID) REFERENCES COLLECTION(ID))
|
||||
CREATE CACHED TABLE VRE(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR NOT NULL,DESCRIPTION VARCHAR NOT NULL,VREDESIGNER VARCHAR NOT NULL,VREMANAGER VARCHAR NOT NULL,INTERVALFROM DATE,INTERVALTO DATE,STATUS VARCHAR)
|
||||
CREATE CACHED TABLE CS(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR NOT NULL,DESCRIPTION VARCHAR NOT NULL)
|
||||
|
@ -17,4 +17,5 @@ CREATE CACHED TABLE SERVICES(ID INTEGER NOT NULL,NAME VARCHAR NOT NULL,CLASS VA
|
|||
CREATE CACHED TABLE VRERELATEDFUNCT(VREID VARCHAR NOT NULL,FUNCID VARCHAR NOT NULL,PRIMARY KEY(VREID,FUNCID))
|
||||
CREATE CACHED TABLE RELATEDSERVICEID(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR NOT NULL,CLASS VARCHAR NOT NULL)
|
||||
CREATE CACHED TABLE PORTLETRELTOFUNCT(FUNCID INTEGER NOT NULL,PORTLETCLASS VARCHAR NOT NULL, FOREIGN KEY(FUNCID) REFERENCES FUNCTIONALITY(ID) )
|
||||
CREATE CACHED TABLE NEEDEDRESOURCES(ID VARCHAR NOT NULL, TYPE VARCHAR NOT NULL, PRIMARY KEY(ID))
|
||||
CREATE CACHED TABLE NEEDEDRESOURCES(ID VARCHAR NOT NULL, TYPE VARCHAR NOT NULL, PRIMARY KEY(ID))
|
||||
CREATE CACHED TABLE VRERELETEDCLOUD(VREID VARCHAR NOT NULL, VMNAME VARCHAR NOT NULL, HOSTNAME VARCHAR, PRIMARY KEY(VREID, VMNAME))
|
|
@ -130,20 +130,18 @@
|
|||
|
||||
<xsd:element name="undeployVREResponseMessage" type="coretypes:VOID"/>
|
||||
|
||||
<xsd:complexType name="CheckStatusResponse">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="Reports" type="xsd:string" minOccurs="2" maxOccurs="2" />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="checkStatusRequestMessage" type="coretypes:VOID"/>
|
||||
|
||||
<xsd:element name="checkStatusResponseMessage" type="tns:CheckStatusResponse"/>
|
||||
<xsd:element name="checkStatusResponseMessage" type="xsd:string"/>
|
||||
|
||||
<xsd:element name="setUseCloudResponseMessage" type="coretypes:VOID"/>
|
||||
|
||||
<xsd:element name="setUseCloudRequestMessage" type="xsd:boolean"/>
|
||||
|
||||
<xsd:element name="setCloudVMsResponseMessage" type="coretypes:VOID"/>
|
||||
|
||||
<xsd:element name="setCloudVMsRequestMessage" type="xsd:int"/>
|
||||
|
||||
<xsd:element name="isUseCloudResponseMessage" type="xsd:boolean"/>
|
||||
|
||||
<xsd:element name="isUseCloudRequestMessage" type="coretypes:VOID"/>
|
||||
|
@ -151,15 +149,11 @@
|
|||
<!--RESOURCE PROPERTIES -->
|
||||
|
||||
<xsd:element name="Id" type="xsd:string"/>
|
||||
<xsd:element name="firstReport" type="xsd:string"/>
|
||||
<xsd:element name="secondReport" type="xsd:string"/>
|
||||
|
||||
|
||||
<xsd:element name="ModelerProperties">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="tns:Id" minOccurs="1" maxOccurs="1"/>
|
||||
<xsd:element ref="tns:firstReport" minOccurs="1" maxOccurs="1"/>
|
||||
<xsd:element ref="tns:secondReport" minOccurs="1" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
@ -239,6 +233,13 @@
|
|||
<part name="response" element="tns:setUseCloudResponseMessage"/>
|
||||
</message>
|
||||
|
||||
<message name="SetCloudVMsInputMessage">
|
||||
<part name="request" element="tns:setCloudVMsRequestMessage"/>
|
||||
</message>
|
||||
<message name="SetCloudVMsOutputMessage">
|
||||
<part name="response" element="tns:setCloudVMsResponseMessage"/>
|
||||
</message>
|
||||
|
||||
<message name="IsUseCloudInputMessage">
|
||||
<part name="request" element="tns:isUseCloudRequestMessage"/>
|
||||
</message>
|
||||
|
@ -349,6 +350,11 @@
|
|||
<output message="tns:SetUseCloudOutputMessage"/>
|
||||
</operation>
|
||||
|
||||
<operation name="setCloudVMs">
|
||||
<input message="tns:SetCloudVMsInputMessage"/>
|
||||
<output message="tns:SetCloudVMsOutputMessage"/>
|
||||
</operation>
|
||||
|
||||
<operation name="isUseCloud">
|
||||
<input message="tns:IsUseCloudInputMessage"/>
|
||||
<output message="tns:IsUseCloudOutputMessage"/>
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.StringReader;
|
|||
import javax.xml.namespace.QName;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.BaseNotificationConsumer;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.GCUBENotificationTopic;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.NotificationEvent;
|
||||
import org.gcube.common.core.resources.GCUBECollection;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
@ -15,7 +16,7 @@ public class CollectionConsumer extends BaseNotificationConsumer{
|
|||
|
||||
private GCUBELog logger= new GCUBELog(GHNConsumer.class);
|
||||
|
||||
public static final QName collectionQName= new QName("http://gcube-system.org/namespaces/informationsystem/registry","Collection");
|
||||
public static final GCUBENotificationTopic collectionTopic= new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","Collection"));
|
||||
|
||||
private GCUBEScope scope;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import javax.xml.namespace.QName;
|
|||
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.BaseNotificationConsumer;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.GCUBENotificationTopic;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.NotificationEvent;
|
||||
import org.gcube.common.core.resources.GCUBEHostingNode;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
@ -16,10 +17,17 @@ import org.gcube.vremanagement.vremodeler.resources.handlers.GHNHandler;
|
|||
|
||||
public class GHNConsumer extends BaseNotificationConsumer{
|
||||
|
||||
public static GCUBENotificationTopic ghnTopic;
|
||||
|
||||
static{
|
||||
ghnTopic= new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","GHN"));
|
||||
ghnTopic.setPrecondition("(//operationType[text()='destroy']) or (//operationType[text()='create'])");
|
||||
}
|
||||
|
||||
private GCUBELog logger= new GCUBELog(GHNConsumer.class);
|
||||
|
||||
public static final QName ghnQName= new QName("http://gcube-system.org/namespaces/informationsystem/registry","GHN");
|
||||
|
||||
|
||||
|
||||
|
||||
private GCUBEScope scope;
|
||||
|
||||
public GHNConsumer(GCUBEScope scope){
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.StringReader;
|
|||
import javax.xml.namespace.QName;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.BaseNotificationConsumer;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.GCUBENotificationTopic;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.NotificationEvent;
|
||||
import org.gcube.common.core.resources.GCUBEGenericResource;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
@ -17,8 +18,8 @@ public class GenericResourceConsumer extends BaseNotificationConsumer{
|
|||
|
||||
private GCUBELog logger= new GCUBELog(GHNConsumer.class);
|
||||
|
||||
public static final QName functionalityQName= new QName("http://gcube-system.org/namespaces/informationsystem/registry","GenericResource");
|
||||
|
||||
public static final GCUBENotificationTopic functionalityTopic= new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","GenericResource"));
|
||||
|
||||
private String functionalityResourceId;
|
||||
private GCUBEScope scope;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import javax.xml.namespace.QName;
|
|||
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.BaseNotificationConsumer;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.GCUBENotificationTopic;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.NotificationEvent;
|
||||
import org.gcube.common.core.resources.GCUBEMCollection;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
@ -15,7 +16,7 @@ import org.gcube.vremanagement.vremodeler.resources.handlers.MCollectionHandler;
|
|||
|
||||
public class MCollectionConsumer extends BaseNotificationConsumer{
|
||||
|
||||
public static final QName mCollectionQName= new QName("http://gcube-system.org/namespaces/informationsystem/registry","MetadataCollection");
|
||||
public static final GCUBENotificationTopic mCollectionTopic=new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","MetadataCollection"));
|
||||
|
||||
private GCUBELog logger= new GCUBELog(MCollectionConsumer.class);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.StringReader;
|
|||
import javax.xml.namespace.QName;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.BaseNotificationConsumer;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.GCUBENotificationTopic;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.NotificationEvent;
|
||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
@ -15,7 +16,7 @@ public class RunningInstanceConsumer extends BaseNotificationConsumer{
|
|||
|
||||
private GCUBELog logger= new GCUBELog(RunningInstanceConsumer.class);
|
||||
|
||||
public static final QName riQName= new QName("http://gcube-system.org/namespaces/informationsystem/registry","RunningInstance");
|
||||
public static final GCUBENotificationTopic riTopic= new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","RunningInstance"));
|
||||
|
||||
private GCUBEScope scope;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.ObjectInputStream;
|
|||
import java.io.ObjectOutputStream;
|
||||
|
||||
import org.gcube.common.core.persistence.GCUBEWSFilePersistenceDelegate;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.deployreport.DeployReport;
|
||||
|
||||
|
||||
public class ModelerPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<ModelerResource>{
|
||||
|
@ -12,8 +13,7 @@ public class ModelerPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<M
|
|||
protected void onLoad(ModelerResource resource, ObjectInputStream ois) throws Exception {
|
||||
super.onLoad(resource, ois);
|
||||
resource.setId((String)ois.readObject());
|
||||
resource.setFirstReport((String)ois.readObject());
|
||||
resource.setSecondReport((String)ois.readObject());
|
||||
resource.setDeployReport((DeployReport)ois.readObject());
|
||||
resource.setUseCloud(ois.readBoolean());
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,7 @@ public class ModelerPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<M
|
|||
protected void onStore(ModelerResource resource,ObjectOutputStream oos) throws Exception {
|
||||
super.onStore(resource, oos);
|
||||
oos.writeObject(resource.getId());
|
||||
oos.writeObject(resource.getFirstReport());
|
||||
oos.writeObject(resource.getSecondReport());
|
||||
oos.writeObject(resource.getDeployReport());
|
||||
oos.writeBoolean(resource.isUseCloud());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
package org.gcube.vremanagement.vremodeler.impl;
|
||||
|
||||
import org.gcube.common.core.state.GCUBEWSResource;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.deployreport.DeployReport;
|
||||
import org.globus.wsrf.ResourceException;
|
||||
|
||||
public class ModelerResource extends GCUBEWSResource {
|
||||
|
||||
protected static final String RP_ID = "Id";
|
||||
protected static final String RP_FIRSTREPORT= "firstReport";
|
||||
protected static final String RP_SECONDREPORT = "secondReport";
|
||||
|
||||
protected static String[] RPNames = { RP_ID, RP_FIRSTREPORT, RP_SECONDREPORT};
|
||||
|
||||
protected static String[] RPNames = { RP_ID};
|
||||
|
||||
private boolean isUseCloud;
|
||||
|
||||
private int numberOfVMsForCloud;
|
||||
|
||||
private DeployReport deployReport;
|
||||
|
||||
|
||||
@Override
|
||||
protected void initialise(Object... args) throws ResourceException {
|
||||
if (args.length!=1) throw new ResourceException();
|
||||
this.setId((String) args[0]);
|
||||
this.setFirstReport("");
|
||||
this.setSecondReport("");
|
||||
this.deployReport=null;
|
||||
this.isUseCloud=false;
|
||||
}
|
||||
|
||||
|
@ -40,6 +43,16 @@ public class ModelerResource extends GCUBEWSResource {
|
|||
this.isUseCloud = isUseCloud;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getNumberOfVMsForCloud() {
|
||||
return numberOfVMsForCloud;
|
||||
}
|
||||
|
||||
|
||||
public void setNumberOfVMsForCloud(int numberOfVMsForCloud) {
|
||||
this.numberOfVMsForCloud = numberOfVMsForCloud;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -67,42 +80,17 @@ public class ModelerResource extends GCUBEWSResource {
|
|||
this.getResourcePropertySet().get(RP_ID).clear();
|
||||
this.getResourcePropertySet().get(RP_ID).add(id);
|
||||
}
|
||||
|
||||
|
||||
public DeployReport getDeployReport() {
|
||||
return deployReport;
|
||||
}
|
||||
|
||||
|
||||
public void setDeployReport(DeployReport deployReport) {
|
||||
this.deployReport = deployReport;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws ResourceException
|
||||
*/
|
||||
public String getSecondReport() throws ResourceException {
|
||||
return (String) this.getResourcePropertySet().get(RP_SECONDREPORT).get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param reportSecondStep
|
||||
* @throws ResourceException
|
||||
*/
|
||||
public synchronized void setSecondReport(String reportSecondStep) throws ResourceException {
|
||||
this.getResourcePropertySet().get(RP_SECONDREPORT).clear();
|
||||
this.getResourcePropertySet().get(RP_SECONDREPORT).add(reportSecondStep);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws ResourceException
|
||||
*/
|
||||
public String getFirstReport() throws ResourceException {
|
||||
return (String) this.getResourcePropertySet().get(RP_FIRSTREPORT).get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param reportFirstStep
|
||||
* @throws ResourceException
|
||||
*/
|
||||
public synchronized void setFirstReport(String reportFirstStep) throws ResourceException {
|
||||
this.getResourcePropertySet().get(RP_FIRSTREPORT).clear();
|
||||
this.getResourcePropertySet().get(RP_FIRSTREPORT).add(reportFirstStep);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,11 +12,10 @@ import org.gcube.common.core.faults.GCUBEUnrecoverableFault;
|
|||
import org.gcube.common.core.types.VOID;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.vremanagement.vremodeler.db.DBInterface;
|
||||
import org.gcube.vremanagement.vremodeler.impl.thread.DeployVREonGHNs;
|
||||
import org.gcube.vremanagement.vremodeler.impl.deploy.DeployVRE;
|
||||
import org.gcube.vremanagement.vremodeler.impl.util.ModelerCollection;
|
||||
import org.gcube.vremanagement.vremodeler.impl.util.Util;
|
||||
import org.gcube.vremanagement.vremodeler.resources.MetadataFormat;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.CheckStatusResponse;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.CollectionArray;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.CollectionList;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.CollectionType;
|
||||
|
@ -28,12 +27,11 @@ import org.gcube.vremanagement.vremodeler.stubs.GHNList;
|
|||
import org.gcube.vremanagement.vremodeler.stubs.GHNType;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.MetadataFormatResponse;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.SetMDFormatArgs;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.Utils;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.VREDescription;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.VREState;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.deployreport.State;
|
||||
import org.globus.wsrf.ResourceException;
|
||||
|
||||
|
||||
|
||||
public class ModelerService {
|
||||
|
||||
private static final GCUBELog logger = new GCUBELog(ModelerService.class);
|
||||
|
@ -61,8 +59,8 @@ public class ModelerService {
|
|||
if(res.next())
|
||||
DBInterface.queryDB("update VRE set name='"+request.getName()+"', description='"+request.getDescription()+"', vredesigner='"+request.getDesigner()+"', vremanager= '"+request.getManager()+"', intervalfrom='"+dateFrom+"', intervalto='"+dateTo+"' where VRE.id='"+getResource().getId()+"'; ");
|
||||
else{
|
||||
logger.debug("insert into VRE values('"+getResource().getId()+"','"+request.getName()+"','"+request.getDescription()+"','"+request.getDesigner()+"','"+request.getManager()+"','"+dateFrom+"','"+dateTo+"','"+VREState.IN_PROGRESS.getValue()+"'); ");
|
||||
DBInterface.ExecuteUpdate("insert into VRE values('"+getResource().getId()+"','"+request.getName()+"','"+request.getDescription()+"','"+request.getDesigner()+"','"+request.getManager()+"','"+dateFrom+"','"+dateTo+"','"+VREState.IN_PROGRESS.getValue()+"'); ");
|
||||
logger.debug("insert into VRE values('"+getResource().getId()+"','"+request.getName()+"','"+request.getDescription()+"','"+request.getDesigner()+"','"+request.getManager()+"','"+dateFrom+"','"+dateTo+"','"+State.Running+"'); ");
|
||||
DBInterface.ExecuteUpdate("insert into VRE values('"+getResource().getId()+"','"+request.getName()+"','"+request.getDescription()+"','"+request.getDesigner()+"','"+request.getManager()+"','"+dateFrom+"','"+dateTo+"','"+State.Running+"'); ");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("an error occurs setting the VRE Description",e);
|
||||
|
@ -445,7 +443,7 @@ public class ModelerService {
|
|||
*/
|
||||
public void setVREtoPendingState(VOID var) throws GCUBEFault{
|
||||
try{
|
||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+VREState.PENDING+"' WHERE VRE.id='"+getResource().getId()+"';");
|
||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+State.Pending+"' WHERE VRE.id='"+getResource().getId()+"';");
|
||||
|
||||
}catch(Exception e){throw new GCUBEFault(e);}
|
||||
}
|
||||
|
@ -467,17 +465,19 @@ public class ModelerService {
|
|||
}
|
||||
|
||||
try{
|
||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+VREState.DEPLOYING+"' WHERE VRE.id='"+resourceID+"';");
|
||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+State.Running+"' WHERE VRE.id='"+resourceID+"';");
|
||||
} catch (Exception e) {
|
||||
logger.error("DB Error ",e);
|
||||
throw new GCUBEUnrecoverableFault(e);
|
||||
}
|
||||
|
||||
if (!resource.isUseCloud()){
|
||||
DeployVREonGHNs deployVREThread= new DeployVREonGHNs(resourceID, ServiceContext.getContext().getScope() );
|
||||
|
||||
try{
|
||||
DeployVRE deployVREThread= new DeployVRE(resourceID, ServiceContext.getContext().getScope() );
|
||||
ServiceContext.getContext().setScope(deployVREThread, ServiceContext.getContext().getScope());
|
||||
logger.trace("Deploy VRE thread started");
|
||||
deployVREThread.start();
|
||||
}catch (Exception e) {
|
||||
throw new GCUBEFault(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -487,10 +487,8 @@ public class ModelerService {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public CheckStatusResponse checkStatus(VOID var) throws Exception{
|
||||
CheckStatusResponse res= new CheckStatusResponse();
|
||||
res.setReports(new String[]{getResource().getFirstReport(), getResource().getSecondReport()});
|
||||
return res;
|
||||
public String checkStatus(VOID var) throws Exception{
|
||||
return Utils.toXML(getResource().getDeployReport());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -517,4 +515,11 @@ public class ModelerService {
|
|||
return getResource().isUseCloud();
|
||||
}
|
||||
|
||||
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");
|
||||
resource.setNumberOfVMsForCloud(numberOfVMs);
|
||||
resource.store();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,12 +3,11 @@ package org.gcube.vremanagement.vremodeler.impl;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import java.util.List;
|
||||
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier.GCUBENotificationTopic;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.vremanagement.vremodeler.consumers.CollectionConsumer;
|
||||
import org.gcube.vremanagement.vremodeler.consumers.GHNConsumer;
|
||||
|
@ -27,6 +26,8 @@ public class ServiceContext extends GCUBEServiceContext{
|
|||
/** Single context instance, created eagerly */
|
||||
private static ServiceContext cache = new ServiceContext();
|
||||
|
||||
private static List<GCUBENotificationTopic> topicToRemove= new ArrayList<ISNotifier.GCUBENotificationTopic>();
|
||||
|
||||
/** Returns cached instance */
|
||||
public static ServiceContext getContext() {return cache;}
|
||||
|
||||
|
@ -78,30 +79,45 @@ public class ServiceContext extends GCUBEServiceContext{
|
|||
logger.debug("Service initialized!!");
|
||||
|
||||
//GHNNotification
|
||||
ArrayList<QName> qnameList= new ArrayList<QName>();
|
||||
qnameList.add(GHNConsumer.ghnQName);
|
||||
notifier.registerToISNotification(qnameList, new GHNConsumer(scope), this, scope);
|
||||
ArrayList<GCUBENotificationTopic> qnameList= new ArrayList<GCUBENotificationTopic>();
|
||||
qnameList.add(GHNConsumer.ghnTopic);
|
||||
notifier.registerToISNotification(new GHNConsumer(scope),qnameList, this, scope);
|
||||
//RINotification
|
||||
qnameList= new ArrayList<QName>();
|
||||
qnameList.add(RunningInstanceConsumer.riQName);
|
||||
notifier.registerToISNotification(qnameList, new RunningInstanceConsumer(scope), this, scope);
|
||||
qnameList= new ArrayList<GCUBENotificationTopic>();
|
||||
qnameList.add(RunningInstanceConsumer.riTopic);
|
||||
notifier.registerToISNotification(new RunningInstanceConsumer(scope), qnameList, this, scope);
|
||||
//CollectionNotification
|
||||
qnameList= new ArrayList<QName>();
|
||||
qnameList.add(CollectionConsumer.collectionQName);
|
||||
notifier.registerToISNotification(qnameList, new CollectionConsumer(scope), this, scope);
|
||||
qnameList= new ArrayList<GCUBENotificationTopic>();
|
||||
qnameList.add(CollectionConsumer.collectionTopic);
|
||||
notifier.registerToISNotification(new CollectionConsumer(scope), qnameList, this, scope);
|
||||
//MCollectionNotification
|
||||
qnameList= new ArrayList<QName>();
|
||||
qnameList.add(MCollectionConsumer.mCollectionQName);
|
||||
notifier.registerToISNotification(qnameList, new MCollectionConsumer(scope), this, scope);
|
||||
qnameList= new ArrayList<GCUBENotificationTopic>();
|
||||
qnameList.add(MCollectionConsumer.mCollectionTopic);
|
||||
notifier.registerToISNotification(new MCollectionConsumer(scope), qnameList, this, scope);
|
||||
//FunctionalityResource
|
||||
qnameList= new ArrayList<QName>();
|
||||
qnameList.add(GenericResourceConsumer.functionalityQName);
|
||||
notifier.registerToISNotification(qnameList, new GenericResourceConsumer(scope,functionalityHandler.getFunctionalityResourceId()), this, scope);
|
||||
qnameList= new ArrayList<GCUBENotificationTopic>();
|
||||
qnameList.add(GenericResourceConsumer.functionalityTopic);
|
||||
notifier.registerToISNotification(new GenericResourceConsumer(scope,functionalityHandler.getFunctionalityResourceId()), qnameList, this, scope);
|
||||
|
||||
logger.debug("consumers registered");
|
||||
}
|
||||
|
||||
//saving topic for removing
|
||||
topicToRemove.add(GHNConsumer.ghnTopic);
|
||||
topicToRemove.add(RunningInstanceConsumer.riTopic);
|
||||
topicToRemove.add(CollectionConsumer.collectionTopic);
|
||||
topicToRemove.add(MCollectionConsumer.mCollectionTopic);
|
||||
topicToRemove.add(GenericResourceConsumer.functionalityTopic);
|
||||
}
|
||||
|
||||
public void onShutdown() throws Exception{
|
||||
ISNotifier notifier= GHNContext.getImplementation(ISNotifier.class);
|
||||
for (GCUBEScope scope : ServiceContext.getContext().getInstance().getScopes().values()){
|
||||
ServiceContext.getContext().setScope(scope);
|
||||
notifier.unregisterFromISNotification(this, topicToRemove, scope);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<String> getSecondaryTypeGenericResourceRequired() {
|
||||
return secondaryTypeGenericResourceRequired;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,198 @@
|
|||
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;
|
||||
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;
|
||||
|
||||
|
||||
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.Running);
|
||||
}
|
||||
|
||||
public GHNonCloudReport getReport() {
|
||||
return report;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public GHNstoUse run() throws Exception{
|
||||
|
||||
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
|
||||
List<State> ghnsStates=new ArrayList<State>(numberOfVMs);
|
||||
Collections.fill(ghnsStates, State.Running);
|
||||
this.report.setDeployingState(ghnsStates);
|
||||
|
||||
VM[] hostnames=createVMs(eolus);
|
||||
configureAndStartContainers(eolus, hostnames);
|
||||
|
||||
//waiting few seconds for GHN registration
|
||||
Thread.sleep(30000);
|
||||
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<String> ghns= new ArrayList<String>(hostnames.length-1);
|
||||
for (int i=1; i<hostnames.length; i++)
|
||||
ghns.add(hostnames[i].getGhnId());
|
||||
ghnToUse.setGhns(ghns);
|
||||
return ghnToUse;
|
||||
}
|
||||
|
||||
private VM[] createVMs(Eolus eolus) throws Exception{
|
||||
String[] nets = {"public"};
|
||||
StringArray vnets = new StringArray();
|
||||
vnets.setItem(nets);
|
||||
|
||||
//TODO: change this code
|
||||
String template=eolus.getTemplates().getItem()[0];
|
||||
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");
|
||||
|
||||
//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");
|
||||
}
|
||||
|
||||
//waiting few seconds
|
||||
Thread.sleep(10000);
|
||||
|
||||
//check if the VMs are ready
|
||||
boolean[] arrayCheck= new boolean[numberOfVMs];
|
||||
Arrays.fill(arrayCheck, false);
|
||||
while (!and(arrayCheck)){
|
||||
//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")){
|
||||
arrayCheck[i]=true;
|
||||
vmsNames[i].setIp(eolus.getVMIP(vmsNames[i].getName()));
|
||||
}
|
||||
}catch (Exception e) {
|
||||
//if one fails i cannot continue
|
||||
logger.error("error deploying "+vmsNames[i].getName());
|
||||
report.getDeployingState().set(i, State.Failed);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vmsNames;
|
||||
}
|
||||
|
||||
private void configureAndStartContainers(Eolus eolus, VM[] hostnames) throws Exception {
|
||||
String[] scopes=ServiceContext.getContext().getScope().toString().split("/");
|
||||
String cmdtorun = "configureGHN.sh "+scopes[1]+" "+scopes[2];
|
||||
String[] res;
|
||||
for (int i=1; i<hostnames.length; i++){
|
||||
res = eolus.execCMD(cmdtorun, hostnames[i].getName()).getItem();
|
||||
if (res.length > 2)
|
||||
this.report.getDeployingState().set(i, State.Failed);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkGHNAvailability(VM[] hostnames) throws Exception{
|
||||
boolean[] arrayCheck= new boolean[hostnames.length];
|
||||
Arrays.fill(arrayCheck, false);
|
||||
while (!and(arrayCheck)){
|
||||
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()+"'");
|
||||
if (queryRes.next()) {
|
||||
hostnames[i].setGhnId(queryRes.getString(1));
|
||||
arrayCheck[i]=true;
|
||||
this.report.getDeployingState().set(i, State.Finished);
|
||||
DBInterface.ExecuteUpdate("update GHN set isoncloud='true' where id='"+hostnames[i].getGhnId()+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean and(boolean ... array){
|
||||
for (int i=0; i<array.length; i++)
|
||||
if(!array[i]) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @author lucio
|
||||
*
|
||||
*/
|
||||
public class VM{
|
||||
private String ip;
|
||||
private String name;
|
||||
private String ghnId;
|
||||
|
||||
public VM(String name) {
|
||||
super();
|
||||
this.ip=null;
|
||||
this.ghnId=null;
|
||||
this.name = name;
|
||||
}
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getGhnId() {
|
||||
return ghnId;
|
||||
}
|
||||
public void setGhnId(String ghnId) {
|
||||
this.ghnId = ghnId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.vremanagement.vremodeler.impl.thread;
|
||||
package org.gcube.vremanagement.vremodeler.impl.deploy;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -13,7 +13,6 @@ import javax.xml.xpath.XPath;
|
|||
import javax.xml.xpath.XPathConstants;
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
|
@ -44,30 +43,44 @@ import org.gcube.vremanagement.vremodeler.impl.ModelerContext;
|
|||
import org.gcube.vremanagement.vremodeler.impl.ModelerResource;
|
||||
import org.gcube.vremanagement.vremodeler.impl.ModelerService;
|
||||
import org.gcube.vremanagement.vremodeler.impl.ServiceContext;
|
||||
import org.gcube.vremanagement.vremodeler.impl.util.Pair;
|
||||
import org.gcube.vremanagement.vremodeler.impl.util.ResourceManagerServiceHandler;
|
||||
import org.gcube.vremanagement.vremodeler.portallayout.CollectionResourceCreation;
|
||||
import org.gcube.vremanagement.vremodeler.portallayout.GenericResourcePortlet;
|
||||
import org.gcube.vremanagement.vremodeler.portallayout.LayoutCreation;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.VREState;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.deployreport.DeployReport;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.deployreport.FunctionalityDeployingReport;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.deployreport.FunctionalityReport;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.deployreport.ServiceReport;
|
||||
import org.globus.wsrf.ResourceException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class DeployVREonGHNs extends Thread{
|
||||
|
||||
public class DeployVRE extends Thread{
|
||||
|
||||
private static GCUBELog logger= new GCUBELog(ModelerService.class);
|
||||
|
||||
private ModelerResource wsResource= null;
|
||||
private String resourceId;
|
||||
private GCUBEScope startingScope;
|
||||
private String vreName=null;
|
||||
private CollectionResourceCreation collectionResourceCreation;
|
||||
private DeployReport report;
|
||||
|
||||
public DeployVREonGHNs(String resourceId, GCUBEScope scope){
|
||||
|
||||
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);
|
||||
}catch (Exception e) {
|
||||
logger.error("error retrieving the VRE Name",e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private ModelerResource getResource() throws ResourceException{
|
||||
|
@ -78,44 +91,47 @@ public class DeployVREonGHNs extends Thread{
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public void run() {
|
||||
public void run(){
|
||||
try {
|
||||
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; ");
|
||||
|
||||
List<Pair<String, String>> GHNList= new ArrayList<Pair<String, String>>();
|
||||
String candidateGHN=null;
|
||||
boolean isCandidatePresent=false;
|
||||
while (resRelatedGHN.next()) {
|
||||
if(resRelatedGHN.getBoolean(3)){
|
||||
candidateGHN=resRelatedGHN.getString(1);
|
||||
isCandidatePresent= true;
|
||||
}else GHNList.add(new Pair<String, String>(resRelatedGHN.getString(1),resRelatedGHN.getString(2)));
|
||||
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Running);
|
||||
getResource().store();
|
||||
GHNstoUse ghnsToUse=null;
|
||||
if (getResource().isUseCloud()){
|
||||
DeployGHNsOnCloud ghnOnCloud = new DeployGHNsOnCloud(getResource().getNumberOfVMsForCloud(), vreName);
|
||||
this.report.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);
|
||||
}
|
||||
}else {
|
||||
this.report.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()) {
|
||||
if(resRelatedGHN.getBoolean(3)){
|
||||
ghnsToUse.setCandidateForRM(resRelatedGHN.getString(1));
|
||||
}else ghnsToUse.getGhns().add(resRelatedGHN.getString(1));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(GHNList.size()>=2 || (GHNList.size()==1 && isCandidatePresent))){
|
||||
getResource().setFirstReport(VREState.FAILED.getValue()+": wrong ghn definition");
|
||||
getResource().store();
|
||||
logger.info("Deploying of the VRE with id "+this.resourceId+" FAILED for wrong ghn definition");
|
||||
throw new Exception("No ghn Selected (at least 2 GHNs have to be selected)");
|
||||
}
|
||||
|
||||
|
||||
if (!deployManagerOnVRE(GHNList, candidateGHN)){
|
||||
//transforming the Pair<String, String> to a ghnid List<String>
|
||||
List<String> ghnEpuredList = new ArrayList<String>();
|
||||
for (Pair<String, String> cpl: GHNList) ghnEpuredList.add(cpl.first);
|
||||
|
||||
if (!createVRE(ghnEpuredList)){
|
||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+VREState.DEPLOYED+"' WHERE VRE.id='"+this.resourceId+"';");
|
||||
|
||||
if (!deployManagerOnVRE(ghnsToUse.candidateForRM)){
|
||||
|
||||
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();
|
||||
logger.info("Deploying of the VRE with id "+this.resourceId+" FINISHED");
|
||||
}
|
||||
else{
|
||||
logger.info("Deploying of the VRE with id "+this.resourceId+" FAILED on second step");
|
||||
getResource().setSecondReport(VREState.FAILED.getValue());
|
||||
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
|
||||
getResource().store();
|
||||
throw new Exception("Error Deployng the VRE failed on second step");
|
||||
}
|
||||
}else{
|
||||
getResource().setFirstReport(VREState.FAILED.getValue());
|
||||
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
|
||||
getResource().store();
|
||||
logger.info("Deploying of the VRE with id "+this.resourceId+" FAILED on first step");
|
||||
throw new Exception("Error Deployng the VRE filed on first step");
|
||||
|
@ -123,7 +139,9 @@ public class DeployVREonGHNs extends Thread{
|
|||
|
||||
}catch(Exception e){
|
||||
try {
|
||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+VREState.FAILED+"' WHERE VRE.id='"+this.resourceId+"';");
|
||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed+"' WHERE VRE.id='"+this.resourceId+"';");
|
||||
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
|
||||
getResource().store();
|
||||
} catch (Exception e1) {
|
||||
logger.error("impossible to update the VRE Status",e1);
|
||||
}
|
||||
|
@ -132,23 +150,22 @@ public class DeployVREonGHNs extends Thread{
|
|||
}
|
||||
|
||||
|
||||
private boolean deployManagerOnVRE(List<Pair<String, String>> ghnList, String candidateGHN) throws GCUBEFault{
|
||||
private boolean deployManagerOnVRE(String candidateGhnId) throws GCUBEFault, ResourceException{
|
||||
String vreName= null;
|
||||
try {
|
||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='Deploying' WHERE VRE.id='"+this.resourceId+"';");
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
logger.error("HSQLDB Error "+e);
|
||||
throw new GCUBEFault(e);
|
||||
}
|
||||
|
||||
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Running);
|
||||
getResource().store();
|
||||
|
||||
|
||||
ResourceManagerServiceHandler<Boolean, Object[]> resourceManagerHandler= new ResourceManagerServiceHandler<Boolean,Object[]>(){
|
||||
|
||||
@SuppressWarnings({ "static-access", "unchecked" })
|
||||
@SuppressWarnings({ "static-access"})
|
||||
@Override
|
||||
protected Boolean makeCall(ResourceManagerPortType resourceManagerPT)
|
||||
throws Exception {
|
||||
|
@ -156,8 +173,7 @@ public class DeployVREonGHNs extends Thread{
|
|||
try{
|
||||
|
||||
String vreName=(String) this.getParameter()[0];
|
||||
List<Pair<String, String>> ghnList= (List<Pair<String, String>>) this.getParameter()[1];
|
||||
String candidateGHN=(String) this.getParameter()[2];
|
||||
String candidateGHN=(String) this.getParameter()[1];
|
||||
|
||||
AddResourcesParameters arp= new AddResourcesParameters();
|
||||
ServiceList services= new ServiceList();
|
||||
|
@ -168,21 +184,7 @@ public class DeployVREonGHNs extends Thread{
|
|||
service[0].setServiceVersion("1.00.00");
|
||||
services.setService(service);
|
||||
|
||||
//preparing the GHN where will be deployed the VREManager
|
||||
if (candidateGHN==null){
|
||||
Pair<String, String> ghnId=null;
|
||||
for (Pair<String, String> cpl: ghnList){
|
||||
if (this.usedhost.contains(cpl.second)){
|
||||
ghnId=cpl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ghnId==null) ghnId=ghnList.get(0);
|
||||
logger.debug("deploying the ResourceManager for the vre on "+ ghnId.second);
|
||||
services.setGHN(new String[]{ghnId.first});
|
||||
ghnList.remove(ghnId);
|
||||
}else services.setGHN(new String[]{candidateGHN});
|
||||
|
||||
services.setGHN(new String[]{candidateGHN});
|
||||
arp.setServices(services);
|
||||
arp.setTargetScope(this.scope+"/"+vreName);
|
||||
String reportId=resourceManagerPT.addResources(arp);
|
||||
|
@ -192,7 +194,7 @@ public class DeployVREonGHNs extends Thread{
|
|||
Thread.currentThread().sleep(20000);
|
||||
report=resourceManagerPT.getReport(reportId);
|
||||
attempt++;
|
||||
getResource().setFirstReport(report);
|
||||
getResource().getDeployReport().getResourceManagerDeployingReport().setResourceManagerReport(report);
|
||||
getResource().store();
|
||||
}while (!isDeploymentStatusFinished(report) && attempt<10);
|
||||
|
||||
|
@ -205,108 +207,38 @@ public class DeployVREonGHNs extends Thread{
|
|||
|
||||
resourceManagerHandler.clearBlackboard();
|
||||
resourceManagerHandler.setHandled(new GCUBEServiceClientImpl());
|
||||
resourceManagerHandler.setParameter(new Object[]{vreName,ghnList,candidateGHN});
|
||||
resourceManagerHandler.setParameter(new Object[]{vreName,candidateGhnId});
|
||||
resourceManagerHandler.scope=this.startingScope;
|
||||
|
||||
try {
|
||||
resourceManagerHandler.run();
|
||||
} catch (Exception e) {
|
||||
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
|
||||
getResource().store();
|
||||
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();
|
||||
return resourceManagerHandler.getReturnValue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
private boolean createVRE(List<String> ghnList) throws Exception{
|
||||
|
||||
ResourceManagerPortType rmPortType=null;
|
||||
int attempt=0;
|
||||
do{
|
||||
try{
|
||||
try{
|
||||
Thread.currentThread().sleep(30000);
|
||||
}catch (Exception et){}
|
||||
|
||||
ISClient client = GHNContext.getImplementation(ISClient.class);
|
||||
GCUBERIQuery query = client.getQuery(GCUBERIQuery.class);
|
||||
|
||||
query.setExpression("declare namespace is = 'http://gcube-system.org/namespaces/informationsystem/registry';" +
|
||||
" for $outer in collection(\"/db/Profiles/RunningInstance\")//Document/Data/is:Profile/Resource " +
|
||||
" let $scope:= $outer/Scopes/Scope[string() eq '"+GCUBEScope.getScope(this.startingScope+"/"+this.vreName).toString()+"'] " +
|
||||
" where count($scope)>0 " +
|
||||
" and $outer/Profile/ServiceName/string() eq 'ResourceManager' " +
|
||||
" return $outer");
|
||||
|
||||
List<EndpointReferenceType> eprs = new ArrayList<EndpointReferenceType>();
|
||||
for (GCUBERunningInstance instance : client.execute(query, GCUBEScope.getScope(this.startingScope+"/"+this.vreName)))
|
||||
eprs.add(instance.getAccessPoint().getEndpoint("gcube/vremanagement/ResourceManager"));
|
||||
if(eprs.size()==0) throw new NoQueryResultException();
|
||||
ResourceManagerServiceAddressingLocator vmsal= new ResourceManagerServiceAddressingLocator();
|
||||
rmPortType= vmsal.getResourceManagerPortTypePort(eprs.get(0));
|
||||
rmPortType = GCUBERemotePortTypeContext.getProxy(rmPortType,GCUBEScope.getScope(this.startingScope+"/"+this.vreName), Integer.parseInt((String)ServiceContext.getContext().getProperty("resourceManagerTimeout", true)));
|
||||
}catch(Exception e){
|
||||
logger.warn(e);
|
||||
logger.warn("the query for resourceManager returned no result, re-trying in 30 secs ("+attempt+")");
|
||||
}finally {attempt++;}
|
||||
}while(rmPortType==null && attempt<10);
|
||||
ResourceManagerPortType rmPortType=getResourceMangerPTinVRE();
|
||||
|
||||
if (attempt>=10) throw new Exception("no ResourceMaanger can be retrieved for scope "+GCUBEScope.getScope(this.startingScope+"/"+this.vreName).toString());
|
||||
retrieveFunctionalityForReport();
|
||||
|
||||
ResultSet resGenericInfo = DBInterface.queryDB("select VRE.name, VRE.vredesigner, VRE.vremanager, VRE.IntervalTo, VRE.IntervalFrom, VRE.description from VRE where VRE.id='"+this.resourceId+"'; ");
|
||||
if (!resGenericInfo.next()) throw new GCUBEFault("The VRE with ID "+this.resourceId+" cannot be retrieved");
|
||||
|
||||
CreateScopeParameters scopeParameter=new CreateScopeParameters();
|
||||
OptionsParameters optPar= new OptionsParameters();
|
||||
ScopeOption[] scopeOptionList= new ScopeOption[6];
|
||||
ScopeOption soDesigner= new ScopeOption();
|
||||
soDesigner.setName("DESIGNER");
|
||||
soDesigner.setValue(resGenericInfo.getString("vredesigner"));
|
||||
scopeOptionList[0]= soDesigner;
|
||||
|
||||
ScopeOption soCreator= new ScopeOption();
|
||||
soCreator.setName("CREATOR");
|
||||
soCreator.setValue(resGenericInfo.getString("vremanager"));
|
||||
scopeOptionList[1]= soCreator;
|
||||
|
||||
ScopeOption soEndtime= new ScopeOption();
|
||||
soEndtime.setName("ENDTIME");
|
||||
soEndtime.setValue(KGCUBEResource.toXMLDateAndTime(resGenericInfo.getDate("IntervalTo")));
|
||||
scopeOptionList[2]= soEndtime;
|
||||
|
||||
ScopeOption soStarttime= new ScopeOption();
|
||||
soStarttime.setName("STARTTIME");
|
||||
soStarttime.setValue(KGCUBEResource.toXMLDateAndTime(resGenericInfo.getDate("IntervalFrom")));
|
||||
scopeOptionList[3]= soStarttime;
|
||||
|
||||
ScopeOption soDescription= new ScopeOption();
|
||||
soDescription.setName("DESCRIPTION");
|
||||
soDescription.setValue(resGenericInfo.getString("description"));
|
||||
scopeOptionList[4]= soDescription;
|
||||
|
||||
ScopeOption soDisplayname= new ScopeOption();
|
||||
soDisplayname.setName("DISPLAYNAME");
|
||||
soDisplayname.setValue(resGenericInfo.getString("name"));
|
||||
scopeOptionList[5]= soDisplayname;
|
||||
|
||||
optPar.setScopeOptionList(scopeOptionList);
|
||||
|
||||
scopeParameter.setOptionsParameters(optPar);
|
||||
CreateScopeParameters scopeParameter=getScopeParameters();
|
||||
|
||||
//creating the GenericResources for Portlets and Collection
|
||||
GenericResourcePortlet.createResource(getResource().getId(), vreName);
|
||||
collectionResourceCreation.createAndPublish();
|
||||
|
||||
LayoutCreation createdlayout= new LayoutCreation(getResource().getId(), vreName);
|
||||
createdlayout.createAndPublishLayout();
|
||||
|
||||
//waiting few seconds to be sure that generic resources will be published
|
||||
Thread.currentThread().sleep(120000);
|
||||
|
||||
|
@ -316,29 +248,12 @@ public class DeployVREonGHNs extends Thread{
|
|||
List<ResourceItem> resItemList= new ArrayList<ResourceItem>();
|
||||
//retrieving Collection
|
||||
try{
|
||||
|
||||
ResourceItem resItem;
|
||||
ResultSet resRelatedCol =DBInterface.queryDB("select VRERELATEDCOLLECTION.collid from VRERELATEDCOLLECTION where VRERELATEDCOLLECTION.vreid='"+this.resourceId+"';");
|
||||
while (resRelatedCol.next()){
|
||||
resItem= new ResourceItem();
|
||||
resItem.setID(resRelatedCol.getString(1));
|
||||
logger.debug("selected collection:"+ resItem.getID());
|
||||
resItem.setType(GCUBECollection.TYPE);
|
||||
resItemList.add(resItem);
|
||||
}
|
||||
resItemList.addAll(addCollections());
|
||||
}catch(SQLException sqle){logger.error("Error contacting HSQLDB "+sqle);}
|
||||
|
||||
//retrieving MDCollection with native MDFormat
|
||||
try{
|
||||
ResourceItem resItem;
|
||||
ResultSet resMdColNative =DBInterface.queryDB("select n.mdcollid from VRERELATEDMETADATAFORMAT AS s, NATIVEMDF as n where s.vreid='"+this.resourceId+"' and n.mdfid=s.mfid;");
|
||||
while (resMdColNative.next()){
|
||||
resItem= new ResourceItem();
|
||||
resItem.setID(resMdColNative.getString(1));
|
||||
logger.debug("selected MetadataCollection:"+ resItem.getID());
|
||||
resItem.setType(GCUBEMCollection.TYPE);
|
||||
resItemList.add(resItem);
|
||||
}
|
||||
resItemList.addAll(addMetadataFormats());
|
||||
}catch(SQLException sqle){
|
||||
logger.error("Error contacting HSQLDB ",sqle);
|
||||
}
|
||||
|
@ -349,45 +264,20 @@ public class DeployVREonGHNs extends Thread{
|
|||
genResItem.setType(GCUBEGenericResource.TYPE);
|
||||
resItemList.add(genResItem);
|
||||
|
||||
genResItem= new ResourceItem();
|
||||
genResItem.setID(createdlayout.getCreatedResourceId());
|
||||
genResItem.setType(GCUBEGenericResource.TYPE);
|
||||
resItemList.add(genResItem);
|
||||
|
||||
//adding the other needed resources
|
||||
try{
|
||||
ResourceItem resItem;
|
||||
ResultSet neededRes =DBInterface.queryDB("select n.id, n.type from NEEDEDRESOURCES AS n;");
|
||||
while (neededRes.next()){
|
||||
resItem= new ResourceItem();
|
||||
resItem.setID(neededRes.getString(1));
|
||||
resItem.setType(neededRes.getString(2));
|
||||
logger.debug("Needed GenericResources:"+ resItem.getID());
|
||||
resItemList.add(resItem);
|
||||
}
|
||||
resItemList.addAll(addGenericResources());
|
||||
}catch(SQLException sqle){
|
||||
logger.error("Error contacting HSQLDB "+sqle);
|
||||
}
|
||||
|
||||
|
||||
rl.setResource(resItemList.toArray(new ResourceItem[0]));
|
||||
arp.setResources(rl);
|
||||
|
||||
//retrieve services
|
||||
ServiceList serviceList= new ServiceList();
|
||||
try{
|
||||
ServiceItem servItem;
|
||||
List<ServiceItem> listService= new ArrayList<ServiceItem>();
|
||||
ResultSet resService =DBInterface.queryDB("select DISTINCT s.name, s.class, s.version from VRERELATEDFUNCT AS vrf, SERVICES AS s where vrf.vreid='"+this.resourceId+"' AND s.id=vrf.funcid;");
|
||||
while (resService.next()){
|
||||
servItem= new ServiceItem();
|
||||
servItem.setServiceClass(resService.getString("class"));
|
||||
servItem.setServiceName(resService.getString("name"));
|
||||
servItem.setServiceVersion(resService.getString("version"));
|
||||
logger.debug("selected services:"+ servItem.getServiceClass()+" "+servItem.getServiceName()+" "+servItem.getServiceVersion());
|
||||
listService.add(servItem);
|
||||
}
|
||||
serviceList.setService(listService.toArray(new ServiceItem[0]));
|
||||
serviceList.setService(addServices().toArray(new ServiceItem[0]));
|
||||
}catch(SQLException sqle){logger.error("Error contacting HSQLDB "+sqle);}
|
||||
|
||||
//sets the GHNs
|
||||
|
@ -398,7 +288,7 @@ public class DeployVREonGHNs extends Thread{
|
|||
scopeParameter.setAddResourcesParameters(arp);
|
||||
scopeParameter.setName(GCUBEScope.getScope(this.startingScope+"/"+this.vreName).toString());
|
||||
|
||||
String report= "starting";
|
||||
String report=null;
|
||||
String reportId=rmPortType.createScope(scopeParameter);
|
||||
|
||||
int reportAttempt=0;
|
||||
|
@ -408,16 +298,14 @@ public class DeployVREonGHNs extends Thread{
|
|||
}catch (Exception e) {}
|
||||
report=rmPortType.getReport(reportId);
|
||||
reportAttempt++;
|
||||
getResource().setSecondReport(report);
|
||||
getResource().getDeployReport().getFunctionalityDeployingReport().setResourceManagerReport(report);
|
||||
getResource().store();
|
||||
|
||||
}while (!isDeploymentStatusFinished(report) && reportAttempt<40);
|
||||
|
||||
|
||||
}while (!(isDeploymentStatusFinished(report)) && reportAttempt<40);
|
||||
|
||||
logger.info("is something failed in the second step?"+isSomethingFailed(report));
|
||||
logger.trace("report step 2: "+report);
|
||||
return isSomethingFailed(report);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -426,7 +314,7 @@ public class DeployVREonGHNs extends Thread{
|
|||
* @param report the VRE deployment report
|
||||
* @return true if Failed, else false
|
||||
*/
|
||||
private boolean isSomethingFailed(String report){
|
||||
private static boolean isSomethingFailed(String report){
|
||||
boolean ret = false;
|
||||
String deploymentXpath = "/ResourceReport/DeploymentPlanCreation/Status";
|
||||
String dependenciesResolutionXpath ="/ResourceReport/Services/Service/DependenciesResolutionStatus";
|
||||
|
@ -470,7 +358,7 @@ public class DeployVREonGHNs extends Thread{
|
|||
return ret;
|
||||
}
|
||||
|
||||
private boolean isDeploymentStatusFinished(String report) {
|
||||
private static boolean isDeploymentStatusFinished(String report) {
|
||||
boolean ret = false;
|
||||
String xpath = "/ResourceReport/Services/Service/DeploymentActivity/GHN/LastReportReceived/Status";
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
|
@ -501,4 +389,166 @@ public class DeployVREonGHNs extends Thread{
|
|||
return ret;
|
||||
}
|
||||
|
||||
private ResourceManagerPortType getResourceMangerPTinVRE() throws Exception{
|
||||
ResourceManagerPortType rmPortType = null;
|
||||
int attempt=0;
|
||||
do{
|
||||
try{
|
||||
try{
|
||||
Thread.sleep(30000);
|
||||
}catch (Exception et){}
|
||||
|
||||
ISClient client = GHNContext.getImplementation(ISClient.class);
|
||||
GCUBERIQuery query = client.getQuery(GCUBERIQuery.class);
|
||||
|
||||
query.setExpression("declare namespace is = 'http://gcube-system.org/namespaces/informationsystem/registry';" +
|
||||
" for $outer in collection(\"/db/Profiles/RunningInstance\")//Document/Data/is:Profile/Resource " +
|
||||
" let $scope:= $outer/Scopes/Scope[string() eq '"+GCUBEScope.getScope(this.startingScope+"/"+this.vreName).toString()+"'] " +
|
||||
" where count($scope)>0 " +
|
||||
" and $outer/Profile/ServiceName/string() eq 'ResourceManager' " +
|
||||
" return $outer");
|
||||
|
||||
List<EndpointReferenceType> eprs = new ArrayList<EndpointReferenceType>();
|
||||
for (GCUBERunningInstance instance : client.execute(query, GCUBEScope.getScope(this.startingScope+"/"+this.vreName)))
|
||||
eprs.add(instance.getAccessPoint().getEndpoint("gcube/vremanagement/ResourceManager"));
|
||||
if(eprs.size()==0) throw new NoQueryResultException();
|
||||
ResourceManagerServiceAddressingLocator vmsal= new ResourceManagerServiceAddressingLocator();
|
||||
rmPortType= vmsal.getResourceManagerPortTypePort(eprs.get(0));
|
||||
rmPortType = GCUBERemotePortTypeContext.getProxy(rmPortType,GCUBEScope.getScope(this.startingScope+"/"+this.vreName), Integer.parseInt((String)ServiceContext.getContext().getProperty("resourceManagerTimeout", true)));
|
||||
}catch(Exception e){
|
||||
logger.warn(e);
|
||||
logger.warn("the query for resourceManager returned no result, re-trying in 30 secs ("+attempt+")");
|
||||
}finally {attempt++;}
|
||||
}while(rmPortType==null && attempt<10);
|
||||
|
||||
if (attempt>=10) throw new Exception("no ResourceMaanger can be retrieved for scope "+GCUBEScope.getScope(this.startingScope+"/"+this.vreName).toString());
|
||||
|
||||
return rmPortType;
|
||||
}
|
||||
|
||||
private CreateScopeParameters getScopeParameters() throws Exception{
|
||||
ResultSet resGenericInfo = DBInterface.queryDB("select VRE.name, VRE.vredesigner, VRE.vremanager, VRE.IntervalTo, VRE.IntervalFrom, VRE.description from VRE where VRE.id='"+this.resourceId+"'; ");
|
||||
if (!resGenericInfo.next()) throw new GCUBEFault("The VRE with ID "+this.resourceId+" cannot be retrieved");
|
||||
|
||||
CreateScopeParameters scopeParameter=new CreateScopeParameters();
|
||||
OptionsParameters optPar= new OptionsParameters();
|
||||
ScopeOption[] scopeOptionList= new ScopeOption[6];
|
||||
ScopeOption soDesigner= new ScopeOption();
|
||||
soDesigner.setName("DESIGNER");
|
||||
soDesigner.setValue(resGenericInfo.getString("vredesigner"));
|
||||
scopeOptionList[0]= soDesigner;
|
||||
|
||||
ScopeOption soCreator= new ScopeOption();
|
||||
soCreator.setName("CREATOR");
|
||||
soCreator.setValue(resGenericInfo.getString("vremanager"));
|
||||
scopeOptionList[1]= soCreator;
|
||||
|
||||
ScopeOption soEndtime= new ScopeOption();
|
||||
soEndtime.setName("ENDTIME");
|
||||
soEndtime.setValue(KGCUBEResource.toXMLDateAndTime(resGenericInfo.getDate("IntervalTo")));
|
||||
scopeOptionList[2]= soEndtime;
|
||||
|
||||
ScopeOption soStarttime= new ScopeOption();
|
||||
soStarttime.setName("STARTTIME");
|
||||
soStarttime.setValue(KGCUBEResource.toXMLDateAndTime(resGenericInfo.getDate("IntervalFrom")));
|
||||
scopeOptionList[3]= soStarttime;
|
||||
|
||||
ScopeOption soDescription= new ScopeOption();
|
||||
soDescription.setName("DESCRIPTION");
|
||||
soDescription.setValue(resGenericInfo.getString("description"));
|
||||
scopeOptionList[4]= soDescription;
|
||||
|
||||
ScopeOption soDisplayname= new ScopeOption();
|
||||
soDisplayname.setName("DISPLAYNAME");
|
||||
soDisplayname.setValue(resGenericInfo.getString("name"));
|
||||
scopeOptionList[5]= soDisplayname;
|
||||
|
||||
optPar.setScopeOptionList(scopeOptionList);
|
||||
|
||||
scopeParameter.setOptionsParameters(optPar);
|
||||
return scopeParameter;
|
||||
}
|
||||
|
||||
private List<ResourceItem> addCollections() throws Exception{
|
||||
List<ResourceItem> resItemList= new ArrayList<ResourceItem>();
|
||||
ResourceItem resItem;
|
||||
ResultSet resRelatedCol =DBInterface.queryDB("select VRERELATEDCOLLECTION.collid from VRERELATEDCOLLECTION where VRERELATEDCOLLECTION.vreid='"+this.resourceId+"';");
|
||||
while (resRelatedCol.next()){
|
||||
resItem= new ResourceItem();
|
||||
resItem.setID(resRelatedCol.getString(1));
|
||||
logger.trace("selected collection:"+ resItem.getID());
|
||||
resItem.setType(GCUBECollection.TYPE);
|
||||
resItemList.add(resItem);
|
||||
}
|
||||
return resItemList;
|
||||
}
|
||||
|
||||
private List<ResourceItem> addMetadataFormats() throws Exception{
|
||||
List<ResourceItem> resItemList= new ArrayList<ResourceItem>();
|
||||
ResourceItem resItem;
|
||||
ResultSet resMdColNative =DBInterface.queryDB("select n.mdcollid from VRERELATEDMETADATAFORMAT AS s, NATIVEMDF as n where s.vreid='"+this.resourceId+"' and n.mdfid=s.mfid;");
|
||||
while (resMdColNative.next()){
|
||||
resItem= new ResourceItem();
|
||||
resItem.setID(resMdColNative.getString(1));
|
||||
logger.trace("selected MetadataCollection:"+ resItem.getID());
|
||||
resItem.setType(GCUBEMCollection.TYPE);
|
||||
resItemList.add(resItem);
|
||||
}
|
||||
return resItemList;
|
||||
}
|
||||
|
||||
private List<ResourceItem> addGenericResources() throws Exception{
|
||||
List<ResourceItem> resItemList= new ArrayList<ResourceItem>();
|
||||
ResourceItem resItem;
|
||||
ResultSet neededRes =DBInterface.queryDB("select n.id, n.type from NEEDEDRESOURCES AS n;");
|
||||
while (neededRes.next()){
|
||||
resItem= new ResourceItem();
|
||||
resItem.setID(neededRes.getString(1));
|
||||
resItem.setType(neededRes.getString(2));
|
||||
logger.trace("Needed GenericResources:"+ resItem.getID());
|
||||
resItemList.add(resItem);
|
||||
}
|
||||
return resItemList;
|
||||
}
|
||||
|
||||
private List<ServiceItem> addServices() throws Exception{
|
||||
ServiceItem servItem;
|
||||
List<ServiceItem> listServices= new ArrayList<ServiceItem>();
|
||||
ResultSet resService =DBInterface.queryDB("select DISTINCT s.name, s.class, s.version from VRERELATEDFUNCT AS vrf, SERVICES AS s where vrf.vreid='"+this.resourceId+"' AND s.id=vrf.funcid;");
|
||||
while (resService.next()){
|
||||
servItem= new ServiceItem();
|
||||
servItem.setServiceClass(resService.getString("class"));
|
||||
servItem.setServiceName(resService.getString("name"));
|
||||
servItem.setServiceVersion(resService.getString("version"));
|
||||
logger.trace("selected services:"+ servItem.getServiceClass()+" "+servItem.getServiceName()+" "+servItem.getServiceVersion());
|
||||
listServices.add(servItem);
|
||||
}
|
||||
return listServices;
|
||||
}
|
||||
|
||||
private void retrieveFunctionalityForReport() throws Exception{
|
||||
ResultSet resService =DBInterface.queryDB("select func.id, func.name, s.name, s.class, s.version from FUNCTIONALITY as func, VRERELATEDFUNCT AS vrf, SERVICES AS s where vrf.vreid='"+this.resourceId+"' AND s.id=vrf.funcid AND vrf.funcid=func.id;");
|
||||
FunctionalityDeployingReport report = getResource().getDeployReport().getFunctionalityDeployingReport();
|
||||
while(resService.next()){
|
||||
FunctionalityReport funcReport= new FunctionalityReport();
|
||||
funcReport.setFunctionalityId(resService.getString(1));
|
||||
funcReport.setFunctionalityName(resService.getString(2));
|
||||
funcReport.setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Running);
|
||||
|
||||
ServiceReport servReport= new ServiceReport();
|
||||
servReport.setServiceName(resService.getString(3));
|
||||
servReport.setServiceClass(resService.getString(4));
|
||||
servReport.setServiceVersion(resService.getString(5));
|
||||
servReport.setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Running);
|
||||
|
||||
List<ServiceReport> listService;
|
||||
if ((listService=report.getFunctionalityTable().get(funcReport))==null){
|
||||
listService= new ArrayList<ServiceReport>();
|
||||
listService.add(servReport);
|
||||
report.getFunctionalityTable().put(funcReport, listService);
|
||||
}else
|
||||
listService.add(servReport);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package org.gcube.vremanagement.vremodeler.impl.deploy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GHNstoUse{
|
||||
String candidateForRM;
|
||||
List<String> ghns= new ArrayList<String>();
|
||||
|
||||
public GHNstoUse(){}
|
||||
|
||||
public GHNstoUse(String candidateForRM, List<String> ghns) {
|
||||
super();
|
||||
this.candidateForRM = candidateForRM;
|
||||
this.ghns = ghns;
|
||||
}
|
||||
|
||||
public String getCandidateForRM() {
|
||||
return candidateForRM;
|
||||
}
|
||||
|
||||
public void setCandidateForRM(String candidateForRM) {
|
||||
this.candidateForRM = candidateForRM;
|
||||
}
|
||||
|
||||
public List<String> getGhns() {
|
||||
return ghns;
|
||||
}
|
||||
|
||||
public void setGhns(List<String> ghns) {
|
||||
this.ghns = ghns;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package org.gcube.vremanagement.vremodeler.portallayout;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.List;
|
||||
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.GCUBEGenericResourceQuery;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISPublisher;
|
||||
import org.gcube.common.core.resources.GCUBEGenericResource;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.vremanagement.vremodeler.impl.ServiceContext;
|
||||
|
||||
public class LayoutCreation {
|
||||
|
||||
private GCUBELog logger= new GCUBELog(LayoutCreation.class);
|
||||
|
||||
private GCUBEGenericResource resource;
|
||||
private String vreName;
|
||||
private String createdResourceId= null;
|
||||
|
||||
public String getCreatedResourceId(){
|
||||
return this.createdResourceId;
|
||||
}
|
||||
|
||||
private void publish(String body) throws Exception{
|
||||
resource.setBody(body);
|
||||
resource.setDescription("the gridsphere layout for vre: "+ServiceContext.getContext().getScope()+"/"+this.vreName);
|
||||
String[] splitScope=ServiceContext.getContext().getScope().toString().split("/");
|
||||
resource.setName("Layout_"+splitScope[1]+"_"+splitScope[2]+"_"+this.vreName);
|
||||
resource.setSecondaryType("LayoutResource");
|
||||
resource.addScope(GCUBEScope.getScope(ServiceContext.getContext().getScope()+"/"+this.vreName));
|
||||
ISPublisher publisher= GHNContext.getImplementation(ISPublisher.class);
|
||||
resource.load(new StringReader(publisher.registerGCUBEResource(resource, GCUBEScope.getScope(ServiceContext.getContext().getScope()+"/"+this.vreName), ServiceContext.getContext())));
|
||||
this.createdResourceId= resource.getID();
|
||||
}
|
||||
|
||||
|
||||
public LayoutCreation(String vreId, String vreName){
|
||||
this.vreName= vreName;
|
||||
try{
|
||||
this.resource= GHNContext.getImplementation(GCUBEGenericResource.class);
|
||||
}catch(Exception e){e.printStackTrace();}
|
||||
}
|
||||
|
||||
public GCUBEGenericResource createAndPublishLayout() throws Exception{
|
||||
ISClient client= GHNContext.getImplementation(ISClient.class);
|
||||
GCUBEGenericResourceQuery query= client.getQuery(GCUBEGenericResourceQuery.class);
|
||||
query.addAtomicConditions(new AtomicCondition("/Profile/SecondaryType","VREModelerResource"), new AtomicCondition("/Profile/Name","DefaultLayout"));
|
||||
List<GCUBEGenericResource> defaultLayoutResourceList= client.execute(query, ServiceContext.getContext().getScope());
|
||||
if (defaultLayoutResourceList.size()>0)
|
||||
this.publish(defaultLayoutResourceList.get(0).getBody());
|
||||
else{
|
||||
logger.debug("no DefaultLayout resource found, creating the VRE with an empty one");
|
||||
this.publish("<tabbed-pane can-modify=\"false\" label=\"\" required-role=\"\" style=\"menu\" visible=\"true\" width=\"\"><tab align=\"left\" can-modify=\"false\" gCube-editable=\"false\" label=\"\" order=\"50\" outline=\"true\" required-role=\"VRE-Manager\" style=\"\" visible=\"true\" width=\"\"><title lang=\"en\">VREManagement</title><tabbed-pane can-modify=\"false\" label=\"\" required-role=\"\" style=\"sub-menu\" visible=\"true\" width=\"\"><tab align=\"left\" can-modify=\"false\" gCube-editable=\"false\" label=\"\" order=\"50\" outline=\"true\" required-role=\"VRE-Manager\" style=\"\" visible=\"true\" width=\"\"><title lang=\"en\">LayoutCreator</title><table can-modify=\"false\" label=\"\" required-role=\"\" style=\"\" visible=\"true\" width=\"\"><row can-modify=\"false\" gCube-editable=\"false\" label=\"\" required-role=\"\" style=\"\" visible=\"true\" width=\"\"><column can-modify=\"false\" gCube-editable=\"false\" label=\"\" required-role=\"\" style=\"\" visible=\"true\" width=\"100%\"><frame can-modify=\"false\" gCube-editable=\"false\" inner-padding=\"\" label=\"LayoutcreatorPortlet\" outer-padding=\"\" required-role=\"VRE-Manager\" style=\"\" transparent=\"true\" visible=\"true\" width=\"\"><portlet-class>layoutcreator#LayoutcreatorPortlet</portlet-class></frame></column></row></table></tab></tabbed-pane></tab></tabbed-pane>");
|
||||
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
|
||||
}
|
|
@ -29,7 +29,7 @@ public class GHNHandler implements ResourceHandler<GCUBEHostingNode> {
|
|||
for (GCUBEHostingNode ghn:ghnList)
|
||||
try{
|
||||
insert(ghn);
|
||||
}catch(Exception e){logger.error("error insertin values in "+tableName, e);}
|
||||
}catch(Exception e){logger.error("error inserting values in "+tableName, e);}
|
||||
}
|
||||
|
||||
private void insert(GCUBEHostingNode ghn) throws Exception {
|
||||
|
@ -45,6 +45,7 @@ public class GHNHandler implements ResourceHandler<GCUBEHostingNode> {
|
|||
row.add(ghn.getSite().getLocation());
|
||||
row.add(ghn.getSite().getCountry());
|
||||
row.add(ghn.getSite().getDomain());
|
||||
row.add("false");
|
||||
DBInterface.connect();
|
||||
DBInterface.insertInto(tableName, row.toArray(new String[0]));
|
||||
RunningInstancesHandler riHandler= new RunningInstancesHandler(ghn.getID());
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package org.gcube.vremanagement.vremodeler.resources.handlers;
|
||||
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
//import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.vremanagement.vremodeler.db.DBInterface;
|
||||
import org.gcube.vremanagement.vremodeler.resources.MFRelationNative;
|
||||
|
||||
public class NativeMetadataFormatHandler implements ResourceHandler<MFRelationNative> {
|
||||
|
||||
private static GCUBELog logger= new GCUBELog(NativeMetadataFormatHandler.class);
|
||||
//private static GCUBELog logger= new GCUBELog(NativeMetadataFormatHandler.class);
|
||||
public static final String tableName="NATIVEMDF";
|
||||
|
||||
|
||||
|
|
|
@ -2,19 +2,6 @@ package org.gcube.vremanagement.vremodeler.resources.kxml;
|
|||
|
||||
import static org.gcube.common.resources.kxml.KGCUBEResource.NS;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.gcube.common.core.resources.GCUBEGenericResource;
|
||||
import org.gcube.common.core.resources.service.Dependency;
|
||||
import org.gcube.common.core.resources.service.Dependency.Service;
|
||||
import org.gcube.common.core.resources.service.Package.ScopeLevel;
|
||||
import org.gcube.common.resources.kxml.GCUBEResourceImpl;
|
||||
import org.gcube.common.resources.kxml.KGCUBEResource;
|
||||
import org.gcube.common.resources.kxml.service.version.VersionSpecificationParser;
|
||||
import org.gcube.vremanagement.vremodeler.resources.Body;
|
||||
import org.gcube.vremanagement.vremodeler.resources.MainFunctionality;
|
||||
import org.kxml2.io.KXmlParser;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package org.gcube.vremanagement.vremodeler.stubs;
|
||||
|
||||
import java.io.StringReader;
|
||||
|
||||
import org.gcube.vremanagement.vremodeler.stubs.deployreport.DeployReport;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
|
||||
public class Utils {
|
||||
|
||||
public static String toXML(DeployReport report){
|
||||
return new XStream().toXML(report);
|
||||
}
|
||||
|
||||
public static DeployReport fromXML(String report){
|
||||
return (DeployReport) new XStream().fromXML(new StringReader(report));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package org.gcube.vremanagement.vremodeler.stubs;
|
||||
|
||||
public enum VREState {
|
||||
|
||||
DEPLOYED("Deployed"),
|
||||
IN_PROGRESS("In Progress"),
|
||||
FAILED("Failed"),
|
||||
PENDING("Pending"),
|
||||
DEPLOYING("Deploying");
|
||||
|
||||
private String value;
|
||||
|
||||
VREState(String value){
|
||||
this.value= value;
|
||||
}
|
||||
|
||||
public String getValue(){
|
||||
return this.value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package org.gcube.vremanagement.vremodeler.stubs.deployreport;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author lucio
|
||||
*
|
||||
*/
|
||||
public class DeployReport implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public DeployReport(){
|
||||
this.state= State.Waiting;
|
||||
this.cloudDeployingReport= new GHNonCloudReport();
|
||||
this.functionalityDeployingReport= new FunctionalityDeployingReport();
|
||||
this.resourceMaangerDeployingReport= new ResourceManagerDeployingReport();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7295105471156172674L;
|
||||
private State state;
|
||||
private GHNonCloudReport cloudDeployingReport;
|
||||
private ResourceManagerDeployingReport resourceMaangerDeployingReport;
|
||||
private FunctionalityDeployingReport functionalityDeployingReport;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public GHNonCloudReport getCloudDeployingReport() {
|
||||
return cloudDeployingReport;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cloudDeployingReport
|
||||
*/
|
||||
public void setCloudDeployingReport(GHNonCloudReport cloudDeployingReport) {
|
||||
this.cloudDeployingReport = cloudDeployingReport;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ResourceManagerDeployingReport getResourceManagerDeployingReport() {
|
||||
return resourceMaangerDeployingReport;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resourceMaangerDeployingReport
|
||||
*/
|
||||
public void setResourceMaangerDeployingReport(
|
||||
ResourceManagerDeployingReport resourceMaangerDeployingReport) {
|
||||
this.resourceMaangerDeployingReport = resourceMaangerDeployingReport;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public FunctionalityDeployingReport getFunctionalityDeployingReport() {
|
||||
return functionalityDeployingReport;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param functionalityDeployingReport
|
||||
*/
|
||||
public void setFunctionalityDeployingReport(
|
||||
FunctionalityDeployingReport functionalityDeployingReport) {
|
||||
this.functionalityDeployingReport = functionalityDeployingReport;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package org.gcube.vremanagement.vremodeler.stubs.deployreport;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
|
||||
public class FunctionalityDeployingReport implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5667226186772008010L;
|
||||
|
||||
private Hashtable<FunctionalityReport, List<ServiceReport>> functionalityTable= new Hashtable<FunctionalityReport, List<ServiceReport>>();
|
||||
|
||||
private String resourceManagerReport;
|
||||
private State state;
|
||||
|
||||
public FunctionalityDeployingReport(){
|
||||
this.state= State.Waiting;
|
||||
this.functionalityTable= new Hashtable<FunctionalityReport, List<ServiceReport>>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Hashtable<FunctionalityReport, List<ServiceReport>> getFunctionalityTable() {
|
||||
return functionalityTable;
|
||||
}
|
||||
|
||||
public void setFunctionalityTable(
|
||||
Hashtable<FunctionalityReport, List<ServiceReport>> functionalityTable) {
|
||||
this.functionalityTable = functionalityTable;
|
||||
}
|
||||
|
||||
public String getResourceManagerReport() {
|
||||
return resourceManagerReport;
|
||||
}
|
||||
|
||||
public void setResourceManagerReport(String resourceManagerReport) {
|
||||
this.resourceManagerReport = resourceManagerReport;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package org.gcube.vremanagement.vremodeler.stubs.deployreport;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class FunctionalityReport implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1104477953274508866L;
|
||||
|
||||
private State state;
|
||||
|
||||
private String functionalityId;
|
||||
private String functionalityName;
|
||||
|
||||
public FunctionalityReport(){
|
||||
this.state=State.Waiting;
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getFunctionalityId() {
|
||||
return functionalityId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setFunctionalityId(String functionalityId) {
|
||||
this.functionalityId = functionalityId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getFunctionalityName() {
|
||||
return functionalityName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setFunctionalityName(String functioanlityName) {
|
||||
this.functionalityName = functioanlityName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int hashCode(){
|
||||
return functionalityId.hashCode();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
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 {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1418965279876312220L;
|
||||
|
||||
private State state;
|
||||
|
||||
private List<State> deployingState= new ArrayList<State>();
|
||||
|
||||
public GHNonCloudReport() {
|
||||
this.state= State.Waiting;
|
||||
Collections.fill(this.deployingState, State.Waiting);
|
||||
}
|
||||
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public List<State> getDeployingState() {
|
||||
return deployingState;
|
||||
}
|
||||
|
||||
public void setDeployingState(List<State> deployingState) {
|
||||
this.deployingState = deployingState;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.gcube.vremanagement.vremodeler.stubs.deployreport;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ResourceManagerDeployingReport implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8076338857724950353L;
|
||||
|
||||
State state;
|
||||
|
||||
private String resourceManagerReport;
|
||||
|
||||
public ResourceManagerDeployingReport(){
|
||||
this.state= State.Waiting;
|
||||
this.resourceManagerReport=null;
|
||||
}
|
||||
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getResourceManagerReport() {
|
||||
return resourceManagerReport;
|
||||
}
|
||||
|
||||
public void setResourceManagerReport(String resourceManagerReport) {
|
||||
this.resourceManagerReport = resourceManagerReport;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package org.gcube.vremanagement.vremodeler.stubs.deployreport;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ServiceReport implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6061025649581168168L;
|
||||
|
||||
private State state;
|
||||
|
||||
private String serviceClass;
|
||||
private String serviceName;
|
||||
private String serviceVersion;
|
||||
|
||||
public ServiceReport(){
|
||||
this.state= State.Waiting;
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
public String getServiceClass() {
|
||||
return serviceClass;
|
||||
}
|
||||
public void setServiceClass(String serviceClass) {
|
||||
this.serviceClass = serviceClass;
|
||||
}
|
||||
public String getServiceName() {
|
||||
return serviceName;
|
||||
}
|
||||
public void setServiceName(String serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
public String getServiceVersion() {
|
||||
return serviceVersion;
|
||||
}
|
||||
public void setServiceVersion(String serviceVersion) {
|
||||
this.serviceVersion = serviceVersion;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.gcube.vremanagement.vremodeler.stubs.deployreport;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public enum State implements Serializable {
|
||||
Running,
|
||||
Failed,
|
||||
Finished,
|
||||
Skipped,
|
||||
Pending,
|
||||
Waiting
|
||||
}
|
Loading…
Reference in New Issue