git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/VREModeler@20236 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8082125adb
commit
e3741bceea
7
README
7
README
|
@ -21,8 +21,6 @@ v. 1.0.0 (17-10-2008)
|
||||||
* First release
|
* First release
|
||||||
|
|
||||||
v. 1.2.0 (14-05-2010)
|
v. 1.2.0 (14-05-2010)
|
||||||
* ticket #211: ResourceManager integration
|
|
||||||
* stubs modified
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
|
@ -34,15 +32,12 @@ The VREModeler allows the user to create a new VRE
|
||||||
Source code is available from SVN:
|
Source code is available from SVN:
|
||||||
http://svn.d4science.research-infrastructures.eu/gcube/trunk/vremanager/VREModeler
|
http://svn.d4science.research-infrastructures.eu/gcube/trunk/vremanager/VREModeler
|
||||||
|
|
||||||
Binaries can be downloaded from:
|
|
||||||
http://diligent.di.uoa.gr/distributionSite/index.html
|
|
||||||
|
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
Documentation is available on-line from the Projects Documentation Wiki:
|
Documentation is available on-line from the Projects Documentation Wiki:
|
||||||
|
|
||||||
https://technical.wiki.d4science.research-infrastructures.eu/documentation/index.php
|
https://gcube.wiki.gcube-system.org/gcube/index.php/VRE_Modeler
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,23 +47,6 @@
|
||||||
type="java.lang.String"
|
type="java.lang.String"
|
||||||
override="false"/>
|
override="false"/>
|
||||||
|
|
||||||
<resource name="publicationProfile" type="org.gcube.common.core.state.GCUBEPublicationProfile">
|
|
||||||
<resourceParams>
|
|
||||||
<parameter>
|
|
||||||
<name>factory</name>
|
|
||||||
<value>org.globus.wsrf.jndi.BeanFactory</value>
|
|
||||||
</parameter>
|
|
||||||
<parameter>
|
|
||||||
<name>mode</name>
|
|
||||||
<value>pull</value>
|
|
||||||
</parameter>
|
|
||||||
<parameter>
|
|
||||||
<name>fileName</name>
|
|
||||||
<value>registration.xml</value>
|
|
||||||
</parameter>
|
|
||||||
</resourceParams>
|
|
||||||
</resource>
|
|
||||||
|
|
||||||
<resource name="home" type="org.gcube.vremanagement.vremodeler.impl.ModelerHome">
|
<resource name="home" type="org.gcube.vremanagement.vremodeler.impl.ModelerHome">
|
||||||
<resourceParams>
|
<resourceParams>
|
||||||
<parameter>
|
<parameter>
|
||||||
|
|
|
@ -24,17 +24,6 @@
|
||||||
<Scope level="GHN"/>
|
<Scope level="GHN"/>
|
||||||
<Optional>false</Optional>
|
<Optional>false</Optional>
|
||||||
</Dependency>
|
</Dependency>
|
||||||
<Dependency>
|
|
||||||
<Service>
|
|
||||||
<Class>VREManagement</Class>
|
|
||||||
<Name>VREManager</Name>
|
|
||||||
<Version>1.0.0</Version>
|
|
||||||
</Service>
|
|
||||||
<Package>VREManager-stubs</Package>
|
|
||||||
<Version>[1.02.00,1.03.00)</Version>
|
|
||||||
<Scope level="GHN"/>
|
|
||||||
<Optional>false</Optional>
|
|
||||||
</Dependency>
|
|
||||||
<Dependency>
|
<Dependency>
|
||||||
<Service>
|
<Service>
|
||||||
<Class>ExternalSoftware</Class>
|
<Class>ExternalSoftware</Class>
|
||||||
|
|
|
@ -45,9 +45,13 @@
|
||||||
|
|
||||||
<xsd:element name="removeVRERequestMessage" type="xsd:string"/>
|
<xsd:element name="removeVRERequestMessage" type="xsd:string"/>
|
||||||
|
|
||||||
|
|
||||||
<xsd:element name="removeVREResponseMessage" type="coretypes:VOID"/>
|
<xsd:element name="removeVREResponseMessage" type="coretypes:VOID"/>
|
||||||
|
|
||||||
|
<xsd:element name="getEPRbyIdRequestMessage" type="xsd:string"/>
|
||||||
|
|
||||||
|
<xsd:element name="getEPRbyIdResponseMessage" type="wsa:EndpointReferenceType"/>
|
||||||
|
|
||||||
|
|
||||||
<xsd:element name="getExistingNamesResponseMessage">
|
<xsd:element name="getExistingNamesResponseMessage">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
|
@ -98,6 +102,12 @@
|
||||||
<message name="GetExistingNamesOutputMessage">
|
<message name="GetExistingNamesOutputMessage">
|
||||||
<part name="response" element="tns:getExistingNamesResponseMessage"/>
|
<part name="response" element="tns:getExistingNamesResponseMessage"/>
|
||||||
</message>
|
</message>
|
||||||
|
<message name="GetEPRbyIdInputMessage">
|
||||||
|
<part name="request" element="tns:getEPRbyIdRequestMessage"/>
|
||||||
|
</message>
|
||||||
|
<message name="GetEPRbyIdOutputMessage">
|
||||||
|
<part name="response" element="tns:getEPRbyIdResponseMessage"/>
|
||||||
|
</message>
|
||||||
|
|
||||||
<!--============================================================
|
<!--============================================================
|
||||||
|
|
||||||
|
@ -129,6 +139,12 @@
|
||||||
<input message="tns:RemoveVREInputMessage"/>
|
<input message="tns:RemoveVREInputMessage"/>
|
||||||
<output message="tns:RemoveVREOutputMessage"/>
|
<output message="tns:RemoveVREOutputMessage"/>
|
||||||
</operation>
|
</operation>
|
||||||
|
|
||||||
|
<operation name="getEPRbyId">
|
||||||
|
<input message="tns:GetEPRbyIdInputMessage"/>
|
||||||
|
<output message="tns:GetEPRbyIdOutputMessage"/>
|
||||||
|
</operation>
|
||||||
|
|
||||||
</portType>
|
</portType>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,6 @@ import org.gcube.vremanagement.vremodeler.stubs.Report;
|
||||||
import org.gcube.vremanagement.vremodeler.stubs.ReportList;
|
import org.gcube.vremanagement.vremodeler.stubs.ReportList;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class ModelFactoryService{
|
public class ModelFactoryService{
|
||||||
|
|
||||||
private GCUBELog logger = new GCUBELog(ModelFactoryService.class);
|
private GCUBELog logger = new GCUBELog(ModelFactoryService.class);
|
||||||
|
@ -141,6 +138,22 @@ public class ModelFactoryService{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
* @throws GCUBEFault
|
||||||
|
*/
|
||||||
|
public EndpointReferenceType getEPRbyId(String id) throws GCUBEFault{
|
||||||
|
ModelerContext pctx= ModelerContext.getPortTypeContext();
|
||||||
|
try {
|
||||||
|
return pctx.getWSHome().find(pctx.makeKey(id)).getEPR();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("resource with id "+id+" not found",e);
|
||||||
|
throw new GCUBEFault(e,"resource with id "+id+" not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ package org.gcube.vremanagement.vremodeler.impl;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
|
import java.sql.Date;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.gcube.common.core.faults.GCUBEFault;
|
import org.gcube.common.core.faults.GCUBEFault;
|
||||||
|
@ -53,23 +53,20 @@ public class ModelerService {
|
||||||
*/
|
*/
|
||||||
public void setDescription(VREDescription request) throws GCUBEFault{
|
public void setDescription(VREDescription request) throws GCUBEFault{
|
||||||
|
|
||||||
Calendar dateFrom=null, dateTo=null;
|
Date dateFrom=null, dateTo=null;
|
||||||
ResultSet res=null;
|
ResultSet res=null;
|
||||||
try {
|
try {
|
||||||
res=DBInterface.queryDB("select * from VRE where VRE.id='"+getResource().getId()+"'; ");
|
res=DBInterface.queryDB("select * from VRE where VRE.id='"+getResource().getId()+"'; ");
|
||||||
|
dateFrom=new Date(request.getStartTime().getTimeInMillis());
|
||||||
|
dateTo=new Date(request.getEndTime().getTimeInMillis());
|
||||||
if(res.next())
|
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()+"'; ");
|
||||||
dateFrom=request.getStartTime();
|
else{
|
||||||
dateTo=request.getEndTime();
|
logger.debug("insert into VRE values('"+getResource().getId()+"','"+request.getName()+"','"+request.getDescription()+"','"+request.getDesigner()+"','"+request.getManager()+"','"+dateFrom+"','"+dateTo+"','"+VREState.IN_PROGRESS.getValue()+"'); ");
|
||||||
DBInterface.queryDB("update VRE set name='"+request.getName()+"', description='"+request.getDescription()+"', vredesigner='"+request.getDesigner()+"', vremanager= '"+request.getManager()+"', intervalfrom='"+dateFrom.getTime()+"', intervalto='"+dateTo.getTime()+"' where VRE.id='"+getResource().getId()+"'; ");
|
DBInterface.ExecuteUpdate("insert into VRE values('"+getResource().getId()+"','"+request.getName()+"','"+request.getDescription()+"','"+request.getDesigner()+"','"+request.getManager()+"','"+dateFrom+"','"+dateTo+"','"+VREState.IN_PROGRESS.getValue()+"'); ");
|
||||||
}else{
|
|
||||||
dateFrom=request.getStartTime();
|
|
||||||
dateTo=request.getEndTime();
|
|
||||||
DBInterface.ExecuteUpdate("insert into VRE values('"+getResource().getId()+"','"+request.getName()+"','"+request.getDescription()+"','"+request.getDesigner()+"','"+request.getManager()+"','"+dateFrom+"','"+dateTo+"','"+VREState.IN_PROGRESS+"'); ");
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e);
|
logger.error("an error occurs setting the VRE Description",e);
|
||||||
throw new GCUBEFault(e);
|
throw new GCUBEFault(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +143,7 @@ public class ModelerService {
|
||||||
row= new ArrayList<String>(3);
|
row= new ArrayList<String>(3);
|
||||||
row.add(dlKey);
|
row.add(dlKey);
|
||||||
row.add(ghnId);
|
row.add(ghnId);
|
||||||
if (request.getCandidateGHN().compareTo(ghnId)==0) row.add("true");
|
if (request.getCandidateGHN()!=null && request.getCandidateGHN().compareTo(ghnId)==0) row.add("true");
|
||||||
else row.add("false");
|
else row.add("false");
|
||||||
values.add(row.toArray(new String[3]));
|
values.add(row.toArray(new String[3]));
|
||||||
}
|
}
|
||||||
|
@ -155,7 +152,6 @@ public class ModelerService {
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("error setting GHNs ",e);
|
logger.error("error setting GHNs ",e);
|
||||||
throw new GCUBEFault(e);}
|
throw new GCUBEFault(e);}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,8 @@ import org.gcube.vremanagement.vremodeler.db.DBInterface;
|
||||||
import org.gcube.vremanagement.vremodeler.impl.ModelerContext;
|
import org.gcube.vremanagement.vremodeler.impl.ModelerContext;
|
||||||
import org.gcube.vremanagement.vremodeler.impl.ModelerResource;
|
import org.gcube.vremanagement.vremodeler.impl.ModelerResource;
|
||||||
import org.gcube.vremanagement.vremodeler.impl.ModelerService;
|
import org.gcube.vremanagement.vremodeler.impl.ModelerService;
|
||||||
import org.gcube.vremanagement.vremodeler.impl.util.Couple;
|
import org.gcube.vremanagement.vremodeler.impl.util.Pair;
|
||||||
import org.gcube.vremanagement.vremodeler.impl.util.VREManagerServiceHandler;
|
import org.gcube.vremanagement.vremodeler.impl.util.ResourceManagerServiceHandler;
|
||||||
import org.gcube.vremanagement.vremodeler.portallayout.CollectionResourceCreation;
|
import org.gcube.vremanagement.vremodeler.portallayout.CollectionResourceCreation;
|
||||||
import org.gcube.vremanagement.vremodeler.portallayout.GenericResourcePortlet;
|
import org.gcube.vremanagement.vremodeler.portallayout.GenericResourcePortlet;
|
||||||
import org.gcube.vremanagement.vremodeler.portallayout.LayoutCreation;
|
import org.gcube.vremanagement.vremodeler.portallayout.LayoutCreation;
|
||||||
|
@ -65,19 +65,27 @@ public class DeployVRE extends Thread{
|
||||||
return wsResource;
|
return wsResource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
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; ");
|
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<Couple<String, String>> GHNList= new ArrayList<Couple<String, String>>();
|
List<Pair<String, String>> GHNList= new ArrayList<Pair<String, String>>();
|
||||||
String candidateGHN=null;
|
String candidateGHN=null;
|
||||||
|
boolean isCandidatePresent=false;
|
||||||
while (resRelatedGHN.next()) {
|
while (resRelatedGHN.next()) {
|
||||||
if(resRelatedGHN.getBoolean(3))
|
if(resRelatedGHN.getBoolean(3)){
|
||||||
candidateGHN=resRelatedGHN.getString(1);
|
candidateGHN=resRelatedGHN.getString(1);
|
||||||
else GHNList.add(new Couple<String, String>(resRelatedGHN.getString(1),resRelatedGHN.getString(2)));
|
isCandidatePresent= true;
|
||||||
|
}else GHNList.add(new Pair<String, String>(resRelatedGHN.getString(1),resRelatedGHN.getString(2)));
|
||||||
}
|
}
|
||||||
if (GHNList.size()<2){
|
|
||||||
|
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)");
|
throw new Exception("No ghn Selected (at least 2 GHNs have to be selected)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +93,7 @@ public class DeployVRE extends Thread{
|
||||||
if (!deployManagerOnVRE(GHNList, candidateGHN)){
|
if (!deployManagerOnVRE(GHNList, candidateGHN)){
|
||||||
//transforming the Pair<String, String> to a ghnid List<String>
|
//transforming the Pair<String, String> to a ghnid List<String>
|
||||||
List<String> ghnEpuredList = new ArrayList<String>();
|
List<String> ghnEpuredList = new ArrayList<String>();
|
||||||
for (Couple<String, String> cpl: GHNList) ghnEpuredList.add(cpl.first);
|
for (Pair<String, String> cpl: GHNList) ghnEpuredList.add(cpl.first);
|
||||||
|
|
||||||
if (!createVRE(ghnEpuredList)){
|
if (!createVRE(ghnEpuredList)){
|
||||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+VREState.DEPLOYED+"' WHERE VRE.id='"+this.resourceId+"';");
|
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+VREState.DEPLOYED+"' WHERE VRE.id='"+this.resourceId+"';");
|
||||||
|
@ -93,10 +101,11 @@ public class DeployVRE extends Thread{
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
logger.info("Deploying of the VRE with id "+this.resourceId+" FAILED on second step");
|
logger.info("Deploying of the VRE with id "+this.resourceId+" FAILED on second step");
|
||||||
|
getResource().setSecondReport(VREState.FAILED.getValue());
|
||||||
throw new Exception("Error Deployng the VRE failed on second step");
|
throw new Exception("Error Deployng the VRE failed on second step");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
getResource().setSecondReport(VREState.FAILED.getValue());
|
getResource().setFirstReport(VREState.FAILED.getValue());
|
||||||
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");
|
||||||
|
@ -113,7 +122,7 @@ public class DeployVRE extends Thread{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean deployManagerOnVRE(List<Couple<String, String>> ghnList, String candidateGHN) throws GCUBEFault{
|
private boolean deployManagerOnVRE(List<Pair<String, String>> ghnList, String candidateGHN) throws GCUBEFault{
|
||||||
String vreName= null;
|
String vreName= null;
|
||||||
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+"';");
|
||||||
|
@ -122,13 +131,12 @@ public class DeployVRE extends Thread{
|
||||||
throw new GCUBEFault("The VRE with ID "+this.resourceId+" cannot be retrieved on the DB");
|
throw new GCUBEFault("The VRE with ID "+this.resourceId+" cannot be retrieved on the DB");
|
||||||
}
|
}
|
||||||
vreName= resGenericInfo.getString(1);
|
vreName= resGenericInfo.getString(1);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("HSQLDB Error "+e);
|
logger.error("HSQLDB Error "+e);
|
||||||
throw new GCUBEFault(e);
|
throw new GCUBEFault(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
VREManagerServiceHandler<Boolean, Object[]> vreManagerHandler= new VREManagerServiceHandler<Boolean,Object[]>(){
|
ResourceManagerServiceHandler<Boolean, Object[]> resourceManagerHandler= new ResourceManagerServiceHandler<Boolean,Object[]>(){
|
||||||
|
|
||||||
@SuppressWarnings({ "static-access", "unchecked" })
|
@SuppressWarnings({ "static-access", "unchecked" })
|
||||||
@Override
|
@Override
|
||||||
|
@ -138,7 +146,7 @@ public class DeployVRE extends Thread{
|
||||||
try{
|
try{
|
||||||
|
|
||||||
String vreName=(String) this.getParameter()[0];
|
String vreName=(String) this.getParameter()[0];
|
||||||
List<Couple<String, String>> ghnList= (List<Couple<String, String>>) this.getParameter()[1];
|
List<Pair<String, String>> ghnList= (List<Pair<String, String>>) this.getParameter()[1];
|
||||||
String candidateGHN=(String) this.getParameter()[2];
|
String candidateGHN=(String) this.getParameter()[2];
|
||||||
|
|
||||||
AddResourcesParameters arp= new AddResourcesParameters();
|
AddResourcesParameters arp= new AddResourcesParameters();
|
||||||
|
@ -146,21 +154,21 @@ public class DeployVRE extends Thread{
|
||||||
ServiceItem[] service= new ServiceItem[1];
|
ServiceItem[] service= new ServiceItem[1];
|
||||||
service[0]=new ServiceItem();
|
service[0]=new ServiceItem();
|
||||||
service[0].setServiceClass("VREManagement");
|
service[0].setServiceClass("VREManagement");
|
||||||
service[0].setServiceName("VREManager");
|
service[0].setServiceName("ResourceManager");
|
||||||
service[0].setServiceVersion("1.00.00");
|
service[0].setServiceVersion("1.00.00");
|
||||||
services.setService(service);
|
services.setService(service);
|
||||||
|
|
||||||
//preparing the GHN where will be deployed the VREManager
|
//preparing the GHN where will be deployed the VREManager
|
||||||
if (candidateGHN==null){
|
if (candidateGHN==null){
|
||||||
Couple<String, String> ghnId=null;
|
Pair<String, String> ghnId=null;
|
||||||
for (Couple<String, String> cpl: ghnList){
|
for (Pair<String, String> cpl: ghnList){
|
||||||
if (this.usedhost.contains(cpl.second)){
|
if (this.usedhost.contains(cpl.second)){
|
||||||
ghnId=cpl;
|
ghnId=cpl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ghnId==null) ghnId=ghnList.get(0);
|
if (ghnId==null) ghnId=ghnList.get(0);
|
||||||
logger.debug("deploying the VREManager for the vre on "+ ghnId.second);
|
logger.debug("deploying the ResourceManager for the vre on "+ ghnId.second);
|
||||||
services.setGHN(new String[]{ghnId.first});
|
services.setGHN(new String[]{ghnId.first});
|
||||||
ghnList.remove(ghnId);
|
ghnList.remove(ghnId);
|
||||||
}else services.setGHN(new String[]{candidateGHN});
|
}else services.setGHN(new String[]{candidateGHN});
|
||||||
|
@ -185,20 +193,20 @@ public class DeployVRE extends Thread{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
vreManagerHandler.clearBlackboard();
|
resourceManagerHandler.clearBlackboard();
|
||||||
vreManagerHandler.setHandled(new GCUBEServiceClientImpl());
|
resourceManagerHandler.setHandled(new GCUBEServiceClientImpl());
|
||||||
vreManagerHandler.setParameter(new Object[]{vreName,ghnList,candidateGHN});
|
resourceManagerHandler.setParameter(new Object[]{vreName,ghnList,candidateGHN});
|
||||||
vreManagerHandler.scope=this.startingScope;
|
resourceManagerHandler.scope=this.startingScope;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
vreManagerHandler.run();
|
resourceManagerHandler.run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("DeployingVRE step 1 -- failed "+e);
|
logger.error("DeployingVRE step 1 -- failed "+e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.vreName= vreName;
|
this.vreName= vreName;
|
||||||
collectionResourceCreation= new CollectionResourceCreation(this.resourceId, this.vreName);
|
collectionResourceCreation= new CollectionResourceCreation(this.resourceId, this.vreName);
|
||||||
return vreManagerHandler.getReturnValue();
|
return resourceManagerHandler.getReturnValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -207,7 +215,7 @@ public class DeployVRE extends Thread{
|
||||||
|
|
||||||
|
|
||||||
private boolean createVRE(List<String> ghnList) throws GCUBEFault{
|
private boolean createVRE(List<String> ghnList) throws GCUBEFault{
|
||||||
VREManagerServiceHandler<Boolean, Couple<List<String>, String>> vreManagerHandler= new VREManagerServiceHandler<Boolean,Couple<List<String>, String>>(){
|
ResourceManagerServiceHandler<Boolean, Pair<List<String>, String>> vreManagerHandler= new ResourceManagerServiceHandler<Boolean,Pair<List<String>, String>>(){
|
||||||
|
|
||||||
//the parameter is resourceID
|
//the parameter is resourceID
|
||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
|
@ -351,7 +359,8 @@ public class DeployVRE extends Thread{
|
||||||
arp.setServices(serviceList);
|
arp.setServices(serviceList);
|
||||||
|
|
||||||
scopeParameter.setAddResourcesParameters(arp);
|
scopeParameter.setAddResourcesParameters(arp);
|
||||||
scopeParameter.setName(this.scope+"/"+vreName);
|
scopeParameter.setName(this.scope.toString());
|
||||||
|
|
||||||
String report= "ok";
|
String report= "ok";
|
||||||
String reportId=rmPortType.createScope(scopeParameter);
|
String reportId=rmPortType.createScope(scopeParameter);
|
||||||
|
|
||||||
|
@ -373,7 +382,7 @@ public class DeployVRE extends Thread{
|
||||||
|
|
||||||
vreManagerHandler.clearBlackboard();
|
vreManagerHandler.clearBlackboard();
|
||||||
vreManagerHandler.setHandled(new GCUBEServiceClientImpl());
|
vreManagerHandler.setHandled(new GCUBEServiceClientImpl());
|
||||||
vreManagerHandler.setParameter(new Couple<List<String>, String>(ghnList,this.resourceId));
|
vreManagerHandler.setParameter(new Pair<List<String>, String>(ghnList,this.resourceId));
|
||||||
vreManagerHandler.scope=GCUBEScope.getScope(this.startingScope+"/"+this.vreName);
|
vreManagerHandler.scope=GCUBEScope.getScope(this.startingScope+"/"+this.vreName);
|
||||||
try {
|
try {
|
||||||
vreManagerHandler.run();
|
vreManagerHandler.run();
|
||||||
|
|
|
@ -5,12 +5,12 @@ package org.gcube.vremanagement.vremodeler.impl.util;
|
||||||
* @author lucio
|
* @author lucio
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Couple<F,S>{
|
public class Pair<F,S>{
|
||||||
|
|
||||||
public F first;
|
public F first;
|
||||||
public S second;
|
public S second;
|
||||||
|
|
||||||
public Couple(F first, S second){
|
public Pair(F first, S second){
|
||||||
this.first=first;
|
this.first=first;
|
||||||
this.second= second;
|
this.second= second;
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@ import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ResourceMan
|
||||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.service.ResourceManagerServiceAddressingLocator;
|
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.service.ResourceManagerServiceAddressingLocator;
|
||||||
import org.gcube.vremanagement.vremodeler.impl.ServiceContext;
|
import org.gcube.vremanagement.vremodeler.impl.ServiceContext;
|
||||||
|
|
||||||
public abstract class VREManagerServiceHandler<T, P> extends GCUBEServiceHandler<GCUBEServiceClient> {
|
public abstract class ResourceManagerServiceHandler<T, P> extends GCUBEServiceHandler<GCUBEServiceClient> {
|
||||||
|
|
||||||
private T returnValue;
|
private T returnValue;
|
||||||
|
|
||||||
|
@ -53,13 +53,13 @@ public abstract class VREManagerServiceHandler<T, P> extends GCUBEServiceHandler
|
||||||
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 '"+scope.toString()+"'] " +
|
" let $scope:= $outer/Scopes/Scope[string() eq '"+scope.toString()+"'] " +
|
||||||
" where count($scope)>0 and $outer/Profile/ServiceName/string() eq 'VREManager'" +
|
" where count($scope)>0 " +
|
||||||
" and $outer/Profile/ServiceName/string() eq 'VREManager' " +
|
" and $outer/Profile/ServiceName/string() eq 'ResourceManager' " +
|
||||||
" return $outer");
|
" return $outer");
|
||||||
|
|
||||||
List<EndpointReferenceType> eprs = new ArrayList<EndpointReferenceType>();
|
List<EndpointReferenceType> eprs = new ArrayList<EndpointReferenceType>();
|
||||||
for (GCUBERunningInstance instance : client.execute(query, scope))
|
for (GCUBERunningInstance instance : client.execute(query, scope))
|
||||||
eprs.add(instance.getAccessPoint().getEndpoint("gcube/vremanagement/VREManager"));
|
eprs.add(instance.getAccessPoint().getEndpoint("gcube/vremanagement/ResourceManager"));
|
||||||
return eprs;
|
return eprs;
|
||||||
}catch(Exception e){logger.error(e); throw e;}
|
}catch(Exception e){logger.error(e); throw e;}
|
||||||
}
|
}
|
|
@ -335,10 +335,10 @@ public class Util {
|
||||||
* @param text the text to add at the element
|
* @param text the text to add at the element
|
||||||
* @return the result element
|
* @return the result element
|
||||||
*/
|
*/
|
||||||
public static Element createTextElement(Document doc, String tag, String text, Couple<String, String> ... attributes ){
|
public static Element createTextElement(Document doc, String tag, String text, Pair<String, String> ... attributes ){
|
||||||
Element returnEl= doc.createElement(tag);
|
Element returnEl= doc.createElement(tag);
|
||||||
if (attributes!=null){
|
if (attributes!=null){
|
||||||
for (Couple<String, String> attribute : attributes){
|
for (Pair<String, String> attribute : attributes){
|
||||||
returnEl.setAttribute(attribute.first, attribute.second);
|
returnEl.setAttribute(attribute.first, attribute.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class VREModelerInitializer {
|
||||||
ModelerFactoryPortType mfptp= mfal.getModelerFactoryPortTypePort(epr);
|
ModelerFactoryPortType mfptp= mfal.getModelerFactoryPortTypePort(epr);
|
||||||
|
|
||||||
mfptp = GCUBERemotePortTypeContext.getProxy(mfptp, GCUBEScope.getScope(args[0]));
|
mfptp = GCUBERemotePortTypeContext.getProxy(mfptp, GCUBEScope.getScope(args[0]));
|
||||||
|
|
||||||
mfptp.initDB(new VOID());
|
mfptp.initDB(new VOID());
|
||||||
}catch (Exception e){e.printStackTrace();}
|
}catch (Exception e){e.printStackTrace();}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue