This commit is contained in:
Lucio Lelii 2010-11-09 18:58:58 +00:00
parent cda4d2f4c0
commit b59afbb4cf
16 changed files with 93 additions and 353 deletions

View File

@ -4,4 +4,8 @@ v. 1.0.0 (17-10-2008)
v. 1.2.0 (14-05-2010) v. 1.2.0 (14-05-2010)
* ticket #211: ResourceManager integration * ticket #211: ResourceManager integration
* stubs modified * stubs modified
v. 1.3.0 (11-09-2010)
* support for cloud deployment

View File

@ -419,7 +419,8 @@ full.stubs: (optional) Set to 'false', it excludes auxiliary stub code plac
<target name="jarService" depends="buildService" description="jars service implementation"> <target name="jarService" depends="buildService" description="jars service implementation">
<copy todir="${build.class.dir}"> <copy todir="${build.class.dir}">
<fileset dir="${source.dir}"> <fileset dir="${source.dir}">
<include name="org/**/*.xsd"/> <include name="org/**/*.xsl"/>
<include name="org/**/*.xsd"/>
<include name="org/**/*.xml"/> <include name="org/**/*.xml"/>
<include name="org/**/*.properties"/> <include name="org/**/*.properties"/>
</fileset> </fileset>

5
changelog.xml Normal file
View File

@ -0,0 +1,5 @@
<ReleaseNotes>
<Changeset component="org.gcube.vremanagement.VREModeler.1-3-0" date="2010-11-9">
<Change>support for cloud deployment</Change>
</Changeset>
</ReleaseNotes>

View File

