Author: samindaw
Date: Thu May 30 17:23:16 2013
New Revision: 1487941

URL: http://svn.apache.org/r1487941
Log:
redirecting data of old gramdata function in the registry api to the new gfac 
data table + improvments to the phoebus integration

Modified:
    
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/phoebus/PhoebusGridConfigurationHandler.java
    
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GridConfigurationHandler.java
    
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java

Modified: 
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/phoebus/PhoebusGridConfigurationHandler.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/phoebus/PhoebusGridConfigurationHandler.java?rev=1487941&r1=1487940&r2=1487941&view=diff
==============================================================================
--- 
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/phoebus/PhoebusGridConfigurationHandler.java
 (original)
+++ 
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/phoebus/PhoebusGridConfigurationHandler.java
 Thu May 30 17:23:16 2013
@@ -20,34 +20,51 @@
 */
 package org.apache.airavata.gfac.phoebus;
 
+import org.apache.airavata.common.utils.Version;
+import org.apache.airavata.common.utils.Version.BuildType;
 import org.apache.airavata.gfac.utils.GridConfigurationHandler;
 import org.apache.airavata.gfac.utils.PhoebusUtils;
 import org.globus.ftp.DataChannelAuthentication;
 import org.globus.ftp.GridFTPClient;
 
 public class PhoebusGridConfigurationHandler implements 
