diff --git a/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java b/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java index 3ed3d90..be50db2 100644 --- a/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java +++ b/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java @@ -144,8 +144,8 @@ public class ModelerService { /** * Set the selected DHN * - * @param request array of dhn id - * @return VoidType + * @param request array of GHN id + * @return VoidType - * @throws RemoteException - */ public void setGHNs(GHNArray request) throws GCUBEFault{ @@ -176,10 +176,10 @@ public class ModelerService { /** * - * Return an XML with all the collection selectable + * Return an XML with all the collection selectable * * @param request void - * @return the collection retreived from the database + * @return the collection retrieved from the database * @throws RemoteException - */ public String getCollection(VOID var) throws GCUBEFault{ diff --git a/src/org/gcube/vremanagement/vremodeler/impl/thread/DeployVRE.java b/src/org/gcube/vremanagement/vremodeler/impl/thread/DeployVRE.java index 6f65f48..b1bee84 100644 --- a/src/org/gcube/vremanagement/vremodeler/impl/thread/DeployVRE.java +++ b/src/org/gcube/vremanagement/vremodeler/impl/thread/DeployVRE.java @@ -33,8 +33,11 @@ import org.gcube.vremanagement.vremanager.stubs.vremanager.ServiceItem; import org.gcube.vremanagement.vremanager.stubs.vremanager.ServiceList; import org.gcube.vremanagement.vremanager.stubs.vremanager.VREManagerPortType; 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.util.Couple; import org.gcube.vremanagement.vremodeler.impl.util.VREManagerServiceHandler; +import org.globus.wsrf.ResourceException; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; @@ -44,7 +47,7 @@ public class DeployVRE extends Thread{ private static GCUBELog logger= new GCUBELog(DeployVRE.class); private ISPublisher publisher; - + private ModelerResource wsResource= null; private String resourceId; private GCUBEScope startingScope; private String vreName=null; @@ -54,6 +57,11 @@ public class DeployVRE extends Thread{ this.startingScope= scope; } + private ModelerResource getResource() throws ResourceException{ + if (wsResource==null) wsResource= (ModelerResource)ModelerContext.getPortTypeContext().getWSHome().find(ModelerContext.getPortTypeContext().makeKey(resourceId)); + return wsResource; + } + public void run() { try { deployManagerOnVRE(); @@ -63,8 +71,6 @@ public class DeployVRE extends Thread{ }catch(Exception e){ e.printStackTrace(); } - - } @@ -97,7 +103,6 @@ public class DeployVRE extends Thread{ System.out.println("makeCall called"); try{ AddResourcesParameters arp= new AddResourcesParameters(); - System.out.println("fin qui ci sono 1"); ServiceList services= new ServiceList(); ServiceItem[] service= new ServiceItem[1]; service[0]=new ServiceItem(); @@ -105,22 +110,21 @@ public class DeployVRE extends Thread{ service[0].setServiceName("VREManager"); service[0].setServiceVersion("1.00.00"); services.setService(service); - System.out.println("fin qui ci sono 2"); services.setGHN(new String[]{this.getParameter().second}); arp.setServices(services); - System.out.println(this.scope); arp.setTargetScope(this.scope+"/"+this.getParameter().first); - String reportId=mbportType.addResources(arp); - System.out.println("fin qui ci sono 3"); + String report; int attempt=0; do{ Thread.currentThread().sleep(30000); report=mbportType.getReport(reportId); attempt++; - System.out.println("report:"); + getResource().setReportFirstStep(report); + System.out.println("---------"); System.out.println(report); + System.out.println("---------"); }while (!isDeploymentStatusFinished(report) && attempt<10); }catch(Exception e){e.printStackTrace(); throw e;} return ""; @@ -258,25 +262,13 @@ public class DeployVRE extends Thread{ String reportId=vreManPortType.addResources(arp); String report; int attempt=0; - GCUBEGenericResource statusResource=null; do{ this.wait(20000); report=vreManPortType.getReport(reportId); attempt++; - try { - publisher= GHNContext.getImplementation(ISPublisher.class); - if (statusResource==null){ - statusResource= GHNContext.getImplementation(GCUBEGenericResource.class); - statusResource.setID(resourceId); - statusResource.setSecondaryType("VREDefinitionStatus"); - statusResource.setDescription("VRE Status"); - statusResource.setName(vreName); - } - statusResource.setBody(report); - publisher.registerGCUBEResource(statusResource, ServiceContext.getContext().getScope(), ServiceContext.getContext()); - }catch(Exception e){logger.error("Error publishing the status");} + getResource().setReportSecondStep(report); }while (!isDeploymentStatusFinished(report) && attempt<20); - return "FINISHED"; + return ""; } };