airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject git commit: updating the catalog handler after the tests
Date Fri, 23 May 2014 11:08:42 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 1d76b48c1 -> 928e37bd9


updating the catalog handler after the tests


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

Branch: refs/heads/master
Commit: 928e37bd9a2a96d3d03b4957f92d9415b27c04b2
Parents: 1d76b48
Author: Saminda Wijeratne <samindaw@gmail.com>
Authored: Fri May 23 04:08:29 2014 -0700
Committer: Saminda Wijeratne <samindaw@gmail.com>
Committed: Fri May 23 04:08:29 2014 -0700

----------------------------------------------------------------------
 .../airavata/api/server/AiravataAPIServer.java  |  14 +-
 .../api/server/ApplicationCatalogServer.java    | 152 +++++++++++++++++++
 .../handler/ApplicationCatalogHandler.java      | 143 +++++++++++++----
 .../airavata/api/server/util/Constants.java     |   1 +
 .../api/client/AiravataClientFactory.java       |  31 ++++
 .../resources/lib/AiravataClientFactory.php     |  14 ++
 .../main/resources/airavata-client.properties   |   3 +
 .../main/resources/airavata-server.properties   |  10 +-
 .../apache/airavata/integration/BaseCaseIT.java |  10 +-
 9 files changed, 335 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/928e37bd/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
index 981e002..30a9145 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
@@ -22,14 +22,14 @@
 package org.apache.airavata.api.server;
 
 import org.apache.airavata.api.Airavata;
-import org.apache.airavata.model.error.AiravataErrorType;
-import org.apache.airavata.model.error.AiravataSystemException;
 import org.apache.airavata.api.server.handler.AiravataServerHandler;
 import org.apache.airavata.api.server.util.Constants;
 import org.apache.airavata.api.server.util.RegistryInitUtil;
 import org.apache.airavata.common.utils.AiravataUtils;
 import org.apache.airavata.common.utils.IServer;
 import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.model.error.AiravataErrorType;
+import org.apache.airavata.model.error.AiravataSystemException;
 import org.apache.thrift.server.TServer;
 import org.apache.thrift.server.TThreadPoolServer;
 import org.apache.thrift.transport.TServerSocket;
@@ -53,15 +53,13 @@ public class AiravataAPIServer implements IServer{
 		setStatus(ServerStatus.STOPPED);
 	}
 	
