airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject [2/3] AIRAVATA-1236
Date Sat, 05 Jul 2014 04:43:56 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/ae1fe88a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpEndpointResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpEndpointResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpEndpointResource.java
new file mode 100644
index 0000000..9c0e538
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpEndpointResource.java
@@ -0,0 +1,266 @@
+package org.apache.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.GridftpDataMovement;
+import org.apache.aiaravata.application.catalog.data.model.GridftpEndpoint;
+import org.apache.aiaravata.application.catalog.data.model.GridftpEndpoint_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GridftpEndpointResource extends AbstractResource {
+	private final static Logger logger = LoggerFactory.getLogger(GridftpEndpointResource.class);
+	private String endpoint;
+	private String dataMovementInterfaceId;
+	private GridftpDataMovementResource gridftpDataMovementResource;
+	
+	@Override
+	public void remove(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
+			generator.setParameter(GridftpEndpointConstants.ENDPOINT, ids.get(GridftpEndpointConstants.ENDPOINT));
+			generator.setParameter(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID));
+			Query q = generator.deleteQuery(em);
+			q.executeUpdate();
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public Resource get(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
+			generator.setParameter(GridftpEndpointConstants.ENDPOINT, ids.get(GridftpEndpointConstants.ENDPOINT));
+			generator.setParameter(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID));
+			Query q = generator.selectQuery(em);
+			GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) q.getSingleResult();
+			GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
+			em.getTransaction().commit();
+			em.close();
+			return gridftpEndpointResource;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+		List<Resource> gridftpEndpointResources = new ArrayList<Resource>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
+			Query q;
+			if ((fieldName.equals(GridftpEndpointConstants.ENDPOINT)) || (fieldName.equals(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) result;
+					GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
+					gridftpEndpointResources.add(gridftpEndpointResource);
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Gridftp Endpoint Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Gridftp Endpoint Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return gridftpEndpointResources;
+	}
+	
+	@Override
+	public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+		List<String> gridftpEndpointResourceIDs = new ArrayList<String>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
+			Query q;
+			if ((fieldName.equals(GridftpEndpointConstants.ENDPOINT)) || (fieldName.equals(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) result;
+					GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
+					gridftpEndpointResourceIDs.add(gridftpEndpointResource.getDataMovementInterfaceId());
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Gridftp Endpoint Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Gridftp Endpoint Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return gridftpEndpointResourceIDs;
+	}
+	
+	@Override
+	public void save() throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			GridftpEndpoint existingGridftpEndpoint = em.find(GridftpEndpoint.class, new GridftpEndpoint_PK(endpoint, dataMovementInterfaceId));
+			em.close();
+			GridftpEndpoint gridftpEndpoint;
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			if (existingGridftpEndpoint == null) {
+				gridftpEndpoint = new GridftpEndpoint();
+			} else {
+				gridftpEndpoint = existingGridftpEndpoint;
+			}
+			gridftpEndpoint.setEndpoint(getEndpoint());
+			gridftpEndpoint.setDataMovementInterfaceId(getDataMovementInterfaceId());
+			GridftpDataMovement gridftpDataMovement = em.find(GridftpDataMovement.class, getDataMovementInterfaceId());
+			gridftpEndpoint.setGridftpDataMovement(gridftpDataMovement);
+			if (existingGridftpEndpoint == null) {
+				em.persist(gridftpEndpoint);
+			} else {
+				em.merge(gridftpEndpoint);
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public boolean isExists(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			GridftpEndpoint gridftpEndpoint = em.find(GridftpEndpoint.class, new GridftpEndpoint_PK(ids.get(GridftpEndpointConstants.ENDPOINT), ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID)));
+			em.close();
+			return gridftpEndpoint != null;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	public String getEndpoint() {
+		return endpoint;
+	}
+	
+	public String getDataMovementInterfaceId() {
+		return dataMovementInterfaceId;
+	}
+	
+	public GridftpDataMovementResource getGridftpDataMovementResource() {
+		return gridftpDataMovementResource;
+	}
+	
+	public void setEndpoint(String endpoint) {
+		this.endpoint=endpoint;
+	}
+	
+	public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+		this.dataMovementInterfaceId=dataMovementInterfaceId;
+	}
+	
+	public void setGridftpDataMovementResource(GridftpDataMovementResource gridftpDataMovementResource) {
+		this.gridftpDataMovementResource=gridftpDataMovementResource;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/ae1fe88a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalDataMovementResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalDataMovementResource.java
new file mode 100644
index 0000000..e8800c2
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalDataMovementResource.java
@@ -0,0 +1,239 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.LocalDataMovement;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LocalDataMovementResource extends AbstractResource {
+	private final static Logger logger = LoggerFactory.getLogger(LocalDataMovementResource.class);
+	private String dataMovementInterfaceId;
+	
+	@Override
+	public void remove(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+			generator.setParameter(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+			Query q = generator.deleteQuery(em);
+			q.executeUpdate();
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public Resource get(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+			generator.setParameter(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+			Query q = generator.selectQuery(em);
+			LocalDataMovement localDataMovement = (LocalDataMovement) q.getSingleResult();
+			LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
+			em.getTransaction().commit();
+			em.close();
+			return localDataMovementResource;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+		List<Resource> localDataMovementResources = new ArrayList<Resource>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+			Query q;
+			if ((fieldName.equals(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					LocalDataMovement localDataMovement = (LocalDataMovement) result;
+					LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
+					localDataMovementResources.add(localDataMovementResource);
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Local Data Movement Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Local Data Movement Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return localDataMovementResources;
+	}
+	
+	@Override
+	public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+		List<String> localDataMovementResourceIDs = new ArrayList<String>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+			Query q;
+			if ((fieldName.equals(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					LocalDataMovement localDataMovement = (LocalDataMovement) result;
+					LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
+					localDataMovementResourceIDs.add(localDataMovementResource.getDataMovementInterfaceId());
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Local Data Movement Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Local Data Movement Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return localDataMovementResourceIDs;
+	}
+	
+	@Override
+	public void save() throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			LocalDataMovement existingLocalDataMovement = em.find(LocalDataMovement.class, dataMovementInterfaceId);
+			em.close();
+			LocalDataMovement localDataMovement;
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			if (existingLocalDataMovement == null) {
+				localDataMovement = new LocalDataMovement();
+			} else {
+				localDataMovement = existingLocalDataMovement;
+			}
+			localDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
+			if (existingLocalDataMovement == null) {
+				em.persist(localDataMovement);
+			} else {
+				em.merge(localDataMovement);
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public boolean isExists(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			LocalDataMovement localDataMovement = em.find(LocalDataMovement.class, identifier);
+			em.close();
+			return localDataMovement != null;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	public String getDataMovementInterfaceId() {
+		return dataMovementInterfaceId;
+	}
+	
+	public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+		this.dataMovementInterfaceId=dataMovementInterfaceId;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ae1fe88a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalSubmissionResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalSubmissionResource.java
new file mode 100644
index 0000000..6a441c9
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalSubmissionResource.java
@@ -0,0 +1,261 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.LocalSubmission;
+import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LocalSubmissionResource extends AbstractResource {
+	private final static Logger logger = LoggerFactory.getLogger(LocalSubmissionResource.class);
+	private String resourceJobManagerId;
+	private ResourceJobManagerResource resourceJobManagerResource;
+	private String jobSubmissionInterfaceId;
+	
+	@Override
+	public void remove(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+			generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+			Query q = generator.deleteQuery(em);
+			q.executeUpdate();
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public Resource get(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+			generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+			Query q = generator.selectQuery(em);
+			LocalSubmission localSubmission = (LocalSubmission) q.getSingleResult();
+			LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
+			em.getTransaction().commit();
+			em.close();
+			return localSubmissionResource;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+		List<Resource> localSubmissionResources = new ArrayList<Resource>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+			Query q;
+			if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					LocalSubmission localSubmission = (LocalSubmission) result;
+					LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
+					localSubmissionResources.add(localSubmissionResource);
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return localSubmissionResources;
+	}
+	
+	@Override
+	public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+		List<String> localSubmissionResourceIDs = new ArrayList<String>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+			Query q;
+			if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					LocalSubmission localSubmission = (LocalSubmission) result;
+					LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
+					localSubmissionResourceIDs.add(localSubmissionResource.getJobSubmissionInterfaceId());
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return localSubmissionResourceIDs;
+	}
+	
+	@Override
+	public void save() throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			LocalSubmission existingLocalSubmission = em.find(LocalSubmission.class, jobSubmissionInterfaceId);
+			em.close();
+			LocalSubmission localSubmission;
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			if (existingLocalSubmission == null) {
+				localSubmission = new LocalSubmission();
+			} else {
+				localSubmission = existingLocalSubmission;
+			}
+			localSubmission.setResourceJobManagerId(getResourceJobManagerId());
+			ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
+			localSubmission.setResourceJobManager(resourceJobManager);
+			localSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+			if (existingLocalSubmission == null) {
+				em.persist(localSubmission);
+			} else {
+				em.merge(localSubmission);
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public boolean isExists(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			LocalSubmission localSubmission = em.find(LocalSubmission.class, identifier);
+			em.close();
+			return localSubmission != null;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	public String getResourceJobManagerId() {
+		return resourceJobManagerId;
+	}
+	
+	public ResourceJobManagerResource getResourceJobManagerResource() {
+		return resourceJobManagerResource;
+	}
+	
+	public String getJobSubmissionInterfaceId() {
+		return jobSubmissionInterfaceId;
+	}
+	
+	public void setResourceJobManagerId(String resourceJobManagerId) {
+		this.resourceJobManagerId=resourceJobManagerId;
+	}
+	
+	public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
+		this.resourceJobManagerResource=resourceJobManagerResource;
+	}
+	
+	public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+		this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ae1fe88a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SCPDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SCPDataMovementResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SCPDataMovementResource.java
deleted file mode 100644
index c2c13c8..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SCPDataMovementResource.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package org.apache.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.SCPDataMovement;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class SCPDataMovementResource extends AbstractResource {
-    private final static Logger logger = LoggerFactory.getLogger(SCPDataMovementResource.class);
-
-    private String dataMoveID;
-    private String securityProtocol;
-    private int sshPort;
-
-    public void remove(Object identifier) throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATAMOVEMENT);
-            generator.setParameter(SCPDataMovementConstants.DATA_MOVE_ID, identifier);
-            Query q = generator.deleteQuery(em);
-            q.executeUpdate();
-            em.getTransaction().commit();
-            em.close();
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-
-    }
-
-    public Resource get(Object identifier) throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATAMOVEMENT);
-            generator.setParameter(SCPDataMovementConstants.DATA_MOVE_ID, identifier);
-            Query q = generator.selectQuery(em);
-            SCPDataMovement scpDataMovement = (SCPDataMovement) q.getSingleResult();
-            SCPDataMovementResource scpDataMovementResource =
-                    (SCPDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATAMOVEMENT, scpDataMovement);
-            em.getTransaction().commit();
-            em.close();
-            return scpDataMovementResource;
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
-        List<Resource> scpDataMoveResources = new ArrayList<Resource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATAMOVEMENT);
-            List results;
-            if (fieldName.equals(SCPDataMovementConstants.SSH_PORT)) {
-                generator.setParameter(SCPDataMovementConstants.SSH_PORT, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        SCPDataMovement scpDataMovement = (SCPDataMovement) result;
-                        SCPDataMovementResource scpDataMovementResource =
-                                (SCPDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATAMOVEMENT, scpDataMovement);
-                        scpDataMoveResources.add(scpDataMovementResource);
-                    }
-                }
-            } else if (fieldName.equals(SCPDataMovementConstants.SECURITY_PROTOCOL)) {
-                generator.setParameter(SCPDataMovementConstants.SECURITY_PROTOCOL, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        SCPDataMovement scpDataMovement = (SCPDataMovement) result;
-                        SCPDataMovementResource scpDataMovementResource =
-                                (SCPDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATAMOVEMENT, scpDataMovement);
-                        scpDataMoveResources.add(scpDataMovementResource);
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for SCP Data Movement resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for SCP Data Movement resource.");
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return scpDataMoveResources;
-    }
-
-    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-        List<String> scpDataMoveIDs = new ArrayList<String>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATAMOVEMENT);
-            List results;
-            if (fieldName.equals(SCPDataMovementConstants.SSH_PORT)) {
-                generator.setParameter(SCPDataMovementConstants.SSH_PORT, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        SCPDataMovement scpDataMovement = (SCPDataMovement) result;
-                        scpDataMoveIDs.add(scpDataMovement.getDataMoveID());
-                    }
-                }
-            }else if (fieldName.equals(SCPDataMovementConstants.SECURITY_PROTOCOL)) {
-                generator.setParameter(SCPDataMovementConstants.SECURITY_PROTOCOL, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        SCPDataMovement scpDataMovement = (SCPDataMovement) result;
-                        scpDataMoveIDs.add(scpDataMovement.getDataMoveID());
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for SCP Data movement resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for SCP Data movement resource.");
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return scpDataMoveIDs;
-    }
-
-    public void save() throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            SCPDataMovement existingSCPDataMovement = em.find(SCPDataMovement.class, dataMoveID);
-            em.close();
-
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            if (existingSCPDataMovement !=  null){
-                existingSCPDataMovement.setDataMoveID(dataMoveID);
-                existingSCPDataMovement.setSshPort(sshPort);
-                existingSCPDataMovement.setSecurityProtocol(securityProtocol);
-                em.merge(existingSCPDataMovement);
-            }else {
-                SCPDataMovement scpDataMovement = new SCPDataMovement();
-                scpDataMovement.setDataMoveID(dataMoveID);
-                scpDataMovement.setSshPort(sshPort);
-                scpDataMovement.setSecurityProtocol(securityProtocol);
-                em.persist(scpDataMovement);
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-
-    }
-
-    public boolean isExists(Object identifier) throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            SCPDataMovement scpDataMovement = em.find(SCPDataMovement.class, identifier);
-            em.close();
-            return scpDataMovement != null;
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public String getDataMoveID() {
-        return dataMoveID;
-    }
-
-    public void setDataMoveID(String dataMoveID) {
-        this.dataMoveID = dataMoveID;
-    }
-
-    public String getSecurityProtocol() {
-        return securityProtocol;
-    }
-
-    public void setSecurityProtocol(String securityProtocol) {
-        this.securityProtocol = securityProtocol;
-    }
-
-    public int getSshPort() {
-        return sshPort;
-    }
-
-    public void setSshPort(int sshPort) {
-        this.sshPort = sshPort;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ae1fe88a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SSHSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SSHSubmissionResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SSHSubmissionResource.java
deleted file mode 100644
index 405f199..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SSHSubmissionResource.java
+++ /dev/null
@@ -1,241 +0,0 @@
-package org.apache.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.SSHSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class SSHSubmissionResource extends AbstractResource {
-    private final static Logger logger = LoggerFactory.getLogger(SSHSubmissionResource.class);
-
-    private String submissionID;
-    private String resourceJobManager;
-    private int sshPort;
-
-
-    public void remove(Object identifier) throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_SUBMISSION);
-            generator.setParameter(SSHSubmissionConstants.SUBMISSION_ID, identifier);
-            Query q = generator.deleteQuery(em);
-            q.executeUpdate();
-            em.getTransaction().commit();
-            em.close();
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public Resource get(Object identifier) throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_SUBMISSION);
-            generator.setParameter(SSHSubmissionConstants.SUBMISSION_ID, identifier);
-            Query q = generator.selectQuery(em);
-            SSHSubmission sshSubmission = (SSHSubmission) q.getSingleResult();
-            SSHSubmissionResource sshSubmissionResource =
-                    (SSHSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_SUBMISSION, sshSubmission);
-            em.getTransaction().commit();
-            em.close();
-            return sshSubmissionResource;
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
-        List<Resource> sshSubmissionResourceList = new ArrayList<Resource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_SUBMISSION);
-            List results;
-            if (fieldName.equals(SSHSubmissionConstants.RESOURCE_JOB_MANAGER)) {
-                generator.setParameter(SSHSubmissionConstants.RESOURCE_JOB_MANAGER, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        SSHSubmission sshSubmission = (SSHSubmission) result;
-                        SSHSubmissionResource sshSubmissionResource =
-                                (SSHSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_SUBMISSION, sshSubmission);
-                        sshSubmissionResourceList.add(sshSubmissionResource);
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for SSH submission resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for SSH Submission resource.");
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return sshSubmissionResourceList;
-    }
-
-    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-        List<String> sshSubmissionResourceIDs = new ArrayList<String>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_SUBMISSION);
-            List results;
-            if (fieldName.equals(SSHSubmissionConstants.RESOURCE_JOB_MANAGER)) {
-                generator.setParameter(SSHSubmissionConstants.RESOURCE_JOB_MANAGER, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        SSHSubmission sshSubmission = (SSHSubmission) result;
-                        sshSubmissionResourceIDs.add(sshSubmission.getSubmissionID());
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for SSH Submission resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for SSH Submission resource.");
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return sshSubmissionResourceIDs;
-    }
-
-    public void save() throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            SSHSubmission existingSSHSubmission = em.find(SSHSubmission.class, submissionID);
-            em.close();
-
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            if (existingSSHSubmission != null) {
-                existingSSHSubmission.setSubmissionID(submissionID);
-                existingSSHSubmission.setSshPort(sshPort);
-                existingSSHSubmission.setResourceJobManager(resourceJobManager);
-                em.merge(existingSSHSubmission);
-            } else {
-                SSHSubmission sshSubmission = new SSHSubmission();
-                sshSubmission.setSubmissionID(submissionID);
-                sshSubmission.setSshPort(sshPort);
-                sshSubmission.setResourceJobManager(resourceJobManager);
-                em.persist(sshSubmission);
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public boolean isExists(Object identifier) throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            SSHSubmission sshSubmission = em.find(SSHSubmission.class, identifier);
-            em.close();
-            return sshSubmission != null;
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public String getSubmissionID() {
-        return submissionID;
-    }
-
-    public void setSubmissionID(String submissionID) {
-        this.submissionID = submissionID;
-    }
-
-    public String getResourceJobManager() {
-        return resourceJobManager;
-    }
-
-    public void setResourceJobManager(String resourceJobManager) {
-        this.resourceJobManager = resourceJobManager;
-    }
-
-    public int getSshPort() {
-        return sshPort;
-    }
-
-    public void setSshPort(int sshPort) {
-        this.sshPort = sshPort;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ae1fe88a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ScpDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ScpDataMovementResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ScpDataMovementResource.java
new file mode 100644
index 0000000..dad3417
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ScpDataMovementResource.java
@@ -0,0 +1,258 @@
+package org.apache.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.ScpDataMovement;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ScpDataMovementResource extends AbstractResource {
+	private final static Logger logger = LoggerFactory.getLogger(ScpDataMovementResource.class);
+	private String queueDescription;
+	private String dataMovementInterfaceId;
+	private String securityProtocol;
+	private String alternativeScpHostname;
+	private int sshPort;
+	
+	@Override
+	public void remove(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+			generator.setParameter(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+			Query q = generator.deleteQuery(em);
+			q.executeUpdate();
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public Resource get(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+			generator.setParameter(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+			Query q = generator.selectQuery(em);
+			ScpDataMovement scpDataMovement = (ScpDataMovement) q.getSingleResult();
+			ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
+			em.getTransaction().commit();
+			em.close();
+			return scpDataMovementResource;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+		List<Resource> scpDataMovementResources = new ArrayList<Resource>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+			Query q;
+			if ((fieldName.equals(ScpDataMovementConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(ScpDataMovementConstants.SECURITY_PROTOCOL)) || (fieldName.equals(ScpDataMovementConstants.ALTERNATIVE_SCP_HOSTNAME)) || (fieldName.equals(ScpDataMovementConstants.SSH_PORT))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					ScpDataMovement scpDataMovement = (ScpDataMovement) result;
+					ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
+					scpDataMovementResources.add(scpDataMovementResource);
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Scp Data Movement Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Scp Data Movement Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return scpDataMovementResources;
+	}
+	
+	@Override
+	public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+		List<String> scpDataMovementResourceIDs = new ArrayList<String>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+			Query q;
+			if ((fieldName.equals(ScpDataMovementConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(ScpDataMovementConstants.SECURITY_PROTOCOL)) || (fieldName.equals(ScpDataMovementConstants.ALTERNATIVE_SCP_HOSTNAME)) || (fieldName.equals(ScpDataMovementConstants.SSH_PORT))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					ScpDataMovement scpDataMovement = (ScpDataMovement) result;
+					ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
+					scpDataMovementResourceIDs.add(scpDataMovementResource.getDataMovementInterfaceId());
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Scp Data Movement Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Scp Data Movement Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return scpDataMovementResourceIDs;
+	}
+	
+	@Override
+	public void save() throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			ScpDataMovement existingScpDataMovement = em.find(ScpDataMovement.class, dataMovementInterfaceId);
+			em.close();
+			ScpDataMovement scpDataMovement;
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			if (existingScpDataMovement == null) {
+				scpDataMovement = new ScpDataMovement();
+			} else {
+				scpDataMovement = existingScpDataMovement;
+			}
+			scpDataMovement.setQueueDescription(getQueueDescription());
+			scpDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
+			scpDataMovement.setSecurityProtocol(getSecurityProtocol());
+			scpDataMovement.setAlternativeScpHostname(getAlternativeScpHostname());
+			scpDataMovement.setSshPort(getSshPort());
+			if (existingScpDataMovement == null) {
+				em.persist(scpDataMovement);
+			} else {
+				em.merge(scpDataMovement);
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public boolean isExists(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			ScpDataMovement scpDataMovement = em.find(ScpDataMovement.class, identifier);
+			em.close();
+			return scpDataMovement != null;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	public String getQueueDescription() {
+		return queueDescription;
+	}
+	
+	public String getDataMovementInterfaceId() {
+		return dataMovementInterfaceId;
+	}
+	
+	public String getSecurityProtocol() {
+		return securityProtocol;
+	}
+	
+	public String getAlternativeScpHostname() {
+		return alternativeScpHostname;
+	}
+	
+	public int getSshPort() {
+		return sshPort;
+	}
+	
+	public void setQueueDescription(String queueDescription) {
+		this.queueDescription=queueDescription;
+	}
+	
+	public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+		this.dataMovementInterfaceId=dataMovementInterfaceId;
+	}
+	
+	public void setSecurityProtocol(String securityProtocol) {
+		this.securityProtocol=securityProtocol;
+	}
+	
+	public void setAlternativeScpHostname(String alternativeScpHostname) {
+		this.alternativeScpHostname=alternativeScpHostname;
+	}
+	
+	public void setSshPort(int sshPort) {
+		this.sshPort=sshPort;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/ae1fe88a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SshJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SshJobSubmissionResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SshJobSubmissionResource.java
new file mode 100644
index 0000000..230489e
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SshJobSubmissionResource.java
@@ -0,0 +1,269 @@
+package org.apache.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.SshJobSubmission;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SshJobSubmissionResource extends AbstractResource {
+	private final static Logger logger = LoggerFactory.getLogger(SshJobSubmissionResource.class);
+	private String resourceJobManagerId;
+	private ResourceJobManagerResource resourceJobManagerResource;
+	private String jobSubmissionInterfaceId;
+	private String alternativeSshHostname;
+	private String securityProtocol;
+	private int sshPort;
+	
+	@Override
+	public void remove(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+			generator.setParameter(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+			Query q = generator.deleteQuery(em);
+			q.executeUpdate();
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public Resource get(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+			generator.setParameter(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+			Query q = generator.selectQuery(em);
+			SshJobSubmission sshJobSubmission = (SshJobSubmission) q.getSingleResult();
+			SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
+			em.getTransaction().commit();
+			em.close();
+			return sshJobSubmissionResource;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+		List<Resource> sshJobSubmissionResources = new ArrayList<Resource>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+			Query q;
+			if ((fieldName.equals(SshJobSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(SshJobSubmissionConstants.ALTERNATIVE_SSH_HOSTNAME)) || (fieldName.equals(SshJobSubmissionConstants.SECURITY_PROTOCOL)) || (fieldName.equals(SshJobSubmissionConstants.SSH_PORT))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					SshJobSubmission sshJobSubmission = (SshJobSubmission) result;
+					SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
+					sshJobSubmissionResources.add(sshJobSubmissionResource);
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Ssh Job Submission Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Ssh Job Submission Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return sshJobSubmissionResources;
+	}
+	
+	@Override
+	public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+		List<String> sshJobSubmissionResourceIDs = new ArrayList<String>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+			Query q;
+			if ((fieldName.equals(SshJobSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(SshJobSubmissionConstants.ALTERNATIVE_SSH_HOSTNAME)) || (fieldName.equals(SshJobSubmissionConstants.SECURITY_PROTOCOL)) || (fieldName.equals(SshJobSubmissionConstants.SSH_PORT))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					SshJobSubmission sshJobSubmission = (SshJobSubmission) result;
+					SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
+					sshJobSubmissionResourceIDs.add(sshJobSubmissionResource.getJobSubmissionInterfaceId());
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Ssh Job Submission Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Ssh Job Submission Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return sshJobSubmissionResourceIDs;
+	}
+	
+	@Override
+	public void save() throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			SshJobSubmission existingSshJobSubmission = em.find(SshJobSubmission.class, jobSubmissionInterfaceId);
+			em.close();
+			SshJobSubmission sshJobSubmission;
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			if (existingSshJobSubmission == null) {
+				sshJobSubmission = new SshJobSubmission();
+			} else {
+				sshJobSubmission = existingSshJobSubmission;
+			}
+			sshJobSubmission.setResourceJobManagerId(getResourceJobManagerId());
+			ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
+			sshJobSubmission.setResourceJobManager(resourceJobManager);
+			sshJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+			sshJobSubmission.setAlternativeSshHostname(getAlternativeSshHostname());
+			sshJobSubmission.setSecurityProtocol(getSecurityProtocol());
+			sshJobSubmission.setSshPort(getSshPort());
+			if (existingSshJobSubmission == null) {
+				em.persist(sshJobSubmission);
+			} else {
+				em.merge(sshJobSubmission);
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public boolean isExists(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			SshJobSubmission sshJobSubmission = em.find(SshJobSubmission.class, identifier);
+			em.close();
+			return sshJobSubmission != null;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	public String getResourceJobManagerId() {
+		return resourceJobManagerId;
+	}
+	
+	public ResourceJobManagerResource getResourceJobManagerResource() {
+		return resourceJobManagerResource;
+	}
+	
+	public String getJobSubmissionInterfaceId() {
+		return jobSubmissionInterfaceId;
+	}
+	
+	public String getAlternativeSshHostname() {
+		return alternativeSshHostname;
+	}
+	
+	public String getSecurityProtocol() {
+		return securityProtocol;
+	}
+	
+	public int getSshPort() {
+		return sshPort;
+	}
+	
+	public void setResourceJobManagerId(String resourceJobManagerId) {
+		this.resourceJobManagerId=resourceJobManagerId;
+	}
+	
+	public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
+		this.resourceJobManagerResource=resourceJobManagerResource;
+	}
+	
+	public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+		this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+	}
+	
+	public void setAlternativeSshHostname(String alternativeSshHostname) {
+		this.alternativeSshHostname=alternativeSshHostname;
+	}
+	
+	public void setSecurityProtocol(String securityProtocol) {
+		this.securityProtocol=securityProtocol;
+	}
+	
+	public void setSshPort(int sshPort) {
+		this.sshPort=sshPort;
+	}
+}
\ No newline at end of file


Mime
View raw message