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/21 19:56:47 UTC

[33/51] [abbrv] git commit: moving common monitoring classes to gfac-core

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/temp
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();
+        }
+	}
+
+}