-    public void StartAiravataServer(Airavata.Processor<AiravataServerHandler> mockAiravataServer)
throws AiravataSystemException {
+    public void StartAiravataServer(Airavata.Processor<Airavata.Iface> mockAiravataServer)
throws AiravataSystemException {
         try {
             AiravataUtils.setExecutionAsServer();
             RegistryInitUtil.initializeDB();
             final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.THRIFT_SERVER_PORT,"8930"));
 			TServerTransport serverTransport = new TServerSocket(serverPort);
-            //server = new TSimpleServer(
-              //      new TServer.Args(serverTransport).processor(mockAiravataServer));
-            server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(mockAiravataServer));
+			server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(mockAiravataServer));
             new Thread() {
 				public void run() {
 					server.serve();
@@ -106,8 +104,8 @@ public class AiravataAPIServer implements IServer{
 	@Override
 	public void start() throws Exception {
 		setStatus(ServerStatus.STARTING);
-		Airavata.Processor<AiravataServerHandler> mockAiravataServer =
-                new Airavata.Processor<AiravataServerHandler>(new AiravataServerHandler());
+		Airavata.Processor<Airavata.Iface> mockAiravataServer =
+                new Airavata.Processor<Airavata.Iface>(new AiravataServerHandler());
     	StartAiravataServer(mockAiravataServer);
 	}
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/928e37bd/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/ApplicationCatalogServer.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/ApplicationCatalogServer.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/ApplicationCatalogServer.java
new file mode 100644
index 0000000..cb4a9ac
--- /dev/null
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/ApplicationCatalogServer.java
@@ -0,0 +1,152 @@
+/*
+ *
+ * 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.api.server;
+
+import org.apache.airavata.api.appcatalog.ApplicationCatalogAPI;
+import org.apache.airavata.api.server.handler.ApplicationCatalogHandler;
+import org.apache.airavata.api.server.util.Constants;
+import org.apache.airavata.api.server.util.RegistryInitUtil;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.IServer;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.model.error.AiravataErrorType;
+import org.apache.airavata.model.error.AiravataSystemException;
+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 ApplicationCatalogServer implements IServer{
+
+    private final static Logger logger = LoggerFactory.getLogger(ApplicationCatalogServer.class);
+	private static final String SERVER_NAME = "Airavata Application Catalog Server";
+	private static final String SERVER_VERSION = "1.0";
+
+    private ServerStatus status;
+
+	private TServer server;
+
+	public ApplicationCatalogServer() {
+		setStatus(ServerStatus.STOPPED);
+	}
+	
+    public void StartAiravataServer(ApplicationCatalogAPI.Processor<ApplicationCatalogAPI.Iface>
appCatalogServerHandler) throws AiravataSystemException {
+        try {
+            AiravataUtils.setExecutionAsServer();
+            RegistryInitUtil.initializeDB();
+            final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.APP_CATALOG_SERVER_PORT,"8931"));
+			TServerTransport serverTransport = new TServerSocket(serverPort);
+			server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(appCatalogServerHandler));
+            new Thread() {
+				public void run() {
+					server.serve();
+					RegistryInitUtil.stopDerbyInServerMode();
+					setStatus(ServerStatus.STOPPED);
+					logger.info("Airavata API 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 Airavata Application Catalog Server on Port " + serverPort);
+			            logger.info("Listening to Application Catalog Clients ....");
+					}
+				}
+			}.start();
+        } catch (TTransportException e) {
+            logger.error(e.getMessage());
+            setStatus(ServerStatus.FAILED);
+            RegistryInitUtil.stopDerbyInServerMode();
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
+    }
+
+    public static void main(String[] args) {
+    	try {
+			ApplicationCatalogServer server = new ApplicationCatalogServer();
+			server.start();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+    }
+
+	@Override
+	public void start() throws Exception {
+		setStatus(ServerStatus.STARTING);
+		ApplicationCatalogAPI.Processor<ApplicationCatalogAPI.Iface> server =
+                new ApplicationCatalogAPI.Processor<ApplicationCatalogAPI.Iface>(new
ApplicationCatalogHandler());
+    	StartAiravataServer(server);
+	}
+
+	@Override
+	public void stop() throws Exception {
+		if (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/928e37bd/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/ApplicationCatalogHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/ApplicationCatalogHandler.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/ApplicationCatalogHandler.java
index f19e757..0fcce80 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/ApplicationCatalogHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/ApplicationCatalogHandler.java
@@ -24,6 +24,7 @@ package org.apache.airavata.api.server.handler;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Calendar;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -37,12 +38,15 @@ import org.apache.airavata.model.appcatalog.ApplicationDeployment;
 import org.apache.airavata.model.appcatalog.ApplicationDescriptor;
 import org.apache.airavata.model.appcatalog.ApplicationInterface;
 import org.apache.airavata.model.appcatalog.ComputeResourceDescription;
+import org.apache.airavata.model.appcatalog.DataMovementProtocol;
 import org.apache.airavata.model.appcatalog.GSISSHJobSubmission;
 import org.apache.airavata.model.appcatalog.GlobusJobSubmission;
 import org.apache.airavata.model.appcatalog.GridFTPDataMovement;
 import org.apache.airavata.model.appcatalog.JobSubmissionProtocol;
+import org.apache.airavata.model.appcatalog.ResourceJobManager;
 import org.apache.airavata.model.appcatalog.SCPDataMovement;
 import org.apache.airavata.model.appcatalog.SSHJobSubmission;
+import org.apache.airavata.model.appcatalog.SecurityProtocol;
 import org.apache.airavata.model.error.AiravataClientException;
 import org.apache.airavata.model.error.AiravataSystemException;
 import org.apache.airavata.model.error.InvalidRequestException;
@@ -58,9 +62,12 @@ import org.apache.airavata.schemas.gfac.SSHHostType;
 import org.apache.thrift.TException;
 
 public class ApplicationCatalogHandler implements Iface {
-
+	AiravataRegistry2 registry;
 	private AiravataRegistry2 getRegistry() throws RegistryException, AiravataConfigurationException{
-		return AiravataRegistryFactory.getRegistry(new Gateway("default"), new AiravataUser("admin"));
+		 if (registry==null){
+			 registry = AiravataRegistryFactory.getRegistry(new Gateway("default"), new AiravataUser("admin"));
+		 }
+		return registry;
 	}
 	
 	@Override
@@ -69,13 +76,20 @@ public class ApplicationCatalogHandler implements Iface {
 	}
 
 	@Override
-	public void addComputeResourceDescription(
+	public String addComputeResourceDescription(
 			ComputeResourceDescription computeResourceDescription)
 			throws InvalidRequestException, AiravataClientException,
 			AiravataSystemException, TException {
+		try {
+			if (getRegistry().isHostDescriptorExists(computeResourceDescription.getHostName())){
+				getRegistry().removeHostDescriptor(computeResourceDescription.getHostName());
+			}
+		} catch (Exception e1) {
+			e1.printStackTrace();
+		}
 		HostDescription host = new HostDescription();
-		host.getType().setHostName(generateId(computeResourceDescription.getHostName()));
-		if (computeResourceDescription.getIpAddresses().size()>0){
+		host.getType().setHostName(computeResourceDescription.getHostName());
+		if (computeResourceDescription.getIpAddressesSize()>0){
 			host.getType().setHostAddress(computeResourceDescription.getIpAddresses().iterator().next());

 		}
 		if (computeResourceDescription.getJobSubmissionProtocolsSize()>0){
@@ -95,12 +109,15 @@ public class ApplicationCatalogHandler implements Iface {
 			case GSISSH:
 				GSISSHJobSubmission gsisshJobSubmissionProtocol = getGSISSHJobSubmissionProtocol(jobSubmissionProtocolDataId);
 				host.getType().changeType(GsisshHostType.type);
+				break;
 				//TODO fill the data
+			default:
 				break;
 			}
 		}
 		try {
 			getRegistry().addHostDescriptor(host);
+			return computeResourceDescription.getHostName();
 		} catch (Exception e) {
 			e.printStackTrace();
 			throw new AiravataSystemException();
@@ -136,14 +153,21 @@ public class ApplicationCatalogHandler implements Iface {
 		try {
 			HostDescription hostDescriptor = getRegistry().getHostDescriptor(computeResourceId);
 			ComputeResourceDescription d = new ComputeResourceDescription();
+			d.setIsEmpty(false);
 			d.setResourceId(computeResourceId);
-			d.getIpAddresses().add(hostDescriptor.getType().getHostAddress());
+			d.setHostName(hostDescriptor.getType().getHostName());
+			if (hostDescriptor.getType().getHostAddress()!=null) {
+				d.addToIpAddresses(hostDescriptor.getType().getHostAddress());
+			}
+			d.setJobSubmissionProtocols(new HashMap<String, JobSubmissionProtocol>());
+			d.setDataMovementProtocols(new HashMap<String, DataMovementProtocol>());
 			if (hostDescriptor.getType() instanceof SSHHostType){
 				d.getJobSubmissionProtocols().put(computeResourceId, JobSubmissionProtocol.SSH);
 			} else if (hostDescriptor.getType() instanceof GsisshHostType){
 				d.getJobSubmissionProtocols().put(computeResourceId, JobSubmissionProtocol.GSISSH);
 			} else if (hostDescriptor.getType() instanceof GlobusHostType){
 				d.getJobSubmissionProtocols().put(computeResourceId, JobSubmissionProtocol.GRAM);
+				d.getDataMovementProtocols().put(computeResourceId, DataMovementProtocol.GridFTP);
 			}
 			return d;
 		} catch (Exception e) {
@@ -208,6 +232,8 @@ public class ApplicationCatalogHandler implements Iface {
 		try {
 			HostDescription hostDescriptor = getRegistry().getHostDescriptor(globusJobSubmissionProtocolResourceId);
 			GlobusJobSubmission d = new GlobusJobSubmission();
+			d.setSecurityProtocol(SecurityProtocol.GSI);
+			d.setResourceJobManager(ResourceJobManager.PBS);
 			d.setJobSubmissionDataID(globusJobSubmissionProtocolResourceId);
 			if (hostDescriptor.getType() instanceof GlobusHostType){
 				GlobusHostType globusHostType = (GlobusHostType)hostDescriptor.getType();
@@ -264,19 +290,37 @@ public class ApplicationCatalogHandler implements Iface {
 	}
 
 	@Override
-	public void addApplicationInterface(
+	public String addApplicationInterface(
 			ApplicationInterface applicationInterface)
 			throws InvalidRequestException, AiravataClientException,
 			AiravataSystemException, TException {
 		try {
 			ServiceDescription serviceDescription = ServiceDescription.fromXML(applicationInterface.getApplicationInterfaceData());
+			try {
+				if (getRegistry().isServiceDescriptorExists(serviceDescription.getType().getName())){
+					getRegistry().removeServiceDescriptor(serviceDescription.getType().getName());
+				}
+			} catch (Exception e1) {
+				e1.printStackTrace();
+			}
 			getRegistry().addServiceDescriptor(serviceDescription);
-			List<ApplicationDeployment> applicationDeployments = applicationInterface.getApplicationDeployments();
-			for (ApplicationDeployment deployment : applicationDeployments) {
-				String hostId = deployment.getComputeResourceDescription().getResourceId();
-				ApplicationDescriptor applicationDescriptor = deployment.getApplicationDescriptor();
-				getRegistry().addApplicationDescriptor(serviceDescription.getType().getName(), hostId,
ApplicationDescription.fromXML(applicationDescriptor.getApplicationDescriptorData()));
+			if (applicationInterface.getApplicationDeploymentsSize()>0) {
+				List<ApplicationDeployment> applicationDeployments = applicationInterface
+						.getApplicationDeployments();
+				for (ApplicationDeployment deployment : applicationDeployments) {
+					String hostId = deployment.getComputeResourceDescription()
+							.getResourceId();
+					ApplicationDescriptor applicationDescriptor = deployment
+							.getApplicationDescriptor();
+					getRegistry().addApplicationDescriptor(
+							serviceDescription.getType().getName(),
+							hostId,
+							ApplicationDescription
+									.fromXML(applicationDescriptor
+											.getApplicationDescriptorData()));
+				}
 			}
+			return serviceDescription.getType().getName();
 		} catch (Exception e) {
 			e.printStackTrace();
 			throw new AiravataSystemException();
@@ -328,12 +372,14 @@ public class ApplicationCatalogHandler implements Iface {
 	}
 
 	@Override
-	public void addApplicationDeployment(String applicationInterfaceId,
+	public String addApplicationDeployment(String applicationInterfaceId,
 			ApplicationDeployment applicationDeployment)
 			throws InvalidRequestException, AiravataClientException,
 			AiravataSystemException, TException {
 		try {
-			getRegistry().addApplicationDescriptor(applicationInterfaceId, applicationDeployment.getComputeResourceDescription().getResourceId(),
ApplicationDescription.fromXML(applicationDeployment.getApplicationDescriptor().getApplicationDescriptorData()));
+			ApplicationDescription appDescription = ApplicationDescription.fromXML(applicationDeployment.getApplicationDescriptor().getApplicationDescriptorData());
+			getRegistry().addApplicationDescriptor(applicationInterfaceId, applicationDeployment.getComputeResourceDescription().getResourceId(),
appDescription);
+			return appDescription.getType().getApplicationName().getStringValue();
 		} catch (Exception e) {
 			e.printStackTrace();
 			throw new AiravataSystemException();
@@ -383,7 +429,7 @@ public class ApplicationCatalogHandler implements Iface {
 	}
 
 	@Override
-	public void addSSHJobSubmissionProtocol(String computeResourceId,
+	public String addSSHJobSubmissionProtocol(String computeResourceId,
 			SSHJobSubmission jobSubmission) throws InvalidRequestException,
 			AiravataClientException, AiravataSystemException, TException {
 		try {
@@ -391,6 +437,7 @@ public class ApplicationCatalogHandler implements Iface {
 			hostDescriptor.getType().changeType(SSHHostType.type);
 			SSHHostType s = (SSHHostType)hostDescriptor.getType();
 			getRegistry().updateHostDescriptor(hostDescriptor);
+			return computeResourceId;
 		} catch (Exception e) {
 			e.printStackTrace();
 			throw new AiravataSystemException();
@@ -399,7 +446,7 @@ public class ApplicationCatalogHandler implements Iface {
 	}
 
 	@Override
-	public void addGSISSHJobSubmissionProtocol(String computeResourceId,
+	public String addGSISSHJobSubmissionProtocol(String computeResourceId,
 			GSISSHJobSubmission jobSubmission) throws InvalidRequestException,
 			AiravataClientException, AiravataSystemException, TException {
 		try {
@@ -408,16 +455,25 @@ public class ApplicationCatalogHandler implements Iface {
 			GsisshHostType s = (GsisshHostType)hostDescriptor.getType();
 			s.setInstalledPath(jobSubmission.getInstalledPath());
 			ExportProperties exports = s.addNewExports();
-			for(String export: jobSubmission.getExports()){
-				exports.addNewName().setValue(export);
+			if (jobSubmission.getExportsSize()>0) {
+				for (String export : jobSubmission.getExports()) {
+					exports.addNewName().setValue(export);
+				}
 			}
 			s.setExports(exports);
 			s.setJobManager(jobSubmission.getResourceJobManager().toString());
 			s.setMonitorMode(jobSubmission.getMonitorMode());
 			s.setPort(22);
-			s.setPostJobCommandsArray(jobSubmission.getPostJobCommands().toArray(new String[]{}));
-			s.setPreJobCommandsArray(jobSubmission.getPreJobCommands().toArray(new String[]{}));
+			if (jobSubmission.getPostJobCommandsSize()>0) {
+				s.setPostJobCommandsArray(jobSubmission.getPostJobCommands()
+						.toArray(new String[] {}));
+			}
+			if (jobSubmission.getPreJobCommandsSize()>0) {
+				s.setPreJobCommandsArray(jobSubmission.getPreJobCommands()
+						.toArray(new String[] {}));
+			}
 			getRegistry().updateHostDescriptor(hostDescriptor);
+			return computeResourceId;
 		} catch (Exception e) {
 			e.printStackTrace();
 			throw new AiravataSystemException();
@@ -425,15 +481,19 @@ public class ApplicationCatalogHandler implements Iface {
 	}
 
 	@Override
-	public void addGlobusJobSubmissionProtocol(String computeResourceId,
+	public String addGlobusJobSubmissionProtocol(String computeResourceId,
 			GlobusJobSubmission jobSubmission) throws InvalidRequestException,
 			AiravataClientException, AiravataSystemException, TException {
 		try {
 			HostDescription hostDescriptor = getRegistry().getHostDescriptor(computeResourceId);
 			hostDescriptor.getType().changeType(GlobusHostType.type);
 			GlobusHostType s = (GlobusHostType)hostDescriptor.getType();
-			s.setGlobusGateKeeperEndPointArray(jobSubmission.getGlobusGateKeeperEndPoint().toArray(new
String[]{}));
+			if (jobSubmission.getGlobusGateKeeperEndPointSize()>0) {
+				s.setGlobusGateKeeperEndPointArray(jobSubmission
+						.getGlobusGateKeeperEndPoint().toArray(new String[] {}));
+			}
 			getRegistry().updateHostDescriptor(hostDescriptor);
+			return computeResourceId;
 		} catch (Exception e) {
 			e.printStackTrace();
 			throw new AiravataSystemException();
@@ -441,7 +501,7 @@ public class ApplicationCatalogHandler implements Iface {
 	}
 
 	@Override
-	public void addSCPDataMovementProtocol(String computeResourceId,
+	public String addSCPDataMovementProtocol(String computeResourceId,
 			SCPDataMovement dataMovement) throws InvalidRequestException,
 			AiravataClientException, AiravataSystemException, TException {
 		try {
@@ -450,6 +510,7 @@ public class ApplicationCatalogHandler implements Iface {
 			GlobusHostType s = (GlobusHostType)hostDescriptor.getType();
 //			s.setGlobusGateKeeperEndPointArray(dataMovement.getGlobusGateKeeperEndPoint().toArray(new
String[]{}));
 			getRegistry().updateHostDescriptor(hostDescriptor);
+			return computeResourceId;
 		} catch (Exception e) {
 			e.printStackTrace();
 			throw new AiravataSystemException();
@@ -458,11 +519,23 @@ public class ApplicationCatalogHandler implements Iface {
 	}
 
 	@Override
-	public void addGridFTPDataMovementProtocol(String computeResourceId,
+	public String addGridFTPDataMovementProtocol(String computeResourceId,
 			GridFTPDataMovement dataMovement) throws InvalidRequestException,
 			AiravataClientException, AiravataSystemException, TException {
-		// TODO Auto-generated method stub
-		
+		try {
+			HostDescription hostDescriptor = getRegistry().getHostDescriptor(computeResourceId);
+			hostDescriptor.getType().changeType(GlobusHostType.type);
+			GlobusHostType s = (GlobusHostType)hostDescriptor.getType();
+			if (dataMovement.getGridFTPEndPointSize()>0) {
+				s.setGridFTPEndPointArray(dataMovement.getGridFTPEndPoint()
+						.toArray(new String[] {}));
+			}
+			getRegistry().updateHostDescriptor(hostDescriptor);
+			return computeResourceId;
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new AiravataSystemException();
+		}
 	}
 
 	@Override
@@ -470,12 +543,18 @@ public class ApplicationCatalogHandler implements Iface {
 			String gridFTPDataMovementResourceId)
 			throws InvalidRequestException, AiravataClientException,
 			AiravataSystemException, TException {
-		// TODO Auto-generated method stub
-		return null;
+		try {
+			GridFTPDataMovement gridFTPDataMovement = new GridFTPDataMovement();
+			gridFTPDataMovement.setDataMovementDataID(gridFTPDataMovementResourceId);
+			HostDescription hostDescriptor = getRegistry().getHostDescriptor(gridFTPDataMovementResourceId);
+			GlobusHostType s = (GlobusHostType)hostDescriptor.getType();
+			gridFTPDataMovement.setGridFTPEndPoint(Arrays.asList(s.getGridFTPEndPointArray()));
+			gridFTPDataMovement.setSecurityProtocol(SecurityProtocol.GSI);
+			return gridFTPDataMovement;
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new AiravataSystemException();
+		}
 	}
 	
-	
-	
-	
-
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/928e37bd/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/Constants.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/Constants.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/Constants.java
index 8a5fd34..a3da94e 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/Constants.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/Constants.java
@@ -23,5 +23,6 @@ package org.apache.airavata.api.server.util;
 
 public class Constants {
     public static final String THRIFT_SERVER_PORT = "apiserver.server.port";
+    public static final String APP_CATALOG_SERVER_PORT = "app.catalog.server.port";
 
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/928e37bd/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java
b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java
index ac59651..a8fefb6 100644
--- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java
+++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java
@@ -21,9 +21,13 @@
 
 package org.apache.airavata.api.client;
 
+import java.lang.reflect.InvocationTargetException;
+
 import org.apache.airavata.api.Airavata;
+import org.apache.airavata.api.appcatalog.ApplicationCatalogAPI;
 import org.apache.airavata.model.error.AiravataClientConnectException;
 import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TMultiplexedProtocol;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.transport.TSocket;
 import org.apache.thrift.transport.TTransport;
@@ -40,9 +44,36 @@ public class AiravataClientFactory {
             TTransport transport = new TSocket(serverHost, serverPort);
             transport.open();
             TProtocol protocol = new TBinaryProtocol(transport);
+//            TMultiplexedProtocol mp = new TMultiplexedProtocol(protocol, "APIServer");
             return new Airavata.Client(protocol);
         } catch (TTransportException e) {
             throw new AiravataClientConnectException("Unable to connect to the server at
"+serverHost+":"+serverPort);
         }
     }
+    
+    public static ApplicationCatalogAPI.Client createApplicationCatalogClient(String serverHost,
int serverPort) throws AiravataClientConnectException{
+        try {
+            TTransport transport = new TSocket(serverHost, serverPort);
+            transport.open();
+            TProtocol protocol = new TBinaryProtocol(transport);
+//            TMultiplexedProtocol mp = new TMultiplexedProtocol(protocol, "AppCatalog");
+            return new ApplicationCatalogAPI.Client(protocol);
+        } catch (TTransportException e) {
+            throw new AiravataClientConnectException("Unable to connect to the server at
"+serverHost+":"+serverPort);
+        }
+    }
+    
+    public static <T extends org.apache.thrift.TServiceClient> T createApplicationCatalogClient(String
serverHost, int serverPort, Class<T> type) throws Exception{
+        try {
+            TTransport transport = new TSocket(serverHost, serverPort);
+            transport.open();
+            TProtocol protocol = new TBinaryProtocol(transport);
+            TMultiplexedProtocol mp = new TMultiplexedProtocol(protocol, "AppCatalog");
+            return  type.getConstructor(TProtocol.class).newInstance(mp);
+        } catch (TTransportException e) {
+            throw new AiravataClientConnectException("Unable to connect to the server at
"+serverHost+":"+serverPort);
+        } catch (Exception e) {
+			throw new Exception("Invalid Airavata API Service "+type.getClass().getCanonicalName());
+		}
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/928e37bd/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/AiravataClientFactory.php
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/AiravataClientFactory.php
b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/AiravataClientFactory.php
index 5724e32..04080c2 100644
--- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/AiravataClientFactory.php
+++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/AiravataClientFactory.php
@@ -29,10 +29,16 @@ class AiravataClientFactory
     private $airavataServerHost;
     private $airavataServerPort;
 
+    private $appCatalogServerHost;
+    private $appCatalogServerPort;
+
     public function __construct($options)
     {
         $this->airavataServerHost = isset($options['airavataServerHost']) ? $options['airavataServerHost']
: null;
         $this->airavataServerPort = isset($options['airavataServerPort']) ? $options['airavataServerPort']
: null;
+
+	$this->airavataServerHost = isset($options['appCatalogServerHost']) ? $options['appCatalogServerHost']
: null;
+        $this->airavataServerPort = isset($options['appCatalogServerPort']) ? $options['appCatalogServerPort']
: null;
     }
 
     public function getAiravataClient()
@@ -42,4 +48,12 @@ class AiravataClientFactory
 	$transport->open();
         return new AiravataClient($protocol);
     }
+
+    public function getApplicationCatalogClient()
+    {
+        $transport = new TSocket($this->airavataServerHost, $this->airavataServerPort);
+        $protocol = new TBinaryProtocol($transport);
+	$transport->open();
+        return new AiravataClient($protocol);
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/928e37bd/modules/configuration/client/src/main/resources/airavata-client.properties
----------------------------------------------------------------------
diff --git a/modules/configuration/client/src/main/resources/airavata-client.properties b/modules/configuration/client/src/main/resources/airavata-client.properties
index 3f2f746..b0b3f90 100644
--- a/modules/configuration/client/src/main/resources/airavata-client.properties
+++ b/modules/configuration/client/src/main/resources/airavata-client.properties
@@ -93,3 +93,6 @@ xbaya.default.gateway=default
 thrift.server.host=localhost
 thrift.server.port=8930
 
+app.catalog.server.host=${thrift.server.host}
+app.catalog.server.port=8931
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/928e37bd/modules/configuration/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/configuration/server/src/main/resources/airavata-server.properties b/modules/configuration/server/src/main/resources/airavata-server.properties
index 360bb5f..6086792 100644
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@ -290,8 +290,12 @@ orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer
 ###---------------------------API Server module Configurations---------------------------###
 apiserver=org.apache.airavata.api.server.AiravataAPIServer
 
+###---------------------------Application Catalog Server module Configurations---------------------------###
+appcatalogserver=org.apache.airavata.api.server.ApplicationCatalogServer
+
+
 ###---------------------------Airavata Server Configurations---------------------------###
-servers=apiserver,orchestrator
+servers=apiserver,appcatalogserver,orchestrator
 #shutdown.trategy=NONE
 shutdown.trategy=SELF_TERMINATE
 # credential store specific parameters
@@ -309,3 +313,7 @@ email.user=airavata
 email.password=xxx
 email.ssl=true
 email.from=airavata@apache.org
+
+
+apiserver.server.port=8930
+app.catalog.server.port=8931
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/928e37bd/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java
----------------------------------------------------------------------
diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java
b/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java
index 43b993f..d5436d2 100644
--- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java
+++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java
@@ -33,7 +33,13 @@ import org.apache.airavata.client.tools.DocumentCreator;
 import org.apache.airavata.model.util.ExperimentModelUtil;
 import org.apache.airavata.model.util.ProjectModelUtil;
 import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.model.workspace.experiment.*;
+import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
+import org.apache.airavata.model.workspace.experiment.DataObjectType;
+import org.apache.airavata.model.workspace.experiment.DataType;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.apache.airavata.model.workspace.experiment.JobStatus;
+import org.apache.airavata.model.workspace.experiment.UserConfigurationData;
 import org.apache.airavata.registry.api.workflow.ApplicationJob;
 import org.apache.airavata.workflow.model.wf.Workflow;
 import org.apache.airavata.ws.monitor.EventData;
@@ -62,7 +68,7 @@ public class BaseCaseIT extends WorkflowIntegrationTestBase {
 
     @Test(groups = {"setupTests"})
     public void testSetup() throws Exception {
-        String version = this.client.GetAPIVersion();
+        String version = this.client.getAPIVersion();
         Assert.assertNotNull(version);
         log("Airavata version - " + version);
 


Mime
View raw message