airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [1/3] adding gfac thrift service module
Date Wed, 21 May 2014 18:30:53 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 009ee0d7b -> 2ce716cd8


http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/cpi/gfac_cpi_serviceConstants.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/cpi/gfac_cpi_serviceConstants.java b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/cpi/gfac_cpi_serviceConstants.java
new file mode 100644
index 0000000..0a46b6b
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/cpi/gfac_cpi_serviceConstants.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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.gfac.cpi;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class gfac_cpi_serviceConstants {
+
+  public static final String GFAC_CPI_VERSION = "0.12.0";
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServer.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServer.java b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServer.java
new file mode 100644
index 0000000..bf6f933
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServer.java
@@ -0,0 +1,134 @@
+/*
+ *
+ * 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.server;
+
+import org.apache.airavata.common.utils.IServer;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.gfac.cpi.GfacService;
+import org.apache.airavata.gfac.util.Constants;
+import org.apache.thrift.server.TServer;
+import org.apache.thrift.server.TThreadPoolServer;
+import org.apache.thrift.transport.TServerSocket;
+import org.apache.thrift.transport.TServerTransport;
+import org.apache.thrift.transport.TTransportException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GfacServer implements IServer{
+
+    private final static Logger logger = LoggerFactory.getLogger(GfacServer.class);
+	private static final String SERVER_NAME = "Gfac Server";
+	private static final String SERVER_VERSION = "1.0";
+
+    private IServer.ServerStatus status;
+
+	private TServer server;
+
+	public GfacServer() {
+		setStatus(IServer.ServerStatus.STOPPED);
+	}
+
+    public void StartGfacServer(GfacService.Processor<GfacServerHandler> gfacServerHandlerProcessor)
+            throws Exception {
+        try {
+            final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.GFAC_SERVER_PORT, "8950"));
+			TServerTransport serverTransport = new TServerSocket(serverPort);
+            server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(gfacServerHandlerProcessor));
+
+            new Thread() {
+				public void run() {
+					server.serve();
+					setStatus(IServer.ServerStatus.STOPPED);
+					logger.info("Gfac Server Stopped.");
+				}
+			}.start();
+			new Thread() {
+				public void run() {
+					while(!server.isServing()){
+						try {
+							Thread.sleep(500);
+						} catch (InterruptedException e) {
+							break;
+						}
+					}
+					if (server.isServing()){
+						setStatus(IServer.ServerStatus.STARTED);
+			            logger.info("Starting Gfac Server on Port " + serverPort);
+			            logger.info("Listening to Gfac Clients ....");
+					}
+				}
+			}.start();
+        } catch (TTransportException e) {
+            logger.error(e.getMessage());
+            setStatus(IServer.ServerStatus.FAILED);
+        }
+    }
+
+    public static void main(String[] args) {
+    	try {
+			new GfacServer().start();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+    }
+
+	public void start() throws Exception {
+		setStatus(IServer.ServerStatus.STARTING);
+        GfacService.Processor<GfacServerHandler> mockAiravataServer =
+                new GfacService.Processor<GfacServerHandler>(new GfacServerHandler());
+		StartGfacServer(mockAiravataServer);
+	}
+
+	public void stop() throws Exception {
+        if (server!=null && server.isServing()){
+			setStatus(IServer.ServerStatus.STOPING);
+			server.stop();
+		}
+
+	}
+
+	public void restart() throws Exception {
+		stop();
+		start();
+	}
+
+	public void configure() throws Exception {
+		// TODO Auto-generated method stub
+
+	}
+
+	public IServer.ServerStatus getStatus() throws Exception {
+		return status;
+	}
+
+	private void setStatus(IServer.ServerStatus stat){
+		status=stat;
+		status.updateTime();
+	}
+
+	public String getName() {
+		return SERVER_NAME;
+	}
+
+	public String getVersion() {
+		return SERVER_VERSION;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
new file mode 100644
index 0000000..4fde071
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.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.server;
+
+import org.apache.airavata.gfac.cpi.GfacService;
+import org.apache.thrift.TException;
+
+public class GfacServerHandler implements GfacService.Iface {
+    public String getGFACServiceVersion() throws TException {
+        return null;
+    }
+
+    public boolean submitJob(String experimentId, String taskId) throws TException {
+        return false;
+    }
+
+    public boolean cancelJob(String experimentId, String taskId) throws TException {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/util/Constants.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/util/Constants.java b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/util/Constants.java
new file mode 100644
index 0000000..3e48898
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/util/Constants.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.util;
+
+public class Constants {
+    public static final String GFAC_SERVER_PORT = "gfac.server.port";
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/main/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/resources/gfac-config.xml b/modules/gfac/airavata-gfac-service/src/main/resources/gfac-config.xml
new file mode 100644
index 0000000..d7bb032
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/main/resources/gfac-config.xml
@@ -0,0 +1,106 @@
+<!-- ~ 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. -->
+    
+<GFac>
+    <DaemonHandlers>
+        <Handler class="org.apache.airavata.gfac.monitor.handlers.GridPullMonitorHandler">
+                <property name="listeners" value="org.apache.airavata.gfac.core.monitor.AiravataJobStatusUpdator"/>
+        </Handler>
+    </DaemonHandlers>
+    <GlobalHandlers>
+        <InHandlers>
+            <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
+                    <property name="name" value="value"/>
+            </Handler>
+        </InHandlers>
+        <OutHandlers></OutHandlers>
+    </GlobalHandlers>
+    <Provider class="org.apache.airavata.gfac.local.provider.impl.LocalProvider" host="org.apache.airavata.schemas.gfac.impl.HostDescriptionTypeImpl">
+        <InHandlers>
+            <Handler class="org.apache.airavata.gfac.local.handler.LocalDirectorySetupHandler"/>
+        </InHandlers>
+    </Provider>
+   <Provider class="org.apache.airavata.gfac.gram.provider.impl.GramProvider" host="org.apache.airavata.schemas.gfac.impl.GlobusHostTypeImpl">
+        <property name="name" value="value"/>
+        <InHandlers>
+            <Handler class="org.apache.airavata.gfac..gram.handler.GramDirectorySetupHandler">
+                    <property name="name" value="value"/>
+            </Handler>
+            <Handler class="org.apache.airavata.gfac..gram.handler.GridFTPInputHandler"/>
+        </InHandlers>
+        <OutHandlers>
+            <Handler class="org.apache.airavata.gfac..gram.handler.GridFTPOutputHandler"/>
+        </OutHandlers>
+    </Provider>
+    <Provider class="org.apache.airavata.gfac.bes.provider.impl.BESProvider" host="org.apache.airavata.schemas.gfac.impl.UnicoreHostTypeImpl">
+    </Provider>
+
+    <Provider class="org.apache.airavata.gfac.ec2.EC2Provider" host="org.apache.airavata.schemas.gfac.impl.Ec2HostTypeImpl">
+        <InHandlers/>
+        <OutHandlers/>
+    </Provider>
+
+    <Provider class="org.apache.airavata.gfac.hadoop.provider.impl.HadoopProvider" host="org.apache.airavata.schemas.gfac.impl.HadoopHostTypeImpl">
+        <InHandlers>
+                <Handler class="org.apache.airavata.gfac.hadoop.handler.HadoopDeploymentHandler"/>
+            <Handler class="org.apache.airavata.gfac.hadoop.handler.HDFSDataMovementHandler"/>
+        </InHandlers>
+        <OutHandlers/>
+    </Provider>
+
+    <Application name="UltraScan">
+        <InHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.GfacDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.gram.handler.GridFTPInputHandler"/>
+        </InHandlers>
+        <OutHandlers>
+            <Handler class="org.apache.airavata.gfac.gram.handler.GridFTPOutputHandler"/>
+        </OutHandlers>
+    </Application>
+
+     <Provider class="org.apache.airavata.gfac.ssh.provider.impl.SSHProvider" host="org.apache.airavata.schemas.gfac.impl.SSHHostTypeImpl">
+         <InHandlers>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHInputHandler"/>
+        </InHandlers>
+        <OutHandlers>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHOutputHandler"/>
+        </OutHandlers>
+    </Provider>
+    <Provider class="org.apache.airavata.gfac.gsissh.provider.impl.GSISSHProvider" host="org.apache.airavata.schemas.gfac.impl.GsisshHostTypeImpl" executionMode="async">
+             <InHandlers>
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHDirectorySetupHandler"/>
+                 <!--Handler class="org.apache.airavata.gfac.handler.AdvancedSCPInputHandler">
+                            <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/>
+                            <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/>
+                        <property name="userName" value="root"/>
+                        <property name="hostName" value="gw98.iu.xsede.org"/>
+                        <property name="inputPath" value="/tmp"/>
+                        <property name="passPhrase" value="/home/airavata/outputData"/>
+                        <property name="password" value="/home/airavata/outputData"/> <either we have to set password or keys, password has higher preference>
+                </Handler-->
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHInputHandler"/>
+            </InHandlers>
+            <OutHandlers>
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHOutputHandler"/>
+                <!--Handler class="org.apache.airavata.gfac.handler.AdvancedSCPOutputHandler">
+                            <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/>
+                            <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/>
+                        <property name="userName" value="root"/>
+                        <property name="hostName" value="gw111.iu.xsede.org"/>
+                        <property name="outputPath" value="/tmp"/>
+                        <property name="passPhrase" value="/home/airavata/outputData"/>
+                        <property name="password" value="/home/airavata/outputData"/> <either we have to set password or keys, password has higher preference>
+                </Handler-->
+            </OutHandlers>
+        </Provider>
+</GFac>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/main/resources/gsissh.properties
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/resources/gsissh.properties b/modules/gfac/airavata-gfac-service/src/main/resources/gsissh.properties
new file mode 100644
index 0000000..3fdf76d
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/main/resources/gsissh.properties
@@ -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.
+#
+
+###########################################################################
+# Specifies system level configurations as a key/value pairs.
+###########################################################################
+
+StrictHostKeyChecking=no
+ssh.session.timeout=360000

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java b/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java
new file mode 100644
index 0000000..4207f05
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java
@@ -0,0 +1,86 @@
+/*
+ *
+ * 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.client;
+
+import org.apache.airavata.client.AiravataAPIFactory;
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.client.tools.DocumentCreator;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.gfac.client.util.Initialize;
+import org.apache.airavata.gfac.cpi.GfacService;
+import org.apache.airavata.gfac.server.GfacServer;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.Registry;
+import org.junit.Test;
+
+public class GfacClientFactoryTest {
+    private DocumentCreator documentCreator;
+    private GfacService.Client gfacClient;
+    private Registry registry;
+    private int NUM_CONCURRENT_REQUESTS = 1;
+    Initialize initialize;
+    GfacServer service;
+    @Test
+    public void setUp() {
+    	AiravataUtils.setExecutionAsServer();
+        initialize = new Initialize("registry-derby.sql");
+        initialize.initializeDB();
+        try {
+            service = (new GfacServer());
+            service.start();
+        } catch (Exception e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        registry = RegistryFactory.getDefaultRegistry();
+        AiravataUtils.setExecutionAsServer();
+        documentCreator = new DocumentCreator(getAiravataAPI());
+        documentCreator.createLocalHostDocs();
+
+        try {
+            service.stop();
+        } catch (Exception e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+    }
+
+    private AiravataAPI getAiravataAPI() {
+        AiravataAPI airavataAPI = null;
+            try {
+                String systemUserName = ServerSettings.getDefaultUser();
+                String gateway = ServerSettings.getDefaultUserGateway();
+                airavataAPI = AiravataAPIFactory.getAPI(gateway, systemUserName);
+            } catch (ApplicationSettingsException e) {
+                e.printStackTrace();
+            } catch (AiravataAPIInvocationException e) {
+                e.printStackTrace();
+            }
+        return airavataAPI;
+    }
+
+    private void storeDescriptors() {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java b/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
new file mode 100644
index 0000000..6e0e7e6
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
@@ -0,0 +1,333 @@
+/*
+ *
+ * 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.client.util;
+
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
+import org.apache.airavata.persistance.registry.jpa.resources.*;
+import org.apache.airavata.registry.api.exception.RegistrySettingsException;
+import org.apache.airavata.registry.api.util.RegistrySettings;
+import org.apache.derby.drda.NetworkServerControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.sql.*;
+import java.util.StringTokenizer;
+
+public class Initialize {
+    private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
+    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+    public  String scriptName = "registry-derby.sql";
+    private NetworkServerControl server;
+    private static final String delimiter = ";";
+    public static final String PERSISTANT_DATA = "Configuration";
+
+    public Initialize(String scriptName) {
+        this.scriptName = scriptName;
+    }
+
+    public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
+        if (suffix.length() > buffer.length()) {
+            return false;
+        }
+        // this loop is done on purpose to avoid memory allocation performance
+        // problems on various JDKs
+        // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
+        // implementation is ok though does allocation/copying
+        // StringBuffer.toString().endsWith() does massive memory
+        // allocation/copying on JDK 1.5
+        // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
+        int endIndex = suffix.length() - 1;
+        int bufferIndex = buffer.length() - 1;
+        while (endIndex >= 0) {
+            if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
+                return false;
+            }
+            bufferIndex--;
+            endIndex--;
+        }
+        return true;
+    }
+
+    private static boolean isServerStarted(NetworkServerControl server, int ntries)
+    {
+        for (int i = 1; i <= ntries; i ++)
+        {
+            try {
+                Thread.sleep(500);
+                server.ping();
+                return true;
+            }
+            catch (Exception e) {
+                if (i == ntries)
+                    return false;
+            }
+        }
+        return false;
+    }
+
+    public void initializeDB() {
+        String jdbcUrl = null;
+        String jdbcDriver = null;
+        String jdbcUser = null;
+        String jdbcPassword = null;
+        try{
+            jdbcDriver = RegistrySettings.getSetting("registry.jdbc.driver");
+            jdbcUrl = RegistrySettings.getSetting("registry.jdbc.url");
+            jdbcUser = RegistrySettings.getSetting("registry.jdbc.user");
+            jdbcPassword = RegistrySettings.getSetting("registry.jdbc.password");
+            jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+        } catch (RegistrySettingsException e) {
+            logger.error("Unable to read properties" , e);
+        }
+
+
+        startDerbyInServerMode();
+        if(!isServerStarted(server, 20)){
+           throw new RuntimeException("Derby server cound not started within five seconds...");
+        }
+//      startDerbyInEmbeddedMode();
+
+        Connection conn = null;
+        try {
+            Class.forName(Utils.getJDBCDriver()).newInstance();
+            conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
+            if (!isDatabaseStructureCreated(PERSISTANT_DATA, conn)) {
+                executeSQLScript(conn);
+                logger.info("New Database created for Registry");
+            } else {
+                logger.debug("Database already created for Registry!");
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new RuntimeException("Database failure", e);
+        } finally {
+            try {
+                if (conn != null){
+                    if (!conn.getAutoCommit()) {
+                        conn.commit();
+                    }
+                    conn.close();
+                }
+            } catch (SQLException e) {
+                logger.error(e.getMessage(), e);
+                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            }
+        }
+
+        try{
+            GatewayResource gatewayResource = (GatewayResource)ResourceUtils.createGateway(RegistrySettings.getSetting("default.registry.gateway"));
+            gatewayResource.setOwner(RegistrySettings.getSetting("default.registry.gateway"));
+            gatewayResource.save();
+
+            UserResource userResource = ResourceUtils.createUser(RegistrySettings.getSetting("default.registry.user"),RegistrySettings.getSetting("default.registry.password"));
+            userResource.save();
+
+            WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
+            workerResource.setUser(userResource.getUserName());
+            workerResource.save();
+
+            ProjectResource resource = (ProjectResource)gatewayResource.create(ResourceType.PROJECT);
+            resource.setId("default");
+            resource.setName("default");
+            resource.setWorker(workerResource);
+            resource.save();
+
+        } catch (RegistrySettingsException e) {
+            logger.error("Unable to read properties", e);
+        }
+    }
+
+    public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
+        try {
+            System.out.println("Running a query to test the database tables existence.");
+            // check whether the tables are already created with a query
+            Statement statement = null;
+            try {
+                statement = conn.createStatement();
+                ResultSet rs = statement.executeQuery("select * from " + tableName);
+                if (rs != null) {
+                    rs.close();
+                }
+            } finally {
+                try {
+                    if (statement != null) {
+                        statement.close();
+                    }
+                } catch (SQLException e) {
+                    return false;
+                }
+            }
+        } catch (SQLException e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    private void executeSQLScript(Connection conn) throws Exception {
+        StringBuffer sql = new StringBuffer();
+        BufferedReader reader = null;
+        try{
+
+        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
+        reader = new BufferedReader(new InputStreamReader(inputStream));
+        String line;
+        while ((line = reader.readLine()) != null) {
+            line = line.trim();
+            if (line.startsWith("//")) {
+                continue;
+            }
+            if (line.startsWith("--")) {
+                continue;
+            }
+            StringTokenizer st = new StringTokenizer(line);
+            if (st.hasMoreTokens()) {
+                String token = st.nextToken();
+                if ("REM".equalsIgnoreCase(token)) {
+                    continue;
+                }
+            }
+            sql.append(" ").append(line);
+
+            // SQL defines "--" as a comment to EOL
+            // and in Oracle it may contain a hint
+            // so we cannot just remove it, instead we must end it
+            if (line.indexOf("--") >= 0) {
+                sql.append("\n");
+            }
+            if ((checkStringBufferEndsWith(sql, delimiter))) {
+                executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
+                sql.replace(0, sql.length(), "");
+            }
+        }
+        // Catch any statements not followed by ;
+        if (sql.length() > 0) {
+            executeSQL(sql.toString(), conn);
+        }
+        }catch (IOException e){
+            logger.error("Error occurred while executing SQL script for creating Airavata database", e);
+            throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
+        }finally {
+            if (reader != null) {
+                reader.close();
+            }
+
+        }
+
+    }
+
+    private static void executeSQL(String sql, Connection conn) throws Exception {
+        // Check and ignore empty statements
+        if ("".equals(sql.trim())) {
+            return;
+        }
+
+        Statement statement = null;
+        try {
+            logger.debug("SQL : " + sql);
+
+            boolean ret;
+            int updateCount = 0, updateCountTotal = 0;
+            statement = conn.createStatement();
+            ret = statement.execute(sql);
+            updateCount = statement.getUpdateCount();
+            do {
+                if (!ret) {
+                    if (updateCount != -1) {
+                        updateCountTotal += updateCount;
+                    }
+                }
+                ret = statement.getMoreResults();
+                if (ret) {
+                    updateCount = statement.getUpdateCount();
+                }
+            } while (ret);
+
+            logger.debug(sql + " : " + updateCountTotal + " rows affected");
+
+            SQLWarning warning = conn.getWarnings();
+            while (warning != null) {
+                logger.warn(warning + " sql warning");
+                warning = warning.getNextWarning();
+            }
+            conn.clearWarnings();
+        } catch (SQLException e) {
+            if (e.getSQLState().equals("X0Y32")) {
+                // eliminating the table already exception for the derby
+                // database
+                logger.info("Table Already Exists", e);
+            } else {
+                throw new Exception("Error occurred while executing : " + sql, e);
+            }
+        } finally {
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException e) {
+                    logger.error("Error occurred while closing result set.", e);
+                }
+            }
+        }
+    }
+
+    private void startDerbyInServerMode() {
+        try {
+            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
+            server = new NetworkServerControl(InetAddress.getByName(Utils.getHost()),
+                    20000,
+                    Utils.getJDBCUser(), Utils.getJDBCPassword());
+            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
+            server.start(consoleWriter);
+        } catch (IOException e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        } catch (Exception e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        }
+
+    }
+
+    private void startDerbyInEmbeddedMode(){
+        try {
+            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+            DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void stopDerbyServer() {
+        try {
+            server.shutdown();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/test/resources/gfac-config.xml b/modules/gfac/airavata-gfac-service/src/test/resources/gfac-config.xml
new file mode 100644
index 0000000..47cad27
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/test/resources/gfac-config.xml
@@ -0,0 +1,90 @@
+<!-- ~ 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. -->
+    
+<GFac>
+    <GlobalHandlers>
+        <InHandlers>
+            <Handler class="org.apache.airavata.gfac.core.handler.AppDescriptorCheckHandler">
+                    <property name="name" value="value"/>
+            </Handler>
+        </InHandlers>
+        <OutHandlers></OutHandlers>
+    </GlobalHandlers>
+    <Provider class="org.apache.airavata.gfac.provider.impl.LocalProvider" host="org.apache.airavata.schemas.gfac.impl.HostDescriptionTypeImpl">
+        <InHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.LocalDirectorySetupHandler"/>
+        </InHandlers>
+    </Provider>
+    <Provider class="org.apache.airavata.gfac.provider.impl.GramProvider" host="org.apache.airavata.schemas.gfac.impl.GlobusHostTypeImpl">
+        <property name="name" value="value"/>
+        <InHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler">
+                    <property name="name" value="value"/>
+            </Handler>
+            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+        </InHandlers>
+        <OutHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
+        </OutHandlers>
+    </Provider>
+      <Provider class="BESProvider" host="org.apache.airavata.schemas.gfac.impl.UnicoreHostTypeImpl">
+        <InHandlers>
+        	<Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+        </InHandlers>
+        <OutHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
+        </OutHandlers>
+    </Provider>
+
+    <Provider class="org.apache.airavata.gfac.ec2.EC2Provider" host="org.apache.airavata.schemas.gfac.impl.Ec2HostTypeImpl">
+        <InHandlers/>
+        <OutHandlers/>
+    </Provider>
+
+    <Provider class="org.apache.airavata.gfac.provider.impl.HadoopProvider" host="org.apache.airavata.schemas.gfac.impl.HadoopHostTypeImpl">
+        <InHandlers>
+        	<Handler class="org.apache.airavata.gfac.handler.HadoopDeploymentHandler"/>
+            <Handler class="org.apache.airavata.gfac.handler.HDFSDataMovementHandler"/>
+        </InHandlers>
+        <OutHandlers/>
+    </Provider>
+
+    <Application name="UltraScan">
+        <InHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+        </InHandlers>
+        <OutHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
+        </OutHandlers>
+    </Application>
+
+     <Provider class="org.apache.airavata.gfac.provider.impl.SSHProvider" host="org.apache.airavata.schemas.gfac.impl.SSHHostTypeImpl">
+         <InHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.SCPDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.handler.SCPInputHandler"/>
+        </InHandlers>
+        <OutHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.SCPOutputHandler"/>
+        </OutHandlers>
+    </Provider>
+     <Provider class="org.apache.airavata.gfac.provider.impl.GSISSHProvider" host="org.apache.airavata.schemas.gfac.impl.GsisshHostTypeImpl">
+         <InHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.SCPDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.handler.SCPInputHandler"/>
+        </InHandlers>
+        <OutHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.SCPOutputHandler"/>
+        </OutHandlers>
+    </Provider>
+</GFac>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/test/resources/gsissh.properties
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/test/resources/gsissh.properties b/modules/gfac/airavata-gfac-service/src/test/resources/gsissh.properties
new file mode 100644
index 0000000..3fdf76d
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/test/resources/gsissh.properties
@@ -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.
+#
+
+###########################################################################
+# Specifies system level configurations as a key/value pairs.
+###########################################################################
+
+StrictHostKeyChecking=no
+ssh.session.timeout=360000

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/test/resources/monitor.properties
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/test/resources/monitor.properties b/modules/gfac/airavata-gfac-service/src/test/resources/monitor.properties
new file mode 100644
index 0000000..02ccf24
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/test/resources/monitor.properties
@@ -0,0 +1,10 @@
+primaryMonitor=org.apache.airavata.gfac.monitor.impl.push.amqp.AMQPMonitor
+secondaryMonitor=org.apache.airavata.gfac.monitor.impl.pull.qstat.QstatMonitor
+amqp.hosts=info1.dyn.teragrid.org,info2.dyn.teragrid.org
+connection.name=xsede_private
+trusted.certificate.location=/Users/chathuri/dev/airavata/cert/certificates
+certificate.path=/Users/chathuri/dev/airavata/cert/certificates
+myproxy.server=myproxy.teragrid.org
+myproxy.user=ogce
+myproxy.password=
+myproxy.life=3600
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/test/resources/orchestrator.properties
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/test/resources/orchestrator.properties b/modules/gfac/airavata-gfac-service/src/test/resources/orchestrator.properties
new file mode 100644
index 0000000..5ebfe4f
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/test/resources/orchestrator.properties
@@ -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.
+#
+job.submitter=org.apache.airavata.orchestrator.core.impl.EmbeddedGFACJobSubmitter
+job.validators=org.apache.airavata.orchestrator.core.validator.impl.SimpleAppDataValidator
+submitter.interval=10000
+threadpool.size=0
+start.submitter=true
+embedded.mode=true
+enable.validation=false

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/airavata-gfac-service/src/test/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/test/resources/registry-derby.sql b/modules/gfac/airavata-gfac-service/src/test/resources/registry-derby.sql
new file mode 100644
index 0000000..5bf2c3f
--- /dev/null
+++ b/modules/gfac/airavata-gfac-service/src/test/resources/registry-derby.sql
@@ -0,0 +1,393 @@
+/*
+ *
+ * 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.
+ *
+ */
+CREATE TABLE GATEWAY
+(
+        GATEWAY_NAME VARCHAR(255),
+	      OWNER VARCHAR(255),
+        PRIMARY KEY (GATEWAY_NAME)
+);
+
+CREATE TABLE CONFIGURATION
+(
+        CONFIG_KEY VARCHAR(255),
+        CONFIG_VAL VARCHAR(255),
+        EXPIRE_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        CATEGORY_ID VARCHAR (255),
+        PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID)
+);
+
+INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.12', CURRENT_TIMESTAMP ,'SYSTEM');
+
+CREATE TABLE USERS
+(
+        USER_NAME VARCHAR(255),
+        PASSWORD VARCHAR(255),
+        PRIMARY KEY(USER_NAME)
+);
+
+CREATE TABLE GATEWAY_WORKER
+(
+        GATEWAY_NAME VARCHAR(255),
+        USER_NAME VARCHAR(255),
+        PRIMARY KEY (GATEWAY_NAME, USER_NAME),
+        FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
+        FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE PROJECT
+(
+         GATEWAY_NAME VARCHAR(255),
+         USER_NAME VARCHAR(255) NOT NULL,
+         PROJECT_ID VARCHAR(255),
+         PROJECT_NAME VARCHAR(255) NOT NULL,
+         DESCRIPTION VARCHAR(255),
+         CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+         PRIMARY KEY (PROJECT_ID),
+         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
+         FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE PROJECT_USER
+(
+    PROJECT_ID VARCHAR(255),
+    USER_NAME VARCHAR(255),
+    PRIMARY KEY (PROJECT_ID,USER_NAME),
+    FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE,
+    FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE PUBLISHED_WORKFLOW
+(
+         GATEWAY_NAME VARCHAR(255),
+         CREATED_USER VARCHAR(255),
+         PUBLISH_WORKFLOW_NAME VARCHAR(255),
+         VERSION VARCHAR(255),
+         PUBLISHED_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+         PATH VARCHAR (255),
+         WORKFLOW_CONTENT BLOB,
+         PRIMARY KEY(GATEWAY_NAME, PUBLISH_WORKFLOW_NAME),
+         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
+         FOREIGN KEY (CREATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE USER_WORKFLOW
+(
+         GATEWAY_NAME VARCHAR(255),
+         OWNER VARCHAR(255),
+         TEMPLATE_NAME VARCHAR(255),
+         LAST_UPDATED_TIME TIMESTAMP DEFAULT CURRENT TIMESTAMP,
+         PATH VARCHAR (255),
+         WORKFLOW_GRAPH BLOB,
+         PRIMARY KEY(GATEWAY_NAME, OWNER, TEMPLATE_NAME),
+         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
+         FOREIGN KEY (OWNER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE HOST_DESCRIPTOR
+(
+         GATEWAY_NAME VARCHAR(255),
+         UPDATED_USER VARCHAR(255),
+         HOST_DESCRIPTOR_ID VARCHAR(255),
+         HOST_DESCRIPTOR_XML BLOB,
+         PRIMARY KEY(GATEWAY_NAME, HOST_DESCRIPTOR_ID),
+         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
+         FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE SERVICE_DESCRIPTOR
+(
+         GATEWAY_NAME VARCHAR(255),
+         UPDATED_USER VARCHAR(255),
+         SERVICE_DESCRIPTOR_ID VARCHAR(255),
+         SERVICE_DESCRIPTOR_XML BLOB,
+         PRIMARY KEY(GATEWAY_NAME,SERVICE_DESCRIPTOR_ID),
+         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
+         FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_DESCRIPTOR
+(
+         GATEWAY_NAME VARCHAR(255),
+         UPDATED_USER VARCHAR(255),
+         APPLICATION_DESCRIPTOR_ID VARCHAR(255),
+         HOST_DESCRIPTOR_ID VARCHAR(255),
+         SERVICE_DESCRIPTOR_ID VARCHAR(255),
+         APPLICATION_DESCRIPTOR_XML BLOB,
+         PRIMARY KEY(GATEWAY_NAME,APPLICATION_DESCRIPTOR_ID),
+         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
+         FOREIGN KEY (UPDATED_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT
+(
+        EXPERIMENT_ID VARCHAR(255),
+        GATEWAY_NAME VARCHAR(255),
+        EXECUTION_USER VARCHAR(255) NOT NULL,
+        PROJECT_ID VARCHAR(255) NOT NULL,
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        EXPERIMENT_NAME VARCHAR(255) NOT NULL,
+        EXPERIMENT_DESCRIPTION VARCHAR(255),
+        APPLICATION_ID VARCHAR(255),
+        APPLICATION_VERSION VARCHAR(255),
+        WORKFLOW_TEMPLATE_ID VARCHAR(255),
+        WORKFLOW_TEMPLATE_VERSION VARCHAR(255),
+        WORKFLOW_EXECUTION_ID VARCHAR(255),
+        PRIMARY KEY(EXPERIMENT_ID),
+        FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE CASCADE,
+        FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE,
+        FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT_INPUT
+(
+        EXPERIMENT_ID VARCHAR(255),
+        INPUT_KEY VARCHAR(255) NOT NULL,
+        INPUT_TYPE VARCHAR(255),
+        METADATA VARCHAR(255),
+        VALUE VARCHAR(255),
+        PRIMARY KEY(EXPERIMENT_ID,INPUT_KEY),
+        FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT_OUTPUT
+(
+        EXPERIMENT_ID VARCHAR(255),
+        OUTPUT_KEY VARCHAR(255) NOT NULL,
+        OUTPUT_KEY_TYPE VARCHAR(255),
+        METADATA VARCHAR(255),
+        VALUE VARCHAR(255),
+        PRIMARY KEY(EXPERIMENT_ID,OUTPUT_KEY),
+        FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+
+CREATE TABLE WORKFLOW_NODE_DETAIL
+(
+        EXPERIMENT_ID VARCHAR(255) NOT NULL,
+        NODE_INSTANCE_ID VARCHAR(255),
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        NODE_NAME VARCHAR(255) NOT NULL,
+        PRIMARY KEY(NODE_INSTANCE_ID),
+        FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE TASK_DETAIL
+(
+        TASK_ID VARCHAR(255),
+        NODE_INSTANCE_ID VARCHAR(255),
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        APPLICATION_ID VARCHAR(255),
+        APPLICATION_VERSION VARCHAR(255),
+        PRIMARY KEY(TASK_ID),
+        FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ERROR_DETAIL
+(
+         ERROR_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+         EXPERIMENT_ID VARCHAR(255),
+         TASK_ID VARCHAR(255),
+         NODE_INSTANCE_ID VARCHAR(255),
+         JOB_ID VARCHAR(255),
+         CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+         ACTUAL_ERROR_MESSAGE CLOB,
+         USER_FRIEDNLY_ERROR_MSG VARCHAR(255),
+         TRANSIENT_OR_PERSISTENT SMALLINT,
+         ERROR_CATEGORY VARCHAR(255),
+         CORRECTIVE_ACTION VARCHAR(255),
+         ACTIONABLE_GROUP VARCHAR(255),
+         PRIMARY KEY(ERROR_ID),
+         FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+         FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
+         FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_INPUT
+(
+        TASK_ID VARCHAR(255),
+        INPUT_KEY VARCHAR(255) NOT NULL,
+        INPUT_KEY_TYPE VARCHAR(255),
+        METADATA VARCHAR(255),
+        VALUE VARCHAR(255),
+        PRIMARY KEY(TASK_ID,INPUT_KEY),
+        FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_OUTPUT
+(
+        TASK_ID VARCHAR(255),
+        OUTPUT_KEY VARCHAR(255) NOT NULL,
+        OUTPUT_KEY_TYPE VARCHAR(255),
+        METADATA VARCHAR(255),
+        VALUE VARCHAR(255),
+        PRIMARY KEY(TASK_ID,OUTPUT_KEY),
+        FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NODE_INPUT
+(
+       NODE_INSTANCE_ID VARCHAR(255),
+       INPUT_KEY VARCHAR(255) NOT NULL,
+       INPUT_KEY_TYPE VARCHAR(255),
+       METADATA VARCHAR(255),
+       VALUE VARCHAR(255),
+       PRIMARY KEY(NODE_INSTANCE_ID,INPUT_KEY),
+       FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NODE_OUTPUT
+(
+       NODE_INSTANCE_ID VARCHAR(255),
+       OUTPUT_KEY VARCHAR(255) NOT NULL,
+       OUTPUT_KEY_TYPE VARCHAR(255),
+       METADATA VARCHAR(255),
+       VALUE VARCHAR(255),
+       PRIMARY KEY(NODE_INSTANCE_ID,OUTPUT_KEY),
+       FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE JOB_DETAIL
+(
+        JOB_ID VARCHAR(255),
+        TASK_ID VARCHAR(255),
+        JOB_DESCRIPTION CLOB NOT NULL,
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        COMPUTE_RESOURCE_CONSUMED VARCHAR(255),
+        PRIMARY KEY (TASK_ID, JOB_ID),
+        FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE DATA_TRANSFER_DETAIL
+(
+        TRANSFER_ID VARCHAR(255),
+        TASK_ID VARCHAR(255),
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        TRANSFER_DESC CLOB NOT NULL,
+        PRIMARY KEY(TRANSFER_ID),
+        FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE STATUS
+(
+        STATUS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+        EXPERIMENT_ID VARCHAR(255),
+        NODE_INSTANCE_ID VARCHAR(255),
+        TRANSFER_ID VARCHAR(255),
+        TASK_ID VARCHAR(255),
+        JOB_ID VARCHAR(255),
+        STATE VARCHAR(255),
+        STATUS_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        STATUS_TYPE VARCHAR(255),
+        PRIMARY KEY(STATUS_ID),
+        FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+        FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
+        FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE,
+        FOREIGN KEY (TRANSFER_ID) REFERENCES DATA_TRANSFER_DETAIL(TRANSFER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE CONFIG_DATA
+(
+        EXPERIMENT_ID VARCHAR(255),
+        AIRAVATA_AUTO_SCHEDULE SMALLINT NOT NULL,
+        OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT NOT NULL,
+        SHARE_EXPERIMENT SMALLINT,
+        PRIMARY KEY(EXPERIMENT_ID)
+);
+
+CREATE TABLE COMPUTATIONAL_RESOURCE_SCHEDULING
+(
+        RESOURCE_SCHEDULING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+        EXPERIMENT_ID VARCHAR(255),
+        TASK_ID VARCHAR(255),
+        RESOURCE_HOST_ID VARCHAR(255),
+        CPU_COUNT INTEGER,
+        NODE_COUNT INTEGER,
+        NO_OF_THREADS INTEGER,
+        QUEUE_NAME VARCHAR(255),
+        WALLTIME_LIMIT INTEGER,
+        JOB_START_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        TOTAL_PHYSICAL_MEMORY INTEGER,
+        COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255),
+        PRIMARY KEY(RESOURCE_SCHEDULING_ID),
+        FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+        FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ADVANCE_INPUT_DATA_HANDLING
+(
+       INPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+       EXPERIMENT_ID VARCHAR(255),
+       TASK_ID VARCHAR(255),
+       WORKING_DIR_PARENT VARCHAR(255),
+       UNIQUE_WORKING_DIR VARCHAR(255),
+       STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT,
+       CLEAN_AFTER_JOB SMALLINT,
+       PRIMARY KEY(INPUT_DATA_HANDLING_ID),
+       FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+       FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ADVANCE_OUTPUT_DATA_HANDLING
+(
+       OUTPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+       EXPERIMENT_ID VARCHAR(255),
+       TASK_ID VARCHAR(255),
+       OUTPUT_DATA_DIR VARCHAR(255),
+       DATA_REG_URL VARCHAR (255),
+       PERSIST_OUTPUT_DATA SMALLINT,
+       PRIMARY KEY(OUTPUT_DATA_HANDLING_ID),
+       FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+       FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE QOS_PARAM
+(
+        QOS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+        EXPERIMENT_ID VARCHAR(255),
+        TASK_ID VARCHAR(255),
+        START_EXECUTION_AT VARCHAR(255),
+        EXECUTE_BEFORE VARCHAR(255),
+        NO_OF_RETRIES INTEGER,
+        PRIMARY KEY(QOS_ID),
+        FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+        FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE COMMUNITY_USER
+(
+        GATEWAY_NAME VARCHAR(256) NOT NULL,
+        COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+        TOKEN_ID VARCHAR(256) NOT NULL,
+        COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
+        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME, TOKEN_ID)
+);
+
+CREATE TABLE CREDENTIALS
+(
+        GATEWAY_ID VARCHAR(256) NOT NULL,
+        TOKEN_ID VARCHAR(256) NOT NULL,
+        CREDENTIAL BLOB NOT NULL,
+        PORTAL_USER_ID VARCHAR(256) NOT NULL,
+        TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
+);
+
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/gfac-thrift-descriptions/generate-gfac-stubs.sh
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-thrift-descriptions/generate-gfac-stubs.sh b/modules/gfac/gfac-thrift-descriptions/generate-gfac-stubs.sh
new file mode 100755
index 0000000..73cdba3
--- /dev/null
+++ b/modules/gfac/gfac-thrift-descriptions/generate-gfac-stubs.sh
@@ -0,0 +1,132 @@
+#! /usr/bin/env bash
+
+# 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.
+
+# This script will regenerate the thrift code for Airavata GFAC Server Skeltons and Client Stubs.
+
+
+# Global Constants used across the script
+REQUIRED_THRIFT_VERSION='0.9.1'
+BASE_TARGET_DIR='target'
+GFAC_SERVICE_DIR='../airavata-gfac-service/src/main/java'
+
+# The Funcation fail prints error messages on failure and quits the script.
+fail() {
+    echo $@
+    exit 1
+}
+
+# The funcation add_license_header adds the ASF V2 license header to all java files within the specified generated
+#   directory. The funcation also adds suppress all warnings annotation to all public classes and enum's
+#  To Call:
+#   add_license_header $generated_code_directory
+add_license_header() {
+
+    # Fetch the generated code directory passed as the argument
+    GENERATED_CODE_DIR=$1
+
+    # For all generated thrift code, add the suppress all warnings annotation
+    #  NOTE: In order to save the orginal file as a backup, use sed -i.orig in place of sed -i ''
+    find ${GENERATED_CODE_DIR} -name '*.java' -print0 | xargs -0 sed -i '' -e 's/public class /@SuppressWarnings("all") public class /'
+    find ${GENERATED_CODE_DIR} -name '*.java' -print0 | xargs -0 sed -i '' -e 's/public enum /@SuppressWarnings("all") public enum /'
+
+    # For each java file within the genrated directory, add the ASF V2 LICENSE header
+    for f in $(find ${GENERATED_CODE_DIR} -name '*.java'); do
+      cat - ${f} >${f}-with-license <<EOF
+    /*
+     * 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.
+     */
+EOF
+    mv ${f}-with-license ${f}
+    done
+}
+
+# The funcation compares every generated java file with the one in specified existing source location. If the comparision
+#   shows a difference, then it replaces with the newly generated file (with added license header).
+#  To Call:
+#   copy_changed_files $generated_code_directory $existing_source_directory
+copy_changed_files() {
+
+    # Read all the funcation arguments
+    GENERATED_CODE_DIR=$1
+    WORKSPACE_SRC_DIR=$2
+
+    echo "Generated sources are in ${GENERATED_CODE_DIR}"
+    echo "Destination workspace is in ${WORKSPACE_SRC_DIR}"
+
+    # Check if the newly generated files exist in the targetted workspace, if not copy. Only changed files will be synced.
+    #  the extra slash to GENERATED_CODE_DIR is needed to ensure the parent directory itself is not copied.
+    rsync -auv ${GENERATED_CODE_DIR}/ ${WORKSPACE_SRC_DIR}
+}
+
+# Generation of thrift files will require installing Apache Thrift. Please add thrift to your path.
+#  Verify is thrift is installed, is in the path is at a specified version.
+VERSION=$(thrift -version 2>/dev/null | grep -F "${REQUIRED_THRIFT_VERSION}" |  wc -l)
+if [ "$VERSION" -ne 1 ] ; then
+    echo "****************************************************"
+    echo "*** thrift is not installed or is not in the path"
+    echo "***   expecting 'thrift -version' to return ${REQUIRED_THRIFT_VERSION}"
+    echo "*** generated code will not be updated"
+    fail "****************************************************"
+fi
+
+# Initialize the thrift arguements.
+#  Since most of the Airavata API and Data Models have includes, use recursive option by defualt.
+#  Generate all the files in target directory
+THRIFT_ARGS="-r -o ${BASE_TARGET_DIR}"
+# Ensure the required target directories exists, if not create.
+mkdir -p ${BASE_TARGET_DIR}
+
+#######################################################################
+# Generate/Update the GFAC CPI service stubs
+#  To start with both the servicer and client are in same package, but
+#  needs to be split using a common generated api-boilerplate-code
+#######################################################################
+
+#Java generation directory
+JAVA_GEN_DIR=${BASE_TARGET_DIR}/gen-java
+
+# As a precausion  remove and previously generated files if exists
+rm -rf ${JAVA_GEN_DIR}
+
+# Using thrify Java generator, generate the java classes based on Airavata API. This
+#   The airavataAPI.thrift includes rest of data models.
+thrift ${THRIFT_ARGS} --gen java gfac.cpi.service.thrift || fail unable to generate java thrift classes
+
+# For the generated java classes add the ASF V2 License header
+add_license_header $JAVA_GEN_DIR
+
+# Compare the newly generated classes with existing java generated skelton/stub sources and replace the changed ones.
+copy_changed_files ${JAVA_GEN_DIR} ${GFAC_SERVICE_DIR}
+
+# CleanUp: Delete the base target build directory
+#rm -rf ${BASE_TARGET_DIR}
+
+echo "Successfully generated new sources, compared against exiting code and replaced the changed files"
+exit 0

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce716cd/modules/gfac/gfac-thrift-descriptions/gfac.cpi.service.thrift
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-thrift-descriptions/gfac.cpi.service.thrift b/modules/gfac/gfac-thrift-descriptions/gfac.cpi.service.thrift
new file mode 100644
index 0000000..3e81148
--- /dev/null
+++ b/modules/gfac/gfac-thrift-descriptions/gfac.cpi.service.thrift
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ */
+
+/*
+ * Component Programming Interface definition for Apache Airavata GFac Service.
+ *
+*/
+
+namespace java org.apache.airavata.gfac.cpi
+
+const string GFAC_CPI_VERSION = "0.12.0"
+
+service GfacService {
+
+  /** Query gfac server to fetch the CPI version */
+  string getGFACServiceVersion(),
+
+    /**
+     * After creating the experiment Data and Task Data in the orchestrator
+     * Orchestrator has to invoke this operation for each Task per experiment to run
+     * the actual Job related actions.
+     *
+     * @param experimentID
+     * @param taskID
+     * @return sucess/failure
+     *
+    **/
+  bool submitJob (1: required string experimentId,
+                  2: required string taskId)
+
+    /**
+     *
+     * Terminate the running job.At this point user
+     * does not have to know the job ID so in the argument
+     * we do not make it to required jobID to provide.
+     *
+     *
+     * @param experimentID
+     * @param taskID
+     * @return sucess/failure
+     *
+    **/
+  bool cancelJob (1: required string experimentId,
+                  2: required string taskId)
+}
\ No newline at end of file


Mime
View raw message