airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1378626 - in /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya: interpretor/ provenance/ ui/monitor/ util/
Date Wed, 29 Aug 2012 16:02:33 GMT
Author: lahiru
Date: Wed Aug 29 16:02:33 2012
New Revision: 1378626

URL: http://svn.apache.org/viewvc?rev=1378626&view=rev
Log:
Fixing some issues with provenacne impl

Modified:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceWrite.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowNodeStatusUpdater.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowStatusUpdater.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/monitor/MonitorEventHandler.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java?rev=1378626&r1=1378625&r2=1378626&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
Wed Aug 29 16:02:33 2012
@@ -179,14 +179,14 @@ public class WorkflowInterpreter {
 			}
 
 			this.getWorkflow().setExecutionState(WorkflowExecutionState.RUNNING);
-			if (this.config.isActOnProvenance()) {
-				try {
-					this.getConfig().getConfiguration().getJcrComponentRegistry().getRegistry()
-							.saveWorkflowExecutionStatus(this.config.getTopic(), ExecutionStatus.STARTED);
-				} catch (RegistryException e) {
-					throw new WorkflowException(e);
-				}
-			}
+//			if (this.config.isActOnProvenance()) {
+//				try {
+//					this.getConfig().getConfiguration().getJcrComponentRegistry().getRegistry()
+//							.saveWorkflowExecutionStatus(this.config.getTopic(), ExecutionStatus.STARTED);
+//				} catch (Exception e) {
+//					throw new WorkflowException(e);
+//				}
+//			}
 			ArrayList<Node> inputNodes = this.getInputNodesDynamically();
 			Object[] values = new Object[inputNodes.size()];
 			String[] keywords = new String[inputNodes.size()];

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java?rev=1378626&r1=1378625&r2=1378626&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java
Wed Aug 29 16:02:33 2012
@@ -71,6 +71,7 @@ public class WorkflowInterpretorEventLis
     private MessagePuller messagePuller;
     private WorkflowStatusUpdater workflowStatusUpdater;
     private WorkflowNodeStatusUpdater workflowNodeStatusUpdater;
+    private WorkflowInterpreterConfiguration workflowInterpreterConfiguration;
 
     private static Logger logger = LoggerFactory.getLogger(WorkflowInterpretorEventListener.class);
 
@@ -82,10 +83,9 @@ public class WorkflowInterpretorEventLis
         this.messageBoxURL = configuration.getMessageBoxURL();
         this.wseClient = new WseMsgBrokerClient();
         this.wseClient.init(this.brokerURL.toString());
