diff --git a/.classpath b/.classpath
index 7f73507..7fae30d 100644
--- a/.classpath
+++ b/.classpath
@@ -3,6 +3,6 @@
-
+
diff --git a/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java b/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java
index ee9b8f9..83faf95 100644
--- a/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java
+++ b/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java
@@ -3,36 +3,11 @@ package org.gcube.vremanagement.vremodeler.db;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.rmi.RemoteException;
-import java.sql.PreparedStatement;
import java.sql.SQLException;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathFactory;
-import org.apache.axis.message.addressing.EndpointReferenceType;
-import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.faults.GCUBEFault;
-import org.gcube.common.core.informationsystem.client.AtomicCondition;
-import org.gcube.common.core.informationsystem.client.ISClient;
-import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericQuery;
-import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericResourceQuery;
-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;
-import org.gcube.vremanagement.vremodeler.resources.Functionality;
-import org.gcube.vremanagement.vremodeler.resources.MainFunctionality;
-import org.gcube.vremanagement.vremodeler.resources.Service;
import org.gcube.vremanagement.vremodeler.resources.handlers.CollectionHandler;
import org.gcube.vremanagement.vremodeler.resources.handlers.FunctionalityHandler;
import org.gcube.vremanagement.vremodeler.resources.handlers.GHNHandler;
@@ -42,9 +17,6 @@ import org.gcube.vremanagement.vremodeler.resources.handlers.MCollectionHandler;
import org.gcube.vremanagement.vremodeler.resources.handlers.MetadataFormatHandler;
import org.gcube.vremanagement.vremodeler.resources.handlers.NativeMetadataFormatHandler;
import org.gcube.vremanagement.vremodeler.resources.handlers.RunningInstancesHandler;
-import org.gcube.vremanagement.vremodeler.resources.kxml.KGCUBEGenericFunctionalityResource;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
diff --git a/src/org/gcube/vremanagement/vremodeler/impl/thread/DeployVRE.java b/src/org/gcube/vremanagement/vremodeler/impl/thread/DeployVRE.java
index 7ea429e..f80ab08 100644
--- a/src/org/gcube/vremanagement/vremodeler/impl/thread/DeployVRE.java
+++ b/src/org/gcube/vremanagement/vremodeler/impl/thread/DeployVRE.java
@@ -13,12 +13,20 @@ 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;
import org.gcube.common.core.faults.GCUBEFault;
+import org.gcube.common.core.informationsystem.client.ISClient;
+import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
import org.gcube.common.core.resources.GCUBECollection;
import org.gcube.common.core.resources.GCUBEGenericResource;
import org.gcube.common.core.resources.GCUBEMCollection;
+import org.gcube.common.core.resources.GCUBERunningInstance;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl;
+import org.gcube.common.core.utils.handlers.GCUBEServiceHandler.NoQueryResultException;
import org.gcube.common.core.utils.logging.GCUBELog;
import org.gcube.common.resources.kxml.KGCUBEResource;
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.AddResourcesParameters;
@@ -30,10 +38,12 @@ import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ResourceMan
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ScopeOption;
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ServiceItem;
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ServiceList;
+import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.service.ResourceManagerServiceAddressingLocator;
import org.gcube.vremanagement.vremodeler.db.DBInterface;
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;
@@ -115,9 +125,9 @@ public class DeployVRE extends Thread{
try {
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+VREState.FAILED+"' WHERE VRE.id='"+this.resourceId+"';");
} catch (Exception e1) {
- logger.error("impossible to update the VRE Status"+e1);
+ logger.error("impossible to update the VRE Status",e1);
}
- logger.error("Error deploying the VRE with id "+this.resourceId+" "+e);
+ logger.error("Error deploying the VRE with id "+this.resourceId+" ",e);
}
}
@@ -214,183 +224,200 @@ public class DeployVRE extends Thread{
- private boolean createVRE(List ghnList) throws GCUBEFault{
- ResourceManagerServiceHandler, String>> vreManagerHandler= new ResourceManagerServiceHandler, String>>(){
-
- //the parameter is resourceID
- @SuppressWarnings("static-access")
- @Override
- protected Boolean makeCall(ResourceManagerPortType rmPortType)
- 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.getParameter().second+"'; ");
- if (!resGenericInfo.next()) throw new GCUBEFault("The VRE with ID "+this.getParameter().second+" 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);
-
- //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(60000);
-
- //Adding the resources to the new VRE
- AddResourcesParameters arp= new AddResourcesParameters();
- ResourceList rl= new ResourceList();
- List resItemList= new ArrayList();
- //retrieving Collection
- try{
-
- ResourceItem resItem;
- ResultSet resRelatedCol =DBInterface.queryDB("select VRERELATEDCOLLECTION.collid from VRERELATEDCOLLECTION where VRERELATEDCOLLECTION.vreid='"+this.getParameter().second+"';");
- while (resRelatedCol.next()){
- resItem= new ResourceItem();
- resItem.setID(resRelatedCol.getString(1));
- logger.debug("selected collection:"+ resItem.getID());
- resItem.setType(GCUBECollection.TYPE);
- resItemList.add(resItem);
- }
- }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.getParameter().second+"' 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);
- }
- }catch(SQLException sqle){
- logger.error("Error contacting HSQLDB ",sqle);
- }
-
- //adding the CollectionResource genericResource
- ResourceItem genResItem= new ResourceItem();
- genResItem.setID(collectionResourceCreation.getCreatedResourceId());
- 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);
- }
- }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 listService= new ArrayList();
- ResultSet resService =DBInterface.queryDB("select DISTINCT s.name, s.class, s.version from VRERELATEDFUNCT AS vrf, SERVICES AS s where vrf.vreid='"+this.getParameter().second+"' 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]));
- }catch(SQLException sqle){logger.error("Error contacting HSQLDB "+sqle);}
-
- //sets the GHNs
- serviceList.setGHN(this.getParameter().first.toArray(new String[0]));
-
- arp.setServices(serviceList);
-
- scopeParameter.setAddResourcesParameters(arp);
- scopeParameter.setName(this.scope.toString());
-
- String report= "ok";
- String reportId=rmPortType.createScope(scopeParameter);
-
- int attempt=0;
- do{
- Thread.currentThread().sleep(20000);
- report=rmPortType.getReport(reportId);
- attempt++;
- getResource().setSecondReport(report);
- getResource().store();
- }while (!isDeploymentStatusFinished(report) && attempt<20);
-
-
- logger.info("is something failed in the second step?"+isSomethingFailed(report));
- logger.trace("report step 2: "+report);
- return isSomethingFailed(report);
- }
- };
+ @SuppressWarnings("static-access")
+ private boolean createVRE(List ghnList) throws Exception{
- vreManagerHandler.clearBlackboard();
- vreManagerHandler.setHandled(new GCUBEServiceClientImpl());
- vreManagerHandler.setParameter(new Pair, String>(ghnList,this.resourceId));
- vreManagerHandler.scope=GCUBEScope.getScope(this.startingScope+"/"+this.vreName);
- try {
- vreManagerHandler.run();
- } catch (Exception e) {
- logger.error("DeployingVRE step 2 -- failed "+e);
- throw new GCUBEFault(e);
+ 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 eprs = new ArrayList();
+ 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());
+
+ 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);
+
+ //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);
+
+ //Adding the resources to the new VRE
+ AddResourcesParameters arp= new AddResourcesParameters();
+ ResourceList rl= new ResourceList();
+ List resItemList= new ArrayList();
+ //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);
+ }
+ }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);
+ }
+ }catch(SQLException sqle){
+ logger.error("Error contacting HSQLDB ",sqle);
}
- return vreManagerHandler.getReturnValue();
+
+ //adding the CollectionResource genericResource
+ ResourceItem genResItem= new ResourceItem();
+ genResItem.setID(collectionResourceCreation.getCreatedResourceId());
+ 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);
+ }
+ }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 listService= new ArrayList();
+ 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]));
+ }catch(SQLException sqle){logger.error("Error contacting HSQLDB "+sqle);}
+
+ //sets the GHNs
+ serviceList.setGHN(ghnList.toArray(new String[0]));
+
+ arp.setServices(serviceList);
+
+ scopeParameter.setAddResourcesParameters(arp);
+ scopeParameter.setName(GCUBEScope.getScope(this.startingScope+"/"+this.vreName).toString());
+
+ String report= "starting";
+ String reportId=rmPortType.createScope(scopeParameter);
+
+ int reportAttempt=0;
+ do{
+ try{
+ Thread.currentThread().sleep(20000);
+ }catch (Exception e) {}
+ report=rmPortType.getReport(reportId);
+ reportAttempt++;
+ getResource().setSecondReport(report);
+ getResource().store();
+
+ }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);
+
}
@@ -401,16 +428,33 @@ public class DeployVRE extends Thread{
*/
private boolean isSomethingFailed(String report){
boolean ret = false;
- String xpath = "/ResourceReport/DeploymentActivity/GHN/LastReportReceived/Packages/Package/Status";
+ String deploymentXpath = "/ResourceReport/DeploymentPlanCreation/Status";
+ String dependenciesResolutionXpath ="/ResourceReport/Services/Service/DependenciesResolutionStatus";
+ String serviceXpath="/ResourceReport/Services/Service/DeploymentActivity/GHN/LastReportReceived/Packages/Package/Status";
+
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db;
try {
db = dbf.newDocumentBuilder();
Document document = db.parse(new ByteArrayInputStream(report.getBytes()));
XPath engine = XPathFactory.newInstance().newXPath();
- NodeList nl = (NodeList) engine.evaluate(xpath,document, XPathConstants.NODESET);
- for (int i = 0; i < nl.getLength(); i++) {
- if(nl.item(i).getFirstChild().getNodeValue().compareTo("FAILED")==0){
+ NodeList nDeployment = (NodeList) engine.evaluate(deploymentXpath,document, XPathConstants.NODESET);
+ for (int i = 0; i < nDeployment.getLength(); i++) {
+ if(nDeployment.item(i).getFirstChild().getNodeValue().compareTo("FAILED")==0){
+ return true;
+ }
+ }
+
+ NodeList nResoulution = (NodeList) engine.evaluate(dependenciesResolutionXpath,document, XPathConstants.NODESET);
+ for (int i = 0; i < nResoulution.getLength(); i++) {
+ if(nResoulution.item(i).getFirstChild().getNodeValue().compareTo("FAILED")==0){
+ return true;
+ }
+ }
+
+ NodeList sResoulution = (NodeList) engine.evaluate(serviceXpath,document, XPathConstants.NODESET);
+ for (int i = 0; i < sResoulution.getLength(); i++) {
+ if(sResoulution.item(i).getFirstChild().getNodeValue().compareTo("FAILED")==0){
return true;
}
}
@@ -428,7 +472,7 @@ public class DeployVRE extends Thread{
private boolean isDeploymentStatusFinished(String report) {
boolean ret = false;
- String xpath = "/ResourceReport/DeploymentActivity/GHN/LastReportReceived/Status";
+ String xpath = "/ResourceReport/Services/Service/DeploymentActivity/GHN/LastReportReceived/Status";
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db;
try {
diff --git a/src/org/gcube/vremanagement/vremodeler/impl/util/ResourceManagerServiceHandler.java b/src/org/gcube/vremanagement/vremodeler/impl/util/ResourceManagerServiceHandler.java
index 1eb4571..84ce42f 100644
--- a/src/org/gcube/vremanagement/vremodeler/impl/util/ResourceManagerServiceHandler.java
+++ b/src/org/gcube/vremanagement/vremodeler/impl/util/ResourceManagerServiceHandler.java
@@ -76,7 +76,7 @@ public abstract class ResourceManagerServiceHandler extends GCUBEServiceHa
rmpt = GCUBERemotePortTypeContext.getProxy(rmpt,scope, Integer.parseInt((String)ServiceContext.getContext().getProperty("resourceManagerTimeout", true)));
this.usedhost= epr.getAddress().getHost();
this.setReturnValue(this.makeCall(rmpt));
- }catch(Exception e){e.printStackTrace();throw e; }
+ }catch(Exception e){logger.error(e);throw e; }
}
}
\ No newline at end of file