You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2013/12/12 05:28:23 UTC
svn commit: r1550346 - in /airavata/trunk/modules/thrift: ./
interpreter-service-handler/ interpreter-service-handler/src/
interpreter-service-handler/src/main/
interpreter-service-handler/src/main/java/
interpreter-service-handler/src/main/java/org/ i...
Author: chathuri
Date: Thu Dec 12 04:28:22 2013
New Revision: 1550346
URL: http://svn.apache.org/r1550346
Log:
thrift service implementation module
Added:
airavata/trunk/modules/thrift/interpreter-service-handler/
airavata/trunk/modules/thrift/interpreter-service-handler/pom.xml
airavata/trunk/modules/thrift/interpreter-service-handler/src/
airavata/trunk/modules/thrift/interpreter-service-handler/src/main/
airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/
airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/
airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/
airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/
airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/
airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/
airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/
airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/InterpreterServiceHandler.java
airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/MappingUtils.java
airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/SimpleThirftServer.java
Modified:
airavata/trunk/modules/thrift/pom.xml
Added: airavata/trunk/modules/thrift/interpreter-service-handler/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/thrift/interpreter-service-handler/pom.xml?rev=1550346&view=auto
==============================================================================
--- airavata/trunk/modules/thrift/interpreter-service-handler/pom.xml (added)
+++ airavata/trunk/modules/thrift/interpreter-service-handler/pom.xml Thu Dec 12 04:28:22 2013
@@ -0,0 +1,48 @@
+<?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/maven-v4_0_0.xsd">
+
+
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>thrift</artifactId>
+ <version>0.11-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>airavata-interpreter-service-handler</artifactId>
+ <packaging>jar</packaging>
+ <name>Airavata Interpreter Service Handler</name>
+ <url>http://airavata.apache.org/</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <version>0.9.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-xbaya-gui</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-interpreter-service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.7.5</version>
+ </dependency>
+ </dependencies>
+</project>
Added: airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/InterpreterServiceHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/InterpreterServiceHandler.java?rev=1550346&view=auto
==============================================================================
--- airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/InterpreterServiceHandler.java (added)
+++ airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/InterpreterServiceHandler.java Thu Dec 12 04:28:22 2013
@@ -0,0 +1,204 @@
+/*
+ *
+ * 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.interpreter.service.handler;
+
+
+import org.apache.airavata.client.AiravataAPIFactory;
+import org.apache.airavata.client.AiravataAPIUtils;
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.experiment.execution.ExperimentAdvanceOptions;
+import org.apache.airavata.experiment.execution.InterpreterService;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.ws.monitor.*;
+import org.apache.airavata.xbaya.interpretor.WorkflowInterpretorSkeleton;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.UUID;
+
+public class InterpreterServiceHandler implements InterpreterService.Iface{
+ private static final Logger log = LoggerFactory.getLogger(InterpreterServiceHandler.class);
+ private WorkflowInterpretorSkeleton interpreterService;
+ private AiravataAPI airavataAPI;
+
+ public String runExperiment(String workflowTemplateName, Map<String, String> workflowInputs, ExperimentAdvanceOptions experimentAdOptions) throws TException {
+ String user = getAiravataAPI().getUserManager().getAiravataUser();
+ String gatewayId = getAiravataAPI().getGateway();
+ String experimentID;
+ Workflow workflowObj;
+ try {
+ workflowObj = extractWorkflow(workflowTemplateName);
+ experimentID = experimentAdOptions.getCustomExperimentId();
+ workflowTemplateName = workflowObj.getName();
+ if (experimentID == null || experimentID.isEmpty()) {
+ experimentID = workflowTemplateName + "_" + UUID.randomUUID();
+ }
+ experimentAdOptions.setCustomExperimentId(experimentID);
+ getAiravataAPI().getProvenanceManager().setWorkflowInstanceTemplateName(experimentID, workflowTemplateName);
+
+ String submissionUser = getAiravataAPI().getUserManager().getAiravataUser();
+ String executionUser=experimentAdOptions.getExecutionUser();
+ if (executionUser==null){
+ executionUser=submissionUser;
+ }
+ experimentAdOptions.setExecutionUser(executionUser);
+ runPreWorkflowExecutionTasks(experimentID, executionUser, experimentAdOptions.getMetadata(), experimentAdOptions.getExperimentName());
+
+ EventDataListener listener = new EventDataListenerAdapter() {
+ @Override
+ public void notify(EventDataRepository eventDataRepo, EventData eventData) {
+
+ }
+ };
+
+ getExperimentMonitor(experimentID, listener).startMonitoring();
+ String workflowContent = extractWorkflowContent(workflowTemplateName);
+
+ return getInterpreterService().setupAndLaunch(workflowContent,
+ experimentID,
+ gatewayId,
+ user,
+ workflowInputs,
+ true,
+ AiravataAPIUtils.createWorkflowContextHeaderBuilder(MappingUtils.getExperimentOptionsObject(experimentAdOptions), experimentAdOptions.getExecutionUser(), user));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public Monitor getExperimentMonitor(String experimentId, EventDataListener listener) throws AiravataAPIInvocationException {
+ MonitorConfiguration monitorConfiguration;
+ try {
+ monitorConfiguration = new MonitorConfiguration(
+ getAiravataAPI().getAiravataManager().getMessageBoxServiceURL(), experimentId,
+ true, getAiravataAPI().getAiravataManager().getMessageBoxServiceURL());
+ final Monitor monitor = new Monitor(monitorConfiguration);
+ monitor.printRawMessage(false);
+ if (listener!=null) {
+ monitor.getEventDataRepository().registerEventListener(listener);
+ listener.setExperimentMonitor(monitor);
+ }
+ if (!monitor.getExperimentId().equals(">")){
+ monitor.getEventDataRepository().registerEventListener(new EventDataListenerAdapter() {
+ public void notify(EventDataRepository eventDataRepo, EventData eventData) {
+ if (eventData.getType()== MonitorUtil.EventType.WORKFLOW_TERMINATED || eventData.getType()== MonitorUtil.EventType.SENDING_FAULT){
+ monitor.stopMonitoring();
+ }
+ }
+ });
+ }
+ return monitor;
+ } catch (Exception e) {
+ throw new AiravataAPIInvocationException(e);
+ }
+ }
+
+ private void runPreWorkflowExecutionTasks(String experimentId, String user,
+ String metadata, String experimentName) throws AiravataAPIInvocationException {
+ if (user != null) {
+ getAiravataAPI().getProvenanceManager().setExperimentUser(experimentId, user);
+ }
+ if (metadata != null) {
+ getAiravataAPI().getProvenanceManager().setExperimentMetadata(experimentId, metadata);
+ }
+ if (experimentName == null) {
+ experimentName = experimentId;
+ }
+ getAiravataAPI().getProvenanceManager().setExperimentName(experimentId, experimentName);
+ }
+
+ private Workflow extractWorkflow(String workflowName) throws AiravataAPIInvocationException {
+ Workflow workflowObj = null;
+ //FIXME - There should be a better way to figure-out if the passed string is a name or an xml
+ if(!workflowName.contains("http://airavata.apache.org/xbaya/xwf")){//(getClient().getWorkflowManager().isWorkflowExists(workflowName)) {
+ workflowObj = getAiravataAPI().getWorkflowManager().getWorkflow(workflowName);
+ }else {
+ try{
+ workflowObj = getAiravataAPI().getWorkflowManager().getWorkflowFromString(workflowName);
+ }catch (AiravataAPIInvocationException e){
+ getAiravataAPI().getWorkflowManager().getWorkflow(workflowName);
+ }
+ }
+ return workflowObj;
+ }
+
+ private AiravataAPI getAiravataAPI(){
+ if (airavataAPI==null) {
+ try {
+ String systemUserName = ServerSettings.getSystemUser();
+ String gateway = ServerSettings.getSystemUserGateway();
+ airavataAPI = AiravataAPIFactory.getAPI(gateway, systemUserName);
+ } catch (ApplicationSettingsException e) {
+ log.error("Unable to read the properties file", e);
+ } catch (AiravataAPIInvocationException e) {
+ log.error("Unable to create Airavata API", e);
+ }
+ }
+ return airavataAPI;
+ }
+
+ private String extractWorkflowContent(String workflowName) throws AiravataAPIInvocationException {
+ if(workflowName.contains("http://airavata.apache.org/xbaya/xwf")){//(getClient().getWorkflowManager().isWorkflowExists(workflowName)) {
+ return workflowName;
+ }else {
+ return getAiravataAPI().getWorkflowManager().getWorkflowAsString(workflowName);
+ }
+ }
+
+ public void cancelExperiment(String experimentID) throws TException {
+ try {
+ getInterpreterService().haltWorkflow(experimentID);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void suspendExperiment(String experimentID) throws TException {
+ try {
+ getInterpreterService().suspendWorkflow(experimentID);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void resumeExperiment(String experimentID) throws TException {
+ try {
+ getInterpreterService().resumeWorkflow(experimentID);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public WorkflowInterpretorSkeleton getInterpreterService() {
+ if (interpreterService==null){
+ interpreterService=new WorkflowInterpretorSkeleton();
+ }
+ return interpreterService;
+ }
+}
Added: airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/MappingUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/MappingUtils.java?rev=1550346&view=auto
==============================================================================
--- airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/MappingUtils.java (added)
+++ airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/MappingUtils.java Thu Dec 12 04:28:22 2013
@@ -0,0 +1,157 @@
+/*
+ *
+ * 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.interpreter.service.handler;
+
+import org.apache.airavata.client.api.*;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.client.impl.*;
+import org.apache.airavata.client.tools.NameValuePairType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MappingUtils {
+ public static ExperimentAdvanceOptions getExperimentOptionsObject(org.apache.airavata.experiment.execution.ExperimentAdvanceOptions advanceOptions){
+ try {
+ ExperimentAdvanceOptions experimentAdvanceOptions = new ExperimentAdvanceOptions();
+ experimentAdvanceOptions.setCustomExperimentId(advanceOptions.getCustomExperimentId());
+ experimentAdvanceOptions.setExperimentExecutionUser(advanceOptions.getExecutionUser());
+ experimentAdvanceOptions.setExperimentCustomMetadata(advanceOptions.getMetadata());
+ experimentAdvanceOptions.setExperimentName(advanceOptions.getExperimentName());
+
+ if (advanceOptions.getWorkflowSchedulingSettings() != null){
+ List<org.apache.airavata.experiment.execution.NodeSettings> nodeSettingsList = advanceOptions.getWorkflowSchedulingSettings().getNodeSettingsList();
+ for (org.apache.airavata.experiment.execution.NodeSettings nodeSettings : nodeSettingsList){
+ NodeSettings n = getNodeSettingObject(nodeSettings);
+ org.apache.airavata.experiment.execution.HPCSettings hpcSettings = nodeSettings.getHpcSettings();
+ HPCSettings hpcSettingsObject = getHPCSettingsObject(hpcSettings);
+ n.setHPCSettings(hpcSettingsObject);
+ org.apache.airavata.experiment.execution.HostSchedulingSettings hostSchedulingSettings = nodeSettings.getHostSchedulingSettings();
+ HostSchedulingSettings hostSchedulingSettingsObj = getHostSchedulingSettingsObj(hostSchedulingSettings);
+ n.setHostSettings(hostSchedulingSettingsObj);
+ experimentAdvanceOptions.getCustomWorkflowSchedulingSettings().addNewNodeSettings(n);
+ }
+ }
+
+ org.apache.airavata.experiment.execution.WorkflowOutputDataSettings workflowOutputDataSettings = advanceOptions.getWorkflowOutputDataSettings();
+ if (workflowOutputDataSettings != null){
+ WorkflowOutputDataSettings dataSettings = getWorkflowOutputDataSettingsObject(workflowOutputDataSettings);
+ experimentAdvanceOptions.getCustomWorkflowOutputDataSettings().addNewOutputDataSettings(dataSettings.getOutputDataSettingsList());
+ }
+
+ SecuritySettings securitySettings = experimentAdvanceOptions.getCustomSecuritySettings();
+ org.apache.airavata.experiment.execution.SecuritySettings securitySettings1 = advanceOptions.getSecuritySettings();
+ if (securitySettings != null && securitySettings1 != null){
+ AmazonWebServicesSettings amazonWSSettings = securitySettings.getAmazonWSSettings();
+ if (amazonWSSettings != null){
+ amazonWSSettings.setAccessKeyId(securitySettings1.getAmazonWSSettings().getAccessKey());
+ amazonWSSettings.setAMIId(securitySettings1.getAmazonWSSettings().getAmiID());
+ amazonWSSettings.setInstanceId(securitySettings1.getAmazonWSSettings().getInstanceID());
+ amazonWSSettings.setInstanceType(securitySettings1.getAmazonWSSettings().getInstanceType());
+ amazonWSSettings.setSecretAccessKey(securitySettings1.getAmazonWSSettings().getSecretAccessKey());
+ amazonWSSettings.setUsername(securitySettings1.getAmazonWSSettings().getUsername());
+ }
+ CredentialStoreSecuritySettings storeSecuritySettings = securitySettings.getCredentialStoreSecuritySettings();
+ if (storeSecuritySettings != null){
+ storeSecuritySettings.setGatewayId(securitySettings1.getCredentialStoreSettings().getGatewayID());
+ storeSecuritySettings.setPortalUser(securitySettings1.getCredentialStoreSettings().getPortalUser());
+ storeSecuritySettings.setTokenId(securitySettings1.getCredentialStoreSettings().getTokenId());
+ }
+
+// GridMyProxyRepositorySettings myProxyRepositorySettings = securitySettings.getGridMyProxyRepositorySettings();
+// if (myProxyRepositorySettings != null){
+// myProxyRepositorySettings.setUsername(securitySettings1.getMyproxySettings().getUserName());
+// myProxyRepositorySettings.setPassword(securitySettings1.getMyproxySettings().getPassword());
+// myProxyRepositorySettings.setLifeTime(securitySettings1.getMyproxySettings().getLifetime());
+// myProxyRepositorySettings.setMyProxyServer(securitySettings1.getMyproxySettings().getMyproxyServer());
+// }
+//
+// SSHAuthenticationSettings authenticationSettings = securitySettings.getSSHAuthenticationSettings();
+// if (authenticationSettings != null){
+// authenticationSettings.setAccessKeyId(securitySettings1.getSshAuthSettings().getAccessKeyID());
+// authenticationSettings.setSecretAccessKey(securitySettings1.getSshAuthSettings().getSecretAccessKey());
+// }
+ }
+ return experimentAdvanceOptions;
+ } catch (AiravataAPIInvocationException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ public static NodeSettingsImpl getNodeSettingObject (org.apache.airavata.experiment.execution.NodeSettings nodeSettings){
+ NodeSettings n = new NodeSettingsImpl(nodeSettings.getNodeId());
+ n.setServiceId(nodeSettings.getServiceId());
+ List<NameValuePairType> nameValuePairTypes = new ArrayList<NameValuePairType>();
+ List<org.apache.airavata.experiment.execution.NameValuePairType> nameValuePairList = nodeSettings.getNameValuePairList();
+ for (org.apache.airavata.experiment.execution.NameValuePairType np : nameValuePairList) {
+ NameValuePairType nameValuePairObject = getNameValuePairObject(np);
+ nameValuePairTypes.add(nameValuePairObject);
+ }
+ n.setNameValuePair(nameValuePairTypes);
+ return (NodeSettingsImpl)n;
+
+ }
+
+ public static NameValuePairType getNameValuePairObject(org.apache.airavata.experiment.execution.NameValuePairType nameValuePairType){
+ NameValuePairType nameValuePair = new NameValuePairType();
+ nameValuePair.setName(nameValuePairType.getName());
+ nameValuePair.setValue(nameValuePairType.getValue());
+ nameValuePair.setDescription(nameValuePairType.getDescription());
+ return nameValuePair;
+ }
+
+ public static HPCSettings getHPCSettingsObject (org.apache.airavata.experiment.execution.HPCSettings hsettings){
+ HPCSettings hpcSettings = new HPCSettingsImpl();
+ hpcSettings.setCPUCount(hsettings.getCpuCount());
+ hpcSettings.setJobManager(hsettings.getJobManager());
+ hpcSettings.setMaxWallTime(hsettings.getMaxWalltime());
+ hpcSettings.setNodeCount(hsettings.getNodeCount());
+ hpcSettings.setQueueName(hsettings.getQueueName());
+ return hpcSettings;
+ }
+
+ public static HostSchedulingSettings getHostSchedulingSettingsObj (org.apache.airavata.experiment.execution.HostSchedulingSettings schedulingSettings){
+ HostSchedulingSettings hostSchedulingSettings = new HostSchedulingSettingsImpl();
+ hostSchedulingSettings.setHostId(schedulingSettings.getHostID());
+ hostSchedulingSettings.setGatekeeperEPR(schedulingSettings.getGatekeeperEPR());
+ hostSchedulingSettings.setWSGramPreffered(schedulingSettings.isIsWSGramPreferred());
+ return hostSchedulingSettings;
+ }
+
+ public static WorkflowOutputDataSettings getWorkflowOutputDataSettingsObject(org.apache.airavata.experiment.execution.WorkflowOutputDataSettings wfods) {
+ WorkflowOutputDataSettings wfOutDataSettings = new WorkflowOutputDataSettingsImpl();
+ List<org.apache.airavata.experiment.execution.OutputDataSettings> dataSettingsList = wfods.getOutputDataSettingsList();
+ for (org.apache.airavata.experiment.execution.OutputDataSettings outPutDSettng : dataSettingsList) {
+ OutputDataSettings outputDataSettings = new ApplicationOutputDataSettingsImpl(outPutDSettng.getNodeID());
+ outputDataSettings.setDataPersistent(outPutDSettng.isIsdataPersisted());
+ outputDataSettings.setDataRegistryUrl(outPutDSettng.getDataRegURL());
+ outputDataSettings.setOutputDataDirectory(outPutDSettng.getOutputdataDir());
+ wfOutDataSettings.addNewOutputDataSettings(outputDataSettings);
+ }
+ return wfOutDataSettings;
+ }
+
+
+
+}
Added: airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/SimpleThirftServer.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/SimpleThirftServer.java?rev=1550346&view=auto
==============================================================================
--- airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/SimpleThirftServer.java (added)
+++ airavata/trunk/modules/thrift/interpreter-service-handler/src/main/java/org/apache/airavata/interpreter/service/handler/SimpleThirftServer.java Thu Dec 12 04:28:22 2013
@@ -0,0 +1,27 @@
+package org.apache.airavata.interpreter.service.handler;
+
+import org.apache.airavata.experiment.execution.InterpreterService;
+import org.apache.thrift.server.TServer;
+import org.apache.thrift.server.TSimpleServer;
+import org.apache.thrift.transport.TServerSocket;
+import org.apache.thrift.transport.TServerTransport;
+
+public class SimpleThirftServer {
+ public static void StartsimpleServer(InterpreterService.Processor<InterpreterServiceHandler> processor) {
+ try {
+ TServerTransport serverTransport = new TServerSocket(9090);
+ TServer server = new TSimpleServer(
+ new TServer.Args(serverTransport).processor(processor));
+
+ System.out.println("Starting the simple server...");
+ server.serve();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args) {
+ InterpreterService.Processor<InterpreterServiceHandler> processor = new InterpreterService.Processor<InterpreterServiceHandler>(new InterpreterServiceHandler());
+ StartsimpleServer(processor);
+ }
+}
Modified: airavata/trunk/modules/thrift/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/thrift/pom.xml?rev=1550346&r1=1550345&r2=1550346&view=diff
==============================================================================
--- airavata/trunk/modules/thrift/pom.xml (original)
+++ airavata/trunk/modules/thrift/pom.xml Thu Dec 12 04:28:22 2013
@@ -32,7 +32,7 @@
<modules>
<module>interpreter-service</module>
<module>interpreter-service-client</module>
- <!--<module>interpreter-service-handler</module>-->
+ <module>interpreter-service-handler</module>
</modules>
</profile>
</profiles>