@ -11,7 +11,7 @@
<Main> <Main>
<Description>Allows user to create new VRE</Description> <Description>Allows user to create new VRE</Description>
<Name>VREModeler-service</Name> <Name>VREModeler-service</Name>
<Version>1.2.1</Version> <Version>1.3.0</Version>
<Dependencies> <Dependencies>
<Dependency> <Dependency>
<Service> <Service>
@ -20,7 +20,7 @@
<Version>1.0.0</Version> <Version>1.0.0</Version>
</Service> </Service>
<Package>VREModeler-stubs</Package> <Package>VREModeler-stubs</Package>
<Version>[1.02.00,1.03.00)</Version> <Version>[1.03.00,1.04.00)</Version>
<Scope level="GHN"/> <Scope level="GHN"/>
<Optional>false</Optional> <Optional>false</Optional>
</Dependency> </Dependency>
@ -39,285 +39,13 @@
<GARArchive>org.gcube.vremanagement.vremodeler.gar</GARArchive> <GARArchive>org.gcube.vremanagement.vremodeler.gar</GARArchive>
<PortType> <PortType>
<Name>gcube/vremanagement/vremodeler/ModelerFactoryService</Name> <Name>gcube/vremanagement/vremodeler/ModelerFactoryService</Name>
<WSDL> <WSDL></WSDL>
<definitions name="ModelerFactoryService"
targetNamespace="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:tns="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:coretypes="http://gcube-system.org/namespaces/common/core/types"
xmlns:corefaults="http://gcube-system.org/namespaces/common/core/faults"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" >
<import namespace="http://gcube-system.org/namespaces/common/core/faults" location="../gcube/common/core/faults/GCUBEFaults.wsdl"/>
<!--============================================================
T Y P E S
============================================================-->
<types>
<xsd:schema targetNamespace="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:tns="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://gcube-system.org/namespaces/common/core/types" schemaLocation="../gcube/common/core/types/GCUBETypes.xsd"/>
<xsd:import namespace="http://schemas.xmlsoap.org/ws/2004/03/addressing" schemaLocation="../ws/addressing/WS-Addressing.xsd" />
<!-- REQUESTS AND RESPONSES -->
<xsd:element name="createResource" type="coretypes:VOID"/>
<xsd:element name="createResourceResponse" type="wsa:EndpointReferenceType"/>
<xsd:element name="getAllVREsMessageResponse" type="xsd:string"/>
<xsd:element name="getAllVREsMessageRequest" type="coretypes:VOID"/>
<xsd:element name="initDBRequestMessage" type="coretypes:VOID"/>
<xsd:element name="initDBResponseMessage" type="coretypes:VOID"/>
<xsd:element name="removeVRERequestMessage" type="xsd:string"/>
<xsd:element name="removeVREResponseMessage" type="coretypes:VOID"/>
<xsd:element name="getExistingNamesResponseMessage">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="names" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getExistingNamesRequestMessage" type="coretypes:VOID"/>
</xsd:schema>
</types>
<!--============================================================
M E S S A G E S
============================================================-->
<message name="CreateResourceRequest">
<part name="request" element="tns:createResource"/>
</message>
<message name="CreateResourceResponse">
<part name="response" element="tns:createResourceResponse"/>
</message>
<message name="GetAllVREsRequest">
<part name="request" element="tns:getAllVREsMessageRequest"/>
</message>
<message name="GetAllVREsResponse">
<part name="response" element="tns:getAllVREsMessageResponse"/>
</message>
<message name="InitDBInputMessage">
<part name="request" element="tns:initDBRequestMessage"/>
</message>
<message name="InitDBOutputMessage">
<part name="response" element="tns:initDBResponseMessage"/>
</message>
<message name="RemoveVREInputMessage">
<part name="request" element="tns:removeVRERequestMessage"/>
</message>
<message name="RemoveVREOutputMessage">
<part name="response" element="tns:removeVREResponseMessage"/>
</message>
<message name="GetExistingNamesInputMessage">
<part name="request" element="tns:getExistingNamesRequestMessage"/>
</message>
<message name="GetExistingNamesOutputMessage">
<part name="response" element="tns:getExistingNamesResponseMessage"/>
</message>
<!--============================================================
P O R T T Y P E
============================================================-->
<portType name="ModelerFactoryPortType">
<operation name="createResource">
<input message="tns:CreateResourceRequest"/>
<output message="tns:CreateResourceResponse"/>
</operation>
<operation name="getAllVREs">
<input message="tns:GetAllVREsRequest"/>
<output message="tns:GetAllVREsResponse"/>
</operation>
<operation name="initDB">
<input message="tns:InitDBInputMessage"/>
<output message="tns:InitDBOutputMessage"/>
</operation>
<operation name="getExistingNamesVREs">
<input message="tns:GetExistingNamesInputMessage"/>
<output message="tns:GetExistingNamesOutputMessage"/>
</operation>
<operation name="removeVRE">
<input message="tns:RemoveVREInputMessage"/>
<output message="tns:RemoveVREOutputMessage"/>
</operation>
</portType>
</definitions></WSDL>
</PortType>
<PortType>
<Name>gcube/vremanagement/vremodeler/ModelerService</Name>
<WSDL>
<definitions name="ModelerFactoryService"
targetNamespace="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:tns="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:coretypes="http://gcube-system.org/namespaces/common/core/types"
xmlns:corefaults="http://gcube-system.org/namespaces/common/core/faults"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" >
<import namespace="http://gcube-system.org/namespaces/common/core/faults" location="../gcube/common/core/faults/GCUBEFaults.wsdl"/>
<!--============================================================
T Y P E S
============================================================-->
<types>
<xsd:schema targetNamespace="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:tns="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://gcube-system.org/namespaces/common/core/types" schemaLocation="../gcube/common/core/types/GCUBETypes.xsd"/>
<xsd:import namespace="http://schemas.xmlsoap.org/ws/2004/03/addressing" schemaLocation="../ws/addressing/WS-Addressing.xsd" />
<!-- REQUESTS AND RESPONSES -->
<xsd:element name="createResource" type="coretypes:VOID"/>
<xsd:element name="createResourceResponse" type="wsa:EndpointReferenceType"/>
<xsd:element name="getAllVREsMessageResponse" type="xsd:string"/>
<xsd:element name="getAllVREsMessageRequest" type="coretypes:VOID"/>
<xsd:element name="initDBRequestMessage" type="coretypes:VOID"/>
<xsd:element name="initDBResponseMessage" type="coretypes:VOID"/>
<xsd:element name="removeVRERequestMessage" type="xsd:string"/>
<xsd:element name="removeVREResponseMessage" type="coretypes:VOID"/>
<xsd:element name="getExistingNamesResponseMessage">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="names" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getExistingNamesRequestMessage" type="coretypes:VOID"/>
</xsd:schema>
</types>
<!--============================================================
M E S S A G E S
============================================================-->
<message name="CreateResourceRequest">
<part name="request" element="tns:createResource"/>
</message>
<message name="CreateResourceResponse">
<part name="response" element="tns:createResourceResponse"/>
</message>
<message name="GetAllVREsRequest">
<part name="request" element="tns:getAllVREsMessageRequest"/>
</message>
<message name="GetAllVREsResponse">
<part name="response" element="tns:getAllVREsMessageResponse"/>
</message>
<message name="InitDBInputMessage">
<part name="request" element="tns:initDBRequestMessage"/>
</message>
<message name="InitDBOutputMessage">
<part name="response" element="tns:initDBResponseMessage"/>
</message>
<message name="RemoveVREInputMessage">
<part name="request" element="tns:removeVRERequestMessage"/>
</message>
<message name="RemoveVREOutputMessage">
<part name="response" element="tns:removeVREResponseMessage"/>
</message>
<message name="GetExistingNamesInputMessage">
<part name="request" element="tns:getExistingNamesRequestMessage"/>
</message>
<message name="GetExistingNamesOutputMessage">
<part name="response" element="tns:getExistingNamesResponseMessage"/>
</message>
<!--============================================================
P O R T T Y P E
============================================================-->
<portType name="ModelerFactoryPortType">
<operation name="createResource">
<input message="tns:CreateResourceRequest"/>
<output message="tns:CreateResourceResponse"/>
</operation>
<operation name="getAllVREs">
<input message="tns:GetAllVREsRequest"/>
<output message="tns:GetAllVREsResponse"/>
</operation>
<operation name="initDB">
<input message="tns:InitDBInputMessage"/>
<output message="tns:InitDBOutputMessage"/>
</operation>
<operation name="getExistingNamesVREs">
<input message="tns:GetExistingNamesInputMessage"/>
<output message="tns:GetExistingNamesOutputMessage"/>
</operation>
<operation name="removeVRE">
<input message="tns:RemoveVREInputMessage"/>
<output message="tns:RemoveVREOutputMessage"/>
</operation>
</portType>
</definitions></WSDL>
</PortType> </PortType>
</Main> </Main>
<Software> <Software>
<Description>Allows user to create new VRE</Description> <Description>Allows user to create new VRE</Description>
<Name>VREModeler-stubs</Name> <Name>VREModeler-stubs</Name>
<Version>1.2.1</Version> <Version>1.3.0</Version>
<Files><File>org.gcube.vremanagement.vremodeler.stubs.jar</File></Files> <Files><File>org.gcube.vremanagement.vremodeler.stubs.jar</File></Files>
</Software> </Software>
</Packages> </Packages>

