You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2014/05/05 18:00:09 UTC
[1/7] moving common monitoring classes to gfac-core
Repository: airavata
Updated Branches:
refs/heads/master 6209ee096 -> 39370c526
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java
deleted file mode 100644
index 4612c3c..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor.state.impl;
-
-import org.apache.airavata.gfac.monitor.state.JobStatusInfo;
-import org.apache.airavata.gsi.ssh.impl.JobStatus;
-
-
-/**
- * This can be used to keep information about a Grid job
- * which we can get from qstat polling or from amqp based
- * monitoring in Grid machines
- */
-public class GridJobStatusInfo implements JobStatusInfo {
- public void setJobStatus(JobStatus jobState) {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public JobStatus getJobStatus() {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
index 17d7925..a9f1520 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
@@ -21,13 +21,12 @@
package org.apache.airavata.gfac.monitor.util;
import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.handler.GFacHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerConfig;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.GFacHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerConfig;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
import org.apache.airavata.gfac.monitor.HostMonitorData;
-import org.apache.airavata.gfac.monitor.MonitorID;
import org.apache.airavata.gfac.monitor.UserMonitorData;
import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
import org.apache.airavata.schemas.gfac.GsisshHostType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java b/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
index 9e1eadd..2c34df9 100644
--- a/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
+++ b/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
@@ -23,6 +23,9 @@ package org.apache.airavata.job;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.gfac.core.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.gsi.ssh.api.ServerInfo;
@@ -30,10 +33,7 @@ import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
import org.apache.airavata.gsi.ssh.impl.PBSCluster;
import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
-import org.apache.airavata.gfac.monitor.MonitorID;
-import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
import org.apache.airavata.gfac.monitor.impl.push.amqp.AMQPMonitor;
-import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
import org.apache.airavata.schemas.gfac.GsisshHostType;
import org.junit.Assert;
import org.junit.Before;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java b/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java
index 54562ba..bb797b3 100644
--- a/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java
@@ -23,6 +23,10 @@ package org.apache.airavata.job;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.gfac.core.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
+import org.apache.airavata.gfac.monitor.HPCMonitorID;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.gsi.ssh.api.ServerInfo;
@@ -31,11 +35,8 @@ import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
import org.apache.airavata.gsi.ssh.impl.PBSCluster;
import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
import org.apache.airavata.gsi.ssh.util.CommonUtils;
-import org.apache.airavata.gfac.monitor.MonitorID;
import org.apache.airavata.gfac.monitor.UserMonitorData;
-import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
import org.apache.airavata.gfac.monitor.impl.pull.qstat.HPCPullMonitor;
-import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
import org.apache.airavata.schemas.gfac.GsisshHostType;
import org.junit.Assert;
import org.testng.annotations.Test;
@@ -146,8 +147,8 @@ public class QstatMonitorTestWithMyProxyAuth {
for (int i = 0; i < 1; i++) {
String jobID = pbsCluster.submitBatchJob(jobDescriptor);
System.out.println("Job submitted successfully, Job ID: " + jobID);
- MonitorID monitorID = new MonitorID(hostDescription, jobID,null,null,null, "ogce");
- monitorID.setAuthenticationInfo(authenticationInfo);
+ MonitorID monitorID = new HPCMonitorID(hostDescription, jobID,null,null,null, "ogce");
+ ((HPCMonitorID)monitorID).setAuthenticationInfo(authenticationInfo);
try {
org.apache.airavata.gfac.monitor.util.CommonUtils.addMonitortoQueue(pullQueue, monitorID);
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
index cba476e..19fc9ef 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
@@ -25,11 +25,11 @@ import org.apache.airavata.common.utils.StringUtil;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
index 79ad49a..03e430b 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
@@ -22,10 +22,10 @@ package org.apache.airavata.gfac.ssh.handler;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
index 0040de0..abedc8f 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
@@ -24,12 +24,12 @@ import java.util.Map;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
-import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
index 3d445e0..c2b7aa3 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
@@ -33,13 +33,13 @@ import org.apache.airavata.common.utils.StringUtil;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
-import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
index 84b41e9..902c09f 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
@@ -35,14 +35,14 @@ import org.apache.airavata.common.utils.Constants;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.ApplicationDescription;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
+import org.apache.airavata.gfac.core.utils.OutputUtils;
import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.gfac.provider.GFacProviderException;
import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
-import org.apache.airavata.gfac.utils.GFacUtils;
-import org.apache.airavata.gfac.utils.OutputUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
import org.apache.airavata.model.workspace.experiment.*;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
index b0fd9eb..fd6ce15 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
@@ -37,15 +37,15 @@ import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.Constants;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.notification.events.StartExecutionEvent;
+import org.apache.airavata.gfac.core.provider.AbstractProvider;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.gfac.notification.events.StartExecutionEvent;
-import org.apache.airavata.gfac.provider.AbstractProvider;
-import org.apache.airavata.gfac.provider.GFacProviderException;
import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
-import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.CommandExecutor;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
index 03f1770..0dcfbb7 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
@@ -28,8 +28,8 @@ import org.apache.airavata.commons.gfac.type.HostDescription;
import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.Constants;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
index 8c42869..7d83461 100644
--- a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
+++ b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
@@ -27,11 +27,11 @@ import org.apache.airavata.commons.gfac.type.ServiceDescription;
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.SecurityContext;
-import org.apache.airavata.gfac.context.ApplicationContext;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.ApplicationContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.cpi.GFacImpl;
import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
-import org.apache.airavata.gfac.cpi.GFacImpl;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.gsi.ssh.api.ServerInfo;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
index 74a79e0..574ad07 100644
--- a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
+++ b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
@@ -34,11 +34,11 @@ import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.commons.gfac.type.ServiceDescription;
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.ApplicationContext;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.ApplicationContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.cpi.GFacImpl;
import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
-import org.apache.airavata.gfac.cpi.GFacImpl;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
import org.apache.airavata.schemas.gfac.InputParameterType;
import org.apache.airavata.schemas.gfac.OutputParameterType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ssh/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/resources/gfac-config.xml b/modules/gfac/gfac-ssh/src/test/resources/gfac-config.xml
index 2388f64..1701dcc 100644
--- a/modules/gfac/gfac-ssh/src/test/resources/gfac-config.xml
+++ b/modules/gfac/gfac-ssh/src/test/resources/gfac-config.xml
@@ -13,7 +13,7 @@
<GFac>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/integration-tests/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/integration-tests/src/test/resources/gfac-config.xml b/modules/integration-tests/src/test/resources/gfac-config.xml
index 9ebee37..d7bb032 100644
--- a/modules/integration-tests/src/test/resources/gfac-config.xml
+++ b/modules/integration-tests/src/test/resources/gfac-config.xml
@@ -13,12 +13,12 @@
<GFac>
<DaemonHandlers>
<Handler class="org.apache.airavata.gfac.monitor.handlers.GridPullMonitorHandler">
- <property name="listeners" value="org.apache.airavata.gfac.monitor.AiravataJobStatusUpdator"/>
+ <property name="listeners" value="org.apache.airavata.gfac.core.monitor.AiravataJobStatusUpdator"/>
</Handler>
</DaemonHandlers>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gfac-config.xml b/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gfac-config.xml
index 9ebee37..d7bb032 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gfac-config.xml
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gfac-config.xml
@@ -13,12 +13,12 @@
<GFac>
<DaemonHandlers>
<Handler class="org.apache.airavata.gfac.monitor.handlers.GridPullMonitorHandler">
- <property name="listeners" value="org.apache.airavata.gfac.monitor.AiravataJobStatusUpdator"/>
+ <property name="listeners" value="org.apache.airavata.gfac.core.monitor.AiravataJobStatusUpdator"/>
</Handler>
</DaemonHandlers>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/orchestrator/airavata-orchestrator-service/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/gfac-config.xml b/modules/orchestrator/airavata-orchestrator-service/src/test/resources/gfac-config.xml
index 901f72e..47cad27 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/gfac-config.xml
+++ b/modules/orchestrator/airavata-orchestrator-service/src/test/resources/gfac-config.xml
@@ -13,7 +13,7 @@
<GFac>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
index 2c41ef7..cbc564d 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
@@ -22,9 +22,9 @@ package org.apache.airavata.orchestrator.core.impl;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.cpi.GFac;
-import org.apache.airavata.gfac.cpi.GFacImpl;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.cpi.GFac;
+import org.apache.airavata.gfac.core.cpi.GFacImpl;
import org.apache.airavata.orchestrator.core.context.OrchestratorContext;
import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
import org.apache.airavata.orchestrator.core.gfac.GFACInstance;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/job/JobSubmitter.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/job/JobSubmitter.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/job/JobSubmitter.java
index cf8642f..b1787a3 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/job/JobSubmitter.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/job/JobSubmitter.java
@@ -20,9 +20,7 @@
*/
package org.apache.airavata.orchestrator.core.job;
-import java.util.List;
-
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.orchestrator.core.context.OrchestratorContext;
import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
import org.apache.airavata.orchestrator.core.gfac.GFACInstance;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
index 91a6e47..e614a9e 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
@@ -25,7 +25,7 @@ import java.util.List;
import java.util.concurrent.ExecutorService;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.model.util.ExperimentModelUtil;
import org.apache.airavata.model.workspace.experiment.Experiment;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml b/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
index 9ebee37..d7bb032 100644
--- a/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
+++ b/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
@@ -13,12 +13,12 @@
<GFac>
<DaemonHandlers>
<Handler class="org.apache.airavata.gfac.monitor.handlers.GridPullMonitorHandler">
- <property name="listeners" value="org.apache.airavata.gfac.monitor.AiravataJobStatusUpdator"/>
+ <property name="listeners" value="org.apache.airavata.gfac.core.monitor.AiravataJobStatusUpdator"/>
</Handler>
</DaemonHandlers>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
[6/7] moving common monitoring classes to gfac-core
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java
new file mode 100644
index 0000000..ce31acd
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java
@@ -0,0 +1,87 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.handler;
+
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.gfac.Constants;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+
+public class AppDescriptorCheckHandler implements GFacHandler {
+ private static final Logger logger = LoggerFactory.getLogger(AppDescriptorCheckHandler.class);
+
+ public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
+ logger.info("Invoking ApplicationDescriptorCheckHandler ...");
+ ApplicationDescription app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
+ ApplicationDeploymentDescriptionType appDesc = app.getType();
+ if (appDesc.getScratchWorkingDirectory() == null) {
+ appDesc.setScratchWorkingDirectory("/tmp");
+ }
+
+ /*
+ * Working dir
+ */
+ if (appDesc.getStaticWorkingDirectory() == null || "null".equals(appDesc.getStaticWorkingDirectory())) {
+ String date = new Date().toString();
+ date = date.replaceAll(" ", "_");
+ date = date.replaceAll(":", "_");
+
+ String tmpDir = appDesc.getScratchWorkingDirectory() + File.separator
+ + jobExecutionContext.getServiceName() + "_" + date + "_" + UUID.randomUUID();
+
+ appDesc.setStaticWorkingDirectory(tmpDir);
+ }
+ //FIXME: Move this input/output to application descrpitor
+ /*
+ * Input and Output Directory
+ */
+ if (appDesc.getInputDataDirectory() == null || "".equals(appDesc.getInputDataDirectory())) {
+ appDesc.setInputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + Constants.INPUT_DATA_DIR_VAR_NAME);
+ }
+ if (appDesc.getOutputDataDirectory() == null || "".equals(appDesc.getOutputDataDirectory())) {
+ appDesc.setOutputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + Constants.OUTPUT_DATA_DIR_VAR_NAME);
+ }
+
+ /*
+ * Stdout and Stderr for Shell
+ */
+ if (appDesc.getStandardOutput() == null || "".equals(appDesc.getStandardOutput())) {
+ appDesc.setStandardOutput(appDesc.getStaticWorkingDirectory() + File.separator
+ + appDesc.getApplicationName().getStringValue() + ".stdout");
+ }
+ if (appDesc.getStandardError() == null || "".equals(appDesc.getStandardError())) {
+ appDesc.setStandardError(appDesc.getStaticWorkingDirectory() + File.separator
+ + appDesc.getApplicationName().getStringValue() + ".stderr");
+ }
+ jobExecutionContext.getApplicationContext().setApplicationDeploymentDescription(app);
+ }
+
+ public void initProperties(Map<String, String> properties) throws GFacHandlerException {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandler.java
new file mode 100644
index 0000000..0719f61
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandler.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.handler;
+
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+
+import java.util.Map;
+
+public interface GFacHandler {
+
+ public void initProperties(Map<String, String> properties) throws GFacHandlerException;
+
+ public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException;
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerConfig.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerConfig.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerConfig.java
new file mode 100644
index 0000000..d5fa418
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerConfig.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.handler;
+
+import java.util.Map;
+
+public class GFacHandlerConfig {
+
+ public GFacHandlerConfig(Map<String, String> properties, String className) {
+ this.properties = properties;
+ this.className = className;
+ }
+
+ private Map<String,String> properties;
+
+ private String className;
+
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerException.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerException.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerException.java
new file mode 100644
index 0000000..cb5439b
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerException.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.handler;
+
+import org.apache.airavata.gfac.GFacException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GFacHandlerException extends GFacException {
+ private static final Logger log = LoggerFactory.getLogger(GFacHandlerException.class);
+
+ public GFacHandlerException(String message) {
+ super(message, new Throwable(message));
+ log.error(message);
+ }
+
+ public GFacHandlerException(String s, Throwable throwable) {
+ super(s, throwable);
+ log.error(s,throwable);
+ }
+
+ public GFacHandlerException(String message, Exception e, String... additionExceptiondata) {
+ super(message, e);
+ log.error(message,e);
+ }
+ public GFacHandlerException(Exception e) {
+ super(e);
+ log.error(e.getMessage(),e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/ThreadedHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/ThreadedHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/ThreadedHandler.java
new file mode 100644
index 0000000..0dcf568
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/ThreadedHandler.java
@@ -0,0 +1,31 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.handler;
+
+/**
+ * This handler can be used to run in a separate thread in handler chain or as a daemon
+ * for the gfac instance you are running. If this is configured as another
+ * handler in the execution chain this will get invoked in asynchronous mode in a separate
+ * thread for each request, so you have to make sure the thread is returning properly.
+ */
+public abstract class ThreadedHandler extends AbstractHandler implements Runnable{
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AbstractActivityListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AbstractActivityListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AbstractActivityListener.java
new file mode 100644
index 0000000..d642154
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AbstractActivityListener.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.monitor;
+
+
+public interface AbstractActivityListener {
+ public void setup(Object... configurations);
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataExperimentStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataExperimentStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataExperimentStatusUpdator.java
new file mode 100644
index 0000000..f265503
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataExperimentStatusUpdator.java
@@ -0,0 +1,80 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.monitor;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.core.monitor.state.ExperimentStatusChangeRequest;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+
+public class AiravataExperimentStatusUpdator implements AbstractActivityListener {
+ private final static Logger logger = LoggerFactory.getLogger(AiravataExperimentStatusUpdator.class);
+
+ private Registry airavataRegistry;
+
+ public Registry getAiravataRegistry() {
+ return airavataRegistry;
+ }
+
+ public void setAiravataRegistry(Registry airavataRegistry) {
+ this.airavataRegistry = airavataRegistry;
+ }
+
+ @Subscribe
+ public void updateRegistry(ExperimentStatusChangeRequest experimentStatus) {
+ ExperimentState state = experimentStatus.getState();
+ if (state != null) {
+ try {
+ String experimentID = experimentStatus.getIdentity().getExperimentID();
+ updateExperimentStatus(experimentID, state);
+ } catch (Exception e) {
+ logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+ }
+ }
+ }
+
+ public void updateExperimentStatus(String experimentId, ExperimentState state) throws Exception {
+ Experiment details = (Experiment)airavataRegistry.get(DataType.EXPERIMENT, experimentId);
+ if(details == null) {
+ details = new Experiment();
+ details.setExperimentID(experimentId);
+ }
+ org.apache.airavata.model.workspace.experiment.ExperimentStatus status = new org.apache.airavata.model.workspace.experiment.ExperimentStatus();
+ status.setExperimentState(state);
+ status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+ details.setExperimentStatus(status);
+ airavataRegistry.update(DataType.EXPERIMENT, details, experimentId);
+ }
+
+ public void setup(Object... configurations) {
+ for (Object configuration : configurations) {
+ if (configuration instanceof Registry){
+ this.airavataRegistry=(Registry)configuration;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java
new file mode 100644
index 0000000..aaf7084
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java
@@ -0,0 +1,145 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.monitor;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.core.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.core.monitor.state.TaskStatusChangeRequest;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
+import org.apache.airavata.model.workspace.experiment.JobDetails;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.apache.airavata.model.workspace.experiment.TaskState;
+import org.apache.airavata.registry.cpi.CompositeIdentifier;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+import java.util.concurrent.BlockingQueue;
+
+public class AiravataJobStatusUpdator implements AbstractActivityListener {
+ private final static Logger logger = LoggerFactory.getLogger(AiravataJobStatusUpdator.class);
+
+ private Registry airavataRegistry;
+
+ private MonitorPublisher monitorPublisher;
+
+ private BlockingQueue<MonitorID> jobsToMonitor;
+
+
+ public Registry getAiravataRegistry() {
+ return airavataRegistry;
+ }
+
+ public void setAiravataRegistry(Registry airavataRegistry) {
+ this.airavataRegistry = airavataRegistry;
+ }
+
+ public BlockingQueue<MonitorID> getJobsToMonitor() {
+ return jobsToMonitor;
+ }
+
+ public void setJobsToMonitor(BlockingQueue<MonitorID> jobsToMonitor) {
+ this.jobsToMonitor = jobsToMonitor;
+ }
+
+ @Subscribe
+ public void updateRegistry(JobStatusChangeRequest jobStatus) {
+ /* Here we need to parse the jobStatus message and update
+ the registry accordingly, for now we are just printing to standard Out
+ */
+ JobState state = jobStatus.getState();
+ if (state != null) {
+ try {
+ String taskID = jobStatus.getIdentity().getTaskId();
+ String jobID = jobStatus.getIdentity().getJobId();
+ updateJobStatus(taskID, jobID, state);
+ } catch (Exception e) {
+ logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+ }
+ logger.info("Job ID:" + jobStatus.getIdentity().getJobId() + " is "+state.toString());
+ switch (state) {
+ case COMPLETE: case UNKNOWN: case CANCELED:case FAILED:case SUSPENDED:
+ jobsToMonitor.remove(jobStatus.getMonitorID());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ @Subscribe
+ public void setupTaskStatus(JobStatusChangeRequest jobStatus){
+ TaskState state=TaskState.UNKNOWN;
+ switch(jobStatus.getState()){
+ case ACTIVE:
+ state=TaskState.EXECUTING; break;
+ case CANCELED:
+ state=TaskState.CANCELED; break;
+ case COMPLETE:
+ state=TaskState.COMPLETED; break;
+ case FAILED:
+ state=TaskState.FAILED; break;
+ case HELD: case SUSPENDED: case QUEUED:
+ state=TaskState.WAITING; break;
+ case SETUP:
+ state=TaskState.PRE_PROCESSING; break;
+ case SUBMITTED:
+ state=TaskState.STARTED; break;
+ case UN_SUBMITTED:
+ state=TaskState.CANCELED; break;
+ case CANCELING:
+ state=TaskState.CANCELING; break;
+ default:
+ break;
+ }
+ logger.debug("Publishing Task Status "+state.toString());
+ monitorPublisher.publish(new TaskStatusChangeRequest(jobStatus.getIdentity(),state));
+ }
+
+ public void updateJobStatus(String taskId, String jobID, JobState state) throws Exception {
+ CompositeIdentifier ids = new CompositeIdentifier(taskId, jobID);
+ JobDetails details = (JobDetails)airavataRegistry.get(DataType.JOB_DETAIL, ids);
+ if(details == null) {
+ details = new JobDetails();
+ }
+ org.apache.airavata.model.workspace.experiment.JobStatus status = new org.apache.airavata.model.workspace.experiment.JobStatus();
+ status.setJobState(state);
+ status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+ details.setJobStatus(status);
+ details.setJobID(jobID);
+ airavataRegistry.update(DataType.JOB_DETAIL, details, ids);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void setup(Object... configurations) {
+ for (Object configuration : configurations) {
+ if (configuration instanceof Registry){
+ this.airavataRegistry=(Registry)configuration;
+ } else if (configuration instanceof BlockingQueue<?>){
+ this.jobsToMonitor=(BlockingQueue<MonitorID>) configuration;
+ } else if (configuration instanceof MonitorPublisher){
+ this.monitorPublisher=(MonitorPublisher) configuration;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java
new file mode 100644
index 0000000..8a57571
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java
@@ -0,0 +1,112 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.monitor;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.core.monitor.state.TaskStatusChangeRequest;
+import org.apache.airavata.gfac.core.monitor.state.WorkflowNodeStatusChangeRequest;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
+import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.airavata.model.workspace.experiment.TaskState;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+
+public class AiravataTaskStatusUpdator implements AbstractActivityListener {
+ private final static Logger logger = LoggerFactory.getLogger(AiravataTaskStatusUpdator.class);
+
+ private Registry airavataRegistry;
+
+ private MonitorPublisher monitorPublisher;
+
+ public Registry getAiravataRegistry() {
+ return airavataRegistry;
+ }
+
+ public void setAiravataRegistry(Registry airavataRegistry) {
+ this.airavataRegistry = airavataRegistry;
+ }
+
+ @Subscribe
+ public void updateRegistry(TaskStatusChangeRequest taskStatus) {
+ TaskState state = taskStatus.getState();
+ if (state != null) {
+ try {
+ String taskID = taskStatus.getIdentity().getTaskId();
+ updateTaskStatus(taskID, state);
+ } catch (Exception e) {
+ logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+ }
+ }
+ }
+
+ @Subscribe
+ public void setupWorkflowNodeStatus(TaskStatusChangeRequest taskStatus){
+ WorkflowNodeState state=WorkflowNodeState.UNKNOWN;
+ switch(taskStatus.getState()){
+ case CANCELED:
+ state=WorkflowNodeState.CANCELED; break;
+ case COMPLETED:
+ state=WorkflowNodeState.COMPLETED; break;
+ case CONFIGURING_WORKSPACE:
+ state=WorkflowNodeState.INVOKED; break;
+ case FAILED:
+ state=WorkflowNodeState.FAILED; break;
+ case EXECUTING: case WAITING: case PRE_PROCESSING: case POST_PROCESSING: case OUTPUT_DATA_STAGING: case INPUT_DATA_STAGING:
+ state=WorkflowNodeState.EXECUTING; break;
+ case STARTED:
+ state=WorkflowNodeState.INVOKED; break;
+ case CANCELING:
+ state=WorkflowNodeState.CANCELING; break;
+ default:
+ break;
+ }
+ logger.debug("Publishing Experiment Status "+state.toString());
+ monitorPublisher.publish(new WorkflowNodeStatusChangeRequest(taskStatus.getIdentity(),state));
+ }
+
+ public void updateTaskStatus(String taskId, TaskState state) throws Exception {
+ TaskDetails details = (TaskDetails)airavataRegistry.get(DataType.TASK_DETAIL, taskId);
+ if(details == null) {
+ details = new TaskDetails();
+ details.setTaskID(taskId);
+ }
+ org.apache.airavata.model.workspace.experiment.TaskStatus status = new org.apache.airavata.model.workspace.experiment.TaskStatus();
+ status.setExecutionState(state);
+ status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+ details.setTaskStatus(status);
+ airavataRegistry.update(DataType.TASK_DETAIL, details, taskId);
+ }
+
+ public void setup(Object... configurations) {
+ for (Object configuration : configurations) {
+ if (configuration instanceof Registry){
+ this.airavataRegistry=(Registry)configuration;
+ } else if (configuration instanceof MonitorPublisher){
+ this.monitorPublisher=(MonitorPublisher) configuration;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
new file mode 100644
index 0000000..66e7ecc
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
@@ -0,0 +1,111 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.monitor;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.core.monitor.state.ExperimentStatusChangeRequest;
+import org.apache.airavata.gfac.core.monitor.state.WorkflowNodeStatusChangeRequest;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+
+public class AiravataWorkflowNodeStatusUpdator implements AbstractActivityListener {
+ private final static Logger logger = LoggerFactory.getLogger(AiravataWorkflowNodeStatusUpdator.class);
+
+ private Registry airavataRegistry;
+
+ private MonitorPublisher monitorPublisher;
+
+ public Registry getAiravataRegistry() {
+ return airavataRegistry;
+ }
+
+ public void setAiravataRegistry(Registry airavataRegistry) {
+ this.airavataRegistry = airavataRegistry;
+ }
+
+ @Subscribe
+ public void updateRegistry(WorkflowNodeStatusChangeRequest workflowNodeStatus) {
+ WorkflowNodeState state = workflowNodeStatus.getState();
+ if (state != null) {
+ try {
+ String workflowNodeID = workflowNodeStatus.getIdentity().getWorkflowNodeID();
+ updateWorkflowNodeStatus(workflowNodeID, state);
+ } catch (Exception e) {
+ logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+ }
+ }
+ }
+
+ @Subscribe
+ public void setupExperimentStatus(WorkflowNodeStatusChangeRequest nodeStatus){
+ ExperimentState state=ExperimentState.UNKNOWN;
+ switch(nodeStatus.getState()){
+ case CANCELED:
+ state=ExperimentState.CANCELED; break;
+ case COMPLETED:
+ state=ExperimentState.COMPLETED; break;
+ case INVOKED:
+ state=ExperimentState.LAUNCHED; break;
+ case FAILED:
+ state=ExperimentState.FAILED; break;
+ case EXECUTING:
+ state=ExperimentState.EXECUTING; break;
+ case CANCELING:
+ state=ExperimentState.CANCELING; break;
+ default:
+ break;
+ }
+ logger.debug("Publishing Experiment Status "+state.toString());
+ monitorPublisher.publish(new ExperimentStatusChangeRequest(nodeStatus.getIdentity(),state));
+ }
+
+ public void updateWorkflowNodeStatus(String workflowNodeId, WorkflowNodeState state) throws Exception {
+ WorkflowNodeDetails details = (WorkflowNodeDetails)airavataRegistry.get(DataType.WORKFLOW_NODE_DETAIL, workflowNodeId);
+ if(details == null) {
+ details = new WorkflowNodeDetails();
+ details.setNodeInstanceId(workflowNodeId);
+ }
+ WorkflowNodeStatus status = new WorkflowNodeStatus();
+ status.setWorkflowNodeState(state);
+ status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+ details.setWorkflowNodeStatus(status);
+ airavataRegistry.update(DataType.WORKFLOW_NODE_DETAIL, details, workflowNodeId);
+ }
+
+ public void setup(Object... configurations) {
+ for (Object configuration : configurations) {
+ if (configuration instanceof Registry){
+ this.airavataRegistry=(Registry)configuration;
+ } else if (configuration instanceof MonitorPublisher){
+ this.monitorPublisher=(MonitorPublisher) configuration;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java
new file mode 100644
index 0000000..5993101
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java
@@ -0,0 +1,36 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.monitor;
+
+public class ExperimentIdentity {
+ private String experimentID;
+ public ExperimentIdentity(String experimentId) {
+ setExperimentID(experimentId);
+ }
+ public String getExperimentID() {
+ return experimentID;
+ }
+
+ public void setExperimentID(String experimentID) {
+ this.experimentID = experimentID;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.java
new file mode 100644
index 0000000..cea7fa7
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.monitor;
+
+public class JobIdentity extends TaskIdentity {
+ private String jobId;
+
+ public JobIdentity(String experimentId, String workflowNodeId, String taskId, String jobId) {
+ super(experimentId,workflowNodeId,taskId);
+ setJobId(jobId);
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
new file mode 100644
index 0000000..beb1f93
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
@@ -0,0 +1,213 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.monitor;
+
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.Map;
+
+/*
+This is the object which contains the data to identify a particular
+Job to start the monitoring
+*/
+public class MonitorID {
+ private final static Logger logger = LoggerFactory.getLogger(MonitorID.class);
+
+ private String userName;
+
+ private Timestamp jobStartedTime;
+
+ private Timestamp lastMonitored;
+
+ private HostDescription host;
+
+ private Map<String, Object> parameters;
+
+ private String experimentID;
+
+ private String workflowNodeID;
+
+ private String taskID;
+
+ private String jobID;
+
+ private int failedCount = 0;
+
+ private JobState state;
+
+ private JobExecutionContext jobExecutionContext;
+
+ public MonitorID() {
+ }
+
+ public MonitorID(HostDescription host, String jobID,String taskID, String workflowNodeID, String experimentID, String userName) {
+ this.host = host;
+ this.jobStartedTime = new Timestamp((new Date()).getTime());
+ this.userName = userName;
+ this.jobID = jobID;
+ this.taskID = taskID;
+ this.experimentID = experimentID;
+ this.workflowNodeID = workflowNodeID;
+ }
+
+ public HostDescription getHost() {
+ return host;
+ }
+
+ public void setHost(HostDescription host) {
+ this.host = host;
+ }
+
+ public Timestamp getLastMonitored() {
+ return lastMonitored;
+ }
+
+ public void setLastMonitored(Timestamp lastMonitored) {
+ this.lastMonitored = lastMonitored;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getJobID() {
+ return jobID;
+ }
+
+ public void setJobID(String jobID) {
+ this.jobID = jobID;
+ }
+
+ public Timestamp getJobStartedTime() {
+ return jobStartedTime;
+ }
+
+ public void setJobStartedTime(Timestamp jobStartedTime) {
+ this.jobStartedTime = jobStartedTime;
+ }
+
+ public void addParameter(String key,Object value) {
+ this.parameters.put(key, value);
+ }
+
+ public Object getParameter(String key) {
+ return this.parameters.get(key);
+ }
+
+ public Map<String, Object> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map<String, Object> parameters) {
+ this.parameters = parameters;
+ }
+
+ public String getExperimentID() {
+ return experimentID;
+ }
+
+ public void setExperimentID(String experimentID) {
+ this.experimentID = experimentID;
+ }
+
+ public String getTaskID() {
+ return taskID;
+ }
+
+ public void setTaskID(String taskID) {
+ this.taskID = taskID;
+ }
+
+ public int getFailedCount() {
+ return failedCount;
+ }
+
+ public void setFailedCount(int failedCount) {
+ this.failedCount = failedCount;
+ }
+
+ public JobState getStatus() {
+ return state;
+ }
+
+ public void setStatus(JobState status) {
+ // this logic is going to be useful for fast finishing jobs
+ // because in some machines job state vanishes quicckly when the job is done
+ // during that case job state comes as unknown.so we handle it here.
+ if (this.state != null && status.equals(JobState.UNKNOWN)) {
+ if (getFailedCount() > 2) {
+ switch (this.state) {
+ case ACTIVE:
+ this.state = JobState.COMPLETE;
+ break;
+ case QUEUED:
+ this.state = JobState.COMPLETE;
+ break;
+ }
+ } else {
+ try {
+ // when state becomes unknown we sleep for a while
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ setFailedCount(getFailedCount() + 1);
+ }
+ } else {
+ // normal scenario
+ this.state = status;
+ }
+ }
+
+ public String getWorkflowNodeID() {
+ return workflowNodeID;
+ }
+
+ public void setWorkflowNodeID(String workflowNodeID) {
+ this.workflowNodeID = workflowNodeID;
+ }
+
+ public JobExecutionContext getJobExecutionContext() {
+ return jobExecutionContext;
+ }
+
+ public void setJobExecutionContext(JobExecutionContext jobExecutionContext) {
+ this.jobExecutionContext = jobExecutionContext;
+ }
+
+ // public String getWorkflowNodeID() {
+// return workflowNodeID;
+// }
+//
+// public void setWorkflowNodeID(String workflowNodeID) {
+// this.workflowNodeID = workflowNodeID;
+// }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.java
new file mode 100644
index 0000000..2f2d6c5
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.java
@@ -0,0 +1,38 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.monitor;
+
+public class TaskIdentity extends WorkflowNodeIdentity {
+ private String taskId;
+
+ public TaskIdentity(String experimentId, String workflowNodeId, String taskId) {
+ super(experimentId,workflowNodeId);
+ setTaskId(taskId);
+ }
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.java
new file mode 100644
index 0000000..71a8f14
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.monitor;
+
+public class WorkflowNodeIdentity extends ExperimentIdentity {
+ private String workflowNodeID;
+ public WorkflowNodeIdentity(String experimentId, String workflowNodeId) {
+ super(experimentId);
+ setWorkflowNodeID(workflowNodeId);
+ }
+ public String getWorkflowNodeID() {
+ return workflowNodeID;
+ }
+
+ public void setWorkflowNodeID(String workflowNodeID) {
+ this.workflowNodeID = workflowNodeID;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/AbstractStateChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/AbstractStateChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/AbstractStateChangeRequest.java
new file mode 100644
index 0000000..7db9e4b
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/AbstractStateChangeRequest.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.monitor.state;
+
+
+public abstract class AbstractStateChangeRequest implements PublisherMessage {
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/ExperimentStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/ExperimentStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/ExperimentStatusChangeRequest.java
new file mode 100644
index 0000000..a8bc6b4
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/ExperimentStatusChangeRequest.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.monitor.state;
+
+import org.apache.airavata.gfac.core.monitor.ExperimentIdentity;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+
+/**
+ * This is the primary job state object used in
+ * through out the monitor module. This use airavata-data-model JobState enum
+ * Ideally after processing each event or monitoring message from remote system
+ * Each monitoring implementation has to return this object with a state and
+ * the monitoring ID
+ */
+public class ExperimentStatusChangeRequest extends AbstractStateChangeRequest {
+ private ExperimentState state;
+ private ExperimentIdentity identity;
+
+ // this constructor can be used in Qstat monitor to handle errors
+ public ExperimentStatusChangeRequest() {
+ }
+
+ public ExperimentStatusChangeRequest(ExperimentIdentity experimentIdentity, ExperimentState state) {
+ this.state = state;
+ setIdentity(experimentIdentity);
+ }
+
+ public ExperimentState getState() {
+ return state;
+ }
+
+ public void setState(ExperimentState state) {
+ this.state = state;
+ }
+
+ public ExperimentIdentity getIdentity() {
+ return identity;
+ }
+
+ public void setIdentity(ExperimentIdentity identity) {
+ this.identity = identity;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java
new file mode 100644
index 0000000..8b308ac
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java
@@ -0,0 +1,80 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.monitor.state;
+
+import org.apache.airavata.gfac.core.monitor.JobIdentity;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.model.workspace.experiment.JobState;
+
+/**
+ * This is the primary job state object used in
+ * through out the monitor module. This use airavata-data-model JobState enum
+ * Ideally after processing each event or monitoring message from remote system
+ * Each monitoring implementation has to return this object with a state and
+ * the monitoring ID
+ */
+public class JobStatusChangeRequest extends AbstractStateChangeRequest {
+ private JobState state;
+ private JobIdentity identity;
+
+ private MonitorID monitorID;
+
+ // this constructor can be used in Qstat monitor to handle errors
+ public JobStatusChangeRequest() {
+ }
+
+ public JobStatusChangeRequest(MonitorID monitorID) {
+ setIdentity(new JobIdentity(monitorID.getExperimentID(),monitorID.getWorkflowNodeID(),
+ monitorID.getTaskID(),monitorID.getJobID()));
+ setMonitorID(monitorID);
+ this.state = monitorID.getStatus();
+ }
+ public JobStatusChangeRequest(MonitorID monitorID, JobIdentity jobId, JobState state) {
+ setIdentity(jobId);
+ setMonitorID(monitorID);
+ this.state = state;
+ }
+
+ public JobState getState() {
+ return state;
+ }
+
+ public void setState(JobState state) {
+ this.state = state;
+ }
+
+ public JobIdentity getIdentity() {
+ return identity;
+ }
+
+ public void setIdentity(JobIdentity identity) {
+ this.identity = identity;
+ }
+
+ public MonitorID getMonitorID() {
+ return monitorID;
+ }
+
+ public void setMonitorID(MonitorID monitorID) {
+ this.monitorID = monitorID;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/PublisherMessage.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/PublisherMessage.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/PublisherMessage.java
new file mode 100644
index 0000000..08294f8
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/PublisherMessage.java
@@ -0,0 +1,26 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.monitor.state;
+
+public interface PublisherMessage {
+// public String getType();
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/TaskStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/TaskStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/TaskStatusChangeRequest.java
new file mode 100644
index 0000000..ec34cc9
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/TaskStatusChangeRequest.java
@@ -0,0 +1,61 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.monitor.state;
+
+import org.apache.airavata.gfac.core.monitor.TaskIdentity;
+import org.apache.airavata.model.workspace.experiment.TaskState;
+
+/**
+ * This is the primary job state object used in
+ * through out the monitor module. This use airavata-data-model JobState enum
+ * Ideally after processing each event or monitoring message from remote system
+ * Each monitoring implementation has to return this object with a state and
+ * the monitoring ID
+ */
+public class TaskStatusChangeRequest extends AbstractStateChangeRequest {
+ private TaskState state;
+ private TaskIdentity identity;
+ // this constructor can be used in Qstat monitor to handle errors
+ public TaskStatusChangeRequest() {
+ }
+
+ public TaskStatusChangeRequest(TaskIdentity taskIdentity, TaskState state) {
+ this.state = state;
+ setIdentity(taskIdentity);
+ }
+
+ public TaskState getState() {
+ return state;
+ }
+
+ public void setState(TaskState state) {
+ this.state = state;
+ }
+
+ public TaskIdentity getIdentity() {
+ return identity;
+ }
+
+ public void setIdentity(TaskIdentity identity) {
+ this.identity = identity;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/WorkflowNodeStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/WorkflowNodeStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/WorkflowNodeStatusChangeRequest.java
new file mode 100644
index 0000000..9e52dd4
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/WorkflowNodeStatusChangeRequest.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.monitor.state;
+
+import org.apache.airavata.gfac.core.monitor.WorkflowNodeIdentity;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
+
+/**
+ * This is the primary job state object used in
+ * through out the monitor module. This use airavata-data-model JobState enum
+ * Ideally after processing each event or monitoring message from remote system
+ * Each monitoring implementation has to return this object with a state and
+ * the monitoring ID
+ */
+public class WorkflowNodeStatusChangeRequest extends AbstractStateChangeRequest {
+ private WorkflowNodeState state;
+ private WorkflowNodeIdentity identity;
+
+ // this constructor can be used in Qstat monitor to handle errors
+ public WorkflowNodeStatusChangeRequest() {
+ }
+
+ public WorkflowNodeStatusChangeRequest(WorkflowNodeIdentity identity, WorkflowNodeState state) {
+ this.state = state;
+ setIdentity(identity);
+ }
+
+ public WorkflowNodeState getState() {
+ return state;
+ }
+
+ public void setState(WorkflowNodeState state) {
+ this.state = state;
+ }
+
+ public WorkflowNodeIdentity getIdentity() {
+ return identity;
+ }
+
+ public void setIdentity(WorkflowNodeIdentity identity) {
+ this.identity = identity;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/GFacNotifier.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/GFacNotifier.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/GFacNotifier.java
new file mode 100644
index 0000000..40ffdcc
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/GFacNotifier.java
@@ -0,0 +1,42 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.notification;
+
+import com.google.common.eventbus.EventBus;
+import org.apache.airavata.gfac.core.notification.events.GFacEvent;
+
+public class GFacNotifier {
+ private EventBus eventBus;
+
+ public GFacNotifier(){
+ eventBus = new EventBus();
+ }
+
+ public void registerListener(Object listener){
+ eventBus.register(listener);
+ }
+
+ public void publish(GFacEvent event){
+ eventBus.post(event);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/MonitorPublisher.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/MonitorPublisher.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/MonitorPublisher.java
new file mode 100644
index 0000000..e44974b
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/MonitorPublisher.java
@@ -0,0 +1,47 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.notification;
+
+import com.google.common.eventbus.EventBus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MonitorPublisher{
+ private final static Logger logger = LoggerFactory.getLogger(MonitorPublisher.class);
+ private EventBus eventBus;
+
+ public MonitorPublisher(EventBus eventBus) {
+ this.eventBus = eventBus;
+ }
+
+ public void registerListener(Object listener) {
+ eventBus.register(listener);
+ }
+
+ public void unregisterListener(Object listener) {
+ eventBus.unregister(listener);
+ }
+
+ public void publish(Object o) {
+ eventBus.post(o);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/ExecutionFailEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/ExecutionFailEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/ExecutionFailEvent.java
new file mode 100644
index 0000000..a7fd986
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/ExecutionFailEvent.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.notification.events;
+
+public class ExecutionFailEvent extends GFacEvent {
+ private Throwable cause;
+
+ public ExecutionFailEvent(Throwable cause){
+ this.eventType = ExecutionFailEvent.class.getSimpleName();
+ this.cause = cause;
+ }
+
+ public Throwable getCauseForFailure(){
+ return cause;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishExecutionEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishExecutionEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishExecutionEvent.java
new file mode 100644
index 0000000..426b182
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishExecutionEvent.java
@@ -0,0 +1,29 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.notification.events;
+
+public class FinishExecutionEvent extends GFacEvent{
+
+ public FinishExecutionEvent(){
+ this.eventType = FinishExecutionEvent.class.getSimpleName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishScheduleEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishScheduleEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishScheduleEvent.java
new file mode 100644
index 0000000..5924aba
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishScheduleEvent.java
@@ -0,0 +1,29 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.notification.events;
+
+public class FinishScheduleEvent extends GFacEvent {
+
+ public FinishScheduleEvent(){
+ this.eventType = FinishScheduleEvent.class.getSimpleName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/GFacEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/GFacEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/GFacEvent.java
new file mode 100644
index 0000000..5b49730
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/GFacEvent.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.notification.events;
+
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+
+public abstract class GFacEvent {
+
+ protected JobExecutionContext executionContext;
+
+ protected String eventType;
+
+ public JobExecutionContext getJobExecutionContext(){
+ return executionContext;
+ }
+
+ public String getEventType(){
+ return eventType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/JobIDEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/JobIDEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/JobIDEvent.java
new file mode 100644
index 0000000..4f13391
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/JobIDEvent.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.notification.events;
+
+public class JobIDEvent extends GFacEvent {
+ String statusMessage;
+
+ public JobIDEvent(String message) {
+ statusMessage = message;
+ this.eventType = JobIDEvent.class.getSimpleName();
+ }
+
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartExecutionEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartExecutionEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartExecutionEvent.java
new file mode 100644
index 0000000..5ab65c1
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartExecutionEvent.java
@@ -0,0 +1,29 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.notification.events;
+
+public class StartExecutionEvent extends GFacEvent {
+
+ public StartExecutionEvent(){
+ this.eventType = StartExecutionEvent.class.getSimpleName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartScheduleEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartScheduleEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartScheduleEvent.java
new file mode 100644
index 0000000..7abdb22
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartScheduleEvent.java
@@ -0,0 +1,29 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.notification.events;
+
+public class StartScheduleEvent extends GFacEvent {
+
+ public StartScheduleEvent(){
+ this.eventType = StartScheduleEvent.class.getSimpleName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StatusChangeEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StatusChangeEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StatusChangeEvent.java
new file mode 100644
index 0000000..b5f964f
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StatusChangeEvent.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.notification.events;
+
+public class StatusChangeEvent extends GFacEvent {
+ String statusMessage;
+ public StatusChangeEvent(String message){
+ statusMessage = message;
+ this.eventType = StatusChangeEvent.class.getSimpleName();
+ }
+
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/UnicoreJobIDEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/UnicoreJobIDEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/UnicoreJobIDEvent.java
new file mode 100644
index 0000000..98dddaf
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/UnicoreJobIDEvent.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.notification.events;
+
+public class UnicoreJobIDEvent extends GFacEvent {
+ String statusMessage;
+
+ public UnicoreJobIDEvent(String message) {
+ statusMessage = message;
+ this.eventType = UnicoreJobIDEvent.class.getSimpleName();
+ }
+
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/LoggingListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/LoggingListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/LoggingListener.java
new file mode 100644
index 0000000..809b9d5
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/LoggingListener.java
@@ -0,0 +1,57 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.notification.listeners;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.core.notification.events.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LoggingListener {
+ private static Logger log = LoggerFactory.getLogger("gfac-logginglistener");
+
+ @Subscribe
+ public void logGFacEvent(GFacEvent e){
+ log.info("GFac event of type " + e.getEventType() + " received.");
+ }
+
+ @Subscribe
+ public void logExecutionFail(ExecutionFailEvent e){
+ log.error("Execution failed." + e.getEventType());
+ }
+
+ @Subscribe
+ public void logFinishExecutionEvent(FinishExecutionEvent event){
+ log.info("Execution has Finished ...");
+ }
+
+ @Subscribe
+ public void logStartExecutionEvent(StartExecutionEvent event){
+ log.info("Execution has started ...");
+ }
+
+ @Subscribe
+ public void logStatusChangeEvent(StatusChangeEvent event){
+ log.info("Job status has changed ...");
+ log.info(event.getStatusMessage());
+ }
+}
[3/7] moving common monitoring classes to gfac-core
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
deleted file mode 100644
index c8113e5..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
+++ /dev/null
@@ -1,662 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.utils;
-
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.net.URISyntaxException;
-import java.net.UnknownHostException;
-import java.util.*;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.commons.gfac.type.ActualParameter;
-import org.apache.airavata.gfac.Constants;
-import org.apache.airavata.gfac.ExecutionMode;
-import org.apache.airavata.gfac.GFacConfiguration;
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.registry.api.workflow.ApplicationJob;
-import org.apache.airavata.registry.api.workflow.ApplicationJob.ApplicationJobStatus;
-import org.apache.airavata.registry.cpi.ChildDataType;
-import org.apache.airavata.registry.cpi.CompositeIdentifier;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.airavata.schemas.gfac.*;
-import org.apache.axiom.om.OMElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GFacUtils {
- private final static Logger log = LoggerFactory.getLogger(GFacUtils.class);
-
- private GFacUtils() {
- }
-
- /**
- * Read data from inputStream and convert it to String.
- *
- * @param in
- * @return String read from inputStream
- * @throws java.io.IOException
- */
- public static String readFromStream(InputStream in) throws IOException {
- try {
- StringBuffer wsdlStr = new StringBuffer();
-
- int read;
-
- byte[] buf = new byte[1024];
- while ((read = in.read(buf)) > 0) {
- wsdlStr.append(new String(buf, 0, read));
- }
- return wsdlStr.toString();
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- log.warn("Cannot close InputStream: " + in.getClass().getName(), e);
- }
- }
- }
- }
-
- /**
- * this can be used to do framework opertaions specific to different modes
- * @param jobExecutionContext
- * @return
- */
- public static boolean isSynchronousMode(JobExecutionContext jobExecutionContext){
- GFacConfiguration gFacConfiguration = jobExecutionContext.getGFacConfiguration();
- if(ExecutionMode.ASYNCHRONOUS.equals(gFacConfiguration.getExecutionMode())){
- return false;
- }
- return true;
- }
- public static String readFileToString(String file) throws FileNotFoundException, IOException {
- BufferedReader instream = null;
- try {
-
- instream = new BufferedReader(new FileReader(file));
- StringBuffer buff = new StringBuffer();
- String temp = null;
- while ((temp = instream.readLine()) != null) {
- buff.append(temp);
- buff.append(Constants.NEWLINE);
- }
- return buff.toString();
- } finally {
- if (instream != null) {
- try {
- instream.close();
- } catch (IOException e) {
- log.warn("Cannot close FileinputStream", e);
- }
- }
- }
- }
-
- public static boolean isLocalHost(String appHost) throws UnknownHostException {
- String localHost = InetAddress.getLocalHost().getCanonicalHostName();
- return (localHost.equals(appHost) || Constants.LOCALHOST.equals(appHost) || Constants._127_0_0_1
- .equals(appHost));
- }
-
- public static String createUniqueNameForService(String serviceName) {
- String date = new Date().toString();
- date = date.replaceAll(" ", "_");
- date = date.replaceAll(":", "_");
- return serviceName + "_" + date + "_" + UUID.randomUUID();
- }
-
-
-
-
-
- public static String createGsiftpURIAsString(String host, String localPath) throws URISyntaxException {
- StringBuffer buf = new StringBuffer();
- if (!host.startsWith("gsiftp://"))
- buf.append("gsiftp://");
- buf.append(host);
- if (!host.endsWith("/"))
- buf.append("/");
- buf.append(localPath);
- return buf.toString();
- }
-
- public static ActualParameter getInputActualParameter(Parameter parameter, DataObjectType element) {
- ActualParameter actualParameter = new ActualParameter();
- if ("String".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(StringParameterType.type);
- if (!"".equals(element.getValue())) {
- ((StringParameterType) actualParameter.getType()).setValue(element.getValue());
- } else {
- ((StringParameterType) actualParameter.getType()).setValue("");
- }
- } else if ("Double".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(DoubleParameterType.type);
- if (!"".equals(element.getValue())) {
- ((DoubleParameterType) actualParameter.getType()).setValue(new Double(element.getValue()));
- }
- } else if ("Integer".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(IntegerParameterType.type);
- if (!"".equals(element.getValue())) {
- ((IntegerParameterType) actualParameter.getType()).setValue(new Integer(element.getValue()));
- }
- } else if ("Float".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(FloatParameterType.type);
- if (!"".equals(element.getValue())) {
- ((FloatParameterType) actualParameter.getType()).setValue(new Float(element.getValue()));
- }
- } else if ("Boolean".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(BooleanParameterType.type);
- if (!"".equals(element.getValue())) {
- ((BooleanParameterType) actualParameter.getType()).setValue(new Boolean(element.getValue()));
- }
- } else if ("File".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(FileParameterType.type);
- if (!"".equals(element.getValue())) {
- ((FileParameterType) actualParameter.getType()).setValue(element.getValue());
- }
- } else if ("URI".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(URIParameterType.type);
- if (!"".equals(element.getValue())) {
- ((URIParameterType) actualParameter.getType()).setValue(element.getValue());
- } else {
- ((URIParameterType) actualParameter.getType()).setValue("");
- }
-
- } else if ("StdOut".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(StdOutParameterType.type);
- if (!"".equals(element.getValue())) {
- ((StdOutParameterType) actualParameter.getType()).setValue(element.getValue());
- } else {
- ((StdOutParameterType) actualParameter.getType()).setValue("");
- }
-
- }
- else if ("StdErr".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(StdErrParameterType.type);
- if (!"".equals(element.getValue())) {
- ((StdErrParameterType) actualParameter.getType()).setValue(element.getValue());
- } else {
- ((StdErrParameterType) actualParameter.getType()).setValue("");
- }
-
- }
- return actualParameter;
- }
- public static ActualParameter getInputActualParameter(Parameter parameter, OMElement element) {
- OMElement innerelement = null;
- ActualParameter actualParameter = new ActualParameter();
- if ("String".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(StringParameterType.type);
- if (!"".equals(element.getText())) {
- ((StringParameterType) actualParameter.getType()).setValue(element.getText());
- } else if (element.getChildrenWithLocalName("value").hasNext()) {
- innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
- ((StringParameterType) actualParameter.getType()).setValue(innerelement.getText());
- } else {
- ((StringParameterType) actualParameter.getType()).setValue("");
- }
- } else if ("Double".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(DoubleParameterType.type);
- if (!"".equals(element.getText())) {
- ((DoubleParameterType) actualParameter.getType()).setValue(new Double(innerelement.getText()));
- } else {
- innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
- ((DoubleParameterType) actualParameter.getType()).setValue(new Double(innerelement.getText()));
- }
- } else if ("Integer".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(IntegerParameterType.type);
- if (!"".equals(element.getText())) {
- ((IntegerParameterType) actualParameter.getType()).setValue(new Integer(element.getText()));
- } else {
- innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
- ((IntegerParameterType) actualParameter.getType()).setValue(new Integer(innerelement.getText()));
- }
- } else if ("Float".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(FloatParameterType.type);
- if (!"".equals(element.getText())) {
- ((FloatParameterType) actualParameter.getType()).setValue(new Float(element.getText()));
- } else {
- innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
- ((FloatParameterType) actualParameter.getType()).setValue(new Float(innerelement.getText()));
- }
- } else if ("Boolean".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(BooleanParameterType.type);
- if (!"".equals(element.getText())) {
- ((BooleanParameterType) actualParameter.getType()).setValue(new Boolean(element.getText()));
- } else {
- innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
- ((BooleanParameterType) actualParameter.getType()).setValue(Boolean.parseBoolean(innerelement.getText()));
- }
- } else if ("File".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(FileParameterType.type);
- if (!"".equals(element.getText())) {
- ((FileParameterType) actualParameter.getType()).setValue(element.getText());
- } else {
- innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
- ((FileParameterType) actualParameter.getType()).setValue(innerelement.getText());
- }
- } else if ("URI".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(URIParameterType.type);
- if (!"".equals(element.getText())) {
- ((URIParameterType) actualParameter.getType()).setValue(element.getText());
- } else if (element.getChildrenWithLocalName("value").hasNext()) {
- innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
- System.out.println(actualParameter.getType().toString());
- log.debug(actualParameter.getType().toString());
- ((URIParameterType) actualParameter.getType()).setValue(innerelement.getText());
- } else {
- ((URIParameterType) actualParameter.getType()).setValue("");
- }
- } else if ("StringArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(StringArrayType.type);
- Iterator value = element.getChildrenWithLocalName("value");
- int i = 0;
- if (!"".equals(element.getText())) {
- String[] list = StringUtil.getElementsFromString(element.getText());
- for (String arrayValue : list) {
- ((StringArrayType) actualParameter.getType()).insertValue(i++, arrayValue);
- }
- } else {
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((StringArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
- }
- }
- } else if ("DoubleArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(DoubleArrayType.type);
- Iterator value = element.getChildrenWithLocalName("value");
- int i = 0;
- if (!"".equals(element.getText())) {
- String[] list = StringUtil.getElementsFromString(element.getText());
- for (String arrayValue : list) {
- ((DoubleArrayType) actualParameter.getType()).insertValue(i++, new Double(arrayValue));
- }
- } else {
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((DoubleArrayType) actualParameter.getType()).insertValue(i++, new Double(innerelement.getText()));
- }
- }
-
- } else if ("IntegerArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(IntegerArrayType.type);
- Iterator value = element.getChildrenWithLocalName("value");
- int i = 0;
- if (!"".equals(element.getText())) {
- String[] list = StringUtil.getElementsFromString(element.getText());
- for (String arrayValue : list) {
- ((IntegerArrayType) actualParameter.getType()).insertValue(i++, new Integer(arrayValue));
- }
- } else {
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((IntegerArrayType) actualParameter.getType()).insertValue(i++, new Integer(innerelement.getText()));
- }
- }
- } else if ("FloatArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(FloatArrayType.type);
- Iterator value = element.getChildrenWithLocalName("value");
- int i = 0;
- if (!"".equals(element.getText())) {
- String[] list = StringUtil.getElementsFromString(element.getText());
- for (String arrayValue : list) {
- ((FloatArrayType) actualParameter.getType()).insertValue(i++, new Float(arrayValue));
- }
- } else {
-
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((FloatArrayType) actualParameter.getType()).insertValue(i++, new Float(innerelement.getText()));
- }
- }
- } else if ("BooleanArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(BooleanArrayType.type);
- Iterator value = element.getChildrenWithLocalName("value");
- int i = 0;
- if (!"".equals(element.getText())) {
- String[] list = StringUtil.getElementsFromString(element.getText());
- for (String arrayValue : list) {
- ((BooleanArrayType) actualParameter.getType()).insertValue(i++, new Boolean(arrayValue));
- }
- } else {
-
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((BooleanArrayType) actualParameter.getType()).insertValue(i++, new Boolean(innerelement.getText()));
- }
- }
- } else if ("FileArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(FileArrayType.type);
- Iterator value = element.getChildrenWithLocalName("value");
- int i = 0;
- if (!"".equals(element.getText())) {
- String[] list = StringUtil.getElementsFromString(element.getText());
- for (String arrayValue : list) {
- ((FileArrayType) actualParameter.getType()).insertValue(i++, arrayValue);
- }
- } else {
-
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((FileArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
- }
- }
- } else if ("URIArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(URIArrayType.type);
- Iterator value = element.getChildrenWithLocalName("value");
- int i = 0;
- if (!"".equals(element.getText())) {
- String[] list = StringUtil.getElementsFromString(element.getText());
- for (String arrayValue : list) {
- ((URIArrayType) actualParameter.getType()).insertValue(i++, arrayValue);
- }
- } else {
-
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((URIArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
- }
- }
- }
- return actualParameter;
- }
-
- public static ActualParameter getInputActualParameter(Parameter parameter, String inputVal) throws GFacException{
- OMElement innerelement = null;
- ActualParameter actualParameter = new ActualParameter();
- if ("String".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(StringParameterType.type);
- ((StringParameterType) actualParameter.getType()).setValue(inputVal);
- } else if ("Double".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(DoubleParameterType.type);
- ((DoubleParameterType) actualParameter.getType()).setValue(new Double(inputVal));
- } else if ("Integer".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(IntegerParameterType.type);
- ((IntegerParameterType) actualParameter.getType()).setValue(new Integer(inputVal));
- } else if ("Float".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(FloatParameterType.type);
- ((FloatParameterType) actualParameter.getType()).setValue(new Float(inputVal));
- } else if ("Boolean".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(BooleanParameterType.type);
- ((BooleanParameterType) actualParameter.getType()).setValue(new Boolean(inputVal));
- } else if ("File".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(FileParameterType.type);
- ((FileParameterType) actualParameter.getType()).setValue(inputVal);
- } else if ("URI".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(URIParameterType.type);
- ((URIParameterType) actualParameter.getType()).setValue(inputVal);
- } else if ("StringArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(StringArrayType.type);
- Iterator iterator = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
- int i = 0;
- while (iterator.hasNext()) {
- innerelement = (OMElement) iterator.next();
- ((StringArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
- }
- } else if ("DoubleArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(DoubleArrayType.type);
- Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
- int i = 0;
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((DoubleArrayType) actualParameter.getType()).insertValue(i++, new Double(innerelement.getText()));
- }
- } else if ("IntegerArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(IntegerArrayType.type);
- Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
- int i = 0;
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((IntegerArrayType) actualParameter.getType()).insertValue(i++, new Integer(innerelement.getText()));
- }
- } else if ("FloatArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(FloatArrayType.type);
- Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
- int i = 0;
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((FloatArrayType) actualParameter.getType()).insertValue(i++, new Float(innerelement.getText()));
- }
- } else if ("BooleanArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(BooleanArrayType.type);
- Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
- int i = 0;
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((BooleanArrayType) actualParameter.getType()).insertValue(i++, new Boolean(innerelement.getText()));
- }
- } else if ("FileArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(FileArrayType.type);
- Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
- int i = 0;
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((FileArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
- }
- } else if ("URIArray".equals(parameter.getParameterType().getName())) {
- actualParameter = new ActualParameter(URIArrayType.type);
- Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
- int i = 0;
- while (value.hasNext()) {
- innerelement = (OMElement) value.next();
- ((URIArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
- }
- } else{
- throw new GFacException("Input parameters are not configured properly ");
- }
- return actualParameter;
- }
-
-
- public static ApplicationJob createApplicationJob(
- JobExecutionContext jobExecutionContext) {
- ApplicationJob appJob = new ApplicationJob();
- appJob.setExperimentId((String) jobExecutionContext.getProperty(Constants.PROP_TOPIC));
- appJob.setWorkflowExecutionId(appJob.getExperimentId());
- appJob.setNodeId((String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_NODE_ID));
- appJob.setServiceDescriptionId(jobExecutionContext.getApplicationContext().getServiceDescription().getType().getName());
- appJob.setHostDescriptionId(jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostName());
- appJob.setApplicationDescriptionId(jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType().getApplicationName().getStringValue());
- return appJob;
- }
-
- public static void updateApplicationJobStatusUpdateTime(JobExecutionContext context, String jobId, Date statusUpdateTime) {
- AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
- try {
- airavataAPI.getProvenanceManager().updateApplicationJobStatusUpdateTime(jobId, statusUpdateTime);
- } catch (AiravataAPIInvocationException e) {
- log.error("Error in updating application job status time " + statusUpdateTime.toString() + " for job Id " + jobId + "!!!", e);
- }
- }
-
- public static void updateApplicationJobStatus(JobExecutionContext context, String jobId, ApplicationJobStatus status, Date statusUpdateTime) {
- AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
- try {
- airavataAPI.getProvenanceManager().updateApplicationJobStatus(jobId, status, statusUpdateTime);
- } catch (AiravataAPIInvocationException e) {
- log.error("Error in updating application job status " + status.toString() + " for job Id " + jobId + "!!!", e);
- }
- }
-
- /**
- * Gets the job ids given experiment id.
- *
- * @param context The job execution context.
- * @param experimentId The experiment id.
- * @return List of job ids relevant to given experiment id.
- */
- public static List<ApplicationJob> getJobIds(JobExecutionContext context, String experimentId) {
-
- AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
- try {
- return airavataAPI.getProvenanceManager().getApplicationJobs(experimentId, null, null);
- } catch (AiravataAPIInvocationException e) {
- log.error("Error retrieving application jobs for experiment id " + experimentId, e);
- }
-
- return new ArrayList<ApplicationJob>(0);
- }
-
- /**
- * Gets the job ids given experiment id and workflow id.
- *
- * @param context The job execution context.
- * @param experimentId The experiment id.
- * @param workflowId The workflow id
- * @return List of job ids relevant to given experiment id and workflow id.
- */
- public static List<ApplicationJob> getJobIds(JobExecutionContext context, String experimentId, String workflowId) {
-
- AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
- try {
- return airavataAPI.getProvenanceManager().getApplicationJobs(experimentId, workflowId, null);
- } catch (AiravataAPIInvocationException e) {
- log.error("Error retrieving application jobs for experiment id " + experimentId, " workflow id " +
- workflowId, e);
- }
-
- return new ArrayList<ApplicationJob>(0);
- }
-
- /**
- * Gets the job ids given experiment id and workflow id.
- *
- * @param context The job execution context.
- * @param experimentId The experiment id.
- * @param workflowId The workflow id
- * @return List of job ids relevant to given experiment id and workflow id.
- */
- public static List<ApplicationJob> getJobIds(JobExecutionContext context, String experimentId,
- String workflowId, String nodeId) {
-
- AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
- try {
- return airavataAPI.getProvenanceManager().getApplicationJobs(experimentId, workflowId, nodeId);
- } catch (AiravataAPIInvocationException e) {
- log.error("Error retrieving application jobs for experiment id " + experimentId, " workflow id " +
- workflowId, e);
- }
-
- return new ArrayList<ApplicationJob>(0);
- }
-
- /*public static RequestData getRequestData(Properties configurationProperties) {
-
- RequestData requestData = new RequestData();
-
- requestData.setMyProxyServerUrl(configurationProperties.getProperty(Constants.MYPROXY_SERVER));
- requestData.setMyProxyUserName(configurationProperties.getProperty(Constants.MYPROXY_USER));
- requestData.setMyProxyPassword(configurationProperties.getProperty(Constants.MYPROXY_PASS));
-
- int lifeTime;
- String sLife = configurationProperties.getProperty(Constants.MYPROXY_LIFE);
- if (sLife != null) {
- lifeTime = Integer.parseInt(sLife);
- requestData.setMyProxyLifeTime(lifeTime);
- } else {
- log.info("The configuration does not specify a default life time");
- }
-
-
-
- }
-*/
-
-
- public static void recordApplicationJob(JobExecutionContext context, ApplicationJob job) {
- AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
- try {
- airavataAPI.getProvenanceManager().addApplicationJob(job);
- } catch (AiravataAPIInvocationException e) {
- log.error("Error in persisting application job data for application job " + job.getJobId() + "!!!", e);
- }
- }
- public static void saveJobStatus(JobExecutionContext jobExecutionContext, JobDetails details, JobState state) throws GFacException {
- try {
- Registry registry = jobExecutionContext.getRegistry();
- JobStatus status = new JobStatus();
- status.setJobState(state);
- details.setJobStatus(status);
- registry.add(ChildDataType.JOB_DETAIL,details, new CompositeIdentifier(jobExecutionContext.getTaskData().getTaskID(), details.getJobID()));
- } catch (Exception e) {
- throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
- }
- }
-
- public static void updateJobStatus(JobExecutionContext jobExecutionContext,JobDetails details, JobState state) throws GFacException {
- try {
- Registry registry = jobExecutionContext.getRegistry();
- JobStatus status = new JobStatus();
- status.setJobState(state);
- status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
- details.setJobStatus(status);
- registry.update(org.apache.airavata.registry.cpi.DataType.JOB_DETAIL, details, details.getJobID());
- } catch (Exception e) {
- throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
- }
- }
- public static void saveErrorDetails(JobExecutionContext jobExecutionContext, String errorMessage, CorrectiveAction action, ErrorCategory errorCatogory) throws GFacException {
- try {
- Registry registry = RegistryFactory.getDefaultRegistry();
- ErrorDetails details = new ErrorDetails();
- details.setActualErrorMessage(errorMessage);
- details.setCorrectiveAction(action);
- details.setActionableGroup(ActionableGroup.GATEWAYS_ADMINS);
- details.setCreationTime(Calendar.getInstance().getTimeInMillis());
- details.setErrorCategory(errorCatogory);
- registry.add(ChildDataType.ERROR_DETAIL, details, jobExecutionContext.getTaskData().getTaskID());
- } catch (Exception e) {
- throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
- }
- }
-
-
- public static Map<String, Object> getMessageContext(List<DataObjectType> experimentData,
- Parameter[] parameters) throws GFacException {
- HashMap<String, Object> stringObjectHashMap = new HashMap<String, Object>();
- Map<String,DataObjectType> map = new HashMap<String,DataObjectType>();
- for(DataObjectType objectType : experimentData){
- map.put(objectType.getKey(), objectType);
- }
- for (int i = 0; i < parameters.length; i++) {
- DataObjectType input = map.get(parameters[i].getParameterName());
- if (input != null) {
- stringObjectHashMap.put(parameters[i].getParameterName(), GFacUtils.getInputActualParameter(parameters[i], input));
- } else {
- throw new GFacException("Error finding the parameter: parameter Name" + parameters[i].getParameterName());
- }
- }
- return stringObjectHashMap;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/OutputUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/OutputUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/OutputUtils.java
deleted file mode 100644
index efcbcd5..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/OutputUtils.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.utils;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.commons.gfac.type.ActualParameter;
-import org.apache.airavata.commons.gfac.type.MappingFactory;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.schemas.gfac.StdErrParameterType;
-import org.apache.airavata.schemas.gfac.StdOutParameterType;
-
-public class OutputUtils {
- private static String regexPattern = "\\s*=\\s*(.*)\\r?\\n";
-
- public static Map<String, ActualParameter> fillOutputFromStdout(Map<String, Object> output, String stdout, String stderr) throws Exception {
-
- if (stdout == null || stdout.equals("")){
- throw new GFacHandlerException("Standard output is empty.");
- }
-
- Map<String, ActualParameter> result = new HashMap<String, ActualParameter>();
- Set<String> keys = output.keySet();
- for (String paramName : keys) {
- ActualParameter actual = (ActualParameter) output.get(paramName);
- // if parameter value is not already set, we let it go
-
- if (actual == null) {
- continue;
- }
- if ("StdOut".equals(actual.getType().getType().toString())) {
- ((StdOutParameterType) actual.getType()).setValue(stdout);
- result.put(paramName, actual);
- } else if ("StdErr".equals(actual.getType().getType().toString())) {
- ((StdErrParameterType) actual.getType()).setValue(stderr);
- result.put(paramName, actual);
- }else if("URI".equals(actual.getType().getType().toString())){
- continue;
- }
- else {
- String parseStdout = parseStdout(stdout, paramName);
- if (parseStdout != null) {
- MappingFactory.fromString(actual, parseStdout);
- result.put(paramName, actual);
- }
- }
- }
-
- return result;
- }
-
- private static String parseStdout(String stdout, String outParam) throws Exception {
- String regex = Pattern.quote(outParam) + regexPattern;
- String match = null;
- Pattern pattern = Pattern.compile(regex);
- Matcher matcher = pattern.matcher(stdout);
- while (matcher.find()) {
- match = matcher.group(1);
- }
- if (match != null) {
- match = match.trim();
- return match;
- } else {
- throw new Exception("Data for the output parameter '" + outParam + "' was not found");
- }
- }
-
- public static String[] parseStdoutArray(String stdout, String outParam) throws Exception {
- String regex = Pattern.quote(outParam) + regexPattern;
- StringBuffer match = new StringBuffer();
- Pattern pattern = Pattern.compile(regex);
- Matcher matcher = pattern.matcher(stdout);
- while (matcher.find()) {
- match.append(matcher.group(1) + StringUtil.DELIMETER);
- }
- if (match != null) {
- return StringUtil.getElementsFromString(match.toString());
- } else {
- throw new Exception("Data for the output parameter '" + outParam + "' was not found");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/GFacConfigXmlTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/GFacConfigXmlTest.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/GFacConfigXmlTest.java
index 042db95..08db750 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/GFacConfigXmlTest.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/GFacConfigXmlTest.java
@@ -26,9 +26,9 @@ import org.apache.airavata.gfac.ExecutionMode;
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.Scheduler;
-import org.apache.airavata.gfac.context.ApplicationContext;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.cpi.GFacImpl;
+import org.apache.airavata.gfac.core.context.ApplicationContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.cpi.GFacImpl;
import org.apache.airavata.schemas.gfac.GsisshHostType;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestGlobalHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestGlobalHandler.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestGlobalHandler.java
index c245140..b699b8f 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestGlobalHandler.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestGlobalHandler.java
@@ -20,8 +20,8 @@
*/
package org.apache.airavata.job;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestInHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestInHandler.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestInHandler.java
index 1c41d8e..bc6af11 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestInHandler.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestInHandler.java
@@ -20,8 +20,8 @@
*/
package org.apache.airavata.job;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestOutHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestOutHandler.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestOutHandler.java
index 2ebf3d8..db39ada 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestOutHandler.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestOutHandler.java
@@ -20,8 +20,8 @@
*/
package org.apache.airavata.job;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestProvider.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestProvider.java
index 3de320a..dcd7e3c 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestProvider.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestProvider.java
@@ -21,9 +21,9 @@
package org.apache.airavata.job;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.provider.AbstractProvider;
-import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.provider.AbstractProvider;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestThreadedHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestThreadedHandler.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestThreadedHandler.java
index 08f9c33..09fd7e5 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestThreadedHandler.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/TestThreadedHandler.java
@@ -21,8 +21,8 @@
package org.apache.airavata.job;
import junit.framework.Assert;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.gfac.handler.ThreadedHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.handler.ThreadedHandler;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2Provider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2Provider.java b/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2Provider.java
index 1ade760..cf8a7d2 100644
--- a/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2Provider.java
+++ b/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2Provider.java
@@ -33,13 +33,13 @@ import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.ApplicationDescription;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.provider.AbstractProvider;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.provider.utils.ProviderUtils;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.gfac.ec2.util.AmazonEC2Util;
import org.apache.airavata.gfac.ec2.util.EC2ProviderUtil;
-import org.apache.airavata.gfac.provider.AbstractProvider;
-import org.apache.airavata.gfac.provider.GFacProviderException;
-import org.apache.airavata.gfac.provider.utils.ProviderUtils;
-import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.model.workspace.experiment.JobState;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
import org.apache.airavata.schemas.gfac.Ec2ApplicationDeploymentType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2ProviderEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2ProviderEvent.java b/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2ProviderEvent.java
index 797461c..42241c4 100644
--- a/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2ProviderEvent.java
+++ b/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2ProviderEvent.java
@@ -21,7 +21,7 @@
package org.apache.airavata.gfac.ec2;
-import org.apache.airavata.gfac.notification.events.GFacEvent;
+import org.apache.airavata.gfac.core.notification.events.GFacEvent;
public class EC2ProviderEvent extends GFacEvent {
String statusMessage;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/util/AmazonEC2Util.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/util/AmazonEC2Util.java b/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/util/AmazonEC2Util.java
index ddf0fab..81b4380 100644
--- a/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/util/AmazonEC2Util.java
+++ b/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/util/AmazonEC2Util.java
@@ -25,7 +25,7 @@ import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.ec2.AmazonEC2Client;
import com.amazonaws.services.ec2.model.*;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.gfac.ec2.EC2ProviderEvent;
import java.util.ArrayList;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ec2/src/test/java/org/apache/airavata/gfac/ec2/EC2ProviderTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ec2/src/test/java/org/apache/airavata/gfac/ec2/EC2ProviderTest.java b/modules/gfac/gfac-ec2/src/test/java/org/apache/airavata/gfac/ec2/EC2ProviderTest.java
index 3fdf292..9b683ca 100644
--- a/modules/gfac/gfac-ec2/src/test/java/org/apache/airavata/gfac/ec2/EC2ProviderTest.java
+++ b/modules/gfac/gfac-ec2/src/test/java/org/apache/airavata/gfac/ec2/EC2ProviderTest.java
@@ -24,10 +24,10 @@ package org.apache.airavata.gfac.ec2;
import org.apache.airavata.commons.gfac.type.*;
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.ApplicationContext;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
-import org.apache.airavata.gfac.cpi.GFacImpl;
+import org.apache.airavata.gfac.core.context.ApplicationContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.cpi.GFacImpl;
import org.apache.airavata.schemas.gfac.*;
import org.junit.Assert;
import org.junit.Before;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-ec2/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ec2/src/test/resources/gfac-config.xml b/modules/gfac/gfac-ec2/src/test/resources/gfac-config.xml
index fec698b..d2b53c4 100644
--- a/modules/gfac/gfac-ec2/src/test/resources/gfac-config.xml
+++ b/modules/gfac/gfac-ec2/src/test/resources/gfac-config.xml
@@ -13,7 +13,7 @@
<GFac>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GramDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GramDirectorySetupHandler.java b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GramDirectorySetupHandler.java
index 76fa2db..bd817db 100644
--- a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GramDirectorySetupHandler.java
+++ b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GramDirectorySetupHandler.java
@@ -27,13 +27,13 @@ import java.util.Map;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.commons.gfac.type.ApplicationDescription;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.gfac.gram.security.GSISecurityContext;
import org.apache.airavata.gfac.gram.external.GridFtp;
import org.apache.airavata.gfac.gram.util.GramProviderUtils;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
import org.apache.airavata.model.workspace.experiment.DataTransferDetails;
import org.apache.airavata.model.workspace.experiment.ErrorCategory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GridFTPInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GridFTPInputHandler.java b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GridFTPInputHandler.java
index 9844e6a..0d87292 100644
--- a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GridFTPInputHandler.java
+++ b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GridFTPInputHandler.java
@@ -38,15 +38,15 @@ import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.ToolsException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.gfac.gram.security.GSISecurityContext;
import org.apache.airavata.gfac.gram.external.GridFtp;
import org.apache.airavata.gfac.gram.util.GramProviderUtils;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.AppDescriptorCheckHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.gfac.utils.GFacUtils;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
import org.apache.airavata.model.workspace.experiment.DataTransferDetails;
import org.apache.airavata.model.workspace.experiment.ErrorCategory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GridFTPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GridFTPOutputHandler.java b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GridFTPOutputHandler.java
index e867b2b..5f61335 100644
--- a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GridFTPOutputHandler.java
+++ b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/handler/GridFTPOutputHandler.java
@@ -42,16 +42,16 @@ import org.apache.airavata.commons.gfac.type.ApplicationDescription;
import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.ToolsException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
+import org.apache.airavata.gfac.core.utils.OutputUtils;
import org.apache.airavata.gfac.gram.security.GSISecurityContext;
import org.apache.airavata.gfac.gram.external.GridFtp;
import org.apache.airavata.gfac.gram.util.GramProviderUtils;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.gfac.provider.GFacProviderException;
-import org.apache.airavata.gfac.utils.GFacUtils;
-import org.apache.airavata.gfac.utils.OutputUtils;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
import org.apache.airavata.model.workspace.experiment.DataTransferDetails;
import org.apache.airavata.model.workspace.experiment.ErrorCategory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/persistence/DBJobPersistenceManager.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/persistence/DBJobPersistenceManager.java b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/persistence/DBJobPersistenceManager.java
index 68e7f48..67ba1a5 100644
--- a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/persistence/DBJobPersistenceManager.java
+++ b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/persistence/DBJobPersistenceManager.java
@@ -23,8 +23,8 @@ package org.apache.airavata.gfac.gram.persistence;
import org.apache.airavata.common.utils.DBUtil;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.persistence.JobData;
-import org.apache.airavata.gfac.persistence.JobPersistenceManager;
+import org.apache.airavata.gfac.core.persistence.JobData;
+import org.apache.airavata.gfac.core.persistence.JobPersistenceManager;
import org.apache.log4j.Logger;
import org.globus.gram.internal.GRAMConstants;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/provider/impl/GramProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/provider/impl/GramProvider.java b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/provider/impl/GramProvider.java
index 03c3fee..71d5a6b 100644
--- a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/provider/impl/GramProvider.java
+++ b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/provider/impl/GramProvider.java
@@ -33,15 +33,15 @@ import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.JobSubmissionFault;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.notification.events.JobIDEvent;
+import org.apache.airavata.gfac.core.notification.events.StartExecutionEvent;
+import org.apache.airavata.gfac.core.provider.AbstractProvider;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.gfac.gram.security.GSISecurityContext;
import org.apache.airavata.gfac.gram.util.GramJobSubmissionListener;
import org.apache.airavata.gfac.gram.util.GramProviderUtils;
-import org.apache.airavata.gfac.notification.events.JobIDEvent;
-import org.apache.airavata.gfac.notification.events.StartExecutionEvent;
-import org.apache.airavata.gfac.provider.AbstractProvider;
-import org.apache.airavata.gfac.provider.GFacProviderException;
-import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
import org.apache.airavata.model.workspace.experiment.ErrorCategory;
import org.apache.airavata.model.workspace.experiment.JobState;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramJobSubmissionListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramJobSubmissionListener.java b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramJobSubmissionListener.java
index d91ae08..782eee2 100644
--- a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramJobSubmissionListener.java
+++ b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramJobSubmissionListener.java
@@ -21,10 +21,10 @@
package org.apache.airavata.gfac.gram.util;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.notification.events.StatusChangeEvent;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.gfac.gram.security.GSISecurityContext;
-import org.apache.airavata.gfac.notification.events.StatusChangeEvent;
-import org.apache.airavata.gfac.utils.GFacUtils;
import org.globus.gram.GramJob;
import org.globus.gram.GramJobListener;
import org.ietf.jgss.GSSCredential;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramProviderUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramProviderUtils.java b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramProviderUtils.java
index 74bb674..8dfe78f 100644
--- a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramProviderUtils.java
+++ b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramProviderUtils.java
@@ -21,8 +21,8 @@
package org.apache.airavata.gfac.gram.util;
import org.apache.airavata.gfac.ToolsException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
import org.apache.airavata.model.workspace.experiment.JobState;
import org.globus.gram.GramAttributes;
import org.globus.gram.GramJob;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramRSLGenerator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramRSLGenerator.java b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramRSLGenerator.java
index f8a7502..8ec4cc8 100644
--- a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramRSLGenerator.java
+++ b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/util/GramRSLGenerator.java
@@ -25,9 +25,9 @@ import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.Constants;
import org.apache.airavata.gfac.ToolsException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
-import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
import org.apache.airavata.schemas.gfac.*;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gram/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTestWithMyProxyAuth.java b/modules/gfac/gfac-gram/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTestWithMyProxyAuth.java
index 4fa945e..10a7110 100644
--- a/modules/gfac/gfac-gram/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-gram/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTestWithMyProxyAuth.java
@@ -34,11 +34,11 @@ import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.commons.gfac.type.ServiceDescription;
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.ApplicationContext;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.ApplicationContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.cpi.GFacImpl;
import org.apache.airavata.gfac.gram.security.GSISecurityContext;
-import org.apache.airavata.gfac.cpi.GFacImpl;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
import org.apache.airavata.schemas.gfac.GlobusHostType;
import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gram/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/test/resources/gfac-config.xml b/modules/gfac/gfac-gram/src/test/resources/gfac-config.xml
index ad1305e..7d8ed76 100644
--- a/modules/gfac/gfac-gram/src/test/resources/gfac-config.xml
+++ b/modules/gfac/gfac-gram/src/test/resources/gfac-config.xml
@@ -13,7 +13,7 @@
<GFac>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
index 0f9e7fc..d447e69 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
@@ -22,12 +22,12 @@ package org.apache.airavata.gfac.gsissh.handler;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.model.workspace.experiment.*;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
index ce9102a..da03a9b 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
@@ -25,13 +25,13 @@ import org.apache.airavata.common.utils.StringUtil;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.model.workspace.experiment.*;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
index 41932d9..aefa80f 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
@@ -27,14 +27,14 @@ import org.apache.airavata.common.utils.Constants;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.ApplicationDescription;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.AbstractHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
+import org.apache.airavata.gfac.core.utils.OutputUtils;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
-import org.apache.airavata.gfac.handler.AbstractHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.gfac.provider.GFacProviderException;
-import org.apache.airavata.gfac.utils.GFacUtils;
-import org.apache.airavata.gfac.utils.OutputUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
import org.apache.airavata.model.workspace.experiment.*;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
index abca9d9..9e66b71 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
@@ -21,15 +21,15 @@
package org.apache.airavata.gfac.gsissh.provider.impl;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.cpi.GFacImpl;
+import org.apache.airavata.gfac.core.handler.ThreadedHandler;
+import org.apache.airavata.gfac.core.notification.events.StartExecutionEvent;
+import org.apache.airavata.gfac.core.provider.AbstractProvider;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
-import org.apache.airavata.gfac.cpi.GFacImpl;
import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
-import org.apache.airavata.gfac.handler.ThreadedHandler;
-import org.apache.airavata.gfac.notification.events.StartExecutionEvent;
-import org.apache.airavata.gfac.provider.AbstractProvider;
-import org.apache.airavata.gfac.provider.GFacProviderException;
-import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
index 2c4c956..ac70bec 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
@@ -28,8 +28,8 @@ import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.Constants;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.RequestData;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java b/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
index 162c2d2..4f9fd16 100644
--- a/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
@@ -34,11 +34,11 @@ import org.apache.airavata.commons.gfac.type.ServiceDescription;
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.SecurityContext;
-import org.apache.airavata.gfac.context.ApplicationContext;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.ApplicationContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.cpi.GFacImpl;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
-import org.apache.airavata.gfac.cpi.GFacImpl;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.gsi.ssh.api.ServerInfo;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-gsissh/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/test/resources/gfac-config.xml b/modules/gfac/gfac-gsissh/src/test/resources/gfac-config.xml
index 759af93..4a9d1ad 100644
--- a/modules/gfac/gfac-gsissh/src/test/resources/gfac-config.xml
+++ b/modules/gfac/gfac-gsissh/src/test/resources/gfac-config.xml
@@ -13,7 +13,7 @@
<GFac>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/handler/HDFSDataMovementHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/handler/HDFSDataMovementHandler.java b/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/handler/HDFSDataMovementHandler.java
index f54b7a5..299be48 100644
--- a/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/handler/HDFSDataMovementHandler.java
+++ b/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/handler/HDFSDataMovementHandler.java
@@ -21,11 +21,11 @@
package org.apache.airavata.gfac.hadoop.handler;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.handler.GFacHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import org.apache.airavata.gfac.hadoop.provider.utils.HadoopUtils;
-import org.apache.airavata.gfac.handler.GFacHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
import org.apache.airavata.schemas.gfac.HadoopApplicationDeploymentDescriptionType;
import org.apache.commons.io.FileUtils;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/handler/HadoopDeploymentHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/handler/HadoopDeploymentHandler.java b/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/handler/HadoopDeploymentHandler.java
index 24e0e9a..69c3087 100644
--- a/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/handler/HadoopDeploymentHandler.java
+++ b/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/handler/HadoopDeploymentHandler.java
@@ -23,10 +23,10 @@ package org.apache.airavata.gfac.hadoop.handler;
import com.google.common.io.Files;
import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
-import org.apache.airavata.gfac.handler.GFacHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.handler.GFacHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import org.apache.airavata.schemas.gfac.HadoopHostType;
import org.apache.commons.configuration.CompositeConfiguration;
import org.apache.commons.configuration.Configuration;
@@ -75,7 +75,7 @@ public class HadoopDeploymentHandler implements GFacHandler {
*
* @param jobExecutionContext job execution context containing all the required configurations
* and runtime information.
- * @throws org.apache.airavata.gfac.handler.GFacHandlerException
+ * @throws org.apache.airavata.gfac.core.handler.GFacHandlerException
*/
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
if(jobExecutionContext.isInPath()){
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/provider/impl/HadoopProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/provider/impl/HadoopProvider.java b/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/provider/impl/HadoopProvider.java
index f0eb06b..6543c01 100644
--- a/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/provider/impl/HadoopProvider.java
+++ b/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/provider/impl/HadoopProvider.java
@@ -29,11 +29,11 @@ import java.util.Map;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.provider.AbstractProvider;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
import org.apache.airavata.gfac.hadoop.provider.utils.HadoopUtils;
-import org.apache.airavata.gfac.provider.AbstractProvider;
-import org.apache.airavata.gfac.provider.GFacProviderException;
import org.apache.airavata.schemas.gfac.HadoopApplicationDeploymentDescriptionType;
import org.apache.airavata.schemas.gfac.OutputParameterType;
import org.apache.airavata.schemas.gfac.StringParameterType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/provider/utils/HadoopUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/provider/utils/HadoopUtils.java b/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/provider/utils/HadoopUtils.java
index 2947fc3..9d46446 100644
--- a/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/provider/utils/HadoopUtils.java
+++ b/modules/gfac/gfac-hadoop/src/main/java/org/apache/airavata/gfac/hadoop/provider/utils/HadoopUtils.java
@@ -21,8 +21,8 @@
package org.apache.airavata.gfac.hadoop.provider.utils;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-hadoop/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-hadoop/src/test/resources/gfac-config.xml b/modules/gfac/gfac-hadoop/src/test/resources/gfac-config.xml
index 9c4774c..4c6484d 100644
--- a/modules/gfac/gfac-hadoop/src/test/resources/gfac-config.xml
+++ b/modules/gfac/gfac-hadoop/src/test/resources/gfac-config.xml
@@ -13,7 +13,7 @@
<GFac>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalDirectorySetupHandler.java b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalDirectorySetupHandler.java
index 81493fb..f145308 100644
--- a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalDirectorySetupHandler.java
+++ b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalDirectorySetupHandler.java
@@ -21,9 +21,9 @@
package org.apache.airavata.gfac.local.handler;
import org.apache.airavata.commons.gfac.type.ApplicationDescription;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.handler.GFacHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.GFacHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
import org.apache.airavata.schemas.gfac.HostDescriptionType;
import org.slf4j.Logger;
[7/7] git commit: moving common monitoring classes to gfac-core
Posted by la...@apache.org.
moving common monitoring classes to gfac-core
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/39370c52
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/39370c52
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/39370c52
Branch: refs/heads/master
Commit: 39370c526b5acf13e31b2f9136605a93bf84b939
Parents: 6209ee0
Author: lahiru <la...@apache.org>
Authored: Mon May 5 11:59:49 2014 -0400
Committer: lahiru <la...@apache.org>
Committed: Mon May 5 11:59:49 2014 -0400
----------------------------------------------------------------------
.../main/resources/airavata-server.properties | 4 +-
.../server/src/main/resources/gfac-config.xml | 4 +-
.../gfac/bes/provider/impl/BESProvider.java | 12 +-
.../gfac/bes/utils/ApplicationProcessor.java | 2 +-
.../gfac/bes/utils/DataStagingProcessor.java | 4 +-
.../gfac/bes/utils/DataTransferrer.java | 4 +-
.../airavata/gfac/bes/utils/JSDLGenerator.java | 2 +-
.../airavata/gfac/bes/utils/OSRequirement.java | 2 +-
.../airavata/gfac/bes/utils/RangeValueType.java | 2 +-
.../gfac/bes/utils/ResourceProcessor.java | 4 +-
.../airavata/gfac/bes/utils/SPMDProcessor.java | 2 +-
.../gfac/bes/utils/UASDataStagingProcessor.java | 4 +-
.../gfac-bes/src/test/resources/gfac-config.xml | 2 +-
.../apache/airavata/gfac/GFacConfiguration.java | 8 +-
.../airavata/gfac/JobSubmissionFault.java | 7 +-
.../org/apache/airavata/gfac/Scheduler.java | 8 +-
.../airavata/gfac/context/AbstractContext.java | 50 --
.../gfac/context/ApplicationContext.java | 57 --
.../gfac/context/JobExecutionContext.java | 277 --------
.../airavata/gfac/context/MessageContext.java | 51 --
.../gfac/core/context/AbstractContext.java | 50 ++
.../gfac/core/context/ApplicationContext.java | 57 ++
.../gfac/core/context/JobExecutionContext.java | 276 ++++++++
.../gfac/core/context/MessageContext.java | 51 ++
.../org/apache/airavata/gfac/core/cpi/GFac.java | 49 ++
.../apache/airavata/gfac/core/cpi/GFacImpl.java | 403 +++++++++++
.../gfac/core/handler/AbstractHandler.java | 37 ++
.../core/handler/AppDescriptorCheckHandler.java | 87 +++
.../airavata/gfac/core/handler/GFacHandler.java | 33 +
.../gfac/core/handler/GFacHandlerConfig.java | 51 ++
.../gfac/core/handler/GFacHandlerException.java | 49 ++
.../gfac/core/handler/ThreadedHandler.java | 31 +
.../core/monitor/AbstractActivityListener.java | 27 +
.../AiravataExperimentStatusUpdator.java | 80 +++
.../core/monitor/AiravataJobStatusUpdator.java | 145 ++++
.../core/monitor/AiravataTaskStatusUpdator.java | 112 ++++
.../AiravataWorkflowNodeStatusUpdator.java | 111 ++++
.../gfac/core/monitor/ExperimentIdentity.java | 36 +
.../airavata/gfac/core/monitor/JobIdentity.java | 39 ++
.../airavata/gfac/core/monitor/MonitorID.java | 213 ++++++
.../gfac/core/monitor/TaskIdentity.java | 38 ++
.../gfac/core/monitor/WorkflowNodeIdentity.java | 37 ++
.../state/AbstractStateChangeRequest.java | 27 +
.../state/ExperimentStatusChangeRequest.java | 63 ++
.../monitor/state/JobStatusChangeRequest.java | 80 +++
.../core/monitor/state/PublisherMessage.java | 26 +
.../monitor/state/TaskStatusChangeRequest.java | 61 ++
.../state/WorkflowNodeStatusChangeRequest.java | 63 ++
.../gfac/core/notification/GFacNotifier.java | 42 ++
.../core/notification/MonitorPublisher.java | 47 ++
.../notification/events/ExecutionFailEvent.java | 35 +
.../events/FinishExecutionEvent.java | 29 +
.../events/FinishScheduleEvent.java | 29 +
.../core/notification/events/GFacEvent.java | 39 ++
.../core/notification/events/JobIDEvent.java | 35 +
.../events/StartExecutionEvent.java | 29 +
.../notification/events/StartScheduleEvent.java | 29 +
.../notification/events/StatusChangeEvent.java | 33 +
.../notification/events/UnicoreJobIDEvent.java | 35 +
.../notification/listeners/LoggingListener.java | 57 ++
.../listeners/WorkflowTrackingListener.java | 133 ++++
.../airavata/gfac/core/persistence/JobData.java | 55 ++
.../core/persistence/JobPersistenceManager.java | 76 +++
.../gfac/core/provider/AbstractProvider.java | 48 ++
.../gfac/core/provider/GFacProvider.java | 63 ++
.../gfac/core/provider/GFacProviderConfig.java | 51 ++
.../core/provider/GFacProviderException.java | 50 ++
.../gfac/core/provider/utils/DataIDType.java | 95 +++
.../gfac/core/provider/utils/ProviderUtils.java | 54 ++
.../provider/utils/ResourceRequirement.java | 34 +
.../gfac/core/scheduler/HostScheduler.java | 35 +
.../scheduler/impl/SimpleHostScheduler.java | 33 +
.../airavata/gfac/core/utils/GFacUtils.java | 662 +++++++++++++++++++
.../airavata/gfac/core/utils/OutputUtils.java | 105 +++
.../java/org/apache/airavata/gfac/cpi/GFac.java | 49 --
.../org/apache/airavata/gfac/cpi/GFacImpl.java | 404 -----------
.../airavata/gfac/handler/AbstractHandler.java | 37 --
.../gfac/handler/AppDescriptorCheckHandler.java | 87 ---
.../airavata/gfac/handler/GFacHandler.java | 34 -
.../gfac/handler/GFacHandlerConfig.java | 51 --
.../gfac/handler/GFacHandlerException.java | 50 --
.../airavata/gfac/handler/ThreadedHandler.java | 31 -
.../gfac/notification/GFacNotifier.java | 42 --
.../notification/events/ExecutionFailEvent.java | 35 -
.../events/FinishExecutionEvent.java | 29 -
.../events/FinishScheduleEvent.java | 29 -
.../gfac/notification/events/GFacEvent.java | 39 --
.../gfac/notification/events/JobIDEvent.java | 35 -
.../events/StartExecutionEvent.java | 29 -
.../notification/events/StartScheduleEvent.java | 29 -
.../notification/events/StatusChangeEvent.java | 33 -
.../notification/events/UnicoreJobIDEvent.java | 35 -
.../notification/listeners/LoggingListener.java | 57 --
.../listeners/WorkflowTrackingListener.java | 133 ----
.../airavata/gfac/persistence/JobData.java | 55 --
.../gfac/persistence/JobPersistenceManager.java | 76 ---
.../gfac/provider/AbstractProvider.java | 50 --
.../airavata/gfac/provider/GFacProvider.java | 63 --
.../gfac/provider/GFacProviderConfig.java | 51 --
.../gfac/provider/GFacProviderException.java | 51 --
.../gfac/provider/utils/DataIDType.java | 95 ---
.../gfac/provider/utils/ProviderUtils.java | 54 --
.../provider/utils/ResourceRequirement.java | 34 -
.../airavata/gfac/scheduler/HostScheduler.java | 35 -
.../scheduler/impl/SimpleHostScheduler.java | 33 -
.../apache/airavata/gfac/utils/GFacUtils.java | 662 -------------------
.../apache/airavata/gfac/utils/OutputUtils.java | 105 ---
.../apache/airavata/job/GFacConfigXmlTest.java | 6 +-
.../apache/airavata/job/TestGlobalHandler.java | 4 +-
.../org/apache/airavata/job/TestInHandler.java | 4 +-
.../org/apache/airavata/job/TestOutHandler.java | 4 +-
.../org/apache/airavata/job/TestProvider.java | 6 +-
.../airavata/job/TestThreadedHandler.java | 4 +-
.../apache/airavata/gfac/ec2/EC2Provider.java | 10 +-
.../airavata/gfac/ec2/EC2ProviderEvent.java | 2 +-
.../airavata/gfac/ec2/util/AmazonEC2Util.java | 2 +-
.../airavata/gfac/ec2/EC2ProviderTest.java | 8 +-
.../gfac-ec2/src/test/resources/gfac-config.xml | 2 +-
.../gram/handler/GramDirectorySetupHandler.java | 8 +-
.../gfac/gram/handler/GridFTPInputHandler.java | 12 +-
.../gfac/gram/handler/GridFTPOutputHandler.java | 14 +-
.../persistence/DBJobPersistenceManager.java | 4 +-
.../gfac/gram/provider/impl/GramProvider.java | 12 +-
.../gram/util/GramJobSubmissionListener.java | 6 +-
.../gfac/gram/util/GramProviderUtils.java | 4 +-
.../gfac/gram/util/GramRSLGenerator.java | 6 +-
.../impl/GramProviderTestWithMyProxyAuth.java | 8 +-
.../src/test/resources/gfac-config.xml | 2 +-
.../handler/GSISSHDirectorySetupHandler.java | 8 +-
.../gfac/gsissh/handler/GSISSHInputHandler.java | 10 +-
.../gsissh/handler/GSISSHOutputHandler.java | 12 +-
.../gsissh/provider/impl/GSISSHProvider.java | 14 +-
.../gfac/gsissh/util/GFACGSISSHUtils.java | 4 +-
.../impl/GSISSHProviderTestWithMyProxyAuth.java | 8 +-
.../src/test/resources/gfac-config.xml | 2 +-
.../hadoop/handler/HDFSDataMovementHandler.java | 8 +-
.../hadoop/handler/HadoopDeploymentHandler.java | 10 +-
.../hadoop/provider/impl/HadoopProvider.java | 8 +-
.../gfac/hadoop/provider/utils/HadoopUtils.java | 4 +-
.../src/test/resources/gfac-config.xml | 2 +-
.../handler/LocalDirectorySetupHandler.java | 6 +-
.../gfac/local/provider/impl/LocalProvider.java | 14 +-
.../gfac/local/utils/LocalProviderUtil.java | 4 +-
.../gfac/services/impl/LocalProviderTest.java | 10 +-
.../src/test/resources/gfac-config.xml | 2 +-
.../gfac/monitor/AbstractActivityListener.java | 27 -
.../AiravataExperimentStatusUpdator.java | 81 ---
.../gfac/monitor/AiravataJobStatusUpdator.java | 146 ----
.../gfac/monitor/AiravataTaskStatusUpdator.java | 113 ----
.../AiravataWorkflowNodeStatusUpdator.java | 112 ----
.../gfac/monitor/ExperimentIdentity.java | 36 -
.../airavata/gfac/monitor/HPCMonitorID.java | 248 +++++++
.../airavata/gfac/monitor/HostMonitorData.java | 1 +
.../airavata/gfac/monitor/JobIdentity.java | 39 --
.../apache/airavata/gfac/monitor/MonitorID.java | 251 -------
.../airavata/gfac/monitor/TaskIdentity.java | 38 --
.../gfac/monitor/WorkflowNodeIdentity.java | 37 --
.../monitor/core/AiravataAbstractMonitor.java | 2 +-
.../airavata/gfac/monitor/core/PushMonitor.java | 2 +-
.../gfac/monitor/event/MonitorPublisher.java | 47 --
.../handlers/GridPullMonitorHandler.java | 15 +-
.../gfac/monitor/impl/LocalJobMonitor.java | 6 +-
.../monitor/impl/pull/qstat/HPCPullMonitor.java | 7 +-
.../impl/pull/qstat/ResourceConnection.java | 2 +-
.../monitor/impl/push/amqp/AMQPMonitor.java | 8 +-
.../monitor/impl/push/amqp/BasicConsumer.java | 4 +-
.../impl/push/amqp/UnRegisterWorker.java | 4 +-
.../state/AbstractStateChangeRequest.java | 27 -
.../state/ExperimentStatusChangeRequest.java | 63 --
.../monitor/state/JobStatusChangeRequest.java | 80 ---
.../gfac/monitor/state/JobStatusInfo.java | 48 --
.../gfac/monitor/state/PublisherMessage.java | 26 -
.../monitor/state/TaskStatusChangeRequest.java | 61 --
.../state/WorkflowNodeStatusChangeRequest.java | 63 --
.../monitor/state/impl/AmazonJobStatusInfo.java | 39 --
.../monitor/state/impl/GridJobStatusInfo.java | 40 --
.../airavata/gfac/monitor/util/CommonUtils.java | 9 +-
.../apache/airavata/job/AMQPMonitorTest.java | 6 +-
.../job/QstatMonitorTestWithMyProxyAuth.java | 11 +-
.../ssh/handler/AdvancedSCPInputHandler.java | 8 +-
.../ssh/handler/AdvancedSCPOutputHandler.java | 6 +-
.../ssh/handler/SSHDirectorySetupHandler.java | 8 +-
.../gfac/ssh/handler/SSHInputHandler.java | 10 +-
.../gfac/ssh/handler/SSHOutputHandler.java | 12 +-
.../gfac/ssh/provider/impl/SSHProvider.java | 14 +-
.../airavata/gfac/ssh/util/GFACSSHUtils.java | 4 +-
.../services/impl/BigRed2TestWithSSHAuth.java | 8 +-
.../impl/SSHProviderTestWithSSHAuth.java | 8 +-
.../gfac-ssh/src/test/resources/gfac-config.xml | 2 +-
.../src/test/resources/gfac-config.xml | 4 +-
.../src/main/resources/gfac-config.xml | 4 +-
.../src/test/resources/gfac-config.xml | 2 +-
.../core/impl/EmbeddedGFACJobSubmitter.java | 6 +-
.../orchestrator/core/job/JobSubmitter.java | 4 +-
.../cpi/impl/SimpleOrchestratorImpl.java | 2 +-
.../src/test/resources/gfac-config.xml | 4 +-
196 files changed, 4764 insertions(+), 4698 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/configuration/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/configuration/server/src/main/resources/airavata-server.properties b/modules/configuration/server/src/main/resources/airavata-server.properties
index 7169ea8..8165f93 100644
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@ -158,7 +158,7 @@ server.context-root=airavata-server
#
# Class which implemented HostScheduler interface. It will determine the which host to submit the request
#
-host.scheduler=org.apache.airavata.gfac.scheduler.impl.SimpleHostScheduler
+host.scheduler=org.apache.airavata.gfac.core.scheduler.impl.SimpleHostScheduler
#
# Data Service Plugins classes
@@ -262,7 +262,7 @@ monitors=org.apache.airavata.gfac.monitor.impl.pull.qstat.QstatMonitor,org.apach
amqp.hosts=info1.dyn.teragrid.org,info2.dyn.teragrid.org
proxy.file.path=/Users/lahirugunathilake/Downloads/x509up_u503876
connection.name=xsede
-activity.listeners=org.apache.airavata.gfac.monitor.AiravataJobStatusUpdator,org.apache.airavata.gfac.monitor.AiravataTaskStatusUpdator,org.apache.airavata.gfac.monitor.AiravataWorkflowNodeStatusUpdator,org.apache.airavata.gfac.monitor.AiravataExperimentStatusUpdator
+activity.listeners=org.apache.airavata.gfac.core.monitor.AiravataJobStatusUpdator,org.apache.airavata.gfac.core.monitor.AiravataTaskStatusUpdator,org.apache.airavata.gfac.core.monitor.AiravataWorkflowNodeStatusUpdator,org.apache.airavata.gfac.core.monitor.AiravataExperimentStatusUpdator
###---------------------------Orchestrator module Configurations---------------------------###
job.submitter=org.apache.airavata.orchestrator.core.impl.EmbeddedGFACJobSubmitter
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/configuration/server/src/main/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/configuration/server/src/main/resources/gfac-config.xml b/modules/configuration/server/src/main/resources/gfac-config.xml
index 4cddfda..29ef0f8 100644
--- a/modules/configuration/server/src/main/resources/gfac-config.xml
+++ b/modules/configuration/server/src/main/resources/gfac-config.xml
@@ -13,12 +13,12 @@
<GFac>
<DaemonHandlers>
<Handler class="org.apache.airavata.gfac.monitor.handlers.GridPullMonitorHandler">
- <property name="listeners" value="org.apache.airavata.gfac.monitor.AiravataJobStatusUpdator"/>
+ <property name="listeners" value="org.apache.airavata.gfac.core.monitor.AiravataJobStatusUpdator"/>
</Handler>
</DaemonHandlers>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handlerAppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java
index cebb7f8..b325f62 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java
@@ -45,15 +45,15 @@ import javax.security.auth.x500.X500Principal;
import org.apache.airavata.gfac.Constants;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.bes.security.GSISecurityContext;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.notification.events.StatusChangeEvent;
-import org.apache.airavata.gfac.notification.events.UnicoreJobIDEvent;
-import org.apache.airavata.gfac.provider.AbstractProvider;
-import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.notification.events.StatusChangeEvent;
+import org.apache.airavata.gfac.core.notification.events.UnicoreJobIDEvent;
+import org.apache.airavata.gfac.core.provider.AbstractProvider;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
import org.apache.airavata.gfac.bes.utils.DataTransferrer;
import org.apache.airavata.gfac.bes.utils.JSDLGenerator;
import org.apache.airavata.gfac.bes.utils.StorageCreator;
-import org.apache.airavata.gfac.utils.GFacUtils;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.model.workspace.experiment.JobState;
import org.apache.airavata.registry.api.workflow.ApplicationJob;
import org.apache.airavata.registry.api.workflow.ApplicationJob.ApplicationJobStatus;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/ApplicationProcessor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/ApplicationProcessor.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/ApplicationProcessor.java
index 77f8a3a..d624340 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/ApplicationProcessor.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/ApplicationProcessor.java
@@ -21,7 +21,7 @@
package org.apache.airavata.gfac.bes.utils;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.schemas.gfac.ExtendedKeyValueType;
import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
import org.apache.airavata.schemas.gfac.JobTypeType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataStagingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataStagingProcessor.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataStagingProcessor.java
index 1ff5504..0541d47 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataStagingProcessor.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataStagingProcessor.java
@@ -26,8 +26,8 @@ import java.net.URI;
import java.util.Map;
import org.apache.airavata.commons.gfac.type.ActualParameter;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.utils.GFacUtils;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
import org.apache.airavata.schemas.gfac.StringArrayType;
import org.apache.airavata.schemas.gfac.StringParameterType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataTransferrer.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataTransferrer.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataTransferrer.java
index a1a884b..74b3591 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataTransferrer.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataTransferrer.java
@@ -32,8 +32,8 @@ import java.util.Map;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.ApplicationDescription;
import org.apache.airavata.gfac.Constants;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/JSDLGenerator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/JSDLGenerator.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/JSDLGenerator.java
index 5c0b832..185c958 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/JSDLGenerator.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/JSDLGenerator.java
@@ -21,7 +21,7 @@
package org.apache.airavata.gfac.bes.utils;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
import org.ggf.schemas.jsdl.x2005.x11.jsdl.JobDefinitionDocument;
import org.ggf.schemas.jsdl.x2005.x11.jsdl.JobDefinitionType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/OSRequirement.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/OSRequirement.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/OSRequirement.java
index 3938598..8aa9521 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/OSRequirement.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/OSRequirement.java
@@ -21,7 +21,7 @@
package org.apache.airavata.gfac.bes.utils;
-import org.apache.airavata.gfac.provider.utils.ResourceRequirement;
+import org.apache.airavata.gfac.core.provider.utils.ResourceRequirement;
public class OSRequirement implements ResourceRequirement {
private OSType osType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/RangeValueType.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/RangeValueType.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/RangeValueType.java
index 6aec82a..b7d204b 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/RangeValueType.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/RangeValueType.java
@@ -21,7 +21,7 @@
package org.apache.airavata.gfac.bes.utils;
-import org.apache.airavata.gfac.provider.utils.ResourceRequirement;
+import org.apache.airavata.gfac.core.provider.utils.ResourceRequirement;
public class RangeValueType implements ResourceRequirement {
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/ResourceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/ResourceProcessor.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/ResourceProcessor.java
index fc8d6ec..5df9a0f 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/ResourceProcessor.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/ResourceProcessor.java
@@ -21,8 +21,8 @@
package org.apache.airavata.gfac.bes.utils;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SPMDProcessor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SPMDProcessor.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SPMDProcessor.java
index 8807026..b906a0a 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SPMDProcessor.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SPMDProcessor.java
@@ -21,7 +21,7 @@
package org.apache.airavata.gfac.bes.utils;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.ggf.schemas.jsdl.x2005.x11.jsdl.JobDefinitionType;
public class SPMDProcessor {
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/UASDataStagingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/UASDataStagingProcessor.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/UASDataStagingProcessor.java
index 0284dea..ab6dc23 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/UASDataStagingProcessor.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/UASDataStagingProcessor.java
@@ -25,8 +25,8 @@ import java.io.File;
import java.util.Map;
import org.apache.airavata.commons.gfac.type.ActualParameter;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
import org.apache.airavata.schemas.gfac.StringArrayType;
import org.apache.airavata.schemas.gfac.StringParameterType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-bes/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/test/resources/gfac-config.xml b/modules/gfac/gfac-bes/src/test/resources/gfac-config.xml
index 0598356..16d187f 100644
--- a/modules/gfac/gfac-bes/src/test/resources/gfac-config.xml
+++ b/modules/gfac/gfac-bes/src/test/resources/gfac-config.xml
@@ -13,7 +13,7 @@
<GFac>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/GFacConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/GFacConfiguration.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/GFacConfiguration.java
index cd716e5..d110a11 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/GFacConfiguration.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/GFacConfiguration.java
@@ -35,12 +35,8 @@ import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.exception.UnspecifiedApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.handler.GFacHandlerConfig;
-import org.apache.airavata.gfac.provider.GFacProviderConfig;
+import org.apache.airavata.gfac.core.handler.GFacHandlerConfig;
+import org.apache.airavata.gfac.core.provider.GFacProviderConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.*;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/JobSubmissionFault.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/JobSubmissionFault.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/JobSubmissionFault.java
index 65e9d2e..b211e2f 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/JobSubmissionFault.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/JobSubmissionFault.java
@@ -20,13 +20,12 @@
*/
package org.apache.airavata.gfac;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.provider.GFacProvider;
-import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
// TODO review this class - Not sure some of the attributes are actually
// needed
-public class JobSubmissionFault extends GFacProviderException{
+public class JobSubmissionFault extends GFacProviderException {
// TODO why we need following ?
//public static final String JOB_CANCEL = "JOB_CANCEL";
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
index 273013b..ef416f7 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
@@ -37,10 +37,10 @@ import org.apache.airavata.client.api.AiravataAPI;
import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
import org.apache.airavata.commons.gfac.type.ApplicationDescription;
import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.provider.GFacProvider;
-import org.apache.airavata.gfac.provider.GFacProviderConfig;
-import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.provider.GFacProvider;
+import org.apache.airavata.gfac.core.provider.GFacProviderConfig;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/AbstractContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/AbstractContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/AbstractContext.java
deleted file mode 100644
index 4932cd6..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/AbstractContext.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.context;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public abstract class AbstractContext {
-
- protected AbstractContext parent;
- protected Map<String, Object> properties = new HashMap<String, Object>();
-
- public Object getProperty(String name) {
- Object value = properties.get(name);
- if (value == null) {
- if(parent != null){
- return parent.getProperty(name);
- }
- }
-
- return value;
- }
-
- public AbstractContext getParent() {
- return parent;
- }
-
- public void setProperty(String name, Object value) {
- properties.put(name, value);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/ApplicationContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/ApplicationContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/ApplicationContext.java
deleted file mode 100644
index 51a5d54..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/ApplicationContext.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.context;
-
-import org.apache.airavata.commons.gfac.type.ApplicationDescription;
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.commons.gfac.type.ServiceDescription;
-
-public class ApplicationContext extends AbstractContext {
-
- private ApplicationDescription applicationDeploymentDescription;
- private ServiceDescription serviceDescription;
- private HostDescription hostDescription;
-
- public ApplicationDescription getApplicationDeploymentDescription() {
- return applicationDeploymentDescription;
- }
-
- public <T extends ApplicationDescription> void setApplicationDeploymentDescription(T applicationDeploymentDescription) {
- this.applicationDeploymentDescription = applicationDeploymentDescription;
- }
-
- public <T extends ServiceDescription> void setServiceDescription(T serviceDescription) {
- this.serviceDescription = serviceDescription;
- }
-
- public <T extends HostDescription> void setHostDescription(T hostDescription) {
- this.hostDescription = hostDescription;
- }
-
- public ServiceDescription getServiceDescription() {
- return serviceDescription;
- }
-
- public HostDescription getHostDescription() {
- return hostDescription;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
deleted file mode 100644
index 2de8f48..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.context;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.airavata.gfac.ExecutionMode;
-import org.apache.airavata.gfac.GFacConfiguration;
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.SecurityContext;
-import org.apache.airavata.gfac.notification.GFacNotifier;
-import org.apache.airavata.gfac.provider.GFacProvider;
-import org.apache.airavata.model.workspace.experiment.Experiment;
-import org.apache.airavata.model.workspace.experiment.JobDetails;
-import org.apache.airavata.model.workspace.experiment.TaskDetails;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-import org.apache.airavata.registry.cpi.Registry;
-
-public class JobExecutionContext extends AbstractContext{
-
- private GFacConfiguration gfacConfiguration;
-
- private ApplicationContext applicationContext;
-
- private MessageContext inMessageContext;
-
- private MessageContext outMessageContext;
-
- private GFacNotifier notifier;
-
- private Experiment experiment;
-
- private TaskDetails taskData;
-
- private JobDetails jobDetails;
-
- private WorkflowNodeDetails workflowNodeDetails;
-
-// private ContextHeaderDocument.ContextHeader contextHeader;
-
- // Keep track of the current path of the message. Before hitting provider its in-path.
- // After provider its out-path.
- private boolean inPath = true;
-
- // Keep list of full qualified class names of GFac handlers which should invoked before
- // the provider. This is specific to current job being executed.
- private List<String> inHandlers = new ArrayList<String>();
-
- // Keep list of full qualified class names of GFac handlers which should invoked after
- // the provider. This is specific to current job being executed.
- private List<String> outHandlers = new ArrayList<String>();
-
- // During the execution of in-flow one of the handlers(Scheduling handler) will
- // set this and GFac API will get it from the JobExecutionContext and execute the provider.
- private GFacProvider provider;
-
- // Service description is used by GFac to mainly specify input/output parameters for a job
- // and to expose a job as a service to the outside world. This service concept abstract out
- // a scientific application(or algorithm) as a service. Service name is there to identify to
- // which service description we should refer during the execution of the current job represented
- // by this context instance.
- private String serviceName;
-
- private String experimentID;
-
- private String status;
-
- private List<String> outputFileList;
-
- private Registry registry;
-
- /**
- * Security context is used to handle authentication for input handlers and providers.
- * There can be multiple security requirement for a single job so this allows you to add multiple security types
- *
- */
- private Map<String, SecurityContext> securityContext = new HashMap<String, SecurityContext>();
-
- public JobExecutionContext(GFacConfiguration gFacConfiguration,String serviceName){
- this.gfacConfiguration = gFacConfiguration;
- notifier = new GFacNotifier();
- setServiceName(serviceName);
- outputFileList = new ArrayList<String>();
- }
-
-
- public String getExperimentID() {
- return experimentID;
- }
-
- public void setExperimentID(String experimentID) {
- this.experimentID = experimentID;
- }
-
- public ApplicationContext getApplicationContext() {
- return applicationContext;
- }
-
- public void setApplicationContext(ApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
- public MessageContext getInMessageContext() {
- return inMessageContext;
- }
-
- public void setInMessageContext(MessageContext inMessageContext) {
- this.inMessageContext = inMessageContext;
- }
-
- public MessageContext getOutMessageContext() {
- return outMessageContext;
- }
-
- public void setOutMessageContext(MessageContext outMessageContext) {
- this.outMessageContext = outMessageContext;
- }
-
- public GFacConfiguration getGFacConfiguration() {
- return gfacConfiguration;
- }
-
- public GFacNotifier getNotificationService(){
- return notifier;
- }
-
- public GFacProvider getProvider() {
- return provider;
- }
-
- public void setProvider(GFacProvider provider) {
- this.provider = provider;
- }
-
- public List<String> getInHandlers() {
- return inHandlers;
- }
-
- public void setInHandlers(List<String> inHandlers) {
- this.inHandlers = inHandlers;
- }
-
- public List<String> getOutHandlers() {
- return outHandlers;
- }
-
- public void setOutHandlers(List<String> outHandlers) {
- this.outHandlers = outHandlers;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public GFacNotifier getNotifier() {
- return notifier;
- }
-
- public boolean isInPath() {
- return inPath;
- }
-
- public TaskDetails getTaskData() {
- return taskData;
- }
-
- public void setTaskData(TaskDetails taskData) {
- this.taskData = taskData;
- }
-
- public boolean isOutPath(){
- return !inPath;
- }
-
- public void setInPath() {
- this.inPath = true;
- }
-
- public void setOutPath(){
- this.inPath = false;
- }
-
-// public ContextHeaderDocument.ContextHeader getContextHeader() {
-// return contextHeader;
-// }
-//
-// public void setContextHeader(ContextHeaderDocument.ContextHeader contextHeader) {
-// this.contextHeader = contextHeader;
-// }
-
-
- public SecurityContext getSecurityContext(String name) throws GFacException{
- SecurityContext secContext = securityContext.get(name);
- return secContext;
- }
-
- public void addSecurityContext(String name, SecurityContext value){
- securityContext.put(name, value);
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public JobDetails getJobDetails() {
- return jobDetails;
- }
-
- public void setJobDetails(JobDetails jobDetails) {
- this.jobDetails = jobDetails;
- }
-
- public void addOutputFile(String file) {
- outputFileList.add(file);
- }
- public List<String> getOutputFiles(){
- return outputFileList;
- }
-
- public Registry getRegistry() {
- return registry;
- }
-
- public Map<String, SecurityContext> getAllSecurityContexts(){
- return securityContext;
- }
-
- public void setRegistry(Registry registry) {
- this.registry = registry;
- }
-
- public Experiment getExperiment() {
- return experiment;
- }
-
- public void setExperiment(Experiment experiment) {
- this.experiment = experiment;
- }
-
- public WorkflowNodeDetails getWorkflowNodeDetails() {
- return workflowNodeDetails;
- }
-
- public void setWorkflowNodeDetails(WorkflowNodeDetails workflowNodeDetails) {
- this.workflowNodeDetails = workflowNodeDetails;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/MessageContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/MessageContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/MessageContext.java
deleted file mode 100644
index a8ed2ff..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/MessageContext.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.context;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class MessageContext extends AbstractContext {
-
- private Map<String, Object> parameters;
-
- public MessageContext(Map<String, Object> parameters){
- this.parameters = parameters;
- }
-
- public MessageContext(){
- this.parameters = new LinkedHashMap<String, Object>();
- }
-
- public Object getParameter(String parameterName) {
- return parameters.get(parameterName);
- }
-
- public void addParameter(String name, Object value){
- parameters.put(name, value);
- }
-
- public Map<String,Object> getParameters(){
- return parameters;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/AbstractContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/AbstractContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/AbstractContext.java
new file mode 100644
index 0000000..60a5de4
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/AbstractContext.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.context;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public abstract class AbstractContext {
+
+ protected AbstractContext parent;
+ protected Map<String, Object> properties = new HashMap<String, Object>();
+
+ public Object getProperty(String name) {
+ Object value = properties.get(name);
+ if (value == null) {
+ if(parent != null){
+ return parent.getProperty(name);
+ }
+ }
+
+ return value;
+ }
+
+ public AbstractContext getParent() {
+ return parent;
+ }
+
+ public void setProperty(String name, Object value) {
+ properties.put(name, value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ApplicationContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ApplicationContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ApplicationContext.java
new file mode 100644
index 0000000..4083f29
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ApplicationContext.java
@@ -0,0 +1,57 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.context;
+
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+
+public class ApplicationContext extends AbstractContext {
+
+ private ApplicationDescription applicationDeploymentDescription;
+ private ServiceDescription serviceDescription;
+ private HostDescription hostDescription;
+
+ public ApplicationDescription getApplicationDeploymentDescription() {
+ return applicationDeploymentDescription;
+ }
+
+ public <T extends ApplicationDescription> void setApplicationDeploymentDescription(T applicationDeploymentDescription) {
+ this.applicationDeploymentDescription = applicationDeploymentDescription;
+ }
+
+ public <T extends ServiceDescription> void setServiceDescription(T serviceDescription) {
+ this.serviceDescription = serviceDescription;
+ }
+
+ public <T extends HostDescription> void setHostDescription(T hostDescription) {
+ this.hostDescription = hostDescription;
+ }
+
+ public ServiceDescription getServiceDescription() {
+ return serviceDescription;
+ }
+
+ public HostDescription getHostDescription() {
+ return hostDescription;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java
new file mode 100644
index 0000000..86f4055
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java
@@ -0,0 +1,276 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.context;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.airavata.gfac.GFacConfiguration;
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.SecurityContext;
+import org.apache.airavata.gfac.core.notification.GFacNotifier;
+import org.apache.airavata.gfac.core.provider.GFacProvider;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.JobDetails;
+import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
+import org.apache.airavata.registry.cpi.Registry;
+
+public class JobExecutionContext extends AbstractContext{
+
+ private GFacConfiguration gfacConfiguration;
+
+ private ApplicationContext applicationContext;
+
+ private MessageContext inMessageContext;
+
+ private MessageContext outMessageContext;
+
+ private GFacNotifier notifier;
+
+ private Experiment experiment;
+
+ private TaskDetails taskData;
+
+ private JobDetails jobDetails;
+
+ private WorkflowNodeDetails workflowNodeDetails;
+
+// private ContextHeaderDocument.ContextHeader contextHeader;
+
+ // Keep track of the current path of the message. Before hitting provider its in-path.
+ // After provider its out-path.
+ private boolean inPath = true;
+
+ // Keep list of full qualified class names of GFac handlers which should invoked before
+ // the provider. This is specific to current job being executed.
+ private List<String> inHandlers = new ArrayList<String>();
+
+ // Keep list of full qualified class names of GFac handlers which should invoked after
+ // the provider. This is specific to current job being executed.
+ private List<String> outHandlers = new ArrayList<String>();
+
+ // During the execution of in-flow one of the handlers(Scheduling handler) will
+ // set this and GFac API will get it from the JobExecutionContext and execute the provider.
+ private GFacProvider provider;
+
+ // Service description is used by GFac to mainly specify input/output parameters for a job
+ // and to expose a job as a service to the outside world. This service concept abstract out
+ // a scientific application(or algorithm) as a service. Service name is there to identify to
+ // which service description we should refer during the execution of the current job represented
+ // by this context instance.
+ private String serviceName;
+
+ private String experimentID;
+
+ private String status;
+
+ private List<String> outputFileList;
+
+ private Registry registry;
+
+ /**
+ * Security context is used to handle authentication for input handlers and providers.
+ * There can be multiple security requirement for a single job so this allows you to add multiple security types
+ *
+ */
+ private Map<String, SecurityContext> securityContext = new HashMap<String, SecurityContext>();
+
+ public JobExecutionContext(GFacConfiguration gFacConfiguration,String serviceName){
+ this.gfacConfiguration = gFacConfiguration;
+ notifier = new GFacNotifier();
+ setServiceName(serviceName);
+ outputFileList = new ArrayList<String>();
+ }
+
+
+ public String getExperimentID() {
+ return experimentID;
+ }
+
+ public void setExperimentID(String experimentID) {
+ this.experimentID = experimentID;
+ }
+
+ public ApplicationContext getApplicationContext() {
+ return applicationContext;
+ }
+
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ this.applicationContext = applicationContext;
+ }
+
+ public MessageContext getInMessageContext() {
+ return inMessageContext;
+ }
+
+ public void setInMessageContext(MessageContext inMessageContext) {
+ this.inMessageContext = inMessageContext;
+ }
+
+ public MessageContext getOutMessageContext() {
+ return outMessageContext;
+ }
+
+ public void setOutMessageContext(MessageContext outMessageContext) {
+ this.outMessageContext = outMessageContext;
+ }
+
+ public GFacConfiguration getGFacConfiguration() {
+ return gfacConfiguration;
+ }
+
+ public GFacNotifier getNotificationService(){
+ return notifier;
+ }
+
+ public GFacProvider getProvider() {
+ return provider;
+ }
+
+ public void setProvider(GFacProvider provider) {
+ this.provider = provider;
+ }
+
+ public List<String> getInHandlers() {
+ return inHandlers;
+ }
+
+ public void setInHandlers(List<String> inHandlers) {
+ this.inHandlers = inHandlers;
+ }
+
+ public List<String> getOutHandlers() {
+ return outHandlers;
+ }
+
+ public void setOutHandlers(List<String> outHandlers) {
+ this.outHandlers = outHandlers;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public GFacNotifier getNotifier() {
+ return notifier;
+ }
+
+ public boolean isInPath() {
+ return inPath;
+ }
+
+ public TaskDetails getTaskData() {
+ return taskData;
+ }
+
+ public void setTaskData(TaskDetails taskData) {
+ this.taskData = taskData;
+ }
+
+ public boolean isOutPath(){
+ return !inPath;
+ }
+
+ public void setInPath() {
+ this.inPath = true;
+ }
+
+ public void setOutPath(){
+ this.inPath = false;
+ }
+
+// public ContextHeaderDocument.ContextHeader getContextHeader() {
+// return contextHeader;
+// }
+//
+// public void setContextHeader(ContextHeaderDocument.ContextHeader contextHeader) {
+// this.contextHeader = contextHeader;
+// }
+
+
+ public SecurityContext getSecurityContext(String name) throws GFacException{
+ SecurityContext secContext = securityContext.get(name);
+ return secContext;
+ }
+
+ public void addSecurityContext(String name, SecurityContext value){
+ securityContext.put(name, value);
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public JobDetails getJobDetails() {
+ return jobDetails;
+ }
+
+ public void setJobDetails(JobDetails jobDetails) {
+ this.jobDetails = jobDetails;
+ }
+
+ public void addOutputFile(String file) {
+ outputFileList.add(file);
+ }
+ public List<String> getOutputFiles(){
+ return outputFileList;
+ }
+
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ public Map<String, SecurityContext> getAllSecurityContexts(){
+ return securityContext;
+ }
+
+ public void setRegistry(Registry registry) {
+ this.registry = registry;
+ }
+
+ public Experiment getExperiment() {
+ return experiment;
+ }
+
+ public void setExperiment(Experiment experiment) {
+ this.experiment = experiment;
+ }
+
+ public WorkflowNodeDetails getWorkflowNodeDetails() {
+ return workflowNodeDetails;
+ }
+
+ public void setWorkflowNodeDetails(WorkflowNodeDetails workflowNodeDetails) {
+ this.workflowNodeDetails = workflowNodeDetails;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/MessageContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/MessageContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/MessageContext.java
new file mode 100644
index 0000000..8bb0e1e
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/MessageContext.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.context;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class MessageContext extends AbstractContext {
+
+ private Map<String, Object> parameters;
+
+ public MessageContext(Map<String, Object> parameters){
+ this.parameters = parameters;
+ }
+
+ public MessageContext(){
+ this.parameters = new LinkedHashMap<String, Object>();
+ }
+
+ public Object getParameter(String parameterName) {
+ return parameters.get(parameterName);
+ }
+
+ public void addParameter(String name, Object value){
+ parameters.put(name, value);
+ }
+
+ public Map<String,Object> getParameters(){
+ return parameters;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFac.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFac.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFac.java
new file mode 100644
index 0000000..c0f7984
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFac.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.cpi;
+
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+
+/**
+ * This is the GFac CPI interface which needs to be implemented by an internal class, this simply have a single method to submit a job to
+ * the resource, required data for the job has to be stored in registry prior to invoke this object.
+ */
+public interface GFac {
+
+ /**
+ * This is the job launching method outsiders of GFac can use, this will invoke the GFac handler chain and providers
+ * And update the registry occordingly, so the users can query the database to retrieve status and output from Registry
+ *
+ * @param experimentID
+ * @return
+ * @throws org.apache.airavata.gfac.GFacException
+ */
+ public JobExecutionContext submitJob(String experimentID,String taskID) throws GFacException;
+
+ /**
+ * This method has to be invoked after submitting the job and have to make sure job is properly finished
+ * @param jobExecutionContext
+ * @throws GFacException
+ */
+ public void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException;
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java
new file mode 100644
index 0000000..15b0d72
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java
@@ -0,0 +1,403 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.cpi;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.gfac.Constants;
+import org.apache.airavata.gfac.GFacConfiguration;
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.Scheduler;
+import org.apache.airavata.gfac.core.context.ApplicationContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.notification.events.ExecutionFailEvent;
+import org.apache.airavata.gfac.core.notification.listeners.LoggingListener;
+import org.apache.airavata.gfac.core.notification.listeners.WorkflowTrackingListener;
+import org.apache.airavata.gfac.core.handler.GFacHandler;
+import org.apache.airavata.gfac.core.provider.GFacProvider;
+import org.apache.airavata.gfac.core.scheduler.HostScheduler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerConfig;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.handler.ThreadedHandler;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
+import org.apache.airavata.model.workspace.experiment.DataObjectType;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.airavata.registry.api.AiravataRegistry2;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+
+/**
+ * This is the GFac CPI class for external usage, this simply have a single method to submit a job to
+ * the resource, required data for the job has to be stored in registry prior to invoke this object.
+ */
+public class GFacImpl implements GFac {
+ private static final Logger log = LoggerFactory.getLogger(GFacImpl.class);
+ public static final String ERROR_SENT = "ErrorSent";
+
+ private Registry registry;
+
+ private AiravataAPI airavataAPI;
+
+ private AiravataRegistry2 airavataRegistry2;
+
+ private static List<ThreadedHandler> daemonHandlers;
+
+ private File gfacConfigFile;
+ /**
+ * Constructor for GFac
+ *
+ * @param registry
+ * @param airavataAPI
+ * @param airavataRegistry2
+ */
+ public GFacImpl(Registry registry, AiravataAPI airavataAPI, AiravataRegistry2 airavataRegistry2) {
+ this.registry = registry;
+ this.airavataAPI = airavataAPI;
+ this.airavataRegistry2 = airavataRegistry2;
+ daemonHandlers = new ArrayList<ThreadedHandler>();
+ startDaemonHandlers();
+ }
+
+ private void startDaemonHandlers() {
+ List<GFacHandlerConfig> daemonHandlerConfig = null;
+ URL resource = GFacImpl.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
+ gfacConfigFile = new File(resource.getPath());
+ try {
+ daemonHandlerConfig = GFacConfiguration.getDaemonHandlers(gfacConfigFile);
+ } catch (ParserConfigurationException e) {
+ log.error("Error parsing gfac-config.xml, double check the xml configuration",e);
+ } catch (IOException e) {
+ log.error("Error parsing gfac-config.xml, double check the xml configuration", e);
+ } catch (SAXException e) {
+ log.error("Error parsing gfac-config.xml, double check the xml configuration", e);
+ } catch (XPathExpressionException e) {
+ log.error("Error parsing gfac-config.xml, double check the xml configuration", e);
+ }
+
+ for(GFacHandlerConfig handlerConfig:daemonHandlerConfig){
+ String className = handlerConfig.getClassName();
+ try {
+ Class<?> aClass = Class.forName(className).asSubclass(ThreadedHandler.class);
+ ThreadedHandler threadedHandler = (ThreadedHandler) aClass.newInstance();
+ threadedHandler.initProperties(handlerConfig.getProperties());
+ daemonHandlers.add(threadedHandler);
+ }catch (ClassNotFoundException e){
+ log.error("Error initializing the handler: " + className);
+ log.error(className + " class has to implement " + ThreadedHandler.class);
+ } catch (InstantiationException e) {
+ log.error("Error initializing the handler: " + className);
+ log.error(className + " class has to implement " + ThreadedHandler.class);
+ } catch (IllegalAccessException e) {
+ log.error("Error initializing the handler: " + className);
+ log.error(className + " class has to implement " + ThreadedHandler.class);
+ } catch (GFacHandlerException e) {
+ log.error("Error initializing the handler " + className);
+ } catch (GFacException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+ for(ThreadedHandler tHandler:daemonHandlers){
+ (new Thread(tHandler)).start();
+ }
+ }
+
+ /**
+ * This can be used to submit jobs for testing purposes just by filling parameters by hand (JobExecutionContext)
+ */
+ public GFacImpl() {
+ daemonHandlers = new ArrayList<ThreadedHandler>();
+ startDaemonHandlers();
+ }
+
+ /**
+ * This is the job launching method outsiders of GFac can use, this will invoke the GFac handler chain and providers
+ * And update the registry occordingly, so the users can query the database to retrieve status and output from Registry
+ *
+ * @param experimentID
+ * @return
+ * @throws GFacException
+ */
+ public JobExecutionContext submitJob(String experimentID,String taskID) throws GFacException {
+ JobExecutionContext jobExecutionContext = null;
+ try {
+ jobExecutionContext = createJEC(experimentID, taskID);
+
+ return submitJob(jobExecutionContext);
+ } catch (Exception e) {
+ log.error("Error inovoking the job with experiment ID: " + experimentID);
+ throw new GFacException(e);
+ }
+ }
+
+ private JobExecutionContext createJEC(String experimentID, String taskID) throws Exception {
+ JobExecutionContext jobExecutionContext;
+ TaskDetails taskData = (TaskDetails) registry.get(DataType.TASK_DETAIL, taskID);
+
+ // this is wear our new model and old model is mapping (so serviceName in ExperimentData and service name in ServiceDescriptor
+ // has to be same.
+
+ // 1. Get the Task from the task ID and construct the Job object and save it in to registry
+ // 2. Add another property to jobExecutionContext and read them inside the provider and use it.
+ String serviceName = taskData.getApplicationId();
+ if (serviceName == null) {
+ throw new GFacException("Error executing the job because there is not Application Name in this Experiment");
+ }
+ List<HostDescription> registeredHosts = new ArrayList<HostDescription>();
+ Map<String, ApplicationDescription> applicationDescriptors = airavataRegistry2.getApplicationDescriptors(serviceName);
+ for (String hostDescName : applicationDescriptors.keySet()) {
+ registeredHosts.add(airavataRegistry2.getHostDescriptor(hostDescName));
+ }
+ Class<? extends HostScheduler> aClass = Class.forName(ServerSettings.getHostScheduler()).asSubclass(HostScheduler.class);
+ HostScheduler hostScheduler = aClass.newInstance();
+ HostDescription hostDescription = hostScheduler.schedule(registeredHosts);
+
+ ServiceDescription serviceDescription = airavataRegistry2.getServiceDescriptor(serviceName);
+ String hostName;
+ if(taskData.getTaskScheduling().getResourceHostId() != null){
+ hostName = taskData.getTaskScheduling().getResourceHostId();
+ }else{
+ hostName = hostDescription.getType().getHostName();
+ }
+
+ ApplicationDescription applicationDescription = airavataRegistry2.getApplicationDescriptors(serviceName, hostName);
+ URL resource = GFacImpl.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
+ Properties configurationProperties = ServerSettings.getProperties();
+ GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()), airavataAPI, configurationProperties);
+
+
+ // start constructing jobexecutioncontext
+ jobExecutionContext = new JobExecutionContext(gFacConfiguration, serviceName);
+ Experiment experiment = (Experiment) registry.get(DataType.EXPERIMENT, experimentID);
+ jobExecutionContext.setExperiment(experiment);
+ jobExecutionContext.setExperimentID(experimentID);
+
+ jobExecutionContext.setTaskData(taskData);
+
+
+
+
+ jobExecutionContext.setRegistry(registry);
+
+ ApplicationContext applicationContext = new ApplicationContext();
+ applicationContext.setApplicationDeploymentDescription(applicationDescription);
+ applicationContext.setHostDescription(hostDescription);
+ applicationContext.setServiceDescription(serviceDescription);
+ jobExecutionContext.setApplicationContext(applicationContext);
+
+ List<DataObjectType> experimentInputs = taskData.getApplicationInputs();
+ jobExecutionContext.setInMessageContext(new MessageContext(GFacUtils.getMessageContext(experimentInputs,
+ serviceDescription.getType().getInputParametersArray())));
+
+ List<DataObjectType> outputData = taskData.getApplicationOutputs();
+ jobExecutionContext.setOutMessageContext(new MessageContext(GFacUtils.getMessageContext(outputData,
+ serviceDescription.getType().getOutputParametersArray())));
+
+ jobExecutionContext.setProperty(Constants.PROP_TOPIC, experimentID);
+
+ return jobExecutionContext;
+ }
+
+ public JobExecutionContext submitJob(JobExecutionContext jobExecutionContext) throws GFacException {
+ // We need to check whether this job is submitted as a part of a large workflow. If yes,
+ // we need to setup workflow tracking listerner.
+ String workflowInstanceID = null;
+ if ((workflowInstanceID = (String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_INSTANCE_ID)) != null) {
+ // This mean we need to register workflow tracking listener.
+ //todo implement WorkflowTrackingListener properly
+ registerWorkflowTrackingListener(workflowInstanceID, jobExecutionContext);
+ }
+ // Register log event listener. This is required in all scenarios.
+ jobExecutionContext.getNotificationService().registerListener(new LoggingListener());
+ schedule(jobExecutionContext);
+ return jobExecutionContext;
+ }
+
+ private void schedule(JobExecutionContext jobExecutionContext) throws GFacException {
+ // Scheduler will decide the execution flow of handlers and provider which handles
+ // the job.
+ String experimentID = jobExecutionContext.getExperimentID();
+ try {
+ Scheduler.schedule(jobExecutionContext);
+
+ // Executing in handlers in the order as they have configured in GFac configuration
+ invokeInFlowHandlers(jobExecutionContext);
+// if (experimentID != null){
+// registry2.changeStatus(jobExecutionContext.getExperimentID(),AiravataJobState.State.INHANDLERSDONE);
+// }
+
+ // After executing the in handlers provider instance should be set to job execution context.
+ // We get the provider instance and execute it.
+ GFacProvider provider = jobExecutionContext.getProvider();
+ if (provider != null) {
+ initProvider(provider, jobExecutionContext);
+ executeProvider(provider, jobExecutionContext);
+ disposeProvider(provider, jobExecutionContext);
+ }
+ if(GFacUtils.isSynchronousMode(jobExecutionContext)){
+ invokeOutFlowHandlers(jobExecutionContext);
+ }
+ } catch (Exception e) {
+ jobExecutionContext.setProperty(ERROR_SENT, "true");
+ jobExecutionContext.getNotifier().publish(new ExecutionFailEvent(e.getCause()));
+ throw new GFacException(e.getMessage(), e);
+ }
+ }
+
+ private void initProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException {
+ try {
+ provider.initialize(jobExecutionContext);
+ } catch (Exception e) {
+ throw new GFacException("Error while initializing provider " + provider.getClass().getName() + ".", e);
+ }
+ }
+
+ private void executeProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException {
+ try {
+ provider.execute(jobExecutionContext);
+ } catch (Exception e) {
+ throw new GFacException("Error while executing provider " + provider.getClass().getName() + " functionality.", e);
+ }
+ }
+
+ private void disposeProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException {
+ try {
+ provider.dispose(jobExecutionContext);
+ } catch (Exception e) {
+ throw new GFacException("Error while invoking provider " + provider.getClass().getName() + " dispose method.", e);
+ }
+ }
+
+ private void registerWorkflowTrackingListener(String workflowInstanceID, JobExecutionContext jobExecutionContext) {
+ String workflowNodeID = (String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_NODE_ID);
+ String topic = (String) jobExecutionContext.getProperty(Constants.PROP_TOPIC);
+ String brokerUrl = (String) jobExecutionContext.getProperty(Constants.PROP_BROKER_URL);
+ jobExecutionContext.getNotificationService().registerListener(
+ new WorkflowTrackingListener(workflowInstanceID, workflowNodeID, brokerUrl, topic));
+
+ }
+
+ private void invokeInFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException {
+ List<GFacHandlerConfig> handlers = jobExecutionContext.getGFacConfiguration().getInHandlers();
+ for (GFacHandlerConfig handlerClassName : handlers) {
+ Class<? extends GFacHandler> handlerClass;
+ GFacHandler handler;
+ try {
+ handlerClass = Class.forName(handlerClassName.getClassName().trim()).asSubclass(GFacHandler.class);
+ handler = handlerClass.newInstance();
+ handler.initProperties(handlerClassName.getProperties());
+ } catch (ClassNotFoundException e) {
+ throw new GFacException("Cannot load handler class " + handlerClassName, e);
+ } catch (InstantiationException e) {
+ throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
+ } catch (IllegalAccessException e) {
+ throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
+ }
+ try {
+ handler.invoke(jobExecutionContext);
+ } catch (GFacHandlerException e) {
+ throw new GFacException("Error Executing a InFlow Handler", e.getCause());
+ }
+ }
+ }
+
+ public void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException {
+ GFacConfiguration gFacConfiguration = jobExecutionContext.getGFacConfiguration();
+ List<GFacHandlerConfig> handlers = null;
+ if(gFacConfiguration != null){
+ handlers = jobExecutionContext.getGFacConfiguration().getOutHandlers();
+ }else {
+ try {
+ jobExecutionContext = createJEC(jobExecutionContext.getExperimentID(), jobExecutionContext.getTaskData().getTaskID());
+ } catch (Exception e) {
+ log.error("Error constructing job execution context during outhandler invocation");
+ throw new GFacException(e);
+ }
+ schedule(jobExecutionContext);
+ }
+ for (GFacHandlerConfig handlerClassName : handlers) {
+ Class<? extends GFacHandler> handlerClass;
+ GFacHandler handler;
+ try {
+ handlerClass = Class.forName(handlerClassName.getClassName().trim()).asSubclass(GFacHandler.class);
+ handler = handlerClass.newInstance();
+ handler.initProperties(handlerClassName.getProperties());
+ } catch (ClassNotFoundException e) {
+ log.error(e.getMessage());
+ throw new GFacException("Cannot load handler class " + handlerClassName, e);
+ } catch (InstantiationException e) {
+ log.error(e.getMessage());
+ throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
+ } catch (IllegalAccessException e) {
+ log.error(e.getMessage());
+ throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
+ }
+ try {
+ handler.invoke(jobExecutionContext);
+ } catch (Exception e) {
+ // TODO: Better error reporting.
+ throw new GFacException("Error Executing a OutFlow Handler", e);
+ }
+ }
+ }
+
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public AiravataRegistry2 getAiravataRegistry2() {
+ return airavataRegistry2;
+ }
+
+ public static List<ThreadedHandler> getDaemonHandlers() {
+ return daemonHandlers;
+ }
+
+ public static String getErrorSent() {
+ return ERROR_SENT;
+ }
+
+ public File getGfacConfigFile() {
+ return gfacConfigFile;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java
new file mode 100644
index 0000000..dcbc79d
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.handler;
+
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.Registry;
+
+public abstract class AbstractHandler implements GFacHandler {
+ protected Registry registry = null;
+
+ public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
+ registry = jobExecutionContext.getRegistry();
+ if(registry == null){
+ registry = RegistryFactory.getDefaultRegistry();
+ }
+ }
+
+}
[5/7] moving common monitoring classes to gfac-core
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/WorkflowTrackingListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/WorkflowTrackingListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/WorkflowTrackingListener.java
new file mode 100644
index 0000000..4f1dd9e
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/WorkflowTrackingListener.java
@@ -0,0 +1,133 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.notification.listeners;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.core.notification.events.*;
+import org.apache.airavata.workflow.tracking.Notifier;
+import org.apache.airavata.workflow.tracking.NotifierFactory;
+import org.apache.airavata.workflow.tracking.common.DurationObj;
+import org.apache.airavata.workflow.tracking.common.InvocationEntity;
+import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+
+import java.net.URI;
+import java.util.Properties;
+
+public class WorkflowTrackingListener {
+
+ private Notifier notifier;
+
+ private String topic;
+
+ private URI workflowID;
+
+ private WorkflowTrackingContext context;
+
+ private InvocationEntity initiator;
+
+ private InvocationEntity receiver;
+
+ private DurationObj duration;
+
+ private org.apache.airavata.workflow.tracking.common.InvocationContext invocationContext;
+
+ public WorkflowTrackingListener(String workflowID, String workflowNodeID, String brokerURL, String topic){
+ this.topic = topic;
+ this.workflowID = URI.create(this.topic);
+ this.notifier = NotifierFactory.createNotifier();
+ URI initiatorWorkflowID = URI.create(workflowID);
+ URI initiatorServiceID = URI.create(topic);
+ String initiatorWorkflowNodeID = workflowNodeID;
+ Integer initiatorWorkflowTimeStep = null;
+ this.context = this.notifier.createTrackingContext(new Properties(), brokerURL, initiatorWorkflowID, initiatorServiceID,
+ initiatorWorkflowNodeID, initiatorWorkflowTimeStep);
+ this.context.setTopic(topic);
+ this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID,
+ initiatorWorkflowTimeStep);
+
+ URI receiverWorkflowID = this.workflowID;
+ URI receiverServiceID = this.workflowID;
+ String receiverWorkflowNodeID = null;
+ Integer receiverWorkflowTimeStep = null;
+
+ setReceiver(this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
+ receiverWorkflowTimeStep));
+ // send start workflow
+ this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator);
+ }
+
+
+
+ @Subscribe
+ public void startExecution(StartExecutionEvent e) {
+ this.duration = this.notifier.computationStarted();
+ }
+
+ @Subscribe
+ public void finishExecution(FinishExecutionEvent e) {
+ this.duration = this.notifier.computationFinished(this.context, this.duration);
+ }
+
+ @Subscribe
+ public void statusChanged(StatusChangeEvent event) {
+ this.notifier.info(this.context, event.getStatusMessage());
+ }
+
+ @Subscribe
+ public void startSchedule(StartScheduleEvent e){
+ this.notifier.info(this.context,e.getEventType());
+ }
+
+ @Subscribe
+ public void executionFail(ExecutionFailEvent e) {
+ this.notifier.sendingFault(this.context, this.invocationContext, e.getCauseForFailure().getMessage());
+ }
+
+
+ @Subscribe
+ public void info(String... data) {
+ this.notifier.info(this.context, data);
+ }
+
+ @Subscribe
+ public void warning(String... data) {
+ }
+
+ @Subscribe
+ public void exception(String... data) {
+ }
+
+ @Subscribe
+ public void finishSchedule(FinishScheduleEvent e){
+ this.notifier.info(this.context,e.getEventType());
+ }
+
+
+ public InvocationEntity getReceiver() {
+ return receiver;
+ }
+
+ public void setReceiver(InvocationEntity receiver) {
+ this.receiver = receiver;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/persistence/JobData.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/persistence/JobData.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/persistence/JobData.java
new file mode 100644
index 0000000..10be472
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/persistence/JobData.java
@@ -0,0 +1,55 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.persistence;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 6/18/13
+ * Time: 2:34 PM
+ */
+
+public class JobData {
+
+ private String jobId;
+ private int state;
+
+ public JobData(String id, int state) {
+ this.jobId = id;
+ this.state = state;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public void setState(int state) {
+ this.state = state;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/persistence/JobPersistenceManager.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/persistence/JobPersistenceManager.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/persistence/JobPersistenceManager.java
new file mode 100644
index 0000000..0f7c848
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/persistence/JobPersistenceManager.java
@@ -0,0 +1,76 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.persistence;
+
+
+import org.apache.airavata.gfac.GFacException;
+
+import java.util.List;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 6/18/13
+ * Time: 2:23 PM
+ */
+
+/**
+ * Responsible persisting job data. This data is useful during a restart.
+ * When restarting Airavata can resume monitoring currently executing jobs.
+ */
+public interface JobPersistenceManager {
+
+ /**
+ * Updates the job state in the persisting storage.
+ * @param jobData Job data to update.
+ * @throws GFacException If an error occurred while updating job data.
+ */
+ void updateJobStatus (JobData jobData) throws GFacException;
+
+ /**
+ * Get all running jobs.
+ * @return Job ids which are not failed nor completed.
+ * @throws GFacException If an error occurred while querying job data.
+ */
+ List<JobData> getRunningJobs() throws GFacException;
+
+ /**
+ * Get all failed job ids.
+ * @return Failed job ids.
+ * @throws GFacException If an error occurred while querying job data.
+ */
+ List<JobData> getFailedJobs() throws GFacException;
+
+ /**
+ * Get all un-submitted job ids.
+ * @return Un-submitted job ids.
+ * @throws GFacException If an error occurred while querying job data.
+ */
+ List<JobData> getUnSubmittedJobs() throws GFacException;
+
+ /**
+ * Get all successfully completed job ids.
+ * @return Successfully completed job ids.
+ * @throws GFacException If an error occurred while querying job data.
+ */
+ List<JobData> getSuccessfullyCompletedJobs() throws GFacException;
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java
new file mode 100644
index 0000000..4d28d72
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java
@@ -0,0 +1,48 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.provider;
+
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.model.workspace.experiment.JobDetails;
+import org.apache.airavata.model.workspace.experiment.JobStatus;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractProvider implements GFacProvider{
+ private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+ protected Registry registry = null;
+ protected JobDetails details; //todo we need to remove this and add methods to fill Job details, this is not a property of a provider
+ protected JobStatus status; //todo we need to remove this and add methods to fill Job details, this is not a property of a provider
+ protected JobExecutionContext jobExecutionContext;
+
+ public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException {
+ log.debug("Initializing " + this.getClass().getName());
+ registry = RegistryFactory.getDefaultRegistry();
+ details = new JobDetails();
+ status = new JobStatus();
+ this.jobExecutionContext=jobExecutionContext;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProvider.java
new file mode 100644
index 0000000..7c17cf2
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProvider.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.provider;
+
+import java.util.Map;
+
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+
+public interface GFacProvider{
+
+ void initProperties(Map<String,String> properties) throws GFacProviderException,GFacException;
+ /**
+ * Initialize environment required for invoking the execute method of the provider. If environment setup is
+ * done during the in handler execution, validation of environment will go here.
+ * @param jobExecutionContext containing job execution related information.
+ * @throws GFacProviderException in case of a error initializing the environment.
+ */
+ void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException,GFacException;
+
+ /**
+ * Invoke the providers intended functionality using information and data in job execution context.
+ * @param jobExecutionContext containing job execution related information.
+ * @throws GFacProviderException in case of a error executing the job.
+ */
+ void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException;
+
+ /**
+ * Cleans up the acquired resources during initialization and execution of the job.
+ * @param jobExecutionContext containing job execution related information.
+ * @throws GFacProviderException in case of a error cleaning resources.
+ */
+ void dispose(JobExecutionContext jobExecutionContext) throws GFacProviderException,GFacException;
+
+ /**
+ * Cancels all jobs relevant to an experiment.
+ * @param jobId The experiment id
+ * @param jobExecutionContext The job execution context, contains runtime information.
+ * @throws GFacException If an error occurred while cancelling the job.
+ */
+ public void cancelJob(String jobId, JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException;
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProviderConfig.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProviderConfig.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProviderConfig.java
new file mode 100644
index 0000000..8a85dc4
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProviderConfig.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.provider;
+
+import java.util.Map;
+
+public class GFacProviderConfig {
+
+ public GFacProviderConfig(Map<String, String> properties, String className) {
+ this.properties = properties;
+ this.className = className;
+ }
+
+ private Map<String, String> properties;
+
+ private String className;
+
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProviderException.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProviderException.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProviderException.java
new file mode 100644
index 0000000..30f9530
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/GFacProviderException.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.gfac.core.provider;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GFacProviderException extends Exception {
+ private static final Logger log = LoggerFactory.getLogger(GFacProviderException.class);
+
+ private String aditionalInfo[] = null;
+
+ public GFacProviderException(String message) {
+ super(message);
+ log.error(message);
+ }
+
+
+ public GFacProviderException(String message, Throwable cause) {
+ super(message, cause);
+ log.error(message,cause);
+ }
+
+
+ public GFacProviderException(String message, Exception e, String... additionExceptiondata) {
+ super(message);
+ this.aditionalInfo = additionExceptiondata;
+ log.error(message,e);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/DataIDType.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/DataIDType.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/DataIDType.java
new file mode 100644
index 0000000..5028502
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/DataIDType.java
@@ -0,0 +1,95 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.provider.utils;
+
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
+import org.xmlpull.v1.builder.XmlElement;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+
+/**
+ * Represents a DataID (A schema with real names), currently it only sends a one
+ * location value.
+ */
+public class DataIDType {
+ public static final String LOCATION_ATTRIBUTE = "location";
+
+ private URI dataID;
+
+ private ArrayList<URI> dataLocations = new ArrayList<URI>();
+
+ public URI getRealLocation() {
+ if (dataLocations.size() > 0) {
+ return dataLocations.get(0);
+ } else {
+ return null;
+ }
+ }
+
+ public DataIDType(XmlElement ele) throws GFacProviderException {
+ try {
+ String value = ele.requiredTextContent();
+ if (value != null) {
+ this.dataID = new URI(value);
+ } else {
+ throw new GFacProviderException(
+ "Illegal InputMessage, No value content found for the parameter "
+ + ele.getName() + "/value. Invalid Local Argument");
+ }
+ String location = ele.getAttributeValue(null, DataIDType.LOCATION_ATTRIBUTE);
+ if (location != null) {
+ addDataLocation(new URI(location));
+ }
+ } catch (URISyntaxException e) {
+ throw new GFacProviderException("Invalid Local Argument", e);
+ }
+ }
+
+ public DataIDType(URI dataID) {
+ super();
+ this.dataID = dataID;
+ }
+
+ public void addDataLocation(URI dataLocation) {
+ dataLocations.add(dataLocation);
+ }
+
+ public ArrayList<URI> getDataLocations() {
+ return dataLocations;
+ }
+
+ public URI getDataID() {
+ return dataID;
+ }
+
+ public void fillData(XmlElement ele) {
+ ele.addChild(dataID.toString());
+ URI location = getRealLocation();
+ if (location != null) {
+ ele.addAttribute(DataIDType.LOCATION_ATTRIBUTE, location.toString());
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/ProviderUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/ProviderUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/ProviderUtils.java
new file mode 100644
index 0000000..c98da92
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/ProviderUtils.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.provider.utils;
+
+import org.apache.airavata.commons.gfac.type.ActualParameter;
+import org.apache.airavata.commons.gfac.type.MappingFactory;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
+import org.apache.airavata.schemas.gfac.InputParameterType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ProviderUtils {
+
+ public static List<String> getInputParameters(JobExecutionContext jobExecutionContext) throws GFacProviderException {
+ List<String> parameters = new ArrayList<String>();
+ MessageContext inMessageContext = jobExecutionContext.getInMessageContext();
+ InputParameterType[] inputParamDefinitionArray = jobExecutionContext.getApplicationContext().
+ getServiceDescription().getType().getInputParametersArray();
+ for (InputParameterType inputParam : inputParamDefinitionArray) {
+ String parameterName = inputParam.getParameterName();
+ ActualParameter parameter = (ActualParameter)inMessageContext.getParameter(parameterName);
+ if(parameter == null){
+ throw new GFacProviderException("Cannot find required input parameter " + parameterName + ".");
+ }
+
+ parameters.add(MappingFactory.toString(parameter));
+ }
+
+ return parameters;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/ResourceRequirement.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/ResourceRequirement.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/ResourceRequirement.java
new file mode 100644
index 0000000..2e824b3
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/utils/ResourceRequirement.java
@@ -0,0 +1,34 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.gfac.core.provider.utils;
+
+public interface ResourceRequirement extends Cloneable {
+
+ /**
+ * States whether this resource requirement is active
+ * and should be written into the job description.
+ * @return
+ */
+ public boolean isEnabled();
+
+ public void setEnabled(boolean enabled);
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/scheduler/HostScheduler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/scheduler/HostScheduler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/scheduler/HostScheduler.java
new file mode 100644
index 0000000..1971a7d
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/scheduler/HostScheduler.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.scheduler;
+
+import org.apache.airavata.commons.gfac.type.HostDescription;
+
+import java.util.List;
+
+public interface HostScheduler {
+ /**
+ * This method will pick a host among set of hosts based on the algorithm users wants to implement, For a single instance
+ * of Airavata users can pick one Scheduler.
+ * @param registeredHosts
+ * @return
+ */
+ public HostDescription schedule(List<HostDescription> registeredHosts);
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/scheduler/impl/SimpleHostScheduler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/scheduler/impl/SimpleHostScheduler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/scheduler/impl/SimpleHostScheduler.java
new file mode 100644
index 0000000..c74b6b3
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/scheduler/impl/SimpleHostScheduler.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.scheduler.impl;
+
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.core.scheduler.HostScheduler;
+
+import java.util.List;
+
+public class SimpleHostScheduler implements HostScheduler {
+ public HostDescription schedule(List<HostDescription> registeredHosts) {
+ //todo implement an algorithm to pick a host among different hosts, ideally this could be configurable in an xml
+ return registeredHosts.get(0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
new file mode 100644
index 0000000..e13fa3f
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
@@ -0,0 +1,662 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.utils;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
+import java.util.*;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.commons.gfac.type.ActualParameter;
+import org.apache.airavata.gfac.Constants;
+import org.apache.airavata.gfac.ExecutionMode;
+import org.apache.airavata.gfac.GFacConfiguration;
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.model.workspace.experiment.*;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.registry.api.workflow.ApplicationJob;
+import org.apache.airavata.registry.api.workflow.ApplicationJob.ApplicationJobStatus;
+import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.CompositeIdentifier;
+import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.schemas.gfac.*;
+import org.apache.axiom.om.OMElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GFacUtils {
+ private final static Logger log = LoggerFactory.getLogger(GFacUtils.class);
+
+ private GFacUtils() {
+ }
+
+ /**
+ * Read data from inputStream and convert it to String.
+ *
+ * @param in
+ * @return String read from inputStream
+ * @throws java.io.IOException
+ */
+ public static String readFromStream(InputStream in) throws IOException {
+ try {
+ StringBuffer wsdlStr = new StringBuffer();
+
+ int read;
+
+ byte[] buf = new byte[1024];
+ while ((read = in.read(buf)) > 0) {
+ wsdlStr.append(new String(buf, 0, read));
+ }
+ return wsdlStr.toString();
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ log.warn("Cannot close InputStream: " + in.getClass().getName(), e);
+ }
+ }
+ }
+ }
+
+ /**
+ * this can be used to do framework opertaions specific to different modes
+ * @param jobExecutionContext
+ * @return
+ */
+ public static boolean isSynchronousMode(JobExecutionContext jobExecutionContext){
+ GFacConfiguration gFacConfiguration = jobExecutionContext.getGFacConfiguration();
+ if(ExecutionMode.ASYNCHRONOUS.equals(gFacConfiguration.getExecutionMode())){
+ return false;
+ }
+ return true;
+ }
+ public static String readFileToString(String file) throws FileNotFoundException, IOException {
+ BufferedReader instream = null;
+ try {
+
+ instream = new BufferedReader(new FileReader(file));
+ StringBuffer buff = new StringBuffer();
+ String temp = null;
+ while ((temp = instream.readLine()) != null) {
+ buff.append(temp);
+ buff.append(Constants.NEWLINE);
+ }
+ return buff.toString();
+ } finally {
+ if (instream != null) {
+ try {
+ instream.close();
+ } catch (IOException e) {
+ log.warn("Cannot close FileinputStream", e);
+ }
+ }
+ }
+ }
+
+ public static boolean isLocalHost(String appHost) throws UnknownHostException {
+ String localHost = InetAddress.getLocalHost().getCanonicalHostName();
+ return (localHost.equals(appHost) || Constants.LOCALHOST.equals(appHost) || Constants._127_0_0_1
+ .equals(appHost));
+ }
+
+ public static String createUniqueNameForService(String serviceName) {
+ String date = new Date().toString();
+ date = date.replaceAll(" ", "_");
+ date = date.replaceAll(":", "_");
+ return serviceName + "_" + date + "_" + UUID.randomUUID();
+ }
+
+
+
+
+
+ public static String createGsiftpURIAsString(String host, String localPath) throws URISyntaxException {
+ StringBuffer buf = new StringBuffer();
+ if (!host.startsWith("gsiftp://"))
+ buf.append("gsiftp://");
+ buf.append(host);
+ if (!host.endsWith("/"))
+ buf.append("/");
+ buf.append(localPath);
+ return buf.toString();
+ }
+
+ public static ActualParameter getInputActualParameter(Parameter parameter, DataObjectType element) {
+ ActualParameter actualParameter = new ActualParameter();
+ if ("String".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(StringParameterType.type);
+ if (!"".equals(element.getValue())) {
+ ((StringParameterType) actualParameter.getType()).setValue(element.getValue());
+ } else {
+ ((StringParameterType) actualParameter.getType()).setValue("");
+ }
+ } else if ("Double".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(DoubleParameterType.type);
+ if (!"".equals(element.getValue())) {
+ ((DoubleParameterType) actualParameter.getType()).setValue(new Double(element.getValue()));
+ }
+ } else if ("Integer".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(IntegerParameterType.type);
+ if (!"".equals(element.getValue())) {
+ ((IntegerParameterType) actualParameter.getType()).setValue(new Integer(element.getValue()));
+ }
+ } else if ("Float".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(FloatParameterType.type);
+ if (!"".equals(element.getValue())) {
+ ((FloatParameterType) actualParameter.getType()).setValue(new Float(element.getValue()));
+ }
+ } else if ("Boolean".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(BooleanParameterType.type);
+ if (!"".equals(element.getValue())) {
+ ((BooleanParameterType) actualParameter.getType()).setValue(new Boolean(element.getValue()));
+ }
+ } else if ("File".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(FileParameterType.type);
+ if (!"".equals(element.getValue())) {
+ ((FileParameterType) actualParameter.getType()).setValue(element.getValue());
+ }
+ } else if ("URI".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(URIParameterType.type);
+ if (!"".equals(element.getValue())) {
+ ((URIParameterType) actualParameter.getType()).setValue(element.getValue());
+ } else {
+ ((URIParameterType) actualParameter.getType()).setValue("");
+ }
+
+ } else if ("StdOut".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(StdOutParameterType.type);
+ if (!"".equals(element.getValue())) {
+ ((StdOutParameterType) actualParameter.getType()).setValue(element.getValue());
+ } else {
+ ((StdOutParameterType) actualParameter.getType()).setValue("");
+ }
+
+ }
+ else if ("StdErr".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(StdErrParameterType.type);
+ if (!"".equals(element.getValue())) {
+ ((StdErrParameterType) actualParameter.getType()).setValue(element.getValue());
+ } else {
+ ((StdErrParameterType) actualParameter.getType()).setValue("");
+ }
+
+ }
+ return actualParameter;
+ }
+ public static ActualParameter getInputActualParameter(Parameter parameter, OMElement element) {
+ OMElement innerelement = null;
+ ActualParameter actualParameter = new ActualParameter();
+ if ("String".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(StringParameterType.type);
+ if (!"".equals(element.getText())) {
+ ((StringParameterType) actualParameter.getType()).setValue(element.getText());
+ } else if (element.getChildrenWithLocalName("value").hasNext()) {
+ innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
+ ((StringParameterType) actualParameter.getType()).setValue(innerelement.getText());
+ } else {
+ ((StringParameterType) actualParameter.getType()).setValue("");
+ }
+ } else if ("Double".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(DoubleParameterType.type);
+ if (!"".equals(element.getText())) {
+ ((DoubleParameterType) actualParameter.getType()).setValue(new Double(innerelement.getText()));
+ } else {
+ innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
+ ((DoubleParameterType) actualParameter.getType()).setValue(new Double(innerelement.getText()));
+ }
+ } else if ("Integer".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(IntegerParameterType.type);
+ if (!"".equals(element.getText())) {
+ ((IntegerParameterType) actualParameter.getType()).setValue(new Integer(element.getText()));
+ } else {
+ innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
+ ((IntegerParameterType) actualParameter.getType()).setValue(new Integer(innerelement.getText()));
+ }
+ } else if ("Float".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(FloatParameterType.type);
+ if (!"".equals(element.getText())) {
+ ((FloatParameterType) actualParameter.getType()).setValue(new Float(element.getText()));
+ } else {
+ innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
+ ((FloatParameterType) actualParameter.getType()).setValue(new Float(innerelement.getText()));
+ }
+ } else if ("Boolean".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(BooleanParameterType.type);
+ if (!"".equals(element.getText())) {
+ ((BooleanParameterType) actualParameter.getType()).setValue(new Boolean(element.getText()));
+ } else {
+ innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
+ ((BooleanParameterType) actualParameter.getType()).setValue(Boolean.parseBoolean(innerelement.getText()));
+ }
+ } else if ("File".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(FileParameterType.type);
+ if (!"".equals(element.getText())) {
+ ((FileParameterType) actualParameter.getType()).setValue(element.getText());
+ } else {
+ innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
+ ((FileParameterType) actualParameter.getType()).setValue(innerelement.getText());
+ }
+ } else if ("URI".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(URIParameterType.type);
+ if (!"".equals(element.getText())) {
+ ((URIParameterType) actualParameter.getType()).setValue(element.getText());
+ } else if (element.getChildrenWithLocalName("value").hasNext()) {
+ innerelement = (OMElement) element.getChildrenWithLocalName("value").next();
+ System.out.println(actualParameter.getType().toString());
+ log.debug(actualParameter.getType().toString());
+ ((URIParameterType) actualParameter.getType()).setValue(innerelement.getText());
+ } else {
+ ((URIParameterType) actualParameter.getType()).setValue("");
+ }
+ } else if ("StringArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(StringArrayType.type);
+ Iterator value = element.getChildrenWithLocalName("value");
+ int i = 0;
+ if (!"".equals(element.getText())) {
+ String[] list = StringUtil.getElementsFromString(element.getText());
+ for (String arrayValue : list) {
+ ((StringArrayType) actualParameter.getType()).insertValue(i++, arrayValue);
+ }
+ } else {
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((StringArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
+ }
+ }
+ } else if ("DoubleArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(DoubleArrayType.type);
+ Iterator value = element.getChildrenWithLocalName("value");
+ int i = 0;
+ if (!"".equals(element.getText())) {
+ String[] list = StringUtil.getElementsFromString(element.getText());
+ for (String arrayValue : list) {
+ ((DoubleArrayType) actualParameter.getType()).insertValue(i++, new Double(arrayValue));
+ }
+ } else {
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((DoubleArrayType) actualParameter.getType()).insertValue(i++, new Double(innerelement.getText()));
+ }
+ }
+
+ } else if ("IntegerArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(IntegerArrayType.type);
+ Iterator value = element.getChildrenWithLocalName("value");
+ int i = 0;
+ if (!"".equals(element.getText())) {
+ String[] list = StringUtil.getElementsFromString(element.getText());
+ for (String arrayValue : list) {
+ ((IntegerArrayType) actualParameter.getType()).insertValue(i++, new Integer(arrayValue));
+ }
+ } else {
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((IntegerArrayType) actualParameter.getType()).insertValue(i++, new Integer(innerelement.getText()));
+ }
+ }
+ } else if ("FloatArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(FloatArrayType.type);
+ Iterator value = element.getChildrenWithLocalName("value");
+ int i = 0;
+ if (!"".equals(element.getText())) {
+ String[] list = StringUtil.getElementsFromString(element.getText());
+ for (String arrayValue : list) {
+ ((FloatArrayType) actualParameter.getType()).insertValue(i++, new Float(arrayValue));
+ }
+ } else {
+
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((FloatArrayType) actualParameter.getType()).insertValue(i++, new Float(innerelement.getText()));
+ }
+ }
+ } else if ("BooleanArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(BooleanArrayType.type);
+ Iterator value = element.getChildrenWithLocalName("value");
+ int i = 0;
+ if (!"".equals(element.getText())) {
+ String[] list = StringUtil.getElementsFromString(element.getText());
+ for (String arrayValue : list) {
+ ((BooleanArrayType) actualParameter.getType()).insertValue(i++, new Boolean(arrayValue));
+ }
+ } else {
+
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((BooleanArrayType) actualParameter.getType()).insertValue(i++, new Boolean(innerelement.getText()));
+ }
+ }
+ } else if ("FileArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(FileArrayType.type);
+ Iterator value = element.getChildrenWithLocalName("value");
+ int i = 0;
+ if (!"".equals(element.getText())) {
+ String[] list = StringUtil.getElementsFromString(element.getText());
+ for (String arrayValue : list) {
+ ((FileArrayType) actualParameter.getType()).insertValue(i++, arrayValue);
+ }
+ } else {
+
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((FileArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
+ }
+ }
+ } else if ("URIArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(URIArrayType.type);
+ Iterator value = element.getChildrenWithLocalName("value");
+ int i = 0;
+ if (!"".equals(element.getText())) {
+ String[] list = StringUtil.getElementsFromString(element.getText());
+ for (String arrayValue : list) {
+ ((URIArrayType) actualParameter.getType()).insertValue(i++, arrayValue);
+ }
+ } else {
+
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((URIArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
+ }
+ }
+ }
+ return actualParameter;
+ }
+
+ public static ActualParameter getInputActualParameter(Parameter parameter, String inputVal) throws GFacException{
+ OMElement innerelement = null;
+ ActualParameter actualParameter = new ActualParameter();
+ if ("String".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(StringParameterType.type);
+ ((StringParameterType) actualParameter.getType()).setValue(inputVal);
+ } else if ("Double".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(DoubleParameterType.type);
+ ((DoubleParameterType) actualParameter.getType()).setValue(new Double(inputVal));
+ } else if ("Integer".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(IntegerParameterType.type);
+ ((IntegerParameterType) actualParameter.getType()).setValue(new Integer(inputVal));
+ } else if ("Float".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(FloatParameterType.type);
+ ((FloatParameterType) actualParameter.getType()).setValue(new Float(inputVal));
+ } else if ("Boolean".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(BooleanParameterType.type);
+ ((BooleanParameterType) actualParameter.getType()).setValue(new Boolean(inputVal));
+ } else if ("File".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(FileParameterType.type);
+ ((FileParameterType) actualParameter.getType()).setValue(inputVal);
+ } else if ("URI".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(URIParameterType.type);
+ ((URIParameterType) actualParameter.getType()).setValue(inputVal);
+ } else if ("StringArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(StringArrayType.type);
+ Iterator iterator = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
+ int i = 0;
+ while (iterator.hasNext()) {
+ innerelement = (OMElement) iterator.next();
+ ((StringArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
+ }
+ } else if ("DoubleArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(DoubleArrayType.type);
+ Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
+ int i = 0;
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((DoubleArrayType) actualParameter.getType()).insertValue(i++, new Double(innerelement.getText()));
+ }
+ } else if ("IntegerArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(IntegerArrayType.type);
+ Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
+ int i = 0;
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((IntegerArrayType) actualParameter.getType()).insertValue(i++, new Integer(innerelement.getText()));
+ }
+ } else if ("FloatArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(FloatArrayType.type);
+ Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
+ int i = 0;
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((FloatArrayType) actualParameter.getType()).insertValue(i++, new Float(innerelement.getText()));
+ }
+ } else if ("BooleanArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(BooleanArrayType.type);
+ Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
+ int i = 0;
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((BooleanArrayType) actualParameter.getType()).insertValue(i++, new Boolean(innerelement.getText()));
+ }
+ } else if ("FileArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(FileArrayType.type);
+ Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
+ int i = 0;
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((FileArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
+ }
+ } else if ("URIArray".equals(parameter.getParameterType().getName())) {
+ actualParameter = new ActualParameter(URIArrayType.type);
+ Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
+ int i = 0;
+ while (value.hasNext()) {
+ innerelement = (OMElement) value.next();
+ ((URIArrayType) actualParameter.getType()).insertValue(i++, innerelement.getText());
+ }
+ } else{
+ throw new GFacException("Input parameters are not configured properly ");
+ }
+ return actualParameter;
+ }
+
+
+ public static ApplicationJob createApplicationJob(
+ JobExecutionContext jobExecutionContext) {
+ ApplicationJob appJob = new ApplicationJob();
+ appJob.setExperimentId((String) jobExecutionContext.getProperty(Constants.PROP_TOPIC));
+ appJob.setWorkflowExecutionId(appJob.getExperimentId());
+ appJob.setNodeId((String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_NODE_ID));
+ appJob.setServiceDescriptionId(jobExecutionContext.getApplicationContext().getServiceDescription().getType().getName());
+ appJob.setHostDescriptionId(jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostName());
+ appJob.setApplicationDescriptionId(jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType().getApplicationName().getStringValue());
+ return appJob;
+ }
+
+ public static void updateApplicationJobStatusUpdateTime(JobExecutionContext context, String jobId, Date statusUpdateTime) {
+ AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
+ try {
+ airavataAPI.getProvenanceManager().updateApplicationJobStatusUpdateTime(jobId, statusUpdateTime);
+ } catch (AiravataAPIInvocationException e) {
+ log.error("Error in updating application job status time " + statusUpdateTime.toString() + " for job Id " + jobId + "!!!", e);
+ }
+ }
+
+ public static void updateApplicationJobStatus(JobExecutionContext context, String jobId, ApplicationJobStatus status, Date statusUpdateTime) {
+ AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
+ try {
+ airavataAPI.getProvenanceManager().updateApplicationJobStatus(jobId, status, statusUpdateTime);
+ } catch (AiravataAPIInvocationException e) {
+ log.error("Error in updating application job status " + status.toString() + " for job Id " + jobId + "!!!", e);
+ }
+ }
+
+ /**
+ * Gets the job ids given experiment id.
+ *
+ * @param context The job execution context.
+ * @param experimentId The experiment id.
+ * @return List of job ids relevant to given experiment id.
+ */
+ public static List<ApplicationJob> getJobIds(JobExecutionContext context, String experimentId) {
+
+ AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
+ try {
+ return airavataAPI.getProvenanceManager().getApplicationJobs(experimentId, null, null);
+ } catch (AiravataAPIInvocationException e) {
+ log.error("Error retrieving application jobs for experiment id " + experimentId, e);
+ }
+
+ return new ArrayList<ApplicationJob>(0);
+ }
+
+ /**
+ * Gets the job ids given experiment id and workflow id.
+ *
+ * @param context The job execution context.
+ * @param experimentId The experiment id.
+ * @param workflowId The workflow id
+ * @return List of job ids relevant to given experiment id and workflow id.
+ */
+ public static List<ApplicationJob> getJobIds(JobExecutionContext context, String experimentId, String workflowId) {
+
+ AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
+ try {
+ return airavataAPI.getProvenanceManager().getApplicationJobs(experimentId, workflowId, null);
+ } catch (AiravataAPIInvocationException e) {
+ log.error("Error retrieving application jobs for experiment id " + experimentId, " workflow id " +
+ workflowId, e);
+ }
+
+ return new ArrayList<ApplicationJob>(0);
+ }
+
+ /**
+ * Gets the job ids given experiment id and workflow id.
+ *
+ * @param context The job execution context.
+ * @param experimentId The experiment id.
+ * @param workflowId The workflow id
+ * @return List of job ids relevant to given experiment id and workflow id.
+ */
+ public static List<ApplicationJob> getJobIds(JobExecutionContext context, String experimentId,
+ String workflowId, String nodeId) {
+
+ AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
+ try {
+ return airavataAPI.getProvenanceManager().getApplicationJobs(experimentId, workflowId, nodeId);
+ } catch (AiravataAPIInvocationException e) {
+ log.error("Error retrieving application jobs for experiment id " + experimentId, " workflow id " +
+ workflowId, e);
+ }
+
+ return new ArrayList<ApplicationJob>(0);
+ }
+
+ /*public static RequestData getRequestData(Properties configurationProperties) {
+
+ RequestData requestData = new RequestData();
+
+ requestData.setMyProxyServerUrl(configurationProperties.getProperty(Constants.MYPROXY_SERVER));
+ requestData.setMyProxyUserName(configurationProperties.getProperty(Constants.MYPROXY_USER));
+ requestData.setMyProxyPassword(configurationProperties.getProperty(Constants.MYPROXY_PASS));
+
+ int lifeTime;
+ String sLife = configurationProperties.getProperty(Constants.MYPROXY_LIFE);
+ if (sLife != null) {
+ lifeTime = Integer.parseInt(sLife);
+ requestData.setMyProxyLifeTime(lifeTime);
+ } else {
+ log.info("The configuration does not specify a default life time");
+ }
+
+
+
+ }
+*/
+
+
+ public static void recordApplicationJob(JobExecutionContext context, ApplicationJob job) {
+ AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
+ try {
+ airavataAPI.getProvenanceManager().addApplicationJob(job);
+ } catch (AiravataAPIInvocationException e) {
+ log.error("Error in persisting application job data for application job " + job.getJobId() + "!!!", e);
+ }
+ }
+ public static void saveJobStatus(JobExecutionContext jobExecutionContext, JobDetails details, JobState state) throws GFacException {
+ try {
+ Registry registry = jobExecutionContext.getRegistry();
+ JobStatus status = new JobStatus();
+ status.setJobState(state);
+ details.setJobStatus(status);
+ registry.add(ChildDataType.JOB_DETAIL,details, new CompositeIdentifier(jobExecutionContext.getTaskData().getTaskID(), details.getJobID()));
+ } catch (Exception e) {
+ throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
+ }
+ }
+
+ public static void updateJobStatus(JobExecutionContext jobExecutionContext,JobDetails details, JobState state) throws GFacException {
+ try {
+ Registry registry = jobExecutionContext.getRegistry();
+ JobStatus status = new JobStatus();
+ status.setJobState(state);
+ status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+ details.setJobStatus(status);
+ registry.update(org.apache.airavata.registry.cpi.DataType.JOB_DETAIL, details, details.getJobID());
+ } catch (Exception e) {
+ throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
+ }
+ }
+ public static void saveErrorDetails(JobExecutionContext jobExecutionContext, String errorMessage, CorrectiveAction action, ErrorCategory errorCatogory) throws GFacException {
+ try {
+ Registry registry = RegistryFactory.getDefaultRegistry();
+ ErrorDetails details = new ErrorDetails();
+ details.setActualErrorMessage(errorMessage);
+ details.setCorrectiveAction(action);
+ details.setActionableGroup(ActionableGroup.GATEWAYS_ADMINS);
+ details.setCreationTime(Calendar.getInstance().getTimeInMillis());
+ details.setErrorCategory(errorCatogory);
+ registry.add(ChildDataType.ERROR_DETAIL, details, jobExecutionContext.getTaskData().getTaskID());
+ } catch (Exception e) {
+ throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
+ }
+ }
+
+
+ public static Map<String, Object> getMessageContext(List<DataObjectType> experimentData,
+ Parameter[] parameters) throws GFacException {
+ HashMap<String, Object> stringObjectHashMap = new HashMap<String, Object>();
+ Map<String,DataObjectType> map = new HashMap<String,DataObjectType>();
+ for(DataObjectType objectType : experimentData){
+ map.put(objectType.getKey(), objectType);
+ }
+ for (int i = 0; i < parameters.length; i++) {
+ DataObjectType input = map.get(parameters[i].getParameterName());
+ if (input != null) {
+ stringObjectHashMap.put(parameters[i].getParameterName(), GFacUtils.getInputActualParameter(parameters[i], input));
+ } else {
+ throw new GFacException("Error finding the parameter: parameter Name" + parameters[i].getParameterName());
+ }
+ }
+ return stringObjectHashMap;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/OutputUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/OutputUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/OutputUtils.java
new file mode 100644
index 0000000..cff1367
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/OutputUtils.java
@@ -0,0 +1,105 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.core.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.commons.gfac.type.ActualParameter;
+import org.apache.airavata.commons.gfac.type.MappingFactory;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.schemas.gfac.StdErrParameterType;
+import org.apache.airavata.schemas.gfac.StdOutParameterType;
+
+public class OutputUtils {
+ private static String regexPattern = "\\s*=\\s*(.*)\\r?\\n";
+
+ public static Map<String, ActualParameter> fillOutputFromStdout(Map<String, Object> output, String stdout, String stderr) throws Exception {
+
+ if (stdout == null || stdout.equals("")){
+ throw new GFacHandlerException("Standard output is empty.");
+ }
+
+ Map<String, ActualParameter> result = new HashMap<String, ActualParameter>();
+ Set<String> keys = output.keySet();
+ for (String paramName : keys) {
+ ActualParameter actual = (ActualParameter) output.get(paramName);
+ // if parameter value is not already set, we let it go
+
+ if (actual == null) {
+ continue;
+ }
+ if ("StdOut".equals(actual.getType().getType().toString())) {
+ ((StdOutParameterType) actual.getType()).setValue(stdout);
+ result.put(paramName, actual);
+ } else if ("StdErr".equals(actual.getType().getType().toString())) {
+ ((StdErrParameterType) actual.getType()).setValue(stderr);
+ result.put(paramName, actual);
+ }else if("URI".equals(actual.getType().getType().toString())){
+ continue;
+ }
+ else {
+ String parseStdout = parseStdout(stdout, paramName);
+ if (parseStdout != null) {
+ MappingFactory.fromString(actual, parseStdout);
+ result.put(paramName, actual);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private static String parseStdout(String stdout, String outParam) throws Exception {
+ String regex = Pattern.quote(outParam) + regexPattern;
+ String match = null;
+ Pattern pattern = Pattern.compile(regex);
+ Matcher matcher = pattern.matcher(stdout);
+ while (matcher.find()) {
+ match = matcher.group(1);
+ }
+ if (match != null) {
+ match = match.trim();
+ return match;
+ } else {
+ throw new Exception("Data for the output parameter '" + outParam + "' was not found");
+ }
+ }
+
+ public static String[] parseStdoutArray(String stdout, String outParam) throws Exception {
+ String regex = Pattern.quote(outParam) + regexPattern;
+ StringBuffer match = new StringBuffer();
+ Pattern pattern = Pattern.compile(regex);
+ Matcher matcher = pattern.matcher(stdout);
+ while (matcher.find()) {
+ match.append(matcher.group(1) + StringUtil.DELIMETER);
+ }
+ if (match != null) {
+ return StringUtil.getElementsFromString(match.toString());
+ } else {
+ throw new Exception("Data for the output parameter '" + outParam + "' was not found");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java
deleted file mode 100644
index fc5fd19..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.cpi;
-
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-
-/**
- * This is the GFac CPI interface which needs to be implemented by an internal class, this simply have a single method to submit a job to
- * the resource, required data for the job has to be stored in registry prior to invoke this object.
- */
-public interface GFac {
-
- /**
- * This is the job launching method outsiders of GFac can use, this will invoke the GFac handler chain and providers
- * And update the registry occordingly, so the users can query the database to retrieve status and output from Registry
- *
- * @param experimentID
- * @return
- * @throws org.apache.airavata.gfac.GFacException
- */
- public JobExecutionContext submitJob(String experimentID,String taskID) throws GFacException;
-
- /**
- * This method has to be invoked after submitting the job and have to make sure job is properly finished
- * @param jobExecutionContext
- * @throws GFacException
- */
- public void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException;
-
-}
[4/7] moving common monitoring classes to gfac-core
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
deleted file mode 100644
index 2241cb2..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.cpi;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.commons.gfac.type.ApplicationDescription;
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.commons.gfac.type.ServiceDescription;
-import org.apache.airavata.gfac.Constants;
-import org.apache.airavata.gfac.GFacConfiguration;
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.Scheduler;
-import org.apache.airavata.gfac.context.ApplicationContext;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
-import org.apache.airavata.gfac.handler.GFacHandler;
-import org.apache.airavata.gfac.handler.GFacHandlerConfig;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.gfac.handler.ThreadedHandler;
-import org.apache.airavata.gfac.notification.events.ExecutionFailEvent;
-import org.apache.airavata.gfac.notification.listeners.LoggingListener;
-import org.apache.airavata.gfac.notification.listeners.WorkflowTrackingListener;
-import org.apache.airavata.gfac.provider.GFacProvider;
-import org.apache.airavata.gfac.scheduler.HostScheduler;
-import org.apache.airavata.gfac.utils.GFacUtils;
-import org.apache.airavata.model.workspace.experiment.DataObjectType;
-import org.apache.airavata.model.workspace.experiment.Experiment;
-import org.apache.airavata.model.workspace.experiment.TaskDetails;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.registry.cpi.DataType;
-import org.apache.airavata.registry.cpi.Registry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPathExpressionException;
-
-/**
- * This is the GFac CPI class for external usage, this simply have a single method to submit a job to
- * the resource, required data for the job has to be stored in registry prior to invoke this object.
- */
-public class GFacImpl implements GFac {
- private static final Logger log = LoggerFactory.getLogger(GFacImpl.class);
- public static final String ERROR_SENT = "ErrorSent";
-
- private Registry registry;
-
- private AiravataAPI airavataAPI;
-
- private AiravataRegistry2 airavataRegistry2;
-
- private static List<ThreadedHandler> daemonHandlers;
-
- private File gfacConfigFile;
- /**
- * Constructor for GFac
- *
- * @param registry
- * @param airavataAPI
- * @param airavataRegistry2
- */
- public GFacImpl(Registry registry, AiravataAPI airavataAPI, AiravataRegistry2 airavataRegistry2) {
- this.registry = registry;
- this.airavataAPI = airavataAPI;
- this.airavataRegistry2 = airavataRegistry2;
- daemonHandlers = new ArrayList<ThreadedHandler>();
- startDaemonHandlers();
- }
-
- private void startDaemonHandlers() {
- List<GFacHandlerConfig> daemonHandlerConfig = null;
- URL resource = GFacImpl.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
- gfacConfigFile = new File(resource.getPath());
- try {
- daemonHandlerConfig = GFacConfiguration.getDaemonHandlers(gfacConfigFile);
- } catch (ParserConfigurationException e) {
- log.error("Error parsing gfac-config.xml, double check the xml configuration",e);
- } catch (IOException e) {
- log.error("Error parsing gfac-config.xml, double check the xml configuration", e);
- } catch (SAXException e) {
- log.error("Error parsing gfac-config.xml, double check the xml configuration", e);
- } catch (XPathExpressionException e) {
- log.error("Error parsing gfac-config.xml, double check the xml configuration", e);
- }
-
- for(GFacHandlerConfig handlerConfig:daemonHandlerConfig){
- String className = handlerConfig.getClassName();
- try {
- Class<?> aClass = Class.forName(className).asSubclass(ThreadedHandler.class);
- ThreadedHandler threadedHandler = (ThreadedHandler) aClass.newInstance();
- threadedHandler.initProperties(handlerConfig.getProperties());
- daemonHandlers.add(threadedHandler);
- }catch (ClassNotFoundException e){
- log.error("Error initializing the handler: " + className);
- log.error(className + " class has to implement " + ThreadedHandler.class);
- } catch (InstantiationException e) {
- log.error("Error initializing the handler: " + className);
- log.error(className + " class has to implement " + ThreadedHandler.class);
- } catch (IllegalAccessException e) {
- log.error("Error initializing the handler: " + className);
- log.error(className + " class has to implement " + ThreadedHandler.class);
- } catch (GFacHandlerException e) {
- log.error("Error initializing the handler " + className);
- } catch (GFacException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
- for(ThreadedHandler tHandler:daemonHandlers){
- (new Thread(tHandler)).start();
- }
- }
-
- /**
- * This can be used to submit jobs for testing purposes just by filling parameters by hand (JobExecutionContext)
- */
- public GFacImpl() {
- daemonHandlers = new ArrayList<ThreadedHandler>();
- startDaemonHandlers();
- }
-
- /**
- * This is the job launching method outsiders of GFac can use, this will invoke the GFac handler chain and providers
- * And update the registry occordingly, so the users can query the database to retrieve status and output from Registry
- *
- * @param experimentID
- * @return
- * @throws GFacException
- */
- public JobExecutionContext submitJob(String experimentID,String taskID) throws GFacException {
- JobExecutionContext jobExecutionContext = null;
- try {
- jobExecutionContext = createJEC(experimentID, taskID);
-
- return submitJob(jobExecutionContext);
- } catch (Exception e) {
- log.error("Error inovoking the job with experiment ID: " + experimentID);
- throw new GFacException(e);
- }
- }
-
- private JobExecutionContext createJEC(String experimentID, String taskID) throws Exception {
- JobExecutionContext jobExecutionContext;
- TaskDetails taskData = (TaskDetails) registry.get(DataType.TASK_DETAIL, taskID);
-
- // this is wear our new model and old model is mapping (so serviceName in ExperimentData and service name in ServiceDescriptor
- // has to be same.
-
- // 1. Get the Task from the task ID and construct the Job object and save it in to registry
- // 2. Add another property to jobExecutionContext and read them inside the provider and use it.
- String serviceName = taskData.getApplicationId();
- if (serviceName == null) {
- throw new GFacException("Error executing the job because there is not Application Name in this Experiment");
- }
- List<HostDescription> registeredHosts = new ArrayList<HostDescription>();
- Map<String, ApplicationDescription> applicationDescriptors = airavataRegistry2.getApplicationDescriptors(serviceName);
- for (String hostDescName : applicationDescriptors.keySet()) {
- registeredHosts.add(airavataRegistry2.getHostDescriptor(hostDescName));
- }
- Class<? extends HostScheduler> aClass = Class.forName(ServerSettings.getHostScheduler()).asSubclass(HostScheduler.class);
- HostScheduler hostScheduler = aClass.newInstance();
- HostDescription hostDescription = hostScheduler.schedule(registeredHosts);
-
- ServiceDescription serviceDescription = airavataRegistry2.getServiceDescriptor(serviceName);
- String hostName;
- if(taskData.getTaskScheduling().getResourceHostId() != null){
- hostName = taskData.getTaskScheduling().getResourceHostId();
- }else{
- hostName = hostDescription.getType().getHostName();
- }
-
- ApplicationDescription applicationDescription = airavataRegistry2.getApplicationDescriptors(serviceName, hostName);
- URL resource = GFacImpl.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
- Properties configurationProperties = ServerSettings.getProperties();
- GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()), airavataAPI, configurationProperties);
-
-
- // start constructing jobexecutioncontext
- jobExecutionContext = new JobExecutionContext(gFacConfiguration, serviceName);
- Experiment experiment = (Experiment) registry.get(DataType.EXPERIMENT, experimentID);
- jobExecutionContext.setExperiment(experiment);
- jobExecutionContext.setExperimentID(experimentID);
-
- jobExecutionContext.setTaskData(taskData);
-
-
-
-
- jobExecutionContext.setRegistry(registry);
-
- ApplicationContext applicationContext = new ApplicationContext();
- applicationContext.setApplicationDeploymentDescription(applicationDescription);
- applicationContext.setHostDescription(hostDescription);
- applicationContext.setServiceDescription(serviceDescription);
- jobExecutionContext.setApplicationContext(applicationContext);
-
- List<DataObjectType> experimentInputs = taskData.getApplicationInputs();
- jobExecutionContext.setInMessageContext(new MessageContext(GFacUtils.getMessageContext(experimentInputs,
- serviceDescription.getType().getInputParametersArray())));
-
- List<DataObjectType> outputData = taskData.getApplicationOutputs();
- jobExecutionContext.setOutMessageContext(new MessageContext(GFacUtils.getMessageContext(outputData,
- serviceDescription.getType().getOutputParametersArray())));
-
- jobExecutionContext.setProperty(Constants.PROP_TOPIC, experimentID);
-
- return jobExecutionContext;
- }
-
- public JobExecutionContext submitJob(JobExecutionContext jobExecutionContext) throws GFacException {
- // We need to check whether this job is submitted as a part of a large workflow. If yes,
- // we need to setup workflow tracking listerner.
- String workflowInstanceID = null;
- if ((workflowInstanceID = (String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_INSTANCE_ID)) != null) {
- // This mean we need to register workflow tracking listener.
- //todo implement WorkflowTrackingListener properly
- registerWorkflowTrackingListener(workflowInstanceID, jobExecutionContext);
- }
- // Register log event listener. This is required in all scenarios.
- jobExecutionContext.getNotificationService().registerListener(new LoggingListener());
- schedule(jobExecutionContext);
- return jobExecutionContext;
- }
-
- private void schedule(JobExecutionContext jobExecutionContext) throws GFacException {
- // Scheduler will decide the execution flow of handlers and provider which handles
- // the job.
- String experimentID = jobExecutionContext.getExperimentID();
- try {
- Scheduler.schedule(jobExecutionContext);
-
- // Executing in handlers in the order as they have configured in GFac configuration
- invokeInFlowHandlers(jobExecutionContext);
-// if (experimentID != null){
-// registry2.changeStatus(jobExecutionContext.getExperimentID(),AiravataJobState.State.INHANDLERSDONE);
-// }
-
- // After executing the in handlers provider instance should be set to job execution context.
- // We get the provider instance and execute it.
- GFacProvider provider = jobExecutionContext.getProvider();
- if (provider != null) {
- initProvider(provider, jobExecutionContext);
- executeProvider(provider, jobExecutionContext);
- disposeProvider(provider, jobExecutionContext);
- }
- if(GFacUtils.isSynchronousMode(jobExecutionContext)){
- invokeOutFlowHandlers(jobExecutionContext);
- }
- } catch (Exception e) {
- jobExecutionContext.setProperty(ERROR_SENT, "true");
- jobExecutionContext.getNotifier().publish(new ExecutionFailEvent(e.getCause()));
- throw new GFacException(e.getMessage(), e);
- }
- }
-
- private void initProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException {
- try {
- provider.initialize(jobExecutionContext);
- } catch (Exception e) {
- throw new GFacException("Error while initializing provider " + provider.getClass().getName() + ".", e);
- }
- }
-
- private void executeProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException {
- try {
- provider.execute(jobExecutionContext);
- } catch (Exception e) {
- throw new GFacException("Error while executing provider " + provider.getClass().getName() + " functionality.", e);
- }
- }
-
- private void disposeProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException {
- try {
- provider.dispose(jobExecutionContext);
- } catch (Exception e) {
- throw new GFacException("Error while invoking provider " + provider.getClass().getName() + " dispose method.", e);
- }
- }
-
- private void registerWorkflowTrackingListener(String workflowInstanceID, JobExecutionContext jobExecutionContext) {
- String workflowNodeID = (String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_NODE_ID);
- String topic = (String) jobExecutionContext.getProperty(Constants.PROP_TOPIC);
- String brokerUrl = (String) jobExecutionContext.getProperty(Constants.PROP_BROKER_URL);
- jobExecutionContext.getNotificationService().registerListener(
- new WorkflowTrackingListener(workflowInstanceID, workflowNodeID, brokerUrl, topic));
-
- }
-
- private void invokeInFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException {
- List<GFacHandlerConfig> handlers = jobExecutionContext.getGFacConfiguration().getInHandlers();
- for (GFacHandlerConfig handlerClassName : handlers) {
- Class<? extends GFacHandler> handlerClass;
- GFacHandler handler;
- try {
- handlerClass = Class.forName(handlerClassName.getClassName().trim()).asSubclass(GFacHandler.class);
- handler = handlerClass.newInstance();
- handler.initProperties(handlerClassName.getProperties());
- } catch (ClassNotFoundException e) {
- throw new GFacException("Cannot load handler class " + handlerClassName, e);
- } catch (InstantiationException e) {
- throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
- } catch (IllegalAccessException e) {
- throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
- }
- try {
- handler.invoke(jobExecutionContext);
- } catch (GFacHandlerException e) {
- throw new GFacException("Error Executing a InFlow Handler", e.getCause());
- }
- }
- }
-
- public void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException {
- GFacConfiguration gFacConfiguration = jobExecutionContext.getGFacConfiguration();
- List<GFacHandlerConfig> handlers = null;
- if(gFacConfiguration != null){
- handlers = jobExecutionContext.getGFacConfiguration().getOutHandlers();
- }else {
- try {
- jobExecutionContext = createJEC(jobExecutionContext.getExperimentID(), jobExecutionContext.getTaskData().getTaskID());
- } catch (Exception e) {
- log.error("Error constructing job execution context during outhandler invocation");
- throw new GFacException(e);
- }
- schedule(jobExecutionContext);
- }
- for (GFacHandlerConfig handlerClassName : handlers) {
- Class<? extends GFacHandler> handlerClass;
- GFacHandler handler;
- try {
- handlerClass = Class.forName(handlerClassName.getClassName().trim()).asSubclass(GFacHandler.class);
- handler = handlerClass.newInstance();
- handler.initProperties(handlerClassName.getProperties());
- } catch (ClassNotFoundException e) {
- log.error(e.getMessage());
- throw new GFacException("Cannot load handler class " + handlerClassName, e);
- } catch (InstantiationException e) {
- log.error(e.getMessage());
- throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
- } catch (IllegalAccessException e) {
- log.error(e.getMessage());
- throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
- }
- try {
- handler.invoke(jobExecutionContext);
- } catch (Exception e) {
- // TODO: Better error reporting.
- throw new GFacException("Error Executing a OutFlow Handler", e);
- }
- }
- }
-
-
- public AiravataAPI getAiravataAPI() {
- return airavataAPI;
- }
-
- public AiravataRegistry2 getAiravataRegistry2() {
- return airavataRegistry2;
- }
-
- public static List<ThreadedHandler> getDaemonHandlers() {
- return daemonHandlers;
- }
-
- public static String getErrorSent() {
- return ERROR_SENT;
- }
-
- public File getGfacConfigFile() {
- return gfacConfigFile;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AbstractHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AbstractHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AbstractHandler.java
deleted file mode 100644
index 3524cdb..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AbstractHandler.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.handler;
-
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.Registry;
-
-public abstract class AbstractHandler implements GFacHandler {
- protected Registry registry = null;
-
- public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
- registry = jobExecutionContext.getRegistry();
- if(registry == null){
- registry = RegistryFactory.getDefaultRegistry();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java
deleted file mode 100644
index 7cc5a47..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.handler;
-
-import org.apache.airavata.commons.gfac.type.ApplicationDescription;
-import org.apache.airavata.gfac.Constants;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-
-public class AppDescriptorCheckHandler implements GFacHandler {
- private static final Logger logger = LoggerFactory.getLogger(AppDescriptorCheckHandler.class);
-
- public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
- logger.info("Invoking ApplicationDescriptorCheckHandler ...");
- ApplicationDescription app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
- ApplicationDeploymentDescriptionType appDesc = app.getType();
- if (appDesc.getScratchWorkingDirectory() == null) {
- appDesc.setScratchWorkingDirectory("/tmp");
- }
-
- /*
- * Working dir
- */
- if (appDesc.getStaticWorkingDirectory() == null || "null".equals(appDesc.getStaticWorkingDirectory())) {
- String date = new Date().toString();
- date = date.replaceAll(" ", "_");
- date = date.replaceAll(":", "_");
-
- String tmpDir = appDesc.getScratchWorkingDirectory() + File.separator
- + jobExecutionContext.getServiceName() + "_" + date + "_" + UUID.randomUUID();
-
- appDesc.setStaticWorkingDirectory(tmpDir);
- }
- //FIXME: Move this input/output to application descrpitor
- /*
- * Input and Output Directory
- */
- if (appDesc.getInputDataDirectory() == null || "".equals(appDesc.getInputDataDirectory())) {
- appDesc.setInputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + Constants.INPUT_DATA_DIR_VAR_NAME);
- }
- if (appDesc.getOutputDataDirectory() == null || "".equals(appDesc.getOutputDataDirectory())) {
- appDesc.setOutputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + Constants.OUTPUT_DATA_DIR_VAR_NAME);
- }
-
- /*
- * Stdout and Stderr for Shell
- */
- if (appDesc.getStandardOutput() == null || "".equals(appDesc.getStandardOutput())) {
- appDesc.setStandardOutput(appDesc.getStaticWorkingDirectory() + File.separator
- + appDesc.getApplicationName().getStringValue() + ".stdout");
- }
- if (appDesc.getStandardError() == null || "".equals(appDesc.getStandardError())) {
- appDesc.setStandardError(appDesc.getStaticWorkingDirectory() + File.separator
- + appDesc.getApplicationName().getStringValue() + ".stderr");
- }
- jobExecutionContext.getApplicationContext().setApplicationDeploymentDescription(app);
- }
-
- public void initProperties(Map<String, String> properties) throws GFacHandlerException {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandler.java
deleted file mode 100644
index 8f86a48..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.handler;
-
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-
-import java.util.Map;
-
-public interface GFacHandler {
-
- public void initProperties(Map<String, String> properties) throws GFacHandlerException;
-
- public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerConfig.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerConfig.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerConfig.java
deleted file mode 100644
index 585cce6..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerConfig.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.handler;
-
-import java.util.Map;
-
-public class GFacHandlerConfig {
-
- public GFacHandlerConfig(Map<String, String> properties, String className) {
- this.properties = properties;
- this.className = className;
- }
-
- private Map<String,String> properties;
-
- private String className;
-
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public String getClassName() {
- return className;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java
deleted file mode 100644
index 775e515..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.handler;
-
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GFacHandlerException extends GFacException {
- private static final Logger log = LoggerFactory.getLogger(GFacHandlerException.class);
-
- public GFacHandlerException(String message) {
- super(message, new Throwable(message));
- log.error(message);
- }
-
- public GFacHandlerException(String s, Throwable throwable) {
- super(s, throwable);
- log.error(s,throwable);
- }
-
- public GFacHandlerException(String message, Exception e, String... additionExceptiondata) {
- super(message, e);
- log.error(message,e);
- }
- public GFacHandlerException(Exception e) {
- super(e);
- log.error(e.getMessage(),e);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/ThreadedHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/ThreadedHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/ThreadedHandler.java
deleted file mode 100644
index fadf120..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/ThreadedHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.handler;
-
-/**
- * This handler can be used to run in a separate thread in handler chain or as a daemon
- * for the gfac instance you are running. If this is configured as another
- * handler in the execution chain this will get invoked in asynchronous mode in a separate
- * thread for each request, so you have to make sure the thread is returning properly.
- */
-public abstract class ThreadedHandler extends AbstractHandler implements Runnable{
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/GFacNotifier.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/GFacNotifier.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/GFacNotifier.java
deleted file mode 100644
index 0828c1b..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/GFacNotifier.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.notification;
-
-import com.google.common.eventbus.EventBus;
-import org.apache.airavata.gfac.notification.events.GFacEvent;
-
-public class GFacNotifier {
- private EventBus eventBus;
-
- public GFacNotifier(){
- eventBus = new EventBus();
- }
-
- public void registerListener(Object listener){
- eventBus.register(listener);
- }
-
- public void publish(GFacEvent event){
- eventBus.post(event);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/ExecutionFailEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/ExecutionFailEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/ExecutionFailEvent.java
deleted file mode 100644
index db96228..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/ExecutionFailEvent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.notification.events;
-
-public class ExecutionFailEvent extends GFacEvent {
- private Throwable cause;
-
- public ExecutionFailEvent(Throwable cause){
- this.eventType = ExecutionFailEvent.class.getSimpleName();
- this.cause = cause;
- }
-
- public Throwable getCauseForFailure(){
- return cause;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishExecutionEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishExecutionEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishExecutionEvent.java
deleted file mode 100644
index 0a0a7e4..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishExecutionEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.notification.events;
-
-public class FinishExecutionEvent extends GFacEvent{
-
- public FinishExecutionEvent(){
- this.eventType = FinishExecutionEvent.class.getSimpleName();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishScheduleEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishScheduleEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishScheduleEvent.java
deleted file mode 100644
index d710b74..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishScheduleEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.notification.events;
-
-public class FinishScheduleEvent extends GFacEvent {
-
- public FinishScheduleEvent(){
- this.eventType = FinishScheduleEvent.class.getSimpleName();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/GFacEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/GFacEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/GFacEvent.java
deleted file mode 100644
index 21fc8af..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/GFacEvent.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.notification.events;
-
-import org.apache.airavata.gfac.context.JobExecutionContext;
-
-public abstract class GFacEvent {
-
- protected JobExecutionContext executionContext;
-
- protected String eventType;
-
- public JobExecutionContext getJobExecutionContext(){
- return executionContext;
- }
-
- public String getEventType(){
- return eventType;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/JobIDEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/JobIDEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/JobIDEvent.java
deleted file mode 100644
index 32cb1cc..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/JobIDEvent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.notification.events;
-
-public class JobIDEvent extends GFacEvent {
- String statusMessage;
-
- public JobIDEvent(String message) {
- statusMessage = message;
- this.eventType = JobIDEvent.class.getSimpleName();
- }
-
- public String getStatusMessage() {
- return statusMessage;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartExecutionEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartExecutionEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartExecutionEvent.java
deleted file mode 100644
index 08feaaa..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartExecutionEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.notification.events;
-
-public class StartExecutionEvent extends GFacEvent {
-
- public StartExecutionEvent(){
- this.eventType = StartExecutionEvent.class.getSimpleName();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartScheduleEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartScheduleEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartScheduleEvent.java
deleted file mode 100644
index 5934371..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartScheduleEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.notification.events;
-
-public class StartScheduleEvent extends GFacEvent {
-
- public StartScheduleEvent(){
- this.eventType = StartScheduleEvent.class.getSimpleName();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java
deleted file mode 100644
index 7ba2af3..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.notification.events;
-
-public class StatusChangeEvent extends GFacEvent {
- String statusMessage;
- public StatusChangeEvent(String message){
- statusMessage = message;
- this.eventType = StatusChangeEvent.class.getSimpleName();
- }
-
- public String getStatusMessage() {
- return statusMessage;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/UnicoreJobIDEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/UnicoreJobIDEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/UnicoreJobIDEvent.java
deleted file mode 100644
index a04e3ab..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/UnicoreJobIDEvent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.notification.events;
-
-public class UnicoreJobIDEvent extends GFacEvent {
- String statusMessage;
-
- public UnicoreJobIDEvent(String message) {
- statusMessage = message;
- this.eventType = UnicoreJobIDEvent.class.getSimpleName();
- }
-
- public String getStatusMessage() {
- return statusMessage;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java
deleted file mode 100644
index c59204c..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.notification.listeners;
-
-import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.gfac.notification.events.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LoggingListener {
- private static Logger log = LoggerFactory.getLogger("gfac-logginglistener");
-
- @Subscribe
- public void logGFacEvent(GFacEvent e){
- log.info("GFac event of type " + e.getEventType() + " received.");
- }
-
- @Subscribe
- public void logExecutionFail(ExecutionFailEvent e){
- log.error("Execution failed." + e.getEventType());
- }
-
- @Subscribe
- public void logFinishExecutionEvent(FinishExecutionEvent event){
- log.info("Execution has Finished ...");
- }
-
- @Subscribe
- public void logStartExecutionEvent(StartExecutionEvent event){
- log.info("Execution has started ...");
- }
-
- @Subscribe
- public void logStatusChangeEvent(StatusChangeEvent event){
- log.info("Job status has changed ...");
- log.info(event.getStatusMessage());
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java
deleted file mode 100644
index d2d813a..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.notification.listeners;
-
-import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.gfac.notification.events.*;
-import org.apache.airavata.workflow.tracking.Notifier;
-import org.apache.airavata.workflow.tracking.NotifierFactory;
-import org.apache.airavata.workflow.tracking.common.DurationObj;
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-
-import java.net.URI;
-import java.util.Properties;
-
-public class WorkflowTrackingListener {
-
- private Notifier notifier;
-
- private String topic;
-
- private URI workflowID;
-
- private WorkflowTrackingContext context;
-
- private InvocationEntity initiator;
-
- private InvocationEntity receiver;
-
- private DurationObj duration;
-
- private org.apache.airavata.workflow.tracking.common.InvocationContext invocationContext;
-
- public WorkflowTrackingListener(String workflowID, String workflowNodeID, String brokerURL, String topic){
- this.topic = topic;
- this.workflowID = URI.create(this.topic);
- this.notifier = NotifierFactory.createNotifier();
- URI initiatorWorkflowID = URI.create(workflowID);
- URI initiatorServiceID = URI.create(topic);
- String initiatorWorkflowNodeID = workflowNodeID;
- Integer initiatorWorkflowTimeStep = null;
- this.context = this.notifier.createTrackingContext(new Properties(), brokerURL, initiatorWorkflowID, initiatorServiceID,
- initiatorWorkflowNodeID, initiatorWorkflowTimeStep);
- this.context.setTopic(topic);
- this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID,
- initiatorWorkflowTimeStep);
-
- URI receiverWorkflowID = this.workflowID;
- URI receiverServiceID = this.workflowID;
- String receiverWorkflowNodeID = null;
- Integer receiverWorkflowTimeStep = null;
-
- setReceiver(this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
- receiverWorkflowTimeStep));
- // send start workflow
- this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator);
- }
-
-
-
- @Subscribe
- public void startExecution(StartExecutionEvent e) {
- this.duration = this.notifier.computationStarted();
- }
-
- @Subscribe
- public void finishExecution(FinishExecutionEvent e) {
- this.duration = this.notifier.computationFinished(this.context, this.duration);
- }
-
- @Subscribe
- public void statusChanged(StatusChangeEvent event) {
- this.notifier.info(this.context, event.getStatusMessage());
- }
-
- @Subscribe
- public void startSchedule(StartScheduleEvent e){
- this.notifier.info(this.context,e.getEventType());
- }
-
- @Subscribe
- public void executionFail(ExecutionFailEvent e) {
- this.notifier.sendingFault(this.context, this.invocationContext, e.getCauseForFailure().getMessage());
- }
-
-
- @Subscribe
- public void info(String... data) {
- this.notifier.info(this.context, data);
- }
-
- @Subscribe
- public void warning(String... data) {
- }
-
- @Subscribe
- public void exception(String... data) {
- }
-
- @Subscribe
- public void finishSchedule(FinishScheduleEvent e){
- this.notifier.info(this.context,e.getEventType());
- }
-
-
- public InvocationEntity getReceiver() {
- return receiver;
- }
-
- public void setReceiver(InvocationEntity receiver) {
- this.receiver = receiver;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobData.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobData.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobData.java
deleted file mode 100644
index c504a55..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobData.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.persistence;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 6/18/13
- * Time: 2:34 PM
- */
-
-public class JobData {
-
- private String jobId;
- private int state;
-
- public JobData(String id, int state) {
- this.jobId = id;
- this.state = state;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public int getState() {
- return state;
- }
-
- public void setState(int state) {
- this.state = state;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobPersistenceManager.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobPersistenceManager.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobPersistenceManager.java
deleted file mode 100644
index 9aaedc0..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobPersistenceManager.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.persistence;
-
-
-import org.apache.airavata.gfac.GFacException;
-
-import java.util.List;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 6/18/13
- * Time: 2:23 PM
- */
-
-/**
- * Responsible persisting job data. This data is useful during a restart.
- * When restarting Airavata can resume monitoring currently executing jobs.
- */
-public interface JobPersistenceManager {
-
- /**
- * Updates the job state in the persisting storage.
- * @param jobData Job data to update.
- * @throws GFacException If an error occurred while updating job data.
- */
- void updateJobStatus (JobData jobData) throws GFacException;
-
- /**
- * Get all running jobs.
- * @return Job ids which are not failed nor completed.
- * @throws GFacException If an error occurred while querying job data.
- */
- List<JobData> getRunningJobs() throws GFacException;
-
- /**
- * Get all failed job ids.
- * @return Failed job ids.
- * @throws GFacException If an error occurred while querying job data.
- */
- List<JobData> getFailedJobs() throws GFacException;
-
- /**
- * Get all un-submitted job ids.
- * @return Un-submitted job ids.
- * @throws GFacException If an error occurred while querying job data.
- */
- List<JobData> getUnSubmittedJobs() throws GFacException;
-
- /**
- * Get all successfully completed job ids.
- * @return Successfully completed job ids.
- * @throws GFacException If an error occurred while querying job data.
- */
- List<JobData> getSuccessfullyCompletedJobs() throws GFacException;
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java
deleted file mode 100644
index 0b712b0..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.provider;
-
-import java.util.List;
-
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.model.workspace.experiment.JobDetails;
-import org.apache.airavata.model.workspace.experiment.JobStatus;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.Registry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractProvider implements GFacProvider{
- private final Logger log = LoggerFactory.getLogger(this.getClass());
-
- protected Registry registry = null;
- protected JobDetails details; //todo we need to remove this and add methods to fill Job details, this is not a property of a provider
- protected JobStatus status; //todo we need to remove this and add methods to fill Job details, this is not a property of a provider
- protected JobExecutionContext jobExecutionContext;
-
- public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException {
- log.debug("Initializing " + this.getClass().getName());
- registry = RegistryFactory.getDefaultRegistry();
- details = new JobDetails();
- status = new JobStatus();
- this.jobExecutionContext=jobExecutionContext;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java
deleted file mode 100644
index 85d1dc5..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.provider;
-
-import java.util.Map;
-
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-
-public interface GFacProvider{
-
- void initProperties(Map<String,String> properties) throws GFacProviderException,GFacException;
- /**
- * Initialize environment required for invoking the execute method of the provider. If environment setup is
- * done during the in handler execution, validation of environment will go here.
- * @param jobExecutionContext containing job execution related information.
- * @throws GFacProviderException in case of a error initializing the environment.
- */
- void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException,GFacException;
-
- /**
- * Invoke the providers intended functionality using information and data in job execution context.
- * @param jobExecutionContext containing job execution related information.
- * @throws GFacProviderException in case of a error executing the job.
- */
- void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException;
-
- /**
- * Cleans up the acquired resources during initialization and execution of the job.
- * @param jobExecutionContext containing job execution related information.
- * @throws GFacProviderException in case of a error cleaning resources.
- */
- void dispose(JobExecutionContext jobExecutionContext) throws GFacProviderException,GFacException;
-
- /**
- * Cancels all jobs relevant to an experiment.
- * @param jobId The experiment id
- * @param jobExecutionContext The job execution context, contains runtime information.
- * @throws GFacException If an error occurred while cancelling the job.
- */
- public void cancelJob(String jobId, JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException;
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderConfig.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderConfig.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderConfig.java
deleted file mode 100644
index 5a7b2e3..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderConfig.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.provider;
-
-import java.util.Map;
-
-public class GFacProviderConfig {
-
- public GFacProviderConfig(Map<String, String> properties, String className) {
- this.properties = properties;
- this.className = className;
- }
-
- private Map<String, String> properties;
-
- private String className;
-
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public String getClassName() {
- return className;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java
deleted file mode 100644
index 8eafb1e..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.provider;
-
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GFacProviderException extends Exception {
- private static final Logger log = LoggerFactory.getLogger(GFacProviderException.class);
-
- private String aditionalInfo[] = null;
-
- public GFacProviderException(String message) {
- super(message);
- log.error(message);
- }
-
-
- public GFacProviderException(String message, Throwable cause) {
- super(message, cause);
- log.error(message,cause);
- }
-
-
- public GFacProviderException(String message, Exception e, String... additionExceptiondata) {
- super(message);
- this.aditionalInfo = additionExceptiondata;
- log.error(message,e);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/DataIDType.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/DataIDType.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/DataIDType.java
deleted file mode 100644
index e2dc268..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/DataIDType.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.provider.utils;
-
-import org.apache.airavata.gfac.provider.GFacProviderException;
-import org.xmlpull.v1.builder.XmlElement;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-
-/**
- * Represents a DataID (A schema with real names), currently it only sends a one
- * location value.
- */
-public class DataIDType {
- public static final String LOCATION_ATTRIBUTE = "location";
-
- private URI dataID;
-
- private ArrayList<URI> dataLocations = new ArrayList<URI>();
-
- public URI getRealLocation() {
- if (dataLocations.size() > 0) {
- return dataLocations.get(0);
- } else {
- return null;
- }
- }
-
- public DataIDType(XmlElement ele) throws GFacProviderException {
- try {
- String value = ele.requiredTextContent();
- if (value != null) {
- this.dataID = new URI(value);
- } else {
- throw new GFacProviderException(
- "Illegal InputMessage, No value content found for the parameter "
- + ele.getName() + "/value. Invalid Local Argument");
- }
- String location = ele.getAttributeValue(null, DataIDType.LOCATION_ATTRIBUTE);
- if (location != null) {
- addDataLocation(new URI(location));
- }
- } catch (URISyntaxException e) {
- throw new GFacProviderException("Invalid Local Argument", e);
- }
- }
-
- public DataIDType(URI dataID) {
- super();
- this.dataID = dataID;
- }
-
- public void addDataLocation(URI dataLocation) {
- dataLocations.add(dataLocation);
- }
-
- public ArrayList<URI> getDataLocations() {
- return dataLocations;
- }
-
- public URI getDataID() {
- return dataID;
- }
-
- public void fillData(XmlElement ele) {
- ele.addChild(dataID.toString());
- URI location = getRealLocation();
- if (location != null) {
- ele.addAttribute(DataIDType.LOCATION_ATTRIBUTE, location.toString());
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ProviderUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ProviderUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ProviderUtils.java
deleted file mode 100644
index 6d276d3..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ProviderUtils.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.provider.utils;
-
-import org.apache.airavata.commons.gfac.type.ActualParameter;
-import org.apache.airavata.commons.gfac.type.MappingFactory;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
-import org.apache.airavata.gfac.provider.GFacProviderException;
-import org.apache.airavata.schemas.gfac.InputParameterType;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ProviderUtils {
-
- public static List<String> getInputParameters(JobExecutionContext jobExecutionContext) throws GFacProviderException {
- List<String> parameters = new ArrayList<String>();
- MessageContext inMessageContext = jobExecutionContext.getInMessageContext();
- InputParameterType[] inputParamDefinitionArray = jobExecutionContext.getApplicationContext().
- getServiceDescription().getType().getInputParametersArray();
- for (InputParameterType inputParam : inputParamDefinitionArray) {
- String parameterName = inputParam.getParameterName();
- ActualParameter parameter = (ActualParameter)inMessageContext.getParameter(parameterName);
- if(parameter == null){
- throw new GFacProviderException("Cannot find required input parameter " + parameterName + ".");
- }
-
- parameters.add(MappingFactory.toString(parameter));
- }
-
- return parameters;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceRequirement.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceRequirement.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceRequirement.java
deleted file mode 100644
index 9ca05dd..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceRequirement.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.provider.utils;
-
-public interface ResourceRequirement extends Cloneable {
-
- /**
- * States whether this resource requirement is active
- * and should be written into the job description.
- * @return
- */
- public boolean isEnabled();
-
- public void setEnabled(boolean enabled);
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/HostScheduler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/HostScheduler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/HostScheduler.java
deleted file mode 100644
index 982ea3d..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/HostScheduler.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.scheduler;
-
-import org.apache.airavata.commons.gfac.type.HostDescription;
-
-import java.util.List;
-
-public interface HostScheduler {
- /**
- * This method will pick a host among set of hosts based on the algorithm users wants to implement, For a single instance
- * of Airavata users can pick one Scheduler.
- * @param registeredHosts
- * @return
- */
- public HostDescription schedule(List<HostDescription> registeredHosts);
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/impl/SimpleHostScheduler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/impl/SimpleHostScheduler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/impl/SimpleHostScheduler.java
deleted file mode 100644
index cbbcbc7..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/impl/SimpleHostScheduler.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.scheduler.impl;
-
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gfac.scheduler.HostScheduler;
-
-import java.util.List;
-
-public class SimpleHostScheduler implements HostScheduler{
- public HostDescription schedule(List<HostDescription> registeredHosts) {
- //todo implement an algorithm to pick a host among different hosts, ideally this could be configurable in an xml
- return registeredHosts.get(0);
- }
-}
[2/7] moving common monitoring classes to gfac-core
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java
index e4d55b8..5494629 100644
--- a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java
+++ b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java
@@ -28,15 +28,15 @@ import java.util.Map;
import org.apache.airavata.gfac.Constants;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.notification.events.StartExecutionEvent;
+import org.apache.airavata.gfac.core.provider.AbstractProvider;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.provider.utils.ProviderUtils;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
+import org.apache.airavata.gfac.core.utils.OutputUtils;
import org.apache.airavata.gfac.local.utils.InputStreamToFileWriter;
import org.apache.airavata.gfac.local.utils.InputUtils;
-import org.apache.airavata.gfac.notification.events.StartExecutionEvent;
-import org.apache.airavata.gfac.provider.AbstractProvider;
-import org.apache.airavata.gfac.provider.GFacProviderException;
-import org.apache.airavata.gfac.provider.utils.ProviderUtils;
-import org.apache.airavata.gfac.utils.GFacUtils;
-import org.apache.airavata.gfac.utils.OutputUtils;
import org.apache.airavata.model.workspace.experiment.JobDetails;
import org.apache.airavata.model.workspace.experiment.JobState;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/LocalProviderUtil.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/LocalProviderUtil.java b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/LocalProviderUtil.java
index 4a19b65..932c693 100644
--- a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/LocalProviderUtil.java
+++ b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/LocalProviderUtil.java
@@ -20,8 +20,8 @@
*/
package org.apache.airavata.gfac.local.utils;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java b/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
index afb101c..df628e4 100644
--- a/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
+++ b/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
@@ -23,12 +23,12 @@ package org.apache.airavata.core.gfac.services.impl;
import org.apache.airavata.commons.gfac.type.*;
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.ApplicationContext;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.core.context.ApplicationContext;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.context.MessageContext;
+import org.apache.airavata.gfac.core.provider.GFacProviderException;
import org.apache.airavata.gfac.local.handler.LocalDirectorySetupHandler;
import org.apache.airavata.gfac.local.provider.impl.LocalProvider;
-import org.apache.airavata.gfac.provider.GFacProviderException;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
import org.apache.airavata.persistance.registry.jpa.impl.LoggingRegistryImpl;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
@@ -161,7 +161,7 @@ public class LocalProviderTest {
}
@Test
- public void testLocalProvider() throws GFacException,GFacProviderException{
+ public void testLocalProvider() throws GFacException,GFacProviderException {
LocalDirectorySetupHandler localDirectorySetupHandler = new LocalDirectorySetupHandler();
localDirectorySetupHandler.invoke(jobExecutionContext);
LocalProvider localProvider = new LocalProvider();
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-local/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-local/src/test/resources/gfac-config.xml b/modules/gfac/gfac-local/src/test/resources/gfac-config.xml
index 8147853..82c9ca8 100644
--- a/modules/gfac/gfac-local/src/test/resources/gfac-config.xml
+++ b/modules/gfac/gfac-local/src/test/resources/gfac-config.xml
@@ -13,7 +13,7 @@
<GFac>
<GlobalHandlers>
<InHandlers>
- <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
+ <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
<property name="name" value="value"/>
</Handler>
</InHandlers>
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AbstractActivityListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AbstractActivityListener.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AbstractActivityListener.java
deleted file mode 100644
index 63f89df..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AbstractActivityListener.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.monitor;
-
-
-public interface AbstractActivityListener {
- public void setup(Object... configurations);
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataExperimentStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataExperimentStatusUpdator.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataExperimentStatusUpdator.java
deleted file mode 100644
index a70b14f..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataExperimentStatusUpdator.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor;
-
-import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.gfac.monitor.state.ExperimentStatusChangeRequest;
-import org.apache.airavata.model.workspace.experiment.Experiment;
-import org.apache.airavata.model.workspace.experiment.ExperimentState;
-import org.apache.airavata.registry.cpi.DataType;
-import org.apache.airavata.registry.cpi.Registry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Calendar;
-
-public class AiravataExperimentStatusUpdator implements AbstractActivityListener {
- private final static Logger logger = LoggerFactory.getLogger(AiravataExperimentStatusUpdator.class);
-
- private Registry airavataRegistry;
-
- public Registry getAiravataRegistry() {
- return airavataRegistry;
- }
-
- public void setAiravataRegistry(Registry airavataRegistry) {
- this.airavataRegistry = airavataRegistry;
- }
-
- @Subscribe
- public void updateRegistry(ExperimentStatusChangeRequest experimentStatus) {
- ExperimentState state = experimentStatus.getState();
- if (state != null) {
- try {
- String experimentID = experimentStatus.getIdentity().getExperimentID();
- updateExperimentStatus(experimentID, state);
- } catch (Exception e) {
- logger.error("Error persisting data" + e.getLocalizedMessage(), e);
- }
- }
- }
-
- public void updateExperimentStatus(String experimentId, ExperimentState state) throws Exception {
- Experiment details = (Experiment)airavataRegistry.get(DataType.EXPERIMENT, experimentId);
- if(details == null) {
- details = new Experiment();
- details.setExperimentID(experimentId);
- }
- org.apache.airavata.model.workspace.experiment.ExperimentStatus status = new org.apache.airavata.model.workspace.experiment.ExperimentStatus();
- status.setExperimentState(state);
- status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
- details.setExperimentStatus(status);
- airavataRegistry.update(DataType.EXPERIMENT, details, experimentId);
- }
-
- @Override
- public void setup(Object... configurations) {
- for (Object configuration : configurations) {
- if (configuration instanceof Registry){
- this.airavataRegistry=(Registry)configuration;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataJobStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataJobStatusUpdator.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataJobStatusUpdator.java
deleted file mode 100644
index 6db5241..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataJobStatusUpdator.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor;
-
-import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
-import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.gfac.monitor.state.TaskStatusChangeRequest;
-import org.apache.airavata.model.workspace.experiment.JobDetails;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.apache.airavata.model.workspace.experiment.TaskState;
-import org.apache.airavata.registry.cpi.CompositeIdentifier;
-import org.apache.airavata.registry.cpi.DataType;
-import org.apache.airavata.registry.cpi.Registry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Calendar;
-import java.util.concurrent.BlockingQueue;
-
-public class AiravataJobStatusUpdator implements AbstractActivityListener {
- private final static Logger logger = LoggerFactory.getLogger(AiravataJobStatusUpdator.class);
-
- private Registry airavataRegistry;
-
- private MonitorPublisher monitorPublisher;
-
- private BlockingQueue<MonitorID> jobsToMonitor;
-
-
- public Registry getAiravataRegistry() {
- return airavataRegistry;
- }
-
- public void setAiravataRegistry(Registry airavataRegistry) {
- this.airavataRegistry = airavataRegistry;
- }
-
- public BlockingQueue<MonitorID> getJobsToMonitor() {
- return jobsToMonitor;
- }
-
- public void setJobsToMonitor(BlockingQueue<MonitorID> jobsToMonitor) {
- this.jobsToMonitor = jobsToMonitor;
- }
-
- @Subscribe
- public void updateRegistry(JobStatusChangeRequest jobStatus) {
- /* Here we need to parse the jobStatus message and update
- the registry accordingly, for now we are just printing to standard Out
- */
- JobState state = jobStatus.getState();
- if (state != null) {
- try {
- String taskID = jobStatus.getIdentity().getTaskId();
- String jobID = jobStatus.getIdentity().getJobId();
- updateJobStatus(taskID, jobID, state);
- } catch (Exception e) {
- logger.error("Error persisting data" + e.getLocalizedMessage(), e);
- }
- logger.info("Job ID:" + jobStatus.getIdentity().getJobId() + " is "+state.toString());
- switch (state) {
- case COMPLETE: case UNKNOWN: case CANCELED:case FAILED:case SUSPENDED:
- jobsToMonitor.remove(jobStatus.getMonitorID());
- break;
- default:
- break;
- }
- }
- }
-
- @Subscribe
- public void setupTaskStatus(JobStatusChangeRequest jobStatus){
- TaskState state=TaskState.UNKNOWN;
- switch(jobStatus.getState()){
- case ACTIVE:
- state=TaskState.EXECUTING; break;
- case CANCELED:
- state=TaskState.CANCELED; break;
- case COMPLETE:
- state=TaskState.COMPLETED; break;
- case FAILED:
- state=TaskState.FAILED; break;
- case HELD: case SUSPENDED: case QUEUED:
- state=TaskState.WAITING; break;
- case SETUP:
- state=TaskState.PRE_PROCESSING; break;
- case SUBMITTED:
- state=TaskState.STARTED; break;
- case UN_SUBMITTED:
- state=TaskState.CANCELED; break;
- case CANCELING:
- state=TaskState.CANCELING; break;
- default:
- break;
- }
- logger.debug("Publishing Task Status "+state.toString());
- monitorPublisher.publish(new TaskStatusChangeRequest(jobStatus.getIdentity(),state));
- }
-
- public void updateJobStatus(String taskId, String jobID, JobState state) throws Exception {
- CompositeIdentifier ids = new CompositeIdentifier(taskId, jobID);
- JobDetails details = (JobDetails)airavataRegistry.get(DataType.JOB_DETAIL, ids);
- if(details == null) {
- details = new JobDetails();
- }
- org.apache.airavata.model.workspace.experiment.JobStatus status = new org.apache.airavata.model.workspace.experiment.JobStatus();
- status.setJobState(state);
- status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
- details.setJobStatus(status);
- details.setJobID(jobID);
- airavataRegistry.update(DataType.JOB_DETAIL, details, ids);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void setup(Object... configurations) {
- for (Object configuration : configurations) {
- if (configuration instanceof Registry){
- this.airavataRegistry=(Registry)configuration;
- } else if (configuration instanceof BlockingQueue<?>){
- this.jobsToMonitor=(BlockingQueue<MonitorID>) configuration;
- } else if (configuration instanceof MonitorPublisher){
- this.monitorPublisher=(MonitorPublisher) configuration;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataTaskStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataTaskStatusUpdator.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataTaskStatusUpdator.java
deleted file mode 100644
index e8dd7a0..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataTaskStatusUpdator.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor;
-
-import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
-import org.apache.airavata.gfac.monitor.state.TaskStatusChangeRequest;
-import org.apache.airavata.gfac.monitor.state.WorkflowNodeStatusChangeRequest;
-import org.apache.airavata.model.workspace.experiment.TaskDetails;
-import org.apache.airavata.model.workspace.experiment.TaskState;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
-import org.apache.airavata.registry.cpi.DataType;
-import org.apache.airavata.registry.cpi.Registry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Calendar;
-
-public class AiravataTaskStatusUpdator implements AbstractActivityListener {
- private final static Logger logger = LoggerFactory.getLogger(AiravataTaskStatusUpdator.class);
-
- private Registry airavataRegistry;
-
- private MonitorPublisher monitorPublisher;
-
- public Registry getAiravataRegistry() {
- return airavataRegistry;
- }
-
- public void setAiravataRegistry(Registry airavataRegistry) {
- this.airavataRegistry = airavataRegistry;
- }
-
- @Subscribe
- public void updateRegistry(TaskStatusChangeRequest taskStatus) {
- TaskState state = taskStatus.getState();
- if (state != null) {
- try {
- String taskID = taskStatus.getIdentity().getTaskId();
- updateTaskStatus(taskID, state);
- } catch (Exception e) {
- logger.error("Error persisting data" + e.getLocalizedMessage(), e);
- }
- }
- }
-
- @Subscribe
- public void setupWorkflowNodeStatus(TaskStatusChangeRequest taskStatus){
- WorkflowNodeState state=WorkflowNodeState.UNKNOWN;
- switch(taskStatus.getState()){
- case CANCELED:
- state=WorkflowNodeState.CANCELED; break;
- case COMPLETED:
- state=WorkflowNodeState.COMPLETED; break;
- case CONFIGURING_WORKSPACE:
- state=WorkflowNodeState.INVOKED; break;
- case FAILED:
- state=WorkflowNodeState.FAILED; break;
- case EXECUTING: case WAITING: case PRE_PROCESSING: case POST_PROCESSING: case OUTPUT_DATA_STAGING: case INPUT_DATA_STAGING:
- state=WorkflowNodeState.EXECUTING; break;
- case STARTED:
- state=WorkflowNodeState.INVOKED; break;
- case CANCELING:
- state=WorkflowNodeState.CANCELING; break;
- default:
- break;
- }
- logger.debug("Publishing Experiment Status "+state.toString());
- monitorPublisher.publish(new WorkflowNodeStatusChangeRequest(taskStatus.getIdentity(),state));
- }
-
- public void updateTaskStatus(String taskId, TaskState state) throws Exception {
- TaskDetails details = (TaskDetails)airavataRegistry.get(DataType.TASK_DETAIL, taskId);
- if(details == null) {
- details = new TaskDetails();
- details.setTaskID(taskId);
- }
- org.apache.airavata.model.workspace.experiment.TaskStatus status = new org.apache.airavata.model.workspace.experiment.TaskStatus();
- status.setExecutionState(state);
- status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
- details.setTaskStatus(status);
- airavataRegistry.update(DataType.TASK_DETAIL, details, taskId);
- }
-
- @Override
- public void setup(Object... configurations) {
- for (Object configuration : configurations) {
- if (configuration instanceof Registry){
- this.airavataRegistry=(Registry)configuration;
- } else if (configuration instanceof MonitorPublisher){
- this.monitorPublisher=(MonitorPublisher) configuration;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataWorkflowNodeStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataWorkflowNodeStatusUpdator.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataWorkflowNodeStatusUpdator.java
deleted file mode 100644
index 2375d72..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/AiravataWorkflowNodeStatusUpdator.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor;
-
-import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
-import org.apache.airavata.gfac.monitor.state.ExperimentStatusChangeRequest;
-import org.apache.airavata.gfac.monitor.state.WorkflowNodeStatusChangeRequest;
-import org.apache.airavata.model.workspace.experiment.ExperimentState;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus;
-import org.apache.airavata.registry.cpi.DataType;
-import org.apache.airavata.registry.cpi.Registry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Calendar;
-
-public class AiravataWorkflowNodeStatusUpdator implements AbstractActivityListener {
- private final static Logger logger = LoggerFactory.getLogger(AiravataWorkflowNodeStatusUpdator.class);
-
- private Registry airavataRegistry;
-
- private MonitorPublisher monitorPublisher;
-
- public Registry getAiravataRegistry() {
- return airavataRegistry;
- }
-
- public void setAiravataRegistry(Registry airavataRegistry) {
- this.airavataRegistry = airavataRegistry;
- }
-
- @Subscribe
- public void updateRegistry(WorkflowNodeStatusChangeRequest workflowNodeStatus) {
- WorkflowNodeState state = workflowNodeStatus.getState();
- if (state != null) {
- try {
- String workflowNodeID = workflowNodeStatus.getIdentity().getWorkflowNodeID();
- updateWorkflowNodeStatus(workflowNodeID, state);
- } catch (Exception e) {
- logger.error("Error persisting data" + e.getLocalizedMessage(), e);
- }
- }
- }
-
- @Subscribe
- public void setupExperimentStatus(WorkflowNodeStatusChangeRequest nodeStatus){
- ExperimentState state=ExperimentState.UNKNOWN;
- switch(nodeStatus.getState()){
- case CANCELED:
- state=ExperimentState.CANCELED; break;
- case COMPLETED:
- state=ExperimentState.COMPLETED; break;
- case INVOKED:
- state=ExperimentState.LAUNCHED; break;
- case FAILED:
- state=ExperimentState.FAILED; break;
- case EXECUTING:
- state=ExperimentState.EXECUTING; break;
- case CANCELING:
- state=ExperimentState.CANCELING; break;
- default:
- break;
- }
- logger.debug("Publishing Experiment Status "+state.toString());
- monitorPublisher.publish(new ExperimentStatusChangeRequest(nodeStatus.getIdentity(),state));
- }
-
- public void updateWorkflowNodeStatus(String workflowNodeId, WorkflowNodeState state) throws Exception {
- WorkflowNodeDetails details = (WorkflowNodeDetails)airavataRegistry.get(DataType.WORKFLOW_NODE_DETAIL, workflowNodeId);
- if(details == null) {
- details = new WorkflowNodeDetails();
- details.setNodeInstanceId(workflowNodeId);
- }
- WorkflowNodeStatus status = new WorkflowNodeStatus();
- status.setWorkflowNodeState(state);
- status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
- details.setWorkflowNodeStatus(status);
- airavataRegistry.update(DataType.WORKFLOW_NODE_DETAIL, details, workflowNodeId);
- }
-
- @Override
- public void setup(Object... configurations) {
- for (Object configuration : configurations) {
- if (configuration instanceof Registry){
- this.airavataRegistry=(Registry)configuration;
- } else if (configuration instanceof MonitorPublisher){
- this.monitorPublisher=(MonitorPublisher) configuration;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/ExperimentIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/ExperimentIdentity.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/ExperimentIdentity.java
deleted file mode 100644
index ba8efeb..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/ExperimentIdentity.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.monitor;
-
-public class ExperimentIdentity {
- private String experimentID;
- public ExperimentIdentity(String experimentId) {
- setExperimentID(experimentId);
- }
- public String getExperimentID() {
- return experimentID;
- }
-
- public void setExperimentID(String experimentID) {
- this.experimentID = experimentID;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
new file mode 100644
index 0000000..da4ff88
--- /dev/null
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
@@ -0,0 +1,248 @@
+package org.apache.airavata.gfac.monitor;/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
+import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.Map;
+
+public class HPCMonitorID extends MonitorID {
+ private final static Logger logger = LoggerFactory.getLogger(HPCMonitorID.class);
+
+ private String userName;
+
+ private Timestamp jobStartedTime;
+
+ private Timestamp lastMonitored;
+
+ private HostDescription host;
+
+ private AuthenticationInfo authenticationInfo = null;
+
+ private Map<String, Object> parameters;
+
+ private String experimentID;
+
+ private String workflowNodeID;
+
+ private String taskID;
+
+ private String jobID;
+
+ private int failedCount = 0;
+
+ private JobState state;
+
+ private JobExecutionContext jobExecutionContext;
+
+ public HPCMonitorID(HostDescription host, String jobID,String taskID, String workflowNodeID, String experimentID, String userName) {
+ super(host,jobID,taskID,workflowNodeID,experimentID,userName);
+ this.host = host;
+ this.jobStartedTime = new Timestamp((new Date()).getTime());
+ this.userName = userName;
+ this.jobID = jobID;
+ this.taskID = taskID;
+ this.experimentID = experimentID;
+ this.workflowNodeID = workflowNodeID;
+ }
+
+ public HPCMonitorID(AuthenticationInfo authenticationInfo, JobExecutionContext jobExecutionContext) {
+ this.authenticationInfo = authenticationInfo;
+ this.jobExecutionContext = jobExecutionContext;
+ host = jobExecutionContext.getApplicationContext().getHostDescription();
+ userName = jobExecutionContext.getExperiment().getUserName();
+ jobID = jobExecutionContext.getJobDetails().getJobID();
+ taskID = jobExecutionContext.getTaskData().getTaskID();
+ experimentID = jobExecutionContext.getExperiment().getExperimentID();
+ workflowNodeID = jobExecutionContext.getExperiment().getWorkflowNodeDetailsList().get(0).getNodeInstanceId();// at this point we only have one node todo: fix this
+
+ }
+
+ public HPCMonitorID(HostDescription host, String jobID,String taskID, String workflowNodeID, String experimentID, String userName,AuthenticationInfo authenticationInfo) {
+ this.host = host;
+ this.jobStartedTime = new Timestamp((new Date()).getTime());
+ this.authenticationInfo = authenticationInfo;
+ this.userName = userName;
+ // if we give myproxyauthenticationInfo, so we try to use myproxy user as the user
+ if(this.authenticationInfo != null){
+ if(this.authenticationInfo instanceof MyProxyAuthenticationInfo){
+ this.userName = ((MyProxyAuthenticationInfo)this.authenticationInfo).getUserName();
+ }
+ }
+ this.workflowNodeID = workflowNodeID;
+ this.jobID = jobID;
+ this.taskID = taskID;
+ this.experimentID = experimentID;
+ }
+ public HostDescription getHost() {
+ return host;
+ }
+
+ public void setHost(HostDescription host) {
+ this.host = host;
+ }
+
+ public Timestamp getLastMonitored() {
+ return lastMonitored;
+ }
+
+ public void setLastMonitored(Timestamp lastMonitored) {
+ this.lastMonitored = lastMonitored;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getJobID() {
+ return jobID;
+ }
+
+ public void setJobID(String jobID) {
+ this.jobID = jobID;
+ }
+
+ public Timestamp getJobStartedTime() {
+ return jobStartedTime;
+ }
+
+ public void setJobStartedTime(Timestamp jobStartedTime) {
+ this.jobStartedTime = jobStartedTime;
+ }
+
+ public AuthenticationInfo getAuthenticationInfo() {
+ return authenticationInfo;
+ }
+
+ public void setAuthenticationInfo(AuthenticationInfo authenticationInfo) {
+ this.authenticationInfo = authenticationInfo;
+ }
+
+ public void addParameter(String key,Object value) {
+ this.parameters.put(key, value);
+ }
+
+ public Object getParameter(String key) {
+ return this.parameters.get(key);
+ }
+
+ public Map<String, Object> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map<String, Object> parameters) {
+ this.parameters = parameters;
+ }
+
+ public String getExperimentID() {
+ return experimentID;
+ }
+
+ public void setExperimentID(String experimentID) {
+ this.experimentID = experimentID;
+ }
+
+ public String getTaskID() {
+ return taskID;
+ }
+
+ public void setTaskID(String taskID) {
+ this.taskID = taskID;
+ }
+
+ public int getFailedCount() {
+ return failedCount;
+ }
+
+ public void setFailedCount(int failedCount) {
+ this.failedCount = failedCount;
+ }
+
+ public JobState getStatus() {
+ return state;
+ }
+
+ public void setStatus(JobState status) {
+ // this logic is going to be useful for fast finishing jobs
+ // because in some machines job state vanishes quicckly when the job is done
+ // during that case job state comes as unknown.so we handle it here.
+ if (this.state != null && status.equals(JobState.UNKNOWN)) {
+ if (getFailedCount() > 2) {
+ switch (this.state) {
+ case ACTIVE:
+ this.state = JobState.COMPLETE;
+ break;
+ case QUEUED:
+ this.state = JobState.COMPLETE;
+ break;
+ }
+ } else {
+ try {
+ // when state becomes unknown we sleep for a while
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ setFailedCount(getFailedCount() + 1);
+ }
+ } else {
+ // normal scenario
+ this.state = status;
+ }
+ }
+
+ public String getWorkflowNodeID() {
+ return workflowNodeID;
+ }
+
+ public void setWorkflowNodeID(String workflowNodeID) {
+ this.workflowNodeID = workflowNodeID;
+ }
+
+ public JobExecutionContext getJobExecutionContext() {
+ return jobExecutionContext;
+ }
+
+ public void setJobExecutionContext(JobExecutionContext jobExecutionContext) {
+ this.jobExecutionContext = jobExecutionContext;
+ }
+
+ // public String getWorkflowNodeID() {
+// return workflowNodeID;
+// }
+//
+// public void setWorkflowNodeID(String workflowNodeID) {
+// this.workflowNodeID = workflowNodeID;
+// }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java
index e57087d..0480925 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java
@@ -21,6 +21,7 @@
package org.apache.airavata.gfac.monitor;
import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
import java.util.ArrayList;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/JobIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/JobIdentity.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/JobIdentity.java
deleted file mode 100644
index 84c4a55..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/JobIdentity.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.monitor;
-
-public class JobIdentity extends TaskIdentity {
- private String jobId;
-
- public JobIdentity(String experimentId, String workflowNodeId, String taskId, String jobId) {
- super(experimentId,workflowNodeId,taskId);
- setJobId(jobId);
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/MonitorID.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/MonitorID.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/MonitorID.java
deleted file mode 100644
index e21160a..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/MonitorID.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor;
-
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
-import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.Timestamp;
-import java.util.Date;
-import java.util.Map;
-
-/*
-This is the object which contains the data to identify a particular
-Job to start the monitoring
-*/
-public class MonitorID {
- private final static Logger logger = LoggerFactory.getLogger(MonitorID.class);
-
- private String userName;
-
- private Timestamp jobStartedTime;
-
- private Timestamp lastMonitored;
-
- private HostDescription host;
-
- private AuthenticationInfo authenticationInfo = null;
-
- private Map<String, Object> parameters;
-
- private String experimentID;
-
- private String workflowNodeID;
-
- private String taskID;
-
- private String jobID;
-
- private int failedCount = 0;
-
- private JobState state;
-
- private JobExecutionContext jobExecutionContext;
-
- public MonitorID(HostDescription host, String jobID,String taskID, String workflowNodeID, String experimentID, String userName) {
- this.host = host;
- this.jobStartedTime = new Timestamp((new Date()).getTime());
- this.userName = userName;
- this.jobID = jobID;
- this.taskID = taskID;
- this.experimentID = experimentID;
- this.workflowNodeID = workflowNodeID;
- }
-
- public MonitorID(AuthenticationInfo authenticationInfo, JobExecutionContext jobExecutionContext) {
- this.authenticationInfo = authenticationInfo;
- this.jobExecutionContext = jobExecutionContext;
- host = jobExecutionContext.getApplicationContext().getHostDescription();
- userName = jobExecutionContext.getExperiment().getUserName();
- jobID = jobExecutionContext.getJobDetails().getJobID();
- taskID = jobExecutionContext.getTaskData().getTaskID();
- experimentID = jobExecutionContext.getExperiment().getExperimentID();
- workflowNodeID = jobExecutionContext.getExperiment().getWorkflowNodeDetailsList().get(0).getNodeInstanceId();// at this point we only have one node todo: fix this
-
- }
-
- public MonitorID(HostDescription host, String jobID,String taskID, String workflowNodeID, String experimentID, String userName,AuthenticationInfo authenticationInfo) {
- this.host = host;
- this.jobStartedTime = new Timestamp((new Date()).getTime());
- this.authenticationInfo = authenticationInfo;
- this.userName = userName;
- // if we give myproxyauthenticationInfo, so we try to use myproxy user as the user
- if(this.authenticationInfo != null){
- if(this.authenticationInfo instanceof MyProxyAuthenticationInfo){
- this.userName = ((MyProxyAuthenticationInfo)this.authenticationInfo).getUserName();
- }
- }
- this.workflowNodeID = workflowNodeID;
- this.jobID = jobID;
- this.taskID = taskID;
- this.experimentID = experimentID;
- }
- public HostDescription getHost() {
- return host;
- }
-
- public void setHost(HostDescription host) {
- this.host = host;
- }
-
- public Timestamp getLastMonitored() {
- return lastMonitored;
- }
-
- public void setLastMonitored(Timestamp lastMonitored) {
- this.lastMonitored = lastMonitored;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getJobID() {
- return jobID;
- }
-
- public void setJobID(String jobID) {
- this.jobID = jobID;
- }
-
- public Timestamp getJobStartedTime() {
- return jobStartedTime;
- }
-
- public void setJobStartedTime(Timestamp jobStartedTime) {
- this.jobStartedTime = jobStartedTime;
- }
-
- public AuthenticationInfo getAuthenticationInfo() {
- return authenticationInfo;
- }
-
- public void setAuthenticationInfo(AuthenticationInfo authenticationInfo) {
- this.authenticationInfo = authenticationInfo;
- }
-
- public void addParameter(String key,Object value) {
- this.parameters.put(key, value);
- }
-
- public Object getParameter(String key) {
- return this.parameters.get(key);
- }
-
- public Map<String, Object> getParameters() {
- return parameters;
- }
-
- public void setParameters(Map<String, Object> parameters) {
- this.parameters = parameters;
- }
-
- public String getExperimentID() {
- return experimentID;
- }
-
- public void setExperimentID(String experimentID) {
- this.experimentID = experimentID;
- }
-
- public String getTaskID() {
- return taskID;
- }
-
- public void setTaskID(String taskID) {
- this.taskID = taskID;
- }
-
- public int getFailedCount() {
- return failedCount;
- }
-
- public void setFailedCount(int failedCount) {
- this.failedCount = failedCount;
- }
-
- public JobState getStatus() {
- return state;
- }
-
- public void setStatus(JobState status) {
- // this logic is going to be useful for fast finishing jobs
- // because in some machines job state vanishes quicckly when the job is done
- // during that case job state comes as unknown.so we handle it here.
- if (this.state != null && status.equals(JobState.UNKNOWN)) {
- if (getFailedCount() > 2) {
- switch (this.state) {
- case ACTIVE:
- this.state = JobState.COMPLETE;
- break;
- case QUEUED:
- this.state = JobState.COMPLETE;
- break;
- }
- } else {
- try {
- // when state becomes unknown we sleep for a while
- Thread.sleep(10000);
- } catch (InterruptedException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- setFailedCount(getFailedCount() + 1);
- }
- } else {
- // normal scenario
- this.state = status;
- }
- }
-
- public String getWorkflowNodeID() {
- return workflowNodeID;
- }
-
- public void setWorkflowNodeID(String workflowNodeID) {
- this.workflowNodeID = workflowNodeID;
- }
-
- public JobExecutionContext getJobExecutionContext() {
- return jobExecutionContext;
- }
-
- public void setJobExecutionContext(JobExecutionContext jobExecutionContext) {
- this.jobExecutionContext = jobExecutionContext;
- }
-
- // public String getWorkflowNodeID() {
-// return workflowNodeID;
-// }
-//
-// public void setWorkflowNodeID(String workflowNodeID) {
-// this.workflowNodeID = workflowNodeID;
-// }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/TaskIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/TaskIdentity.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/TaskIdentity.java
deleted file mode 100644
index c6d386e..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/TaskIdentity.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.monitor;
-
-public class TaskIdentity extends WorkflowNodeIdentity {
- private String taskId;
-
- public TaskIdentity(String experimentId, String workflowNodeId, String taskId) {
- super(experimentId,workflowNodeId);
- setTaskId(taskId);
- }
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/WorkflowNodeIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/WorkflowNodeIdentity.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/WorkflowNodeIdentity.java
deleted file mode 100644
index e569c52..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/WorkflowNodeIdentity.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.monitor;
-
-public class WorkflowNodeIdentity extends ExperimentIdentity {
- private String workflowNodeID;
- public WorkflowNodeIdentity(String experimentId, String workflowNodeId) {
- super(experimentId);
- setWorkflowNodeID(workflowNodeId);
- }
- public String getWorkflowNodeID() {
- return workflowNodeID;
- }
-
- public void setWorkflowNodeID(String workflowNodeID) {
- this.workflowNodeID = workflowNodeID;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java
index da6baf8..26f25b8 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java
@@ -20,7 +20,7 @@
*/
package org.apache.airavata.gfac.monitor.core;
-import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/PushMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/PushMonitor.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/PushMonitor.java
index 8e13252..1b6a228 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/PushMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/PushMonitor.java
@@ -20,7 +20,7 @@
*/
package org.apache.airavata.gfac.monitor.core;
-import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
/**
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/event/MonitorPublisher.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/event/MonitorPublisher.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/event/MonitorPublisher.java
deleted file mode 100644
index 52487fe..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/event/MonitorPublisher.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor.event;
-
-import com.google.common.eventbus.EventBus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MonitorPublisher{
- private final static Logger logger = LoggerFactory.getLogger(MonitorPublisher.class);
- private EventBus eventBus;
-
- public MonitorPublisher(EventBus eventBus) {
- this.eventBus = eventBus;
- }
-
- public void registerListener(Object listener) {
- eventBus.register(listener);
- }
-
- public void unregisterListener(Object listener) {
- eventBus.unregister(listener);
- }
-
- public void publish(Object o) {
- eventBus.post(o);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
index fc83751..a87b8a5 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
@@ -22,11 +22,12 @@ package org.apache.airavata.gfac.monitor.handlers;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.handler.GFacHandlerException;
-import org.apache.airavata.gfac.handler.ThreadedHandler;
-import org.apache.airavata.gfac.monitor.AbstractActivityListener;
-import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.handler.ThreadedHandler;
+import org.apache.airavata.gfac.core.monitor.AbstractActivityListener;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.HPCMonitorID;
import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
import org.apache.airavata.gfac.monitor.impl.pull.qstat.HPCPullMonitor;
import org.apache.airavata.gfac.monitor.util.CommonUtils;
@@ -90,14 +91,14 @@ public class GridPullMonitorHandler extends ThreadedHandler {
hpcPullMonitor.run();
}
- public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException{
+ public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
if(!registrySet){
for(AbstractActivityListener listener:activityListeners){
listener.setup(jobExecutionContext.getRegistry());
}
}
super.invoke(jobExecutionContext);
- MonitorID monitorID = new MonitorID(authenticationInfo, jobExecutionContext);
+ MonitorID monitorID = new HPCMonitorID(authenticationInfo, jobExecutionContext);
try {
CommonUtils.addMonitortoQueue(hpcPullMonitor.getQueue(), monitorID);
} catch (AiravataMonitorException e) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/LocalJobMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/LocalJobMonitor.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/LocalJobMonitor.java
index a64b484..3c87d7d 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/LocalJobMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/LocalJobMonitor.java
@@ -21,10 +21,10 @@
package org.apache.airavata.gfac.monitor.impl;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.gfac.monitor.JobIdentity;
-import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.gfac.core.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.core.monitor.JobIdentity;
import org.apache.airavata.gfac.monitor.core.AiravataAbstractMonitor;
-import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
import org.apache.airavata.model.workspace.experiment.JobState;
import java.util.concurrent.BlockingQueue;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
index 0a1e985..38453e8 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
@@ -23,13 +23,13 @@ package org.apache.airavata.gfac.monitor.impl.pull.qstat;
import com.google.common.eventbus.EventBus;
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.gfac.core.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
import org.apache.airavata.gfac.monitor.HostMonitorData;
-import org.apache.airavata.gfac.monitor.MonitorID;
import org.apache.airavata.gfac.monitor.UserMonitorData;
import org.apache.airavata.gfac.monitor.core.PullMonitor;
-import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
import org.apache.airavata.gfac.monitor.util.CommonUtils;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.model.workspace.experiment.JobState;
@@ -39,7 +39,6 @@ import org.slf4j.LoggerFactory;
import java.sql.Timestamp;
import java.util.*;
-import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
index 6ab86af..957e288 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
@@ -21,9 +21,9 @@
package org.apache.airavata.gfac.monitor.impl.pull.qstat;
import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.monitor.HostMonitorData;
-import org.apache.airavata.gfac.monitor.MonitorID;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.gsi.ssh.impl.JobStatus;
import org.apache.airavata.gsi.ssh.impl.PBSCluster;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/AMQPMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/AMQPMonitor.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/AMQPMonitor.java
index fbf6e21..fa17c4e 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/AMQPMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/AMQPMonitor.java
@@ -26,12 +26,12 @@ import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gfac.monitor.JobIdentity;
-import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.core.monitor.JobIdentity;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.gfac.core.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
import org.apache.airavata.gfac.monitor.core.PushMonitor;
-import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
import org.apache.airavata.gfac.monitor.util.AMQPConnectionUtil;
import org.apache.airavata.gfac.monitor.util.CommonUtils;
import org.apache.airavata.model.workspace.experiment.JobState;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/BasicConsumer.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/BasicConsumer.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/BasicConsumer.java
index 1d60c45..b8ec08a 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/BasicConsumer.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/BasicConsumer.java
@@ -24,9 +24,9 @@ import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Consumer;
import com.rabbitmq.client.Envelope;
import com.rabbitmq.client.ShutdownSignalException;
-import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
import org.apache.airavata.gfac.monitor.core.MessageParser;
-import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
index c6e1378..2cde735 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
@@ -22,9 +22,9 @@ package org.apache.airavata.gfac.monitor.impl.push.amqp;
import com.google.common.eventbus.Subscribe;
import com.rabbitmq.client.Channel;
-import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.gfac.core.monitor.state.JobStatusChangeRequest;
import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
import org.apache.airavata.gfac.monitor.util.CommonUtils;
import org.apache.airavata.model.workspace.experiment.JobState;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/AbstractStateChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/AbstractStateChangeRequest.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/AbstractStateChangeRequest.java
deleted file mode 100644
index 10048b0..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/AbstractStateChangeRequest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.monitor.state;
-
-
-public abstract class AbstractStateChangeRequest implements PublisherMessage {
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java
deleted file mode 100644
index eecf88d..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor.state;
-
-import org.apache.airavata.gfac.monitor.ExperimentIdentity;
-import org.apache.airavata.model.workspace.experiment.ExperimentState;
-
-/**
- * This is the primary job state object used in
- * through out the monitor module. This use airavata-data-model JobState enum
- * Ideally after processing each event or monitoring message from remote system
- * Each monitoring implementation has to return this object with a state and
- * the monitoring ID
- */
-public class ExperimentStatusChangeRequest extends AbstractStateChangeRequest {
- private ExperimentState state;
- private ExperimentIdentity identity;
-
- // this constructor can be used in Qstat monitor to handle errors
- public ExperimentStatusChangeRequest() {
- }
-
- public ExperimentStatusChangeRequest(ExperimentIdentity experimentIdentity, ExperimentState state) {
- this.state = state;
- setIdentity(experimentIdentity);
- }
-
- public ExperimentState getState() {
- return state;
- }
-
- public void setState(ExperimentState state) {
- this.state = state;
- }
-
- public ExperimentIdentity getIdentity() {
- return identity;
- }
-
- public void setIdentity(ExperimentIdentity identity) {
- this.identity = identity;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java
deleted file mode 100644
index da52656..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor.state;
-
-import org.apache.airavata.gfac.monitor.JobIdentity;
-import org.apache.airavata.gfac.monitor.MonitorID;
-import org.apache.airavata.model.workspace.experiment.JobState;
-
-/**
- * This is the primary job state object used in
- * through out the monitor module. This use airavata-data-model JobState enum
- * Ideally after processing each event or monitoring message from remote system
- * Each monitoring implementation has to return this object with a state and
- * the monitoring ID
- */
-public class JobStatusChangeRequest extends AbstractStateChangeRequest {
- private JobState state;
- private JobIdentity identity;
-
- private MonitorID monitorID;
-
- // this constructor can be used in Qstat monitor to handle errors
- public JobStatusChangeRequest() {
- }
-
- public JobStatusChangeRequest(MonitorID monitorID) {
- setIdentity(new JobIdentity(monitorID.getExperimentID(),monitorID.getWorkflowNodeID(),
- monitorID.getTaskID(),monitorID.getJobID()));
- setMonitorID(monitorID);
- this.state = monitorID.getStatus();
- }
- public JobStatusChangeRequest(MonitorID monitorID, JobIdentity jobId, JobState state) {
- setIdentity(jobId);
- setMonitorID(monitorID);
- this.state = state;
- }
-
- public JobState getState() {
- return state;
- }
-
- public void setState(JobState state) {
- this.state = state;
- }
-
- public JobIdentity getIdentity() {
- return identity;
- }
-
- public void setIdentity(JobIdentity identity) {
- this.identity = identity;
- }
-
- public MonitorID getMonitorID() {
- return monitorID;
- }
-
- public void setMonitorID(MonitorID monitorID) {
- this.monitorID = monitorID;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java
deleted file mode 100644
index 9a59b50..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor.state;
-
-import org.apache.airavata.gsi.ssh.impl.JobStatus;
-
-/**
- * Based on the job status monitoring we can gather
- * different informaation about the job, its not simply
- * the job status, so we need a way to implement
- * different job statusinfo object to keep job status
- */
-public interface JobStatusInfo {
-
- /**
- * This method can be used to get JobStatusInfo data and
- * decide the finalJobState
- *
- * @param jobState
- */
- void setJobStatus(JobStatus jobState);
-
- /**
- * After setting the jobState by processing jobinformation
- * this method can be used to get the JobStatus
- * @return
- */
- JobStatus getJobStatus();
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/PublisherMessage.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/PublisherMessage.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/PublisherMessage.java
deleted file mode 100644
index cbfcb5a..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/PublisherMessage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac.monitor.state;
-
-public interface PublisherMessage {
-// public String getType();
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java
deleted file mode 100644
index af20707..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor.state;
-
-import org.apache.airavata.gfac.monitor.TaskIdentity;
-import org.apache.airavata.model.workspace.experiment.TaskState;
-
-/**
- * This is the primary job state object used in
- * through out the monitor module. This use airavata-data-model JobState enum
- * Ideally after processing each event or monitoring message from remote system
- * Each monitoring implementation has to return this object with a state and
- * the monitoring ID
- */
-public class TaskStatusChangeRequest extends AbstractStateChangeRequest {
- private TaskState state;
- private TaskIdentity identity;
- // this constructor can be used in Qstat monitor to handle errors
- public TaskStatusChangeRequest() {
- }
-
- public TaskStatusChangeRequest(TaskIdentity taskIdentity, TaskState state) {
- this.state = state;
- setIdentity(taskIdentity);
- }
-
- public TaskState getState() {
- return state;
- }
-
- public void setState(TaskState state) {
- this.state = state;
- }
-
- public TaskIdentity getIdentity() {
- return identity;
- }
-
- public void setIdentity(TaskIdentity identity) {
- this.identity = identity;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java
deleted file mode 100644
index 632f2e3..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor.state;
-
-import org.apache.airavata.gfac.monitor.WorkflowNodeIdentity;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
-
-/**
- * This is the primary job state object used in
- * through out the monitor module. This use airavata-data-model JobState enum
- * Ideally after processing each event or monitoring message from remote system
- * Each monitoring implementation has to return this object with a state and
- * the monitoring ID
- */
-public class WorkflowNodeStatusChangeRequest extends AbstractStateChangeRequest {
- private WorkflowNodeState state;
- private WorkflowNodeIdentity identity;
-
- // this constructor can be used in Qstat monitor to handle errors
- public WorkflowNodeStatusChangeRequest() {
- }
-
- public WorkflowNodeStatusChangeRequest(WorkflowNodeIdentity identity, WorkflowNodeState state) {
- this.state = state;
- setIdentity(identity);
- }
-
- public WorkflowNodeState getState() {
- return state;
- }
-
- public void setState(WorkflowNodeState state) {
- this.state = state;
- }
-
- public WorkflowNodeIdentity getIdentity() {
- return identity;
- }
-
- public void setIdentity(WorkflowNodeIdentity identity) {
- this.identity = identity;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java
deleted file mode 100644
index 19b051a..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.gfac.monitor.state.impl;
-
-import org.apache.airavata.gfac.monitor.state.JobStatusInfo;
-import org.apache.airavata.gsi.ssh.impl.JobStatus;
-
-/**
- * This can be used to store job status information about
- * amazon jobs, this data could be very different from
- * a typical grid job
- */
-public class AmazonJobStatusInfo implements JobStatusInfo {
- public void setJobStatus(JobStatus jobState) {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public JobStatus getJobStatus() {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
-}