Renamed orchestrator component nested modules and artifact ids

Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/82773c73
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/82773c73
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/82773c73

Branch: refs/heads/moduleRefactor
Commit: 82773c73b7fa2c5f74918575d976235daa7c4660
Parents: 8d160a7
Author: Shameera Rathanyaka <[email protected]>
Authored: Wed Jun 3 00:46:02 2015 -0400
Committer: Shameera Rathanyaka <[email protected]>
Committed: Wed Jun 3 00:46:02 2015 -0400

----------------------------------------------------------------------
 airavata-api/airavata-api-server/pom.xml        |    2 +-
 .../orchestrator/generate-orchestrator-stubs.sh |    2 +-
 .../java/src/main/assembly/bin-assembly.xml     |    4 +-
 .../distribution/orchestrator-server/pom.xml    |    2 +-
 modules/distribution/server/pom.xml             |    6 +-
 .../airavata-orchestrator-service/pom.xml       |   85 -
 .../orchestrator/server/OrchestratorServer.java |  160 -
 .../server/OrchestratorServerHandler.java       |  643 ---
 .../airavata/orchestrator/util/Constants.java   |   29 -
 .../orchestrator/util/DataModelUtils.java       |   55 -
 .../OrchestratorServerThreadPoolExecutor.java   |   56 -
 .../src/main/resources/gsissh.properties        |   26 -
 .../client/OrchestratorClientFactoryTest.java   |   90 -
 .../orchestrator/client/util/Initialize.java    |  330 --
 .../src/test/resources/gsissh.properties        |   26 -
 .../src/test/resources/monitor.properties       |   30 -
 .../src/test/resources/orchestrator.properties  |   26 -
 .../src/test/resources/registry-derby.sql       |  361 --
 .../src/test/resources/zoo.cfg                  |   22 -
 .../airavata-orchestrator-stubs/pom.xml         |   60 -
 .../client/OrchestratorClientFactory.java       |   44 -
 .../orchestrator/cpi/OrchestratorService.java   | 4669 ------------------
 .../cpi/orchestrator_cpi_serviceConstants.java  |   55 -
 .../sample/OrchestratorClientSample.java        |  136 -
 .../orchestrator/orchestrator-client/pom.xml    |   60 +
 .../client/OrchestratorClientFactory.java       |   44 +
 .../orchestrator/cpi/OrchestratorService.java   | 4669 ++++++++++++++++++
 .../cpi/orchestrator_cpi_serviceConstants.java  |   55 +
 .../sample/OrchestratorClientSample.java        |  136 +
 modules/orchestrator/orchestrator-core/pom.xml  |    2 +-
 .../orchestrator/orchestrator-service/pom.xml   |   85 +
 .../orchestrator/server/OrchestratorServer.java |  160 +
 .../server/OrchestratorServerHandler.java       |  643 +++
 .../airavata/orchestrator/util/Constants.java   |   29 +
 .../orchestrator/util/DataModelUtils.java       |   55 +
 .../OrchestratorServerThreadPoolExecutor.java   |   56 +
 .../src/main/resources/gsissh.properties        |   26 +
 .../client/OrchestratorClientFactoryTest.java   |   90 +
 .../orchestrator/client/util/Initialize.java    |  330 ++
 .../src/test/resources/gsissh.properties        |   26 +
 .../src/test/resources/monitor.properties       |   30 +
 .../src/test/resources/orchestrator.properties  |   26 +
 .../src/test/resources/registry-derby.sql       |  361 ++
 .../src/test/resources/zoo.cfg                  |   22 +
 modules/orchestrator/pom.xml                    |    4 +-
 modules/server/pom.xml                          |    2 +-
 modules/workflow-model/workflow-engine/pom.xml  |    2 +-
 modules/xbaya-gui/pom.xml                       |    2 +-
 48 files changed, 6917 insertions(+), 6917 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/airavata-api/airavata-api-server/pom.xml
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/pom.xml 
b/airavata-api/airavata-api-server/pom.xml
index 64b436b..6bf3d32 100644
--- a/airavata-api/airavata-api-server/pom.xml
+++ b/airavata-api/airavata-api-server/pom.xml
@@ -63,7 +63,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-orchestrator-stubs</artifactId>
+            <artifactId>orchestrator-client</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/component-interface-descriptions/orchestrator/generate-orchestrator-stubs.sh
----------------------------------------------------------------------
diff --git 
a/component-interface-descriptions/orchestrator/generate-orchestrator-stubs.sh 
b/component-interface-descriptions/orchestrator/generate-orchestrator-stubs.sh
index b122f02..df526d2 100755
--- 
a/component-interface-descriptions/orchestrator/generate-orchestrator-stubs.sh
+++ 
b/component-interface-descriptions/orchestrator/generate-orchestrator-stubs.sh
@@ -21,7 +21,7 @@
 # Global Constants used across the script
 REQUIRED_THRIFT_VERSION='0.9.1'
 BASE_TARGET_DIR='target'