-        this.workflowNodeStatusUpdater = new WorkflowNodeStatusUpdater(WorkflowInterpreter.getWorkflowInterpreterConfiguration().
-                getConfiguration().getJcrComponentRegistry().getRegistry());
-        this.workflowStatusUpdater = new WorkflowStatusUpdater(WorkflowInterpreter.getWorkflowInterpreterConfiguration().
-                getConfiguration().getJcrComponentRegistry().getRegistry());
+        this.workflowInterpreterConfiguration = WorkflowInterpreter.getWorkflowInterpreterConfiguration();
+        this.workflowNodeStatusUpdater = new WorkflowNodeStatusUpdater(this.workflowInterpreterConfiguration.getRegistry());
+        this.workflowStatusUpdater = new WorkflowStatusUpdater(this.workflowInterpreterConfiguration.getRegistry());
     }
 
     public void start() throws MonitorException {
@@ -170,7 +170,7 @@ public class WorkflowInterpretorEventLis
             workflowStarted(graph, forward);
             //todo ideally experimentID and workflowInstanceID has to be different
             workflowStatusUpdater.saveWorkflowData(event.getExperimentID(), event.getExperimentID(),
-                    WorkflowInterpreter.getWorkflowInterpreterConfiguration().getWorkflow().getName());
+                    this.workflowInterpreterConfiguration.getWorkflow().getName());
             workflowStatusUpdater.workflowStarted(event.getExperimentID());
         } else if (type == MonitorUtil.EventType.WORKFLOW_TERMINATED) {
             workflowFinished(graph, forward);
@@ -180,7 +180,8 @@ public class WorkflowInterpretorEventLis
                 logger.warn("There is no node that has ID, " + nodeID);
             } else {
                 nodeStarted(node, forward);
-                workflowNodeStatusUpdater.workflowStarted(event.getExperimentID(), event.getNodeID());
+                workflowNodeStatusUpdater.workflowStarted(event.getExperimentID(), event.getNodeID()
+                        ,event.getMessage(),event.getWorkflowID().toASCIIString());
             }
         } else if (type == MonitorUtil.EventType.RECEIVED_RESULT
         // TODO this should be removed when GPEL sends all notification
@@ -190,7 +191,8 @@ public class WorkflowInterpretorEventLis
                 logger.warn("There is no node that has ID, " + nodeID);
             } else {
                 nodeFinished(node, forward);
-                workflowNodeStatusUpdater.workflowFinished(event.getExperimentID(), event.getNodeID());
+                workflowNodeStatusUpdater.workflowFinished(event.getExperimentID(), event.getNodeID(),event.getMessage(),
+                        event.getWorkflowID().toASCIIString());
             }
         } else if (type == EventType.INVOKING_SERVICE_FAILED || type == EventType.RECEIVED_FAULT
         // TODO

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java?rev=1378626&r1=1378625&r2=1378626&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java
Wed Aug 29 16:02:33 2012
@@ -138,7 +138,7 @@ public class WorkflowInterpretorSkeleton
 	private URL getXBayaPropertiesURL() {
 		return this.getClass().getClassLoader().getResource("xbaya.properties");
 	}
-	
+
     public void startUp(final ConfigurationContext configctx, AxisService service) {
     	new Thread(){
 			@Override
@@ -299,10 +299,11 @@ public class WorkflowInterpretorSkeleton
 		WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow,topic,conf.getMessageBoxURL(),
conf.getBrokerURL(), registry, conf, null, null, null);
         workflowInterpreterConfiguration.setGfacEmbeddedMode(gfacEmbeddedMode);
         workflowInterpreterConfiguration.setActOnProvenance(provenance);
-        listener = new WorkflowInterpretorEventListener(workflow, conf);
+        // WorkflowInterpreter object should create prior creation of Listener, because listener
needs the threadlocal variable
         interpreter = new WorkflowInterpreter(workflowInterpreterConfiguration, new SSWorkflowInterpreterInteractorImpl());
+        listener = new WorkflowInterpretorEventListener(workflow, conf);
         try {
-            System.err.println("start listener set");
+             System.err.println("start listener set");
             listener.start();
         } catch (MonitorException e1) {
             e1.printStackTrace();
@@ -341,7 +342,7 @@ public class WorkflowInterpretorSkeleton
         try {
             interpreter.scheduleDynamically();
             System.err.println("Called the interpreter");
-        } catch (WorkflowException e) {
+        } catch (Exception e) {
             throw new WorkflowRuntimeException(e);
         } finally {
             /*

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceWrite.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceWrite.java?rev=1378626&r1=1378625&r2=1378626&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceWrite.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceWrite.java
Wed Aug 29 16:02:33 2012
@@ -177,7 +177,7 @@ public final class ProvenanceWrite imple
 				try {
 					this.registry.saveWorkflowExecutionServiceInput(new WorkflowServiceIOData(
 							xsul5.XmlConstants.BUILDER.serializeToString(inputs),
-							experimentId, node.getID(), this.workflowName));
+							experimentId,experimentId, node.getID(), this.workflowName));
 				} catch (RegistryException e) {
 					throw new WorkflowException(e);
 				}
@@ -207,7 +207,7 @@ public final class ProvenanceWrite imple
 				}
 			}
             try {
-				this.registry.saveWorkflowExecutionServiceOutput(new WorkflowServiceIOData(xsul5.XmlConstants.BUILDER.serializeToString(outputs),
experimentId, node.getID(),this.workflowName));
+				this.registry.saveWorkflowExecutionServiceOutput(new WorkflowServiceIOData(xsul5.XmlConstants.BUILDER.serializeToString(outputs),
experimentId,experimentId, node.getID(),this.workflowName));
             } catch (RegistryException e) {
 				throw new WorkflowException(e);
 			}

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowNodeStatusUpdater.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowNodeStatusUpdater.java?rev=1378626&r1=1378625&r2=1378626&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowNodeStatusUpdater.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowNodeStatusUpdater.java
Wed Aug 29 16:02:33 2012
@@ -23,6 +23,7 @@ package org.apache.airavata.xbaya.proven
 import org.apache.airavata.common.registry.api.exception.RegistryException;
 import org.apache.airavata.registry.api.AiravataRegistry;
 import org.apache.airavata.registry.api.workflow.WorkflowInstanceStatus;
+import org.apache.airavata.registry.api.workflow.WorkflowServiceIOData;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,8 +36,10 @@ public class WorkflowNodeStatusUpdater {
         this.registry = registry;
     }
 
-    public boolean workflowStarted(String workflowInstanceID,String nodeID){
+    public boolean workflowStarted(String workflowInstanceID,String nodeID,String inputs,String
workflowID){
         try {
+            WorkflowServiceIOData workflowServiceIOData = new WorkflowServiceIOData(inputs,
workflowInstanceID,workflowInstanceID, workflowID, nodeID, null);
+            registry.saveWorkflowExecutionServiceInput(workflowServiceIOData);          
                                                                                  registry.saveWorkflowNodeStatus(workflowInstanceID,
nodeID, WorkflowInstanceStatus.ExecutionStatus.STARTED);
             registry.saveWorkflowNodeStatus(workflowInstanceID, nodeID, WorkflowInstanceStatus.ExecutionStatus.STARTED);
         } catch (RegistryException e) {
             logger.error("Error updating Wokflow Node status !!");
@@ -55,8 +58,10 @@ public class WorkflowNodeStatusUpdater {
         return true;
     }
 
-    public boolean workflowFinished(String workflowInstanceID,String nodeID){
+    public boolean workflowFinished(String workflowInstanceID,String nodeID,String inputs,String
workflowID){
         try {
+            WorkflowServiceIOData workflowServiceIOData = new WorkflowServiceIOData(inputs,
workflowInstanceID,workflowInstanceID, workflowID, nodeID, null);
+            registry.saveWorkflowExecutionServiceOutput(workflowServiceIOData);
             registry.saveWorkflowNodeStatus(workflowInstanceID, nodeID, WorkflowInstanceStatus.ExecutionStatus.FINISHED);
         } catch (RegistryException e) {
             logger.error("Error updating Wokflow Node status !!");

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowStatusUpdater.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowStatusUpdater.java?rev=1378626&r1=1378625&r2=1378626&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowStatusUpdater.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/WorkflowStatusUpdater.java
Wed Aug 29 16:02:33 2012
@@ -94,6 +94,7 @@ public class WorkflowStatusUpdater {
         WorkflowRunTimeData workflowRunTimeData = new WorkflowRunTimeData(experimentID, workflowInstanceID,
workflowTemplateID, currentTime,
                 WorkflowInstanceStatus.ExecutionStatus.STARTED, currentTime);
         try {
+            registry.saveWorkflowExecutionName(experimentID, workflowInstanceID);
             registry.saveWorkflowData(workflowRunTimeData);
         } catch (RegistryException e) {
             logger.error("Error saving Workflow Data !!");

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/monitor/MonitorEventHandler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/monitor/MonitorEventHandler.java?rev=1378626&r1=1378625&r2=1378626&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/monitor/MonitorEventHandler.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/monitor/MonitorEventHandler.java
Wed Aug 29 16:02:33 2012
@@ -22,7 +22,9 @@
 package org.apache.airavata.xbaya.ui.monitor;
 
 import java.awt.Color;
+import java.io.IOException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -31,6 +33,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
+import javax.jcr.RepositoryException;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
@@ -60,6 +63,7 @@ import org.apache.airavata.xbaya.provena
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.graph.GraphCanvas;
 import org.apache.airavata.xbaya.ui.graph.NodeGUI;
+import org.apache.airavata.xbaya.util.XBayaUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xmlpull.infoset.XmlElement;
@@ -114,24 +118,33 @@ public class MonitorEventHandler impleme
 
     private Map<Node, LinkedList<ResourcePaintable>> resourcePaintableMap;
 
-    private WorkflowStatusUpdater workflowStatusUpdater;
+//    private WorkflowStatusUpdater workflowStatusUpdater;
+
+//    private WorkflowNodeStatusUpdater workflowNodeStatusUpdater;
 
-    private WorkflowNodeStatusUpdater workflowNodeStatusUpdater;
     /**
-     * Constructs a MonitorEventHandler.
-     *
-     * @param engine
-     * @param dataModel
+     * Model MonitorEventHandler
+     * @param xbayaGUI
      */
     public MonitorEventHandler(XBayaGUI xbayaGUI) {
         this.xbayaGUI=xbayaGUI;
         this.incorrectWorkflowIDs = Collections.synchronizedSet(new HashSet<URI>());
         this.triedWorkflowIDs = Collections.synchronizedSet(new HashSet<URI>());
         this.resourcePaintableMap = new HashMap<Node, LinkedList<ResourcePaintable>>();
-        this.workflowNodeStatusUpdater = new WorkflowNodeStatusUpdater(WorkflowInterpreter.getWorkflowInterpreterConfiguration().
-                getConfiguration().getJcrComponentRegistry().getRegistry());
-        this.workflowStatusUpdater = new WorkflowStatusUpdater(WorkflowInterpreter.getWorkflowInterpreterConfiguration().
-                getConfiguration().getJcrComponentRegistry().getRegistry());
+//        try {
+//            if (this.getClass().getClassLoader().getResource("xbaya.properties") != null)
{
+//                this.workflowNodeStatusUpdater =
+//                        new WorkflowNodeStatusUpdater(XBayaUtil.getRegistry(this.getClass().getClassLoader().getResource("xbaya.properties")));
+//                this.workflowStatusUpdater =
+//                        new WorkflowStatusUpdater(XBayaUtil.getRegistry(this.getClass().getClassLoader().getResource("xbaya.properties")));
+//            }
+//        } catch (IOException e) {
+//            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+//        } catch (RepositoryException e) {
+//            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+//        } catch (URISyntaxException e) {
+//            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+//        }
     }
 
     /**
@@ -304,10 +317,10 @@ public class MonitorEventHandler impleme
         // logger.info("type: " + type);
         if (type == MonitorUtil.EventType.WORKFLOW_INVOKED) {
             workflowStarted(graph, forward);
-            workflowStatusUpdater.workflowStarted(event.getExperimentID());
+//            workflowStatusUpdater.workflowStarted(event.getExperimentID());
         } else if (type == MonitorUtil.EventType.WORKFLOW_TERMINATED) {
             workflowFinished(graph, forward);
-            workflowStatusUpdater.workflowFinished(event.getExperimentID());
+//            workflowStatusUpdater.workflowFinished(event.getExperimentID());
         } else if (type == EventType.INVOKING_SERVICE
         // TODO this should be removed when GPEL sends all notification
         // correctly.
@@ -316,7 +329,7 @@ public class MonitorEventHandler impleme
                 logger.warn("There is no node that has ID, " + nodeID);
             } else {
                 nodeStarted(node, forward);
-                workflowNodeStatusUpdater.workflowStarted(event.getExperimentID(), event.getNodeID());
+//                workflowNodeStatusUpdater.workflowStarted(event.getExperimentID(), event.getNodeID());
             }
         } else if (type == MonitorUtil.EventType.RECEIVED_RESULT
         // TODO this should be removed when GPEL sends all notification
@@ -326,7 +339,7 @@ public class MonitorEventHandler impleme
                 logger.warn("There is no node that has ID, " + nodeID);
             } else {
                 nodeFinished(node, forward);
-                workflowNodeStatusUpdater.workflowFinished(event.getExperimentID(), event.getNodeID());
+//                workflowNodeStatusUpdater.workflowFinished(event.getExperimentID(), event.getNodeID());
             }
 
         } else if (type == EventType.INVOKING_SERVICE_FAILED || type == EventType.RECEIVED_FAULT
@@ -336,14 +349,14 @@ public class MonitorEventHandler impleme
                 logger.warn("There is no node that has ID, " + nodeID);
             } else {
                 nodeFailed(node, forward);
-                workflowNodeStatusUpdater.workflowFailed(event.getExperimentID(), event.getNodeID());
+//                workflowNodeStatusUpdater.workflowFailed(event.getExperimentID(), event.getNodeID());
             }
         } else if (type == MonitorUtil.EventType.RESOURCE_MAPPING) {
             if (node == null) {
                 logger.warn("There is no node that has ID, " + nodeID);
             } else {
                 nodeResourceMapped(node, event.getEvent(), forward);
-                workflowNodeStatusUpdater.workflowRunning(event.getExperimentID(), event.getNodeID());
+//                workflowNodeStatusUpdater.workflowRunning(event.getExperimentID(), event.getNodeID());
             }
         } else {
             // Ignore the rest.

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java?rev=1378626&r1=1378625&r2=1378626&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
Wed Aug 29 16:02:33 2012
@@ -23,20 +23,14 @@ package org.apache.airavata.xbaya.util;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.SocketTimeoutException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
+import java.net.*;
+import java.util.*;
 
+import javax.jcr.RepositoryException;
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.apache.airavata.registry.api.AiravataRegistry;
+import org.apache.airavata.workflow.model.component.registry.JCRComponentRegistry;
 import org.apache.airavata.workflow.model.exceptions.WorkflowException;
 import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
 import org.apache.airavata.workflow.model.graph.DataPort;
@@ -73,6 +67,9 @@ import xsul5.XmlConstants;
 public class XBayaUtil {
 
     private static final Logger logger = LoggerFactory.getLogger(XBayaUtil.class);
+    public static final String JCR_USER = "jcr.username";
+    public static final String JCR_PASS = "jcr.password";
+    public static final String JCR_URL = "jcr.url";
 
     public static LeadContextHeader buildLeadContextHeader(final XBayaEngine engine,
             MonitorConfiguration monitorConfiguration, String nodeId, LeadResourceMapping
resourceMapping)
@@ -338,4 +335,12 @@ public class XBayaUtil {
 		return parameters;
 	}
 
+    public static AiravataRegistry getRegistry(URL url) throws IOException, RepositoryException,
URISyntaxException {
+        Properties properties = new Properties();
+        properties.load(url.openStream());
+        JCRComponentRegistry jcrComponentRegistry = new JCRComponentRegistry(new URI((String)
properties.get(JCR_URL)),
+                (String) properties.get(JCR_USER),(String) properties.get(JCR_PASS));
+        return jcrComponentRegistry.getRegistry();
+    }
+
 }
\ No newline at end of file



Mime
View raw message