View File

@ -18,6 +18,10 @@ public class CollectionConsumer extends BaseNotificationConsumer{
public static final GCUBENotificationTopic collectionTopic= new GCUBENotificationTopic(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"));
static{
collectionTopic.setUseRenotifier(false);
}
private GCUBEScope scope; private GCUBEScope scope;
public CollectionConsumer(GCUBEScope scope){ public CollectionConsumer(GCUBEScope scope){
@ -30,12 +34,12 @@ public class CollectionConsumer extends BaseNotificationConsumer{
logger.trace("notification received"); logger.trace("notification received");
ServiceContext.getContext().setScope(this.scope); ServiceContext.getContext().setScope(this.scope);
String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue(); String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue(); String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue();
if (operation.compareTo("create")==0){ if (operation.compareTo("create")==0){
logger.trace("adding a new Collection in DB"); logger.trace("adding a new Collection in DB");
GCUBECollection collection= GHNContext.getImplementation(GCUBECollection.class); GCUBECollection collection= GHNContext.getImplementation(GCUBECollection.class);
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
collection.load(new StringReader(profile)); collection.load(new StringReader(profile));
new CollectionHandler().add(collection); new CollectionHandler().add(collection);
} else if (operation.compareTo("destroy")==0){ } else if (operation.compareTo("destroy")==0){

View File

@ -22,6 +22,7 @@ public class GHNConsumer extends BaseNotificationConsumer{
static{ static{
ghnTopic= new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","GHN")); ghnTopic= new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","GHN"));
ghnTopic.setPrecondition("(//operationType[text()='destroy']) or (//operationType[text()='create'])"); ghnTopic.setPrecondition("(//operationType[text()='destroy']) or (//operationType[text()='create'])");
ghnTopic.setUseRenotifier(false);
} }
private GCUBELog logger= new GCUBELog(GHNConsumer.class); private GCUBELog logger= new GCUBELog(GHNConsumer.class);
@ -40,13 +41,13 @@ public class GHNConsumer extends BaseNotificationConsumer{
logger.trace("notification received"); logger.trace("notification received");
ServiceContext.getContext().setScope(this.scope); ServiceContext.getContext().setScope(this.scope);
String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue(); String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue(); String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue();
//logger.trace("received id: "+id+" op: "+operation+" profile: "+profile); //logger.trace("received id: "+id+" op: "+operation+" profile: "+profile);
if (operation.compareTo("create")==0){ if (operation.compareTo("create")==0){
logger.trace("adding a new GHN in DB"); logger.trace("adding a new GHN in DB");
GCUBEHostingNode ghn= GHNContext.getImplementation(GCUBEHostingNode.class); GCUBEHostingNode ghn= GHNContext.getImplementation(GCUBEHostingNode.class);
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
ghn.load(new StringReader(profile)); ghn.load(new StringReader(profile));
new GHNHandler().add(ghn); new GHNHandler().add(ghn);
} else if (operation.compareTo("destroy")==0){ } else if (operation.compareTo("destroy")==0){

View File

@ -20,6 +20,10 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
public static final GCUBENotificationTopic functionalityTopic= new GCUBENotificationTopic(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"));
static{
functionalityTopic.setUseRenotifier(false);
}
private String functionalityResourceId; private String functionalityResourceId;
private GCUBEScope scope; private GCUBEScope scope;
@ -33,7 +37,6 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
try{ try{
ServiceContext.getContext().setScope(this.scope); ServiceContext.getContext().setScope(this.scope);
String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue(); String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue(); String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue();
logger.info("notification received for genericResource "+id+" and operation "+operation); logger.info("notification received for genericResource "+id+" and operation "+operation);
@ -41,14 +44,16 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
if ((operation.compareTo("update")==0) && id.compareTo(this.functionalityResourceId)==0){ if ((operation.compareTo("update")==0) && id.compareTo(this.functionalityResourceId)==0){
logger.trace("notification received for functionalityResource with id "+id+" in scope "+scope.toString()); logger.trace("notification received for functionalityResource with id "+id+" in scope "+scope.toString());
KGCUBEGenericFunctionalityResource resource= new KGCUBEGenericFunctionalityResource(); KGCUBEGenericFunctionalityResource resource= new KGCUBEGenericFunctionalityResource();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
resource.load(new StringReader(profile)); resource.load(new StringReader(profile));
//FunctionalityHandler //FunctionalityHandler
FunctionalityHandler functionalityHandler= new FunctionalityHandler(); FunctionalityHandler functionalityHandler= new FunctionalityHandler();
functionalityHandler.add(resource); functionalityHandler.add(resource);
}else if (operation.compareTo("create")==0){ }else if (operation.compareTo("create")==0){
logger.trace("notification received for generic resource with operation create"); logger.trace("notification received for generic resource with operation create");
GCUBEGenericResource genericResource= GHNContext.getImplementation(GCUBEGenericResource.class); GCUBEGenericResource genericResource= GHNContext.getImplementation(GCUBEGenericResource.class);
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
genericResource.load(new StringReader(profile)); genericResource.load(new StringReader(profile));
if (genericResource.getName().compareTo("FuctionalitiesResource")==0){ if (genericResource.getName().compareTo("FuctionalitiesResource")==0){
FunctionalityHandler functionalityHandler= new FunctionalityHandler(); FunctionalityHandler functionalityHandler= new FunctionalityHandler();

View File

@ -18,6 +18,10 @@ public class MCollectionConsumer extends BaseNotificationConsumer{
public static final GCUBENotificationTopic mCollectionTopic=new GCUBENotificationTopic(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"));
static{
mCollectionTopic.setUseRenotifier(false);
}
private GCUBELog logger= new GCUBELog(MCollectionConsumer.class); private GCUBELog logger= new GCUBELog(MCollectionConsumer.class);
private GCUBEScope scope; private GCUBEScope scope;
@ -32,10 +36,10 @@ public class MCollectionConsumer extends BaseNotificationConsumer{
//logger.trace("notification received"); //logger.trace("notification received");
ServiceContext.getContext().setScope(this.scope); ServiceContext.getContext().setScope(this.scope);
String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue(); String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue(); String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue();
if (operation.compareTo("create")==0){ if (operation.compareTo("create")==0){
logger.trace("adding a new MCollection in DB"); logger.trace("adding a new MCollection in DB");
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
GCUBEMCollection mCollection= GHNContext.getImplementation(GCUBEMCollection.class); GCUBEMCollection mCollection= GHNContext.getImplementation(GCUBEMCollection.class);
mCollection.load(new StringReader(profile)); mCollection.load(new StringReader(profile));
new MCollectionHandler(mCollection.getRelCollection().getCollectionID()).add(mCollection); new MCollectionHandler(mCollection.getRelCollection().getCollectionID()).add(mCollection);

View File

@ -18,6 +18,10 @@ public class RunningInstanceConsumer extends BaseNotificationConsumer{
public static final GCUBENotificationTopic riTopic= new GCUBENotificationTopic(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"));
static{
riTopic.setUseRenotifier(false);
}
private GCUBEScope scope; private GCUBEScope scope;
public RunningInstanceConsumer(GCUBEScope scope){ public RunningInstanceConsumer(GCUBEScope scope){
@ -30,11 +34,11 @@ public class RunningInstanceConsumer extends BaseNotificationConsumer{
logger.trace("notification received for RI"); logger.trace("notification received for RI");
ServiceContext.getContext().setScope(this.scope); ServiceContext.getContext().setScope(this.scope);
String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue(); String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue(); String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue();
if (operation.compareTo("create")==0){ if (operation.compareTo("create")==0){
logger.trace("adding a new RI in DB"); logger.trace("adding a new RI in DB");
GCUBERunningInstance ri= GHNContext.getImplementation(GCUBERunningInstance.class); GCUBERunningInstance ri= GHNContext.getImplementation(GCUBERunningInstance.class);
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
ri.load(new StringReader(profile)); ri.load(new StringReader(profile));
new RunningInstancesHandler(ri.getGHNID()).add(ri); new RunningInstancesHandler(ri.getGHNID()).add(ri);
} else if (operation.compareTo("destroy")==0){ } else if (operation.compareTo("destroy")==0){

View File

@ -55,8 +55,7 @@ public class DBInterface {
// of the db. // of the db.
// It can contain directory names relative to the // It can contain directory names relative to the
// current working directory // current working directory
Connection conn = DriverManager.getConnection("jdbc:hsqldb:file:" Connection conn = DriverManager.getConnection("jdbc:hsqldb:file:"
+ dbFile+ServiceContext.getContext().getScope().toString().replace("/", "-"), // filenames + dbFile+ServiceContext.getContext().getScope().toString().replace("/", "-"), // filenames
"sa", // username "sa", // username

View File

@ -55,7 +55,7 @@ public class IStoDBUtil {
logger.info("Starting initialization!!"); logger.info("Starting initialization!!");
if (!DBInterface.dbAlreadyCreated()) if (!DBInterface.dbAlreadyCreated())
createTables(scope); createTables(scope);
cleanDB(scope); else cleanDB(scope);
} }
private static void cleanDB(GCUBEScope scope) throws GCUBEFault private static void cleanDB(GCUBEScope scope) throws GCUBEFault

View File

@ -14,6 +14,7 @@ import org.gcube.vremanagement.vremodeler.consumers.GHNConsumer;
import org.gcube.vremanagement.vremodeler.consumers.GenericResourceConsumer; import org.gcube.vremanagement.vremodeler.consumers.GenericResourceConsumer;
import org.gcube.vremanagement.vremodeler.consumers.MCollectionConsumer; import org.gcube.vremanagement.vremodeler.consumers.MCollectionConsumer;
import org.gcube.vremanagement.vremodeler.consumers.RunningInstanceConsumer; import org.gcube.vremanagement.vremodeler.consumers.RunningInstanceConsumer;
import org.gcube.vremanagement.vremodeler.db.DBInterface;
import org.gcube.vremanagement.vremodeler.db.IStoDBUtil; import org.gcube.vremanagement.vremodeler.db.IStoDBUtil;
import org.gcube.vremanagement.vremodeler.impl.util.ServicePair; import org.gcube.vremanagement.vremodeler.impl.util.ServicePair;
import org.gcube.vremanagement.vremodeler.resources.handlers.CollectionHandler; import org.gcube.vremanagement.vremodeler.resources.handlers.CollectionHandler;
@ -116,6 +117,7 @@ public class ServiceContext extends GCUBEServiceContext{
for (GCUBEScope scope : ServiceContext.getContext().getInstance().getScopes().values()){ for (GCUBEScope scope : ServiceContext.getContext().getInstance().getScopes().values()){
ServiceContext.getContext().setScope(scope); ServiceContext.getContext().setScope(scope);
notifier.unregisterFromISNotification(this, topicToRemove, scope); notifier.unregisterFromISNotification(this, topicToRemove, scope);
if (!scope.isInfrastructure()) DBInterface.close();
} }
} }

View File

@ -61,7 +61,7 @@ public class DeployGHNsOnCloud{
configureAndStartContainers(eolus, hostnames); configureAndStartContainers(eolus, hostnames);
//waiting few seconds for GHN registration //waiting few seconds for GHN registration
Thread.sleep(30000); Thread.sleep(60000);
checkGHNAvailability(hostnames); checkGHNAvailability(hostnames);
//now we can be sure that the GHNs are registered on the IS //now we can be sure that the GHNs are registered on the IS
@ -129,6 +129,8 @@ public class DeployGHNsOnCloud{
} }
} }
} }
//waiting 1 minute for the boot of the VMs
Thread.sleep(180000);
return vmsNames; return vmsNames;
} }

View File

@ -24,6 +24,7 @@ import org.gcube.common.core.resources.GCUBEGenericResource;
import org.gcube.common.core.resources.GCUBEMCollection; import org.gcube.common.core.resources.GCUBEMCollection;
import org.gcube.common.core.resources.GCUBERunningInstance; import org.gcube.common.core.resources.GCUBERunningInstance;
import org.gcube.common.core.scope.GCUBEScope; import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.core.scope.GCUBEScope.MalformedScopeExpressionException;
import org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl; import org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl;
import org.gcube.common.core.utils.handlers.GCUBEServiceHandler.NoQueryResultException; import org.gcube.common.core.utils.handlers.GCUBEServiceHandler.NoQueryResultException;
import org.gcube.common.core.utils.logging.GCUBELog; import org.gcube.common.core.utils.logging.GCUBELog;
@ -134,6 +135,7 @@ public class DeployVRE extends Thread{
} }
}else{ }else{
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed); getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
getResource().store(); getResource().store();
logger.info("Deploying of the VRE with id "+this.resourceId+" FAILED on first step"); 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"); throw new Exception("Error Deployng the VRE filed on first step");
@ -152,7 +154,7 @@ public class DeployVRE extends Thread{
} }
private boolean deployManagerOnVRE(String candidateGhnId) throws GCUBEFault, ResourceException{ private boolean deployManagerOnVRE(String candidateGhnId) throws MalformedScopeExpressionException, Exception{
try { try {
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='Deploying' WHERE VRE.id='"+this.resourceId+"';"); DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='Deploying' WHERE VRE.id='"+this.resourceId+"';");
} catch (Exception e) { } catch (Exception e) {
@ -163,68 +165,44 @@ public class DeployVRE extends Thread{
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Running); getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Running);
getResource().store(); getResource().store();
ResourceManagerPortType rmPortType=getResourceMangerPT(this.startingScope);
ResourceManagerServiceHandler<Boolean, Object[]> resourceManagerHandler= new ResourceManagerServiceHandler<Boolean,Object[]>(){
String report;
try{
AddResourcesParameters arp= new AddResourcesParameters();
ServiceList services= new ServiceList();
ServiceItem[] service= new ServiceItem[1];
service[0]=new ServiceItem();
service[0].setServiceClass("VREManagement");
service[0].setServiceName("ResourceManager");
service[0].setServiceVersion("1.00.00");
services.setService(service);
@SuppressWarnings({ "static-access"}) services.setGHN(new String[]{candidateGhnId});
@Override arp.setServices(services);
protected Boolean makeCall(ResourceManagerPortType resourceManagerPT) arp.setTargetScope(this.startingScope+"/"+vreName);
throws Exception { String reportId=rmPortType.addResources(arp);
String report; logger.trace("the report id for Rm is "+reportId);
try{ //waiting few seconds
Thread.sleep(60000);
String vreName=(String) this.getParameter()[0]; int attempt=0;
String candidateGHN=(String) this.getParameter()[1]; do{
Thread.sleep(20000);
AddResourcesParameters arp= new AddResourcesParameters(); report=rmPortType.getReport(reportId);
ServiceList services= new ServiceList(); attempt++;
ServiceItem[] service= new ServiceItem[1]; getResource().getDeployReport().getResourceManagerDeployingReport().setResourceManagerReport(report);
service[0]=new ServiceItem(); getResource().store();
service[0].setServiceClass("VREManagement"); }while (!isDeploymentStatusFinished(report) && attempt<10);
service[0].setServiceName("ResourceManager");
service[0].setServiceVersion("1.00.00"); }catch(Exception e){logger.error("error deploying RM on VRE",e); throw e;}
services.setService(service); logger.trace("report step 1: "+report);
logger.info("is something failed in the first step?"+isSomethingFailed(report));
services.setGHN(new String[]{candidateGHN});
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);
report=resourceManagerPT.getReport(reportId);
attempt++;
getResource().getDeployReport().getResourceManagerDeployingReport().setResourceManagerReport(report);
getResource().store();
}while (!isDeploymentStatusFinished(report) && attempt<10);
}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);
}
};
resourceManagerHandler.clearBlackboard();
resourceManagerHandler.setHandled(new GCUBEServiceClientImpl());
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;
}
collectionResourceCreation= new CollectionResourceCreation(this.resourceId, this.vreName); collectionResourceCreation= new CollectionResourceCreation(this.resourceId, this.vreName);
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished); getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished);
getResource().store(); getResource().store();
return resourceManagerHandler.getReturnValue(); return !isSomethingFailed(report);
} }
@ -236,7 +214,7 @@ public class DeployVRE extends Thread{
ReportFiller.initizlizeFunctionalityForReport(getResource().getDeployReport().getFunctionalityDeployingReport(),this.resourceId); ReportFiller.initizlizeFunctionalityForReport(getResource().getDeployReport().getFunctionalityDeployingReport(),this.resourceId);
ReportFiller.initializeResourcesForReport(getResource().getDeployReport().getResourceDeployingReport(), this.resourceId); ReportFiller.initializeResourcesForReport(getResource().getDeployReport().getResourceDeployingReport(), this.resourceId);
ResourceManagerPortType rmPortType=getResourceMangerPTinVRE(); ResourceManagerPortType rmPortType=getResourceMangerPT(GCUBEScope.getScope(this.startingScope+"/"+this.vreName));
CreateScopeParameters scopeParameter=getScopeParameters(); CreateScopeParameters scopeParameter=getScopeParameters();
@ -397,7 +375,7 @@ public class DeployVRE extends Thread{
return ret; return ret;
} }
private ResourceManagerPortType getResourceMangerPTinVRE() throws Exception{ private ResourceManagerPortType getResourceMangerPT(GCUBEScope scope) throws Exception{
ResourceManagerPortType rmPortType = null; ResourceManagerPortType rmPortType = null;
int attempt=0; int attempt=0;
do{ do{
@ -411,25 +389,27 @@ public class DeployVRE extends Thread{
query.setExpression("declare namespace is = 'http://gcube-system.org/namespaces/informationsystem/registry';" + query.setExpression("declare namespace is = 'http://gcube-system.org/namespaces/informationsystem/registry';" +
" for $outer in collection(\"/db/Profiles/RunningInstance\")//Document/Data/is:Profile/Resource " + " 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()+"'] " + " let $scope:= $outer/Scopes/Scope[string() eq '"+scope.toString()+"'] " +
" where count($scope)>0 " + " where count($scope)>0 " +
" and $outer/Profile/ServiceName/string() eq 'ResourceManager' " + " and $outer/Profile/ServiceName/string() eq 'ResourceManager' " +
" and $outer/Profile/DeploymentData/Status/string() eq 'ready'"+
" return $outer"); " return $outer");
List<EndpointReferenceType> eprs = new ArrayList<EndpointReferenceType>(); List<EndpointReferenceType> eprs = new ArrayList<EndpointReferenceType>();
for (GCUBERunningInstance instance : client.execute(query, GCUBEScope.getScope(this.startingScope+"/"+this.vreName))) for (GCUBERunningInstance instance : client.execute(query, scope))
eprs.add(instance.getAccessPoint().getEndpoint("gcube/vremanagement/ResourceManager")); eprs.add(instance.getAccessPoint().getEndpoint("gcube/vremanagement/ResourceManager"));
if(eprs.size()==0) throw new NoQueryResultException(); if(eprs.size()==0) throw new NoQueryResultException();
ResourceManagerServiceAddressingLocator vmsal= new ResourceManagerServiceAddressingLocator(); ResourceManagerServiceAddressingLocator vmsal= new ResourceManagerServiceAddressingLocator();
logger.trace("trying to contact instance at "+eprs.get(0).getAddress());
rmPortType= vmsal.getResourceManagerPortTypePort(eprs.get(0)); rmPortType= vmsal.getResourceManagerPortTypePort(eprs.get(0));
rmPortType = GCUBERemotePortTypeContext.getProxy(rmPortType,GCUBEScope.getScope(this.startingScope+"/"+this.vreName), Integer.parseInt((String)ServiceContext.getContext().getProperty("resourceManagerTimeout", true))); rmPortType = GCUBERemotePortTypeContext.getProxy(rmPortType,scope, Integer.parseInt((String)ServiceContext.getContext().getProperty("resourceManagerTimeout", true)));
}catch(Exception e){ }catch(Exception e){
logger.warn(e); logger.warn(e);
logger.warn("the query for resourceManager returned no result, re-trying in 30 secs ("+attempt+")"); logger.warn("the query for resourceManager returned no result, re-trying in 30 secs ("+attempt+")");
}finally {attempt++;} }finally {attempt++;}
}while(rmPortType==null && attempt<10); }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()); if (attempt>=10) throw new Exception("no ResourceMaanger can be retrieved for scope "+scope);
return rmPortType; return rmPortType;
} }

View File

@ -25,6 +25,7 @@ public class GHNHandler implements ResourceHandler<GCUBEHostingNode> {
ISClient client= GHNContext.getImplementation(ISClient.class); ISClient client= GHNContext.getImplementation(ISClient.class);
GCUBEGHNQuery query=client.getQuery(GCUBEGHNQuery.class); GCUBEGHNQuery query=client.getQuery(GCUBEGHNQuery.class);
query.addAtomicConditions(new AtomicCondition("/Profile/GHNDescription/Type","Dynamic")); query.addAtomicConditions(new AtomicCondition("/Profile/GHNDescription/Type","Dynamic"));
query.addAtomicConditions(new AtomicCondition("/Profile/GHNDescription/Status","certified"));
List<GCUBEHostingNode> ghnList= client.execute(query, ServiceContext.getContext().getScope()); List<GCUBEHostingNode> ghnList= client.execute(query, ServiceContext.getContext().getScope());
for (GCUBEHostingNode ghn:ghnList) for (GCUBEHostingNode ghn:ghnList)
try{ try{

View File

@ -54,7 +54,7 @@ public class ModelerTest {
vreReq.setDescription("desc"); vreReq.setDescription("desc");
vreReq.setDesigner("Lucio"); vreReq.setDesigner("Lucio");
vreReq.setManager("Lucio"); vreReq.setManager("Lucio");
vreReq.setName("testCloud"); vreReq.setName("lucioCloud");
msptp.setDescription(vreReq); msptp.setDescription(vreReq);
System.out.println("description set"); System.out.println("description set");