-ORCHESTRATOR_SERVICE_DIR='../../modules/orchestrator/airavata-orchestrator-stubs/src/main/java'
+ORCHESTRATOR_SERVICE_DIR='../../modules/orchestrator/orchestrator-client/src/main/java'
 
 # The Funcation fail prints error messages on failure and quits the script.
 fail() {

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/distribution/client/java/src/main/assembly/bin-assembly.xml
----------------------------------------------------------------------
diff --git 
a/modules/distribution/client/java/src/main/assembly/bin-assembly.xml 
b/modules/distribution/client/java/src/main/assembly/bin-assembly.xml
index 4df667f..59976d8 100644
--- a/modules/distribution/client/java/src/main/assembly/bin-assembly.xml
+++ b/modules/distribution/client/java/src/main/assembly/bin-assembly.xml
@@ -106,7 +106,7 @@
                                
<!--<include>com.amazonaws:aws-java-sdk</include> -->
                                
<!--<include>amazon:MapReduce.Service.Client</include> -->
                                <include>net.java.dev.jets3t:jets3t</include>
-                               
<include>org.apache.airavata:airavata-orchestrator-core:jar
+                               
<include>org.apache.airavata:orchestrator-core:jar
                                </include>
                                
<!--<include>org.apache.airavata:airavata-gfac-schema-utils:jar-->
                                <!--</include>-->
@@ -127,7 +127,7 @@
                                </include>
                                
<include>org.apache.airavata:gsissh:jar</include>
                                
<include>org.apache.airavata:airavata-model-utils:jar</include>
-                               
<include>org.apache.airavata:airavata-orchestrator-service:jar
+                               
<include>org.apache.airavata:orchestrator-service:jar
                                </include>
                                
<include>org.apache.openjpa:openjpa-all:jar</include>
                                <include>xerces:xercesImpl:jar:2.9.1</include>

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/distribution/orchestrator-server/pom.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/orchestrator-server/pom.xml 
b/modules/distribution/orchestrator-server/pom.xml
index a6c44ad..4f39b5f 100644
--- a/modules/distribution/orchestrator-server/pom.xml
+++ b/modules/distribution/orchestrator-server/pom.xml
@@ -138,7 +138,7 @@
                </dependency>
                <dependency>
                        <groupId>org.apache.airavata</groupId>
-                       <artifactId>airavata-orchestrator-service</artifactId>
+                       <artifactId>orchestrator-service</artifactId>
                        <version>${project.version}</version>
                </dependency>
        </dependencies>

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/distribution/server/pom.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/server/pom.xml 
b/modules/distribution/server/pom.xml
index 4aa09f8..fc2df04 100644
--- a/modules/distribution/server/pom.xml
+++ b/modules/distribution/server/pom.xml
@@ -244,7 +244,7 @@
                </dependency>
                <dependency>
                        <groupId>org.apache.airavata</groupId>
-                       <artifactId>airavata-orchestrator-service</artifactId>
+                       <artifactId>orchestrator-service</artifactId>
                        <version>${project.version}</version>
                        <exclusions>
                                <exclusion>
@@ -263,7 +263,7 @@
                </dependency>
                <dependency>
                        <groupId>org.apache.airavata</groupId>
-                       <artifactId>airavata-orchestrator-stubs</artifactId>
+                       <artifactId>orchestrator-client</artifactId>
                        <version>${project.version}</version>
                </dependency>
                <dependency>
@@ -273,7 +273,7 @@
                </dependency>
                <dependency>
                        <groupId>org.apache.airavata</groupId>
-                       <artifactId>airavata-orchestrator-core</artifactId>
+                       <artifactId>orchestrator-core</artifactId>
                        <version>${project.version}</version>
                </dependency>
                <dependency>

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/orchestrator/airavata-orchestrator-service/pom.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/pom.xml 
b/modules/orchestrator/airavata-orchestrator-service/pom.xml
deleted file mode 100644
index fc60a17..0000000
--- a/modules/orchestrator/airavata-orchestrator-service/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--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. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <artifactId>orchestrator</artifactId>
-        <groupId>org.apache.airavata</groupId>
-        <version>0.16-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <name>Airavata Orchestrator Service</name>
-    <artifactId>airavata-orchestrator-service</artifactId>
-    <packaging>jar</packaging>
-    <url>http://airavata.apache.org/</url>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-credential-store</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.thrift</groupId>
-            <artifactId>libthrift</artifactId>
-            <version>${thrift.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <version>${org.slf4j.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-orchestrator-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-orchestrator-stubs</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-workflow-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>app-catalog-data</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>app-catalog-cpi</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-model-utils</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-server-configuration</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-    </properties>
-    
-</project>

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServer.java
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServer.java
 
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServer.java
deleted file mode 100644
index 78957ac..0000000
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServer.java
+++ /dev/null
@@ -1,160 +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.orchestrator.server;
-
-import java.net.InetSocketAddress;
-
-import org.apache.airavata.common.utils.IServer;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.orchestrator.cpi.OrchestratorService;
-import org.apache.airavata.orchestrator.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 OrchestratorServer implements IServer{
-
-    private final static Logger logger = 
LoggerFactory.getLogger(OrchestratorServer.class);
-       private static final String SERVER_NAME = "Orchestrator Server";
-       private static final String SERVER_VERSION = "1.0";
-
-    private ServerStatus status;
-
-       private TServer server;
-
-       public OrchestratorServer() {
-               setStatus(ServerStatus.STOPPED);
-       }
-
-    public void 
StartOrchestratorServer(OrchestratorService.Processor<OrchestratorServerHandler>
 orchestratorServerHandlerProcessor)
-            throws Exception {
-        try {
-            final int serverPort = 
Integer.parseInt(ServerSettings.getSetting(Constants.ORCHESTRATOT_SERVER_PORT,"8940"));
-
-            final String serverHost = 
ServerSettings.getSetting(Constants.ORCHESTRATOT_SERVER_HOST, null);
-            
-                       TServerTransport serverTransport;
-                       
-                       if(serverHost == null){
-                               serverTransport = new TServerSocket(serverPort);
-                       }else{
-                               InetSocketAddress inetSocketAddress = new 
InetSocketAddress(serverHost, serverPort);
-                               serverTransport = new 
TServerSocket(inetSocketAddress);
-                       }
-                       
-            //server = new TSimpleServer(
-              //      new 
TServer.Args(serverTransport).processor(orchestratorServerHandlerProcessor));
-            TThreadPoolServer.Args options = new 
TThreadPoolServer.Args(serverTransport);
-            options.minWorkerThreads = 
Integer.parseInt(ServerSettings.getSetting(Constants.ORCHESTRATOT_SERVER_MIN_THREADS,
 "30"));
-            server = new 
TThreadPoolServer(options.processor(orchestratorServerHandlerProcessor));
-
-            new Thread() {
-                               public void run() {
-                                       server.serve();
-                                       setStatus(ServerStatus.STOPPED);
-                                       logger.info("Orchestrator Server 
Stopped.");
-                               }
-                       }.start();
-                       new Thread() {
-                               public void run() {
-                                       while(!server.isServing()){
-                                               try {
-                                                       Thread.sleep(500);
-                                               } catch (InterruptedException 
e) {
-                                                       break;
-                                               }
-                                       }
-                                       if (server.isServing()){
-                                               setStatus(ServerStatus.STARTED);
-                                   logger.info("Starting Orchestrator Server 
on Port " + serverPort);
-                                   logger.info("Listening to Orchestrator 
Clients ....");
-                                       }
-                               }
-                       }.start();
-        } catch (TTransportException e) {
-            logger.error(e.getMessage());
-            setStatus(ServerStatus.FAILED);
-        }
-    }
-
-    public static void main(String[] args) {
-       try {
-                       new OrchestratorServer().start();
-               } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-               }
-    }
-
-       @Override
-       public void start() throws Exception {
-               setStatus(ServerStatus.STARTING);
-               OrchestratorService.Processor<OrchestratorServerHandler> 
orchestratorService =
-                new 
OrchestratorService.Processor<OrchestratorServerHandler>(new 
OrchestratorServerHandler());
-               StartOrchestratorServer(orchestratorService);
-       }
-
-       @Override
-       public void stop() throws Exception {
-        if (server!=null && server.isServing()){
-                       setStatus(ServerStatus.STOPING);
-                       server.stop();
-               }
-               
-       }
-
-       @Override
-       public void restart() throws Exception {
-               stop();
-               start();
-       }
-
-       @Override
-       public void configure() throws Exception {
-               // TODO Auto-generated method stub
-               
-       }
-
-       @Override
-       public ServerStatus getStatus() throws Exception {
-               return status;
-       }
-       
-       private void setStatus(ServerStatus stat){
-               status=stat;
-               status.updateTime();
-       }
-
-       @Override
-       public String getName() {
-               return SERVER_NAME;
-       }
-
-       @Override
-       public String getVersion() {
-               return SERVER_VERSION;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
 
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
deleted file mode 100644
index 4ef9dbc..0000000
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ /dev/null
@@ -1,643 +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.orchestrator.server;
-
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
-import 
org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
-import org.apache.airavata.common.exception.AiravataException;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.logger.AiravataLogger;
-import org.apache.airavata.common.logger.AiravataLoggerFactory;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.AiravataZKUtils;
-import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.credential.store.store.CredentialReader;
-import org.apache.airavata.gfac.core.scheduler.HostScheduler;
-import org.apache.airavata.gfac.core.utils.GFacUtils;
-import org.apache.airavata.messaging.core.MessageContext;
-import org.apache.airavata.messaging.core.MessageHandler;
-import org.apache.airavata.messaging.core.MessagingConstants;
-import org.apache.airavata.messaging.core.Publisher;
-import org.apache.airavata.messaging.core.PublisherFactory;
-import org.apache.airavata.messaging.core.impl.RabbitMQProcessConsumer;
-import org.apache.airavata.messaging.core.impl.RabbitMQProcessPublisher;
-import 
org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
-import 
org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
-import 
org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
-import org.apache.airavata.model.error.LaunchValidationException;
-import org.apache.airavata.model.messaging.event.ExperimentStatusChangeEvent;
-import org.apache.airavata.model.messaging.event.MessageType;
-import org.apache.airavata.model.messaging.event.ProcessSubmitEvent;
-import org.apache.airavata.model.util.ExecutionType;
-import org.apache.airavata.model.workspace.experiment.Experiment;
-import org.apache.airavata.model.workspace.experiment.ExperimentState;
-import org.apache.airavata.model.workspace.experiment.ExperimentStatus;
-import org.apache.airavata.model.workspace.experiment.TaskDetails;
-import org.apache.airavata.model.workspace.experiment.TaskState;
-import org.apache.airavata.model.workspace.experiment.TaskStatus;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus;
-import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
-import org.apache.airavata.orchestrator.cpi.OrchestratorService;
-import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
-import org.apache.airavata.orchestrator.cpi.orchestrator_cpi_serviceConstants;
-import org.apache.airavata.orchestrator.util.DataModelUtils;
-import 
org.apache.airavata.orchestrator.util.OrchestratorServerThreadPoolExecutor;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.RegistryModelType;
-import 
org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.TaskDetailConstants;
-import 
org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowNodeConstants;
-import org.apache.airavata.workflow.core.WorkflowEnactmentService;
-import org.apache.thrift.TBase;
-import org.apache.thrift.TException;
-
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class OrchestratorServerHandler implements OrchestratorService.Iface {
-       private static AiravataLogger log = AiravataLoggerFactory 
.getLogger(OrchestratorServerHandler.class);
-       private SimpleOrchestratorImpl orchestrator = null;
-       private Registry registry;
-       private static Integer mutex = new Integer(-1);
-       private String airavataUserName;
-       private String gatewayName;
-       private Publisher publisher;
-    private RabbitMQProcessConsumer rabbitMQProcessConsumer;
-    private RabbitMQProcessPublisher rabbitMQProcessPublisher;
-
-    /**
-        * Query orchestrator server to fetch the CPI version
-        */
-       public String getOrchestratorCPIVersion() throws TException {
-               return 
orchestrator_cpi_serviceConstants.ORCHESTRATOR_CPI_VERSION;
-       }
-
-       public OrchestratorServerHandler() throws OrchestratorException{
-               // registering with zk
-               try {
-               publisher = PublisherFactory.createActivityPublisher();
-                       String zkhostPort = AiravataZKUtils.getZKhostPort();
-                       String airavataServerHostPort = ServerSettings
-                                       
.getSetting(Constants.ORCHESTRATOR_SERVER_HOST)
-                                       + ":"
-                                       + ServerSettings
-                                                       
.getSetting(Constants.ORCHESTRATOR_SERVER_PORT);
-                       
-//            setGatewayName(ServerSettings.getDefaultUserGateway());
-            setAiravataUserName(ServerSettings.getDefaultUser());
-               } catch (AiravataException e) {
-            log.error(e.getMessage(), e);
-            throw new OrchestratorException("Error while initializing 
orchestrator service", e);
-               }
-               // orchestrator init
-               try {
-                       // first constructing the monitorManager and 
orchestrator, then fill
-                       // the required properties
-                       orchestrator = new SimpleOrchestratorImpl();
-                       registry = RegistryFactory.getDefaultRegistry();
-                       orchestrator.initialize();
-                       
orchestrator.getOrchestratorContext().setPublisher(this.publisher);
-            startProcessConsumer();
-        } catch (OrchestratorException e) {
-            log.error(e.getMessage(), e);
-            throw new OrchestratorException("Error while initializing 
orchestrator service", e);
-               } catch (RegistryException e) {
-            log.error(e.getMessage(), e);
-            throw new OrchestratorException("Error while initializing 
orchestrator service", e);
-               }
-       }
-
-    private void startProcessConsumer() throws OrchestratorException {
-        try {
-            rabbitMQProcessConsumer = new RabbitMQProcessConsumer();
-            ProcessConsumer processConsumer = new ProcessConsumer();
-            Thread thread = new Thread(processConsumer);
-            thread.start();
-
-        } catch (AiravataException e) {
-            throw new OrchestratorException("Error while starting process 
consumer", e);
-        }
-
-    }
-
-    /**
-        * * After creating the experiment Data user have the * experimentID as 
the
-        * handler to the experiment, during the launchExperiment * We just 
have to
-        * give the experimentID * * @param experimentID * @return 
sucess/failure *
-        * *
-        * 
-        * @param experimentId
-        */
-       public boolean launchExperiment(String experimentId, String token) 
throws TException {
-        Experiment experiment = null; // this will inside the bottom catch 
statement
-        try {
-            experiment = (Experiment) registry.get(
-                    RegistryModelType.EXPERIMENT, experimentId);
-            if (experiment == null) {
-                log.errorId(experimentId, "Error retrieving the Experiment by 
the given experimentID: {} ", experimentId);
-                return false;
-            }
-            CredentialReader credentialReader = 
GFacUtils.getCredentialReader();
-            String gatewayId = null;
-            if (credentialReader != null) {
-                try {
-                    gatewayId = credentialReader.getGatewayID(token);
-                } catch (Exception e) {
-                    log.error(e.getLocalizedMessage());
-                }
-            }
-            if (gatewayId == null) {
-                gatewayId = ServerSettings.getDefaultUserGateway();
-                log.info("Couldn't identify the gateway Id using the 
credential token, Use default gateway Id");
-//                throw new AiravataException("Couldn't identify the gateway 
Id using the credential token");
-            }
-            ExecutionType executionType = 
DataModelUtils.getExecutionType(gatewayId, experiment);
-            if (executionType == ExecutionType.SINGLE_APP) {
-                //its an single application execution experiment
-                log.debugId(experimentId, "Launching single application 
experiment {}.", experimentId);
-                
OrchestratorServerThreadPoolExecutor.getCachedThreadPool().execute(new 
SingleAppExperimentRunner(experimentId, token));
-            } else if (executionType == ExecutionType.WORKFLOW) {
-                //its a workflow execution experiment
-                log.debugId(experimentId, "Launching workflow experiment {}.", 
experimentId);
-                launchWorkflowExperiment(experimentId, token);
-            } else {
-                log.errorId(experimentId, "Couldn't identify experiment type, 
experiment {} is neither single application nor workflow.", experimentId);
-                throw new TException("Experiment '" + experimentId + "' launch 
failed. Unable to figureout execution type for application " + 
experiment.getApplicationId());
-            }
-        } catch (Exception e) {
-            throw new TException("Experiment '" + experimentId + "' launch 
failed. Unable to figureout execution type for application " + 
experiment.getApplicationId(), e);
-        }
-        return true;
-       }
-
-       /**
-        * This method will validate the experiment before launching, if is 
failed
-        * we do not run the launch in airavata thrift service (only if 
validation
-        * is enabled
-        * 
-        * @param experimentId
-        * @return
-        * @throws TException
-        */
-       public boolean validateExperiment(String experimentId) throws 
TException,
-                       LaunchValidationException {
-               // TODO: Write the Orchestrator implementaion
-               try {
-                       List<TaskDetails> tasks = 
orchestrator.createTasks(experimentId);
-                       if (tasks.size() > 1) {
-                               log.info("There are multiple tasks for this 
experiment, So Orchestrator will launch multiple Jobs");
-                       }
-                       List<String> ids = registry.getIds(
-                                       RegistryModelType.WORKFLOW_NODE_DETAIL,
-                                       WorkflowNodeConstants.EXPERIMENT_ID, 
experimentId);
-                       for (String workflowNodeId : ids) {
-                               WorkflowNodeDetails workflowNodeDetail = 
(WorkflowNodeDetails) registry
-                                               
.get(RegistryModelType.WORKFLOW_NODE_DETAIL,
-                                                               workflowNodeId);
-                               List<Object> taskDetailList = registry.get(
-                                               RegistryModelType.TASK_DETAIL,
-                                               TaskDetailConstants.NODE_ID, 
workflowNodeId);
-                               for (Object o : taskDetailList) {
-                                       TaskDetails taskID = (TaskDetails) o;
-                                       // iterate through all the generated 
tasks and performs the
-                                       // job submisssion+monitoring
-                                       Experiment experiment = (Experiment) 
registry.get(
-                                                       
RegistryModelType.EXPERIMENT, experimentId);
-                                       if (experiment == null) {
-                                               log.errorId(experimentId, 
"Error retrieving the Experiment by the given experimentID: {}.",
-                                experimentId);
-                                               return false;
-                                       }
-                                       return 
orchestrator.validateExperiment(experiment,
-                                                       workflowNodeDetail, 
taskID).isSetValidationState();
-                               }
-                       }
-
-               } catch (OrchestratorException e) {
-            log.errorId(experimentId, "Error while validating experiment", e);
-                       throw new TException(e);
-               } catch (RegistryException e) {
-            log.errorId(experimentId, "Error while validating experiment", e);
-                       throw new TException(e);
-               }
-               return false;
-       }
-
-       /**
-        * This can be used to cancel a running experiment and store the status 
to
-        * terminated in registry
-        * 
-        * @param experimentId
-        * @return
-        * @throws TException
-        */
-       public boolean terminateExperiment(String experimentId, String tokenId) 
throws TException {
-        log.infoId(experimentId, "Experiment: {} is cancelling  !!!!!", 
experimentId);
-        return validateStatesAndCancel(experimentId, tokenId);
-       }
-
-       private String getAiravataUserName() {
-               return airavataUserName;
-       }
-
-       private String getGatewayName() {
-               return gatewayName;
-       }
-
-       public void setAiravataUserName(String airavataUserName) {
-               this.airavataUserName = airavataUserName;
-       }
-
-       public void setGatewayName(String gatewayName) {
-               this.gatewayName = gatewayName;
-       }
-
-       @Override
-       public boolean launchTask(String taskId, String airavataCredStoreToken) 
throws TException {
-               try {
-                       TaskDetails taskData = (TaskDetails) registry.get(
-                                       RegistryModelType.TASK_DETAIL, taskId);
-                       String applicationId = taskData.getApplicationId();
-                       if (applicationId == null) {
-                log.errorId(taskId, "Application id shouldn't be null.");
-                               throw new OrchestratorException("Error 
executing the job, application id shouldn't be null.");
-                       }
-                       ApplicationDeploymentDescription 
applicationDeploymentDescription = getAppDeployment(taskData, applicationId);
-            
taskData.setApplicationDeploymentId(applicationDeploymentDescription.getAppDeploymentId());
-                       registry.update(RegistryModelType.TASK_DETAIL, 
taskData,taskData.getTaskID());
-                       List<Object> workflowNodeDetailList = 
registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL,
-                                                       
org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowNodeConstants.TASK_LIST,
 taskData);
-                       if (workflowNodeDetailList != null
-                                       && workflowNodeDetailList.size() > 0) {
-                               List<Object> experimentList = 
registry.get(RegistryModelType.EXPERIMENT,
-                                                               
org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.ExperimentConstants.WORKFLOW_NODE_LIST,
-                                                               
(WorkflowNodeDetails) workflowNodeDetailList.get(0));
-                               if (experimentList != null && 
experimentList.size() > 0) {
-                                       return orchestrator
-                                                       .launchExperiment(
-                                                                       
(Experiment) experimentList.get(0),
-                                                                       
(WorkflowNodeDetails) workflowNodeDetailList
-                                                                               
        .get(0), taskData,airavataCredStoreToken);
-                               }
-                       }
-               } catch (Exception e) {
-            log.errorId(taskId, "Error while launching task ", e);
-            throw new TException(e);
-        }
-        log.infoId(taskId, "No experiment found associated in task {}", 
taskId);
-        return false;
-       }
-
-       private ApplicationDeploymentDescription getAppDeployment(
-                       TaskDetails taskData, String applicationId)
-                       throws AppCatalogException, OrchestratorException,
-                       ClassNotFoundException, ApplicationSettingsException,
-                       InstantiationException, IllegalAccessException {
-               AppCatalog appCatalog = AppCatalogFactory.getAppCatalog();
-               String selectedModuleId = getModuleId(appCatalog, 
applicationId);
-               ApplicationDeploymentDescription 
applicationDeploymentDescription = getAppDeployment(
-                               appCatalog, taskData, selectedModuleId);
-               return applicationDeploymentDescription;
-       }
-
-       private ApplicationDeploymentDescription getAppDeployment(
-                       AppCatalog appCatalog, TaskDetails taskData, String 
selectedModuleId)
-                       throws AppCatalogException, ClassNotFoundException,
-                       ApplicationSettingsException, InstantiationException,
-                       IllegalAccessException {
-               Map<String, String> moduleIdFilter = new HashMap<String, 
String>();
-               
moduleIdFilter.put(AbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID,
 selectedModuleId);
-               if (taskData.getTaskScheduling()!=null && 
taskData.getTaskScheduling().getResourceHostId() != null) {
-                   
moduleIdFilter.put(AbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID,
 taskData.getTaskScheduling().getResourceHostId());
-               }
-               List<ApplicationDeploymentDescription> applicationDeployements 
= 
appCatalog.getApplicationDeployment().getApplicationDeployements(moduleIdFilter);
-               Map<ComputeResourceDescription, 
ApplicationDeploymentDescription> deploymentMap = new 
HashMap<ComputeResourceDescription, ApplicationDeploymentDescription>();
-               ComputeResource computeResource = 
appCatalog.getComputeResource();
-               for (ApplicationDeploymentDescription deploymentDescription : 
applicationDeployements) {
-                       
deploymentMap.put(computeResource.getComputeResource(deploymentDescription.getComputeHostId()),deploymentDescription);
-               }
-               List<ComputeResourceDescription> computeHostList = 
Arrays.asList(deploymentMap.keySet().toArray(new 
ComputeResourceDescription[]{}));   
-               Class<? extends HostScheduler> aClass = Class.forName(
-                               ServerSettings.getHostScheduler()).asSubclass(
-                               HostScheduler.class);
-               HostScheduler hostScheduler = aClass.newInstance();
-               ComputeResourceDescription ComputeResourceDescription = 
hostScheduler.schedule(computeHostList);
-               ApplicationDeploymentDescription 
applicationDeploymentDescription = 
deploymentMap.get(ComputeResourceDescription);
-               return applicationDeploymentDescription;
-       }
-
-       private String getModuleId(AppCatalog appCatalog, String applicationId)
-                       throws AppCatalogException, OrchestratorException {
-               ApplicationInterfaceDescription applicationInterface = 
appCatalog.getApplicationInterface().getApplicationInterface(applicationId);
-               List<String> applicationModules = 
applicationInterface.getApplicationModules();
-               if (applicationModules.size()==0){
-                       throw new OrchestratorException(
-                                       "No modules defined for application "
-                                                       + applicationId);
-               }
-//                     AiravataAPI airavataAPI = getAiravataAPI();
-               String selectedModuleId=applicationModules.get(0);
-               return selectedModuleId;
-       }
-
-    private boolean validateStatesAndCancel(String experimentId, String 
tokenId)throws TException{
-        try {
-            Experiment experiment = (Experiment) registry.get(
-                    RegistryModelType.EXPERIMENT, experimentId);
-                       log.info("Waiting for zookeeper to connect to the 
server");
-                       synchronized (mutex){
-                               mutex.wait(5000);
-                       }
-            if (experiment == null) {
-                log.errorId(experimentId, "Error retrieving the Experiment by 
the given experimentID: {}.", experimentId);
-                throw new OrchestratorException("Error retrieving the 
Experiment by the given experimentID: " + experimentId);
-            }
-            ExperimentState experimentState = 
experiment.getExperimentStatus().getExperimentState();
-            if (isCancelValid(experimentState)){
-                ExperimentStatus status = new ExperimentStatus();
-                status.setExperimentState(ExperimentState.CANCELING);
-                status.setTimeOfStateChange(Calendar.getInstance()
-                        .getTimeInMillis());
-                experiment.setExperimentStatus(status);
-                registry.update(RegistryModelType.EXPERIMENT, experiment,
-                        experimentId);
-
-                List<String> ids = registry.getIds(
-                        RegistryModelType.WORKFLOW_NODE_DETAIL,
-                        WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
-                for (String workflowNodeId : ids) {
-                    WorkflowNodeDetails workflowNodeDetail = 
(WorkflowNodeDetails) registry
-                            .get(RegistryModelType.WORKFLOW_NODE_DETAIL,
-                                    workflowNodeId);
-                    int value = 
workflowNodeDetail.getWorkflowNodeStatus().getWorkflowNodeState().getValue();
-                    if ( value> 1 && value < 7) { // we skip the unknown state
-                        log.error(workflowNodeDetail.getNodeName() + " 
Workflow Node status cannot mark as cancelled, because " +
-                                "current status is " + 
workflowNodeDetail.getWorkflowNodeStatus().getWorkflowNodeState().toString());
-                        continue; // this continue is very useful not to 
process deeper loops if the upper layers have non-cancel states
-                    } else {
-                        WorkflowNodeStatus workflowNodeStatus = new 
WorkflowNodeStatus();
-                        
workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.CANCELING);
-                        
workflowNodeStatus.setTimeOfStateChange(Calendar.getInstance()
-                                .getTimeInMillis());
-                        
workflowNodeDetail.setWorkflowNodeStatus(workflowNodeStatus);
-                        
registry.update(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeDetail,
-                                workflowNodeId);
-                    }
-                    List<Object> taskDetailList = registry.get(
-                            RegistryModelType.TASK_DETAIL,
-                            TaskDetailConstants.NODE_ID, workflowNodeId);
-                    for (Object o : taskDetailList) {
-                        TaskDetails taskDetails = (TaskDetails) o;
-                        TaskStatus taskStatus = ((TaskDetails) 
o).getTaskStatus();
-                        if (taskStatus.getExecutionState().getValue() > 7 && 
taskStatus.getExecutionState().getValue()<12) {
-                            log.error(((TaskDetails) o).getTaskID() + " Task 
status cannot mark as cancelled, because " +
-                                    "current task state is " + ((TaskDetails) 
o).getTaskStatus().getExecutionState().toString());
-                            continue;// this continue is very useful not to 
process deeper loops if the upper layers have non-cancel states
-                        } else {
-                            taskStatus.setExecutionState(TaskState.CANCELING);
-                            
taskStatus.setTimeOfStateChange(Calendar.getInstance()
-                                    .getTimeInMillis());
-                            taskDetails.setTaskStatus(taskStatus);
-                            registry.update(RegistryModelType.TASK_DETAIL, o,
-                                    taskDetails.getTaskID());
-                        }
-                        orchestrator.cancelExperiment(experiment,
-                                workflowNodeDetail, taskDetails, tokenId);
-                        // Status update should be done at the monitor
-                    }
-                }
-            }else {
-                if (isCancelAllowed(experimentState)){
-                    // when experiment status is < 3 no jobDetails object is 
created,
-                    // so we don't have to worry, we simply have to change the 
status and stop the execution
-                    ExperimentStatus status = new ExperimentStatus();
-                    status.setExperimentState(ExperimentState.CANCELED);
-                    status.setTimeOfStateChange(Calendar.getInstance()
-                            .getTimeInMillis());
-                    experiment.setExperimentStatus(status);
-                    registry.update(RegistryModelType.EXPERIMENT, experiment,
-                            experimentId);
-                    List<String> ids = registry.getIds(
-                            RegistryModelType.WORKFLOW_NODE_DETAIL,
-                            WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
-                    for (String workflowNodeId : ids) {
-                        WorkflowNodeDetails workflowNodeDetail = 
(WorkflowNodeDetails) registry
-                                .get(RegistryModelType.WORKFLOW_NODE_DETAIL,
-                                        workflowNodeId);
-                        WorkflowNodeStatus workflowNodeStatus = new 
WorkflowNodeStatus();
-                        
workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.CANCELED);
-                        
workflowNodeStatus.setTimeOfStateChange(Calendar.getInstance()
-                                .getTimeInMillis());
-                        
workflowNodeDetail.setWorkflowNodeStatus(workflowNodeStatus);
-                        
registry.update(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeDetail,
-                                workflowNodeId);
-                        List<Object> taskDetailList = registry.get(
-                                RegistryModelType.TASK_DETAIL,
-                                TaskDetailConstants.NODE_ID, workflowNodeId);
-                        for (Object o : taskDetailList) {
-                            TaskDetails taskDetails = (TaskDetails) o;
-                            TaskStatus taskStatus = ((TaskDetails) 
o).getTaskStatus();
-                            taskStatus.setExecutionState(TaskState.CANCELED);
-                            
taskStatus.setTimeOfStateChange(Calendar.getInstance()
-                                    .getTimeInMillis());
-                            taskDetails.setTaskStatus(taskStatus);
-                            registry.update(RegistryModelType.TASK_DETAIL, o,
-                                    taskDetails);
-                        }
-                    }
-                }else {
-                    log.errorId(experimentId, "Unable to mark experiment as 
Cancelled, current state {} doesn't allow to cancel the experiment {}.",
-                            
experiment.getExperimentStatus().getExperimentState().toString(), experimentId);
-                    throw new OrchestratorException("Unable to mark experiment 
as Cancelled, because current state is: "
-                            + 
experiment.getExperimentStatus().getExperimentState().toString());
-                }
-            }
-            log.info("Experiment: " + experimentId + " is cancelled !!!!!");
-        } catch (Exception e) {
-            throw new TException(e);
-        }
-        return true;
-    }
-
-    private boolean isCancelValid(ExperimentState state){
-        switch (state) {
-            case LAUNCHED:
-            case EXECUTING:
-            case CANCELING:
-                return true;
-            default:
-                return false;
-        }
-    }
-
-    private boolean isCancelAllowed(ExperimentState state){
-        switch (state) {
-            case CREATED:
-            case VALIDATED:
-            case SCHEDULED:
-                return true;
-            default:
-                return false;
-        }
-    }
-
-    private void launchWorkflowExperiment(String experimentId, String 
airavataCredStoreToken) throws TException {
-        try {
-            WorkflowEnactmentService.getInstance().
-                    submitWorkflow(experimentId, airavataCredStoreToken, 
getGatewayName(), getRabbitMQProcessPublisher());
-        } catch (Exception e) {
-            log.error("Error while launching workflow", e);
-        }
-    }
-
-    public synchronized RabbitMQProcessPublisher getRabbitMQProcessPublisher() 
throws Exception {
-        if (rabbitMQProcessPublisher == null) {
-            rabbitMQProcessPublisher = new RabbitMQProcessPublisher();
-        }
-        return rabbitMQProcessPublisher;
-    }
-
-
-    private class SingleAppExperimentRunner implements Runnable {
-
-        String experimentId;
-        String airavataCredStoreToken;
-        public SingleAppExperimentRunner(String experimentId,String 
airavataCredStoreToken){
-            this.experimentId = experimentId;
-            this.airavataCredStoreToken = airavataCredStoreToken;
-        }
-        @Override
-        public void run() {
-            try {
-                launchSingleAppExperiment();
-            } catch (TException e) {
-                e.printStackTrace();
-            }
-        }
-
-        private boolean launchSingleAppExperiment() throws TException {
-            Experiment experiment = null;
-            try {
-                List<String> ids = 
registry.getIds(RegistryModelType.WORKFLOW_NODE_DETAIL, 
WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
-                for (String workflowNodeId : ids) {
-//                WorkflowNodeDetails workflowNodeDetail = 
(WorkflowNodeDetails) registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL, 
workflowNodeId);
-                    List<Object> taskDetailList = 
registry.get(RegistryModelType.TASK_DETAIL, TaskDetailConstants.NODE_ID, 
workflowNodeId);
-                    for (Object o : taskDetailList) {
-                        TaskDetails taskData = (TaskDetails) o;
-                        //iterate through all the generated tasks and performs 
the job submisssion+monitoring
-                        experiment = (Experiment) 
registry.get(RegistryModelType.EXPERIMENT, experimentId);
-                        if (experiment == null) {
-                            log.errorId(experimentId, "Error retrieving the 
Experiment by the given experimentID: {}", experimentId);
-                            return false;
-                        }
-                        String gatewayId = null;
-                        CredentialReader credentialReader = 
GFacUtils.getCredentialReader();
-                        if (credentialReader != null) {
-                            try {
-                                gatewayId = 
credentialReader.getGatewayID(airavataCredStoreToken);
-                            } catch (Exception e) {
-                                log.error(e.getLocalizedMessage());
-                            }
-                        }
-                        if (gatewayId == null || gatewayId.isEmpty()) {
-                            gatewayId = ServerSettings.getDefaultUserGateway();
-                        }
-                        ExperimentStatusChangeEvent event = new 
ExperimentStatusChangeEvent(ExperimentState.LAUNCHED,
-                                experimentId,
-                                gatewayId);
-                        String messageId = AiravataUtils.getId("EXPERIMENT");
-                        MessageContext messageContext = new 
MessageContext(event, MessageType.EXPERIMENT, messageId, gatewayId);
-                        
messageContext.setUpdatedTime(AiravataUtils.getCurrentTimestamp());
-                        publisher.publish(messageContext);
-                        registry.update(RegistryModelType.TASK_DETAIL, 
taskData, taskData.getTaskID());
-                        //launching the experiment
-                        launchTask(taskData.getTaskID(), 
airavataCredStoreToken);
-                    }
-                }
-
-            } catch (Exception e) {
-                // Here we really do not have to do much because only 
potential failure can happen
-                // is in gfac, if there are errors in gfac, it will handle the 
experiment/task/job statuses
-                // We might get failures in registry access before submitting 
the jobs to gfac, in that case we
-                // leave the status of these as created.
-                ExperimentStatus status = new ExperimentStatus();
-                status.setExperimentState(ExperimentState.FAILED);
-                
status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
-                experiment.setExperimentStatus(status);
-                try {
-                    registry.update(RegistryModelType.EXPERIMENT_STATUS, 
status, experimentId);
-                } catch (RegistryException e1) {
-                    log.errorId(experimentId, "Error while updating experiment 
status to " + status.toString(), e);
-                    throw new TException(e);
-                }
-                log.errorId(experimentId, "Error while updating task status, 
hence updated experiment status to " + status.toString(), e);
-                throw new TException(e);
-            }
-            return true;
-        }
-    }
-
-    private class ProcessConsumer implements Runnable, MessageHandler{
-
-
-        @Override
-        public void run() {
-            try {
-                rabbitMQProcessConsumer.listen(this);
-            } catch (AiravataException e) {
-                log.error("Error while listen to the RabbitMQProcessConsumer");
-            }
-        }
-
-        @Override
-        public Map<String, Object> getProperties() {
-            Map<String, Object> props = new HashMap<String, Object>();
-            props.put(MessagingConstants.RABBIT_QUEUE, 
RabbitMQProcessPublisher.PROCESS);
-            props.put(MessagingConstants.RABBIT_ROUTING_KEY, 
RabbitMQProcessPublisher.PROCESS);
-            return props;
-        }
-
-        @Override
-        public void onMessage(MessageContext msgCtx) {
-            TBase event = msgCtx.getEvent();
-            if (event instanceof ProcessSubmitEvent) {
-                ProcessSubmitEvent processSubmitEvent = (ProcessSubmitEvent) 
event;
-                try {
-                    launchTask(processSubmitEvent.getTaskId(), 
processSubmitEvent.getCredentialToken());
-                } catch (TException e) {
-                    log.error("Error while launching task : " + 
processSubmitEvent.getTaskId());
-                }
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/Constants.java
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/Constants.java
 
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/Constants.java
deleted file mode 100644
index f9833e9..0000000
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/Constants.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.orchestrator.util;
-
-public class Constants {
-    public static final String ORCHESTRATOT_SERVER_PORT = 
"orchestrator.server.port";
-    public static final String ORCHESTRATOT_SERVER_HOST = 
"orchestrator.server.host";
-    public static final String ORCHESTRATOT_SERVER_MIN_THREADS = 
"orchestrator.server.min.threads";
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
 
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
deleted file mode 100644
index da11a59..0000000
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.orchestrator.util;
-
-import java.util.List;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
-import org.apache.airavata.model.util.ExecutionType;
-import org.apache.airavata.model.workspace.experiment.Experiment;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DataModelUtils {
-
-    private final static Logger logger = 
LoggerFactory.getLogger(DataModelUtils.class);
-       public static ExecutionType getExecutionType(String gatewayId, 
Experiment experiment){
-               try {
-                       ApplicationInterface applicationInterface = 
AppCatalogFactory.getAppCatalog().getApplicationInterface();
-                       List<String> allApplicationInterfaceIds = 
applicationInterface.getAllApplicationInterfaceIds();
-                       String applicationId = experiment.getApplicationId();
-                       if (allApplicationInterfaceIds.contains(applicationId)){
-                               return ExecutionType.SINGLE_APP;
-                       } else {
-                               List<String> allWorkflows = 
AppCatalogFactory.getAppCatalog().getWorkflowCatalog().getAllWorkflows(gatewayId);
-                               if (allWorkflows.contains(applicationId)){
-                                       return ExecutionType.WORKFLOW;
-                               }
-                       }
-               } catch (AppCatalogException e) {
-                       logger.error(e.getMessage(), e);
-               }
-        return ExecutionType.UNKNOWN;
-       }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/OrchestratorServerThreadPoolExecutor.java
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/OrchestratorServerThreadPoolExecutor.java
 
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/OrchestratorServerThreadPoolExecutor.java
deleted file mode 100644
index 1730998..0000000
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/OrchestratorServerThreadPoolExecutor.java
+++ /dev/null
@@ -1,56 +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.orchestrator.util;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.logger.AiravataLogger;
-import org.apache.airavata.common.logger.AiravataLoggerFactory;
-import org.apache.airavata.common.utils.ServerSettings;
-
-public class OrchestratorServerThreadPoolExecutor {
-           private final static AiravataLogger logger = 
AiravataLoggerFactory.getLogger(OrchestratorServerThreadPoolExecutor.class);
-           public static final String AIRAVATA_SERVER_THREAD_POOL_SIZE = 
"airavata.server.thread.pool.size";
-
-           private static ExecutorService threadPool;
-
-           public static ExecutorService getCachedThreadPool() {
-               if(threadPool ==null){
-                   threadPool = Executors.newCachedThreadPool();
-               }
-               return threadPool;
-           }
-
-           public static ExecutorService getFixedThreadPool() {
-               if(threadPool ==null){
-                   try {
-                       threadPool = 
Executors.newFixedThreadPool(Integer.parseInt(ServerSettings.getSetting(AIRAVATA_SERVER_THREAD_POOL_SIZE)));
-                   } catch (ApplicationSettingsException e) {
-                       logger.error("Error reading " + 
AIRAVATA_SERVER_THREAD_POOL_SIZE+ " property");
-                   }
-               }
-               return threadPool;
-           }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gsissh.properties
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gsissh.properties
 
b/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gsissh.properties
deleted file mode 100644
index 3fdf76d..0000000
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gsissh.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-###########################################################################
-# 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/82773c73/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
 
b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
deleted file mode 100644
index 18168c7..0000000
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
+++ /dev/null
@@ -1,90 +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.orchestrator.client;
-
-//import org.apache.airavata.client.AiravataAPIFactory;
-//import 
org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-//import org.apache.airavata.client.tools.DocumentCreator;
-//import org.apache.airavata.client.tools.DocumentCreatorNew;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.AiravataZKUtils;
-import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.error.AiravataClientConnectException;
-import org.apache.airavata.orchestrator.client.util.Initialize;
-import org.apache.airavata.orchestrator.cpi.OrchestratorService;
-import org.apache.airavata.orchestrator.server.OrchestratorServer;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.zookeeper.server.ServerCnxnFactory;
-import org.junit.Test;
-
-public class OrchestratorClientFactoryTest {
-/*    private DocumentCreatorNew documentCreator;
-    private OrchestratorService.Client orchestratorClient;
-    private Registry registry;
-    private int NUM_CONCURRENT_REQUESTS = 1;
-    Initialize initialize;
-    OrchestratorServer service;
-    private static ServerCnxnFactory cnxnFactory;
-
-    @Test
-    public void setUp() {
-       AiravataUtils.setExecutionAsServer();
-        initialize = new Initialize("registry-derby.sql");
-        initialize.initializeDB();
-        System.setProperty(Constants.ZOOKEEPER_SERVER_PORT,"2185");
-        AiravataZKUtils.startEmbeddedZK(cnxnFactory);
-
-        try {
-            service = (new OrchestratorServer());
-            service.start();
-            registry = RegistryFactory.getDefaultRegistry();
-            documentCreator = new DocumentCreatorNew(getAiravataClient());
-            documentCreator.createLocalHostDocs();
-        } catch (Exception e) {
-            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
-        }
-        AiravataUtils.setExecutionAsServer();
-        try {
-            service.stop();
-        } catch (Exception e) {
-            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
-        }
-
-    }
-
-    private Airavata.Client getAiravataClient() {
-        Airavata.Client client = null;
-            try {
-                client = 
AiravataClientFactory.createAiravataClient("localhost", 8930);
-            } catch (AiravataClientConnectException e) {
-                e.printStackTrace();
-            }
-        return client;
-    }
-
-    private void storeDescriptors() {
-
-    }*/
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
 
b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
deleted file mode 100644
index c827fc4..0000000
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
+++ /dev/null
@@ -1,330 +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.orchestrator.client.util;
-
-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.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.resources.*;
-import org.apache.airavata.registry.cpi.RegistryException;
-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() throws SQLException{
-        String jdbcUrl = null;
-        String jdbcUser = null;
-        String jdbcPassword = null;
-        try{
-            jdbcUrl = ServerSettings.getSetting("registry.jdbc.url");
-            jdbcUser = ServerSettings.getSetting("registry.jdbc.user");
-            jdbcPassword = ServerSettings.getSetting("registry.jdbc.password");
-            jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + 
jdbcPassword;
-        } catch (ApplicationSettingsException e) {
-            logger.error("Unable to read properties", e);
-        }
-        startDerbyInServerMode();
-        if(!isServerStarted(server, 20)){
-           throw new RuntimeException("Derby server cound not started within 
five seconds...");
-        }
-
-        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);
-            }
-        }
-
-        try{
-            GatewayResource gatewayResource = new GatewayResource();
-            
gatewayResource.setGatewayId(ServerSettings.getSetting("default.registry.gateway"));
-            
gatewayResource.setGatewayName(ServerSettings.getSetting("default.registry.gateway"));
-            gatewayResource.setDomain("test-domain");
-            gatewayResource.setEmailAddress("test-email");
-            gatewayResource.save();
-            
-            UserResource userResource = new UserResource();
-            
userResource.setUserName(ServerSettings.getSetting("default.registry.user"));
-            
userResource.setPassword(ServerSettings.getSetting("default.registry.password"));
-            userResource.save();
-
-            WorkerResource workerResource = (WorkerResource) 
gatewayResource.create(ResourceType.GATEWAY_WORKER);
-            workerResource.setUser(userResource.getUserName());
-            workerResource.save();
-            
-            ProjectResource projectResource = 
(ProjectResource)workerResource.create(ResourceType.PROJECT);
-            projectResource.setGatewayId(gatewayResource.getGatewayId());
-            projectResource.setId("default");
-            projectResource.setName("default");
-            projectResource.setWorker(workerResource);
-            projectResource.save();
-        
-          
-        } catch (ApplicationSettingsException e) {
-            logger.error("Unable to read properties", e);
-            throw new SQLException(e.getMessage(), e);
-        } catch (RegistryException e) {
-            logger.error("Unable to save data to registry", e);
-            throw new SQLException(e.getMessage(), 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");
-        }
-
-    }
-
-    public void stopDerbyServer() throws SQLException{
-        try {
-            server.shutdown();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new SQLException("Error while stopping derby server", e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/82773c73/modules/orchestrator/airavata-orchestrator-service/src/test/resources/gsissh.properties
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/gsissh.properties
 
b/modules/orchestrator/airavata-orchestrator-service/src/test/resources/gsissh.properties
deleted file mode 100644
index 3fdf76d..0000000
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/gsissh.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-###########################################################################
-# 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/82773c73/modules/orchestrator/airavata-orchestrator-service/src/test/resources/monitor.properties
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/monitor.properties
 
b/modules/orchestrator/airavata-orchestrator-service/src/test/resources/monitor.properties
deleted file mode 100644
index 7f0299a..0000000
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/monitor.properties
+++ /dev/null
@@ -1,30 +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.
-#
-
-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/82773c73/modules/orchestrator/airavata-orchestrator-service/src/test/resources/orchestrator.properties
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/orchestrator.properties
 
b/modules/orchestrator/airavata-orchestrator-service/src/test/resources/orchestrator.properties
deleted file mode 100644
index e84c429..0000000
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/orchestrator.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-job.submitter=org.apache.airavata.orchestrator.core.impl.GFACEmbeddedJobSubmitter
-job.validators=org.apache.airavata.orchestrator.core.validator.impl.BatchQueueValidator
-submitter.interval=10000
-threadpool.size=0
-start.submitter=true
-embedded.mode=true
-enable.validation=false

Reply via email to