GridConfigurationHandler{
-
-    public void handleFileTransferFTPClientConfigurations(GridFTPClient 
source, GridFTPClient destination) throws Exception {
-        if (source!=null && 
PhoebusUtils.isPhoebusDriverConfigurationsDefined(source.getHost())) {
-            
source.setDataChannelAuthentication(DataChannelAuthentication.NONE);
-            source.site("SITE SETNETSTACK phoebus:" + 
PhoebusUtils.getPhoebusDataChannelXIODriverParameters(source.getHost()));
-        }
+       private static String HANDLER_NAME="PHOEBUS";
+       
+    public void handleFileTransferFTPClientConfigurations(GridFTPClient 
source, GridFTPClient destination) throws GridConfigurationHandlerException {
+        try {
+                       if (source!=null && 
PhoebusUtils.isPhoebusDriverConfigurationsDefined(source.getHost())) {
+                           
source.setDataChannelAuthentication(DataChannelAuthentication.NONE);
+                           source.site("SITE SETNETSTACK phoebus:" + 
PhoebusUtils.getPhoebusDataChannelXIODriverParameters(source.getHost()));
+                       }
+               } catch (Exception e) {
+                       throw new GridConfigurationHandlerException("Error 
configuring for Phoebus handler: "+e.getLocalizedMessage(),e);
+               }
     }
 
     public void handleMakeDirFTPClientConfigurations(GridFTPClient client, 
String dirPath)
-            throws Exception {
+            throws GridConfigurationHandlerException {
        //nothing to do
     }
 
        @Override
        public void handleListDirFTPClientConfigurations(GridFTPClient client, 
String dirPath)
-                       throws Exception {
+                       throws GridConfigurationHandlerException {
        //nothing to do
        }
 
        @Override
        public void handleFTPClientConfigurations(GridFTPClient client,
-                       String taskDescription) throws Exception {
+                       String taskDescription) throws 
GridConfigurationHandlerException {
        //nothing to do
        }
+
+       @Override
+       public String getHandlerName() {
+               return HANDLER_NAME;
+       }
+
+       @Override
+       public Version getHandlerVersion() {
+               return new Version(HANDLER_NAME, 1, 0, 0, null, BuildType.RC);
+       }
 }

Modified: 
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GridConfigurationHandler.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GridConfigurationHandler.java?rev=1487941&r1=1487940&r2=1487941&view=diff
==============================================================================
--- 
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GridConfigurationHandler.java
 (original)
+++ 
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GridConfigurationHandler.java
 Thu May 30 17:23:16 2013
@@ -19,9 +19,30 @@
  *
 */
 package org.apache.airavata.gfac.utils;
+import org.apache.airavata.common.utils.Version;
 import org.globus.ftp.GridFTPClient;
 
 public interface GridConfigurationHandler {
+       public static class GridConfigurationHandlerException extends Exception{
+               private static final long serialVersionUID = 
4009827774771871814L;
+
+               public GridConfigurationHandlerException(String message, 
Throwable e){
+                       super(message,e);
+               }
+       }
+       
+       /**
+        * A unique name for this GridConfigruationHandler
+        * @return
+        */
+       public String getHandlerName();
+       
+       /**
+        * The version of this handler. 
+        * Note: Given multiple versions of the same handler, the latest 
version will be used. 
+        * @return
+        */
+       public Version getHandlerVersion();
 
        /**
         * Gets triggered if any GridFTP tasks other than mentioned below if 
called. This is there to 
@@ -30,7 +51,7 @@ public interface GridConfigurationHandle
         * @param taskDescription - a description of the task that is being 
carried out.
         * @throws Exception
         */
-       public void handleFTPClientConfigurations(GridFTPClient client, String 
taskDescription) throws Exception;
+       public void handleFTPClientConfigurations(GridFTPClient client, String 
taskDescription) throws GridConfigurationHandlerException;
 
        /**
         * Do the configurations required for the source GridFTPClient object
@@ -38,14 +59,14 @@ public interface GridConfigurationHandle
         * @param destination - <code>null</code> if the transfer is to the 
local file-system 
         * @throws Exception
         */
-       public void handleFileTransferFTPClientConfigurations(GridFTPClient 
source, GridFTPClient destination) throws Exception;
+       public void handleFileTransferFTPClientConfigurations(GridFTPClient 
source, GridFTPClient destination) throws GridConfigurationHandlerException;
 
        /**
         * Do the configurations required for the GridFTPClient object which is 
going to create a directory
         * @param client
         * @throws Exception
         */
-       public void handleMakeDirFTPClientConfigurations(GridFTPClient client, 
String dirPath) throws Exception;
+       public void handleMakeDirFTPClientConfigurations(GridFTPClient client, 
String dirPath) throws GridConfigurationHandlerException;
        
        /**
         * Do the configurations required for the GridFTPClient object which is 
going to list a directory
@@ -53,6 +74,6 @@ public interface GridConfigurationHandle
         * @param dirPath
         * @throws Exception
         */
-       public void handleListDirFTPClientConfigurations(GridFTPClient client, 
String dirPath) throws Exception;
+       public void handleListDirFTPClientConfigurations(GridFTPClient client, 
String dirPath) throws GridConfigurationHandlerException;
 }
 

Modified: 
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1487941&r1=1487940&r2=1487941&view=diff
==============================================================================
--- 
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
 (original)
+++ 
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
 Thu May 30 17:23:16 2013
@@ -49,7 +49,6 @@ import org.apache.airavata.persistance.r
 import 
org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource;
 import 
org.apache.airavata.persistance.registry.jpa.resources.GFacJobDataResource;
 import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
-import org.apache.airavata.persistance.registry.jpa.resources.GramDataResource;
 import 
org.apache.airavata.persistance.registry.jpa.resources.HostDescriptorResource;
 import org.apache.airavata.persistance.registry.jpa.resources.NodeDataResource;
 import org.apache.airavata.persistance.registry.jpa.resources.ProjectResource;
@@ -1808,20 +1807,18 @@ public class AiravataJPARegistry extends
         if (provenanceRegistry != null){
             
provenanceRegistry.updateWorkflowNodeGramData(workflowNodeGramData);
         }else {
-            if 
(!isWorkflowInstanceNodePresent(workflowNodeGramData.getWorkflowInstanceId(),workflowNodeGramData.getNodeID(),
 true)){
-                throw new 
WorkflowInstanceNodeDoesNotExistsException(workflowNodeGramData.getWorkflowInstanceId(),workflowNodeGramData.getNodeID());
-            }
-            WorkflowDataResource workflowInstance = 
jpa.getWorker().getWorkflowInstance(workflowNodeGramData.getWorkflowInstanceId());
-            GramDataResource gramData;
-            if 
(workflowInstance.isGramDataExists(workflowNodeGramData.getNodeID())){
-                gramData = 
workflowInstance.getGramData(workflowNodeGramData.getNodeID());
-            }else{
-                gramData = 
workflowInstance.createGramData(workflowNodeGramData.getNodeID());
-            }
-            gramData.setInvokedHost(workflowNodeGramData.getInvokedHost());
-            gramData.setLocalJobID(workflowNodeGramData.getGramJobID());
-            gramData.setRsl(workflowNodeGramData.getRsl());
-            gramData.save();
+               GFacJob job = new GFacJob();
+               job.setJobId(workflowNodeGramData.getGramJobID());
+               job.setMetadata(workflowNodeGramData.getInvokedHost());
+               
job.setExperimentId(workflowNodeGramData.getWorkflowInstanceId());
+               
job.setWorkflowExecutionId(workflowNodeGramData.getWorkflowInstanceId());
+               job.setNodeId(workflowNodeGramData.getNodeID());
+               job.setJobData(workflowNodeGramData.getRsl());
+               if (isGFacJobExists(job.getJobId())){
+                       updateGFacJob(job);
+               }else{
+                       addGFacJob(job);
+               }
         }
        }
 


Reply via email to