airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [40/52] [abbrv] [partial] airavata git commit: registry refactoring
Date Thu, 04 Jun 2015 20:37:26 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/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
deleted file mode 100644
index a909122..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalDataMovementResource.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.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<Resource> getAll() throws AppCatalogException {
-        return null;
-    }
-
-    @Override
-    public List<String> getAllIds() throws AppCatalogException {
-        return null;
-    }
-
-    @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/ec8c6202/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
deleted file mode 100644
index 487e5dc..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalSubmissionResource.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-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.apache.airavata.common.utils.AiravataUtils;
-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;
-    private Timestamp createdTime;
-    private Timestamp updatedTime;
-
-    public Timestamp getCreatedTime() {
-        return createdTime;
-    }
-
-    public void setCreatedTime(Timestamp createdTime) {
-        this.createdTime = createdTime;
-    }
-
-    public Timestamp getUpdatedTime() {
-        return updatedTime;
-    }
-
-    public void setUpdatedTime(Timestamp updatedTime) {
-        this.updatedTime = updatedTime;
-    }
-	
-	@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<Resource> getAll() throws AppCatalogException {
-        return null;
-    }
-
-    @Override
-    public List<String> getAllIds() throws AppCatalogException {
-        return null;
-    }
-
-    @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();
-                localSubmission.setCreationTime(AiravataUtils.getCurrentTimestamp());
-			} else {
-				localSubmission = existingLocalSubmission;
-                localSubmission.setUpdateTime(AiravataUtils.getCurrentTimestamp());
-			}
-			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/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java
deleted file mode 100644
index 99faacf..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd;
-import org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd_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;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ModuleLoadCmdResource extends AbstractResource {
-    private final static Logger logger = LoggerFactory.getLogger(ModuleLoadCmdResource.class);
-    private String cmd;
-    private String appDeploymentId;
-    private AppDeploymentResource appDeploymentResource;
-
-    @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(MODULE_LOAD_CMD);
-            generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID));
-            if (ids.get(ModuleLoadCmdConstants.CMD) != null){
-                generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
-            }
-            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(MODULE_LOAD_CMD);
-            generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
-            generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID));
-            Query q = generator.selectQuery(em);
-            ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) q.getSingleResult();
-            ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
-            em.getTransaction().commit();
-            em.close();
-            return moduleLoadCmdResource;
-        } 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> moduleLoadCmdResources = new ArrayList<Resource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
-            Query q;
-            if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
-                generator.setParameter(fieldName, value);
-                q = generator.selectQuery(em);
-                List<?> results = q.getResultList();
-                for (Object result : results) {
-                    ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
-                    ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
-                    moduleLoadCmdResources.add(moduleLoadCmdResource);
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for Module Load Cmd 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 moduleLoadCmdResources;
-    }
-
-    @Override
-    public List<Resource> getAll() throws AppCatalogException {
-        return null;
-    }
-
-    @Override
-    public List<String> getAllIds() throws AppCatalogException {
-        return null;
-    }
-
-    @Override
-    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-        List<String> moduleLoadCmdResourceIDs = new ArrayList<String>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
-            Query q;
-            if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
-                generator.setParameter(fieldName, value);
-                q = generator.selectQuery(em);
-                List<?> results = q.getResultList();
-                for (Object result : results) {
-                    ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
-                    ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
-                    moduleLoadCmdResourceIDs.add(moduleLoadCmdResource.getAppDeploymentId());
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for Module Load Cmd 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 moduleLoadCmdResourceIDs;
-    }
-
-    @Override
-    public void save() throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            ModuleLoadCmd existingModuleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(cmd, appDeploymentId));
-            em.close();
-            ModuleLoadCmd moduleLoadCmd;
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            if (existingModuleLoadCmd == null) {
-                moduleLoadCmd = new ModuleLoadCmd();
-            } else {
-                moduleLoadCmd = existingModuleLoadCmd;
-            }
-            moduleLoadCmd.setCmd(getCmd());
-            moduleLoadCmd.setAppDeploymentId(getAppDeploymentId());
-            ApplicationDeployment applicationDeployment = em.find(ApplicationDeployment.class, getAppDeploymentId());
-            moduleLoadCmd.setApplicationDeployment(applicationDeployment);
-            if (existingModuleLoadCmd == null) {
-                em.persist(moduleLoadCmd);
-            } else {
-                em.merge(moduleLoadCmd);
-            }
-            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();
-            ModuleLoadCmd moduleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(ids.get(ModuleLoadCmdConstants.CMD), ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID)));
-            em.close();
-            return moduleLoadCmd != 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 getCmd() {
-        return cmd;
-    }
-
-    public String getAppDeploymentId() {
-        return appDeploymentId;
-    }
-
-    public AppDeploymentResource getAppDeploymentResource() {
-        return appDeploymentResource;
-    }
-
-    public void setCmd(String cmd) {
-        this.cmd=cmd;
-    }
-
-    public void setAppDeploymentId(String appDeploymentId) {
-        this.appDeploymentId=appDeploymentId;
-    }
-
-    public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
-        this.appDeploymentResource=appDeploymentResource;
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java
deleted file mode 100644
index 7cde166..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.PostJobCommand;
-import org.apache.aiaravata.application.catalog.data.model.PostJobCommandPK;
-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.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class PostJobCommandResource extends AbstractResource {
-    private final static Logger logger = LoggerFactory.getLogger(PostJobCommandResource.class);
-
-    private String appDeploymentId;
-    private String command;
-
-    private AppDeploymentResource appDeploymentResource;
-
-
-    public void remove(Object identifier) throws AppCatalogException {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map){
-            ids = (HashMap)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(POST_JOBCOMMAND);
-            generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
-                    ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
-            if (ids.get(PostJobCommandConstants.COMMAND) != null){
-                generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
-            }
-            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 {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map){
-            ids = (HashMap)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(POST_JOBCOMMAND);
-            generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
-                    ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
-            generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
-            Query q = generator.selectQuery(em);
-            PostJobCommand postJobCommand = (PostJobCommand) q.getSingleResult();
-            PostJobCommandResource postJobCommandResource =
-                    (PostJobCommandResource) AppCatalogJPAUtils.getResource(
-                            AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
-            em.getTransaction().commit();
-            em.close();
-            return postJobCommandResource;
-        } 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> gsiSSHPostJobCommandResources = new ArrayList<Resource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
-            List results;
-            if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
-                generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        PostJobCommand postJobCommand = (PostJobCommand) result;
-                        PostJobCommandResource postJobCommandResource =
-                                (PostJobCommandResource) AppCatalogJPAUtils.getResource(
-                                        AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
-                        gsiSSHPostJobCommandResources.add(postJobCommandResource);
-                    }
-                }
-            } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
-                generator.setParameter(PostJobCommandConstants.COMMAND, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        PostJobCommand postJobCommand = (PostJobCommand) result;
-                        PostJobCommandResource postJobCommandResource =
-                                (PostJobCommandResource) AppCatalogJPAUtils.getResource(
-                                        AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
-                        gsiSSHPostJobCommandResources.add(postJobCommandResource);
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for GSISSH Post Job Command Resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for GSISSH Post Job Command 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 gsiSSHPostJobCommandResources;
-    }
-
-    @Override
-    public List<Resource> getAll() throws AppCatalogException {
-        return null;
-    }
-
-    @Override
-    public List<String> getAllIds() throws AppCatalogException {
-        return null;
-    }
-
-    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-        List<String> gsiSSHPostJobResourceIDs = new ArrayList<String>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
-            List results;
-            if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
-                generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        PostJobCommand postJobCommand = (PostJobCommand) result;
-                        gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
-                    }
-                }
-            } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
-                generator.setParameter(PostJobCommandConstants.COMMAND, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        PostJobCommand postJobCommand = (PostJobCommand) result;
-                        gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for GSISSH Post Job resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for GSISSH Post JOb 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 gsiSSHPostJobResourceIDs;
-    }
-
-    public void save() throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            PostJobCommand existingPostJobCommand = em.find(PostJobCommand.class,
-                    new PostJobCommandPK(appDeploymentId, command));
-            em.close();
-
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
-            if (existingPostJobCommand !=  null){
-                existingPostJobCommand.setDeploymentId(appDeploymentId);
-                existingPostJobCommand.setCommand(command);
-                existingPostJobCommand.setDeployment(deployment);
-                em.merge(existingPostJobCommand);
-            }else {
-                PostJobCommand postJobCommand = new PostJobCommand();
-                postJobCommand.setDeploymentId(appDeploymentId);
-                postJobCommand.setCommand(command);
-                postJobCommand.setDeployment(deployment);
-                em.persist(postJobCommand);
-            }
-            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 {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map){
-            ids = (HashMap)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();
-            PostJobCommand postJobCommand = em.find(PostJobCommand.class, new PostJobCommandPK(
-                    ids.get(PostJobCommandConstants.DEPLOYMENT_ID),
-                    ids.get(PostJobCommandConstants.COMMAND)));
-
-            em.close();
-            return postJobCommand != 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 getAppDeploymentId() {
-        return appDeploymentId;
-    }
-
-    public void setAppDeploymentId(String appDeploymentId) {
-        this.appDeploymentId = appDeploymentId;
-    }
-
-    public String getCommand() {
-        return command;
-    }
-
-    public void setCommand(String command) {
-        this.command = command;
-    }
-
-    public AppDeploymentResource getAppDeploymentResource() {
-        return appDeploymentResource;
-    }
-
-    public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
-        this.appDeploymentResource = appDeploymentResource;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java
deleted file mode 100644
index 09a8fa1..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.PreJobCommand;
-import org.apache.aiaravata.application.catalog.data.model.PreJobCommandPK;
-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.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class PreJobCommandResource extends AbstractResource {
-    private final static Logger logger = LoggerFactory.getLogger(PreJobCommandResource.class);
-
-    private String appDeploymentId;
-    private String command;
-
-    private AppDeploymentResource appDeploymentResource;
-
-
-    public void remove(Object identifier) throws AppCatalogException {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map){
-            ids = (HashMap)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(PRE_JOBCOMMAND);
-            generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
-                    ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
-            if (ids.get(PreJobCommandConstants.COMMAND) != null){
-                generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
-            }
-            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 {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map){
-            ids = (HashMap)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(PRE_JOBCOMMAND);
-            generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
-                    ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
-            generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
-            Query q = generator.selectQuery(em);
-            PreJobCommand preJobCommand = (PreJobCommand) q.getSingleResult();
-            PreJobCommandResource preJobCommandResource =
-                    (PreJobCommandResource) AppCatalogJPAUtils.getResource(
-                            AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
-            em.getTransaction().commit();
-            em.close();
-            return preJobCommandResource;
-        } 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> gsiSSHPreJobResources = new ArrayList<Resource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
-            List results;
-            if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
-                generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        PreJobCommand preJobCommand = (PreJobCommand) result;
-                        PreJobCommandResource preJobCommandResource =
-                                (PreJobCommandResource) AppCatalogJPAUtils.getResource(
-                                        AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
-                        gsiSSHPreJobResources.add(preJobCommandResource);
-                    }
-                }
-            } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
-                generator.setParameter(PreJobCommandConstants.COMMAND, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        PreJobCommand preJobCommand = (PreJobCommand) result;
-                        PreJobCommandResource preJobCommandResource =
-                                (PreJobCommandResource) AppCatalogJPAUtils.getResource(
-                                        AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
-                        gsiSSHPreJobResources.add(preJobCommandResource);
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for GSISSH Pre Job Command Resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for GSISSH Pre Job Command 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 gsiSSHPreJobResources;
-    }
-
-    @Override
-    public List<Resource> getAll() throws AppCatalogException {
-        return null;
-    }
-
-    @Override
-    public List<String> getAllIds() throws AppCatalogException {
-        return null;
-    }
-
-    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-        List<String> gsiSSHPreJobResourceIDs = new ArrayList<String>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
-            List results;
-            if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
-                generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        PreJobCommand preJobCommand = (PreJobCommand) result;
-                        gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
-                    }
-                }
-            } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
-                generator.setParameter(PreJobCommandConstants.COMMAND, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        PreJobCommand preJobCommand = (PreJobCommand) result;
-                        gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for GSISSH Pre Job resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for GSISSH Pre JOb 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 gsiSSHPreJobResourceIDs;
-    }
-
-    public void save() throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            PreJobCommand existingGSIsshPreJobCommand = em.find(PreJobCommand.class,
-                    new PreJobCommandPK(appDeploymentId, command));
-            em.close();
-
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
-            if (existingGSIsshPreJobCommand !=  null){
-                existingGSIsshPreJobCommand.setDeploymentId(appDeploymentId);
-                existingGSIsshPreJobCommand.setCommand(command);
-                existingGSIsshPreJobCommand.setApplicationDeployment(deployment);
-                em.merge(existingGSIsshPreJobCommand);
-            }else {
-                PreJobCommand preJobCommand = new PreJobCommand();
-                preJobCommand.setDeploymentId(appDeploymentId);
-                preJobCommand.setCommand(command);
-                preJobCommand.setApplicationDeployment(deployment);
-                em.persist(preJobCommand);
-            }
-            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 {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map){
-            ids = (HashMap)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();
-            PreJobCommand preJobCommand = em.find(PreJobCommand.class, new PreJobCommandPK(
-                    ids.get(PreJobCommandConstants.DEPLOYMENT_ID),
-                    ids.get(PreJobCommandConstants.COMMAND)));
-
-            em.close();
-            return preJobCommand != 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 getAppDeploymentId() {
-        return appDeploymentId;
-    }
-
-    public void setAppDeploymentId(String appDeploymentId) {
-        this.appDeploymentId = appDeploymentId;
-    }
-
-    public String getCommand() {
-        return command;
-    }
-
-    public void setCommand(String command) {
-        this.command = command;
-    }
-
-    public AppDeploymentResource getAppDeploymentResource() {
-        return appDeploymentResource;
-    }
-
-    public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
-        this.appDeploymentResource = appDeploymentResource;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java
deleted file mode 100644
index d4ad2fd..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-package org.apache.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-
-import java.util.List;
-
-public interface Resource {
-
-    /**
-     * This method will remove the given resource from the database
-     *
-     * @param identifier identifier that can uniquely identify a single instance of the resource
-     */
-    void remove(Object identifier) throws AppCatalogException;
-
-    /**
-     * This method will return the given resource from the database
-     *
-     * @param identifier identifier that can uniquely identify a single instance of the resource
-     * @return associate resource
-     */
-    Resource get(Object identifier) throws AppCatalogException;
-
-    /**
-     * This method will list all the resources according to the filtering criteria
-     * @param fieldName field name
-     * @param value value of the field
-     * @return list of resources
-     */
-    List<Resource> get(String fieldName, Object value) throws AppCatalogException;
-
-    /**
-     *
-     * @return
-     * @throws AppCatalogException
-     */
-    List<Resource> getAll() throws AppCatalogException;
-
-    /**
-     *
-     * @return
-     * @throws AppCatalogException
-     */
-    List<String> getAllIds() throws AppCatalogException;
-
-    /** This method will return list of resource ids according to given criteria
-     * @param fieldName field name
-     * @param value value of the field
-     * @return list of resource Ids
-     * @throws AppCatalogException
-     */
-    List<String> getIds(String fieldName, Object value) throws AppCatalogException;
-
-    /**
-     * This method will save the resource to the database.
-     */
-    void save() throws AppCatalogException;
-
-    /**
-     * This method will check whether an entry from the given resource and resource name
-     * exists in the database
-     *
-     * @param identifier identifier that can uniquely identify a single instance of the resource
-     * @return whether the entry exists in the database or not
-     */
-    boolean isExists(Object identifier) throws AppCatalogException;
-
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ResourceJobManagerResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ResourceJobManagerResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ResourceJobManagerResource.java
deleted file mode 100644
index 0cc5a18..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ResourceJobManagerResource.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-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.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.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ResourceJobManagerResource extends AbstractResource {
-	private final static Logger logger = LoggerFactory.getLogger(ResourceJobManagerResource.class);
-	private String resourceJobManagerId;
-	private String pushMonitoringEndpoint;
-	private String jobManagerBinPath;
-	private String resourceJobManagerType;
-    private Timestamp createdTime;
-    private Timestamp updatedTime;
-
-    public Timestamp getCreatedTime() {
-        return createdTime;
-    }
-
-    public void setCreatedTime(Timestamp createdTime) {
-        this.createdTime = createdTime;
-    }
-
-    public Timestamp getUpdatedTime() {
-        return updatedTime;
-    }
-
-    public void setUpdatedTime(Timestamp updatedTime) {
-        this.updatedTime = updatedTime;
-    }
-	
-	@Override
-	public void remove(Object identifier) throws AppCatalogException {
-		EntityManager em = null;
-		try {
-			em = AppCatalogJPAUtils.getEntityManager();
-			em.getTransaction().begin();
-			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
-			generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_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(RESOURCE_JOB_MANAGER);
-			generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID, identifier);
-			Query q = generator.selectQuery(em);
-			ResourceJobManager resourceJobManager = (ResourceJobManager) q.getSingleResult();
-			ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
-			em.getTransaction().commit();
-			em.close();
-			return resourceJobManagerResource;
-		} 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> resourceJobManagerResources = new ArrayList<Resource>();
-		EntityManager em = null;
-		try {
-			em = AppCatalogJPAUtils.getEntityManager();
-			em.getTransaction().begin();
-			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
-			Query q;
-			if ((fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(ResourceJobManagerConstants.PUSH_MONITORING_ENDPOINT)) || (fieldName.equals(ResourceJobManagerConstants.JOB_MANAGER_BIN_PATH)) || (fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_TYPE))) {
-				generator.setParameter(fieldName, value);
-				q = generator.selectQuery(em);
-				List<?> results = q.getResultList();
-				for (Object result : results) {
-					ResourceJobManager resourceJobManager = (ResourceJobManager) result;
-					ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
-					resourceJobManagerResources.add(resourceJobManagerResource);
-				}
-			} else {
-				em.getTransaction().commit();
-					em.close();
-				logger.error("Unsupported field name for Resource Job Manager Resource.", new IllegalArgumentException());
-				throw new IllegalArgumentException("Unsupported field name for Resource Job Manager 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 resourceJobManagerResources;
-	}
-
-    @Override
-    public List<Resource> getAll() throws AppCatalogException {
-        return null;
-    }
-
-    @Override
-    public List<String> getAllIds() throws AppCatalogException {
-        return null;
-    }
-
-    @Override
-	public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-		List<String> resourceJobManagerResourceIDs = new ArrayList<String>();
-		EntityManager em = null;
-		try {
-			em = AppCatalogJPAUtils.getEntityManager();
-			em.getTransaction().begin();
-			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
-			Query q;
-			if ((fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(ResourceJobManagerConstants.PUSH_MONITORING_ENDPOINT)) || (fieldName.equals(ResourceJobManagerConstants.JOB_MANAGER_BIN_PATH)) || (fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_TYPE))) {
-				generator.setParameter(fieldName, value);
-				q = generator.selectQuery(em);
-				List<?> results = q.getResultList();
-				for (Object result : results) {
-					ResourceJobManager resourceJobManager = (ResourceJobManager) result;
-					ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
-					resourceJobManagerResourceIDs.add(resourceJobManagerResource.getResourceJobManagerId());
-				}
-			} else {
-				em.getTransaction().commit();
-					em.close();
-				logger.error("Unsupported field name for Resource Job Manager Resource.", new IllegalArgumentException());
-				throw new IllegalArgumentException("Unsupported field name for Resource Job Manager 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 resourceJobManagerResourceIDs;
-	}
-	
-	@Override
-	public void save() throws AppCatalogException {
-		EntityManager em = null;
-		try {
-			em = AppCatalogJPAUtils.getEntityManager();
-			ResourceJobManager existingResourceJobManager = em.find(ResourceJobManager.class, resourceJobManagerId);
-			em.close();
-			ResourceJobManager resourceJobManager;
-			em = AppCatalogJPAUtils.getEntityManager();
-			em.getTransaction().begin();
-			if (existingResourceJobManager == null) {
-				resourceJobManager = new ResourceJobManager();
-                resourceJobManager.setCreationTime(AiravataUtils.getCurrentTimestamp());
-			} else {
-				resourceJobManager = existingResourceJobManager;
-                resourceJobManager.setUpdateTime(AiravataUtils.getCurrentTimestamp());
-			}
-			resourceJobManager.setResourceJobManagerId(getResourceJobManagerId());
-			resourceJobManager.setPushMonitoringEndpoint(getPushMonitoringEndpoint());
-			resourceJobManager.setJobManagerBinPath(getJobManagerBinPath());
-			resourceJobManager.setResourceJobManagerType(getResourceJobManagerType());
-			if (existingResourceJobManager == null) {
-				em.persist(resourceJobManager);
-			} else {
-				em.merge(resourceJobManager);
-			}
-			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();
-			ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, identifier);
-			em.close();
-			return resourceJobManager != 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 String getPushMonitoringEndpoint() {
-		return pushMonitoringEndpoint;
-	}
-	
-	public String getJobManagerBinPath() {
-		return jobManagerBinPath;
-	}
-	
-	public String getResourceJobManagerType() {
-		return resourceJobManagerType;
-	}
-	
-	public void setResourceJobManagerId(String resourceJobManagerId) {
-		this.resourceJobManagerId=resourceJobManagerId;
-	}
-	
-	public void setPushMonitoringEndpoint(String pushMonitoringEndpoint) {
-		this.pushMonitoringEndpoint=pushMonitoringEndpoint;
-	}
-	
-	public void setJobManagerBinPath(String jobManagerBinPath) {
-		this.jobManagerBinPath=jobManagerBinPath;
-	}
-	
-	public void setResourceJobManagerType(String resourceJobManagerType) {
-		this.resourceJobManagerType=resourceJobManagerType;
-	}
-}


Mime
View raw message