airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [41/52] [abbrv] [partial] airavata git commit: registry refactoring
Date Thu, 04 Jun 2015 20:37:27 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/HostIPAddressResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostIPAddressResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostIPAddressResource.java
deleted file mode 100644
index 683efec..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostIPAddressResource.java
+++ /dev/null
@@ -1,318 +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.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.HostIPAddress;
-import org.apache.aiaravata.application.catalog.data.model.HostIPAddressPK;
-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 HostIPAddressResource extends AbstractResource{
-
-    private final static Logger logger = LoggerFactory.getLogger(HostIPAddressResource.class);
-
-    private String resourceID;
-    private String ipaddress;
-    private ComputeResourceResource computeHostResource;
-
-    public void remove(Object identifier) throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(HOST_IPADDRESS);
-            generator.setParameter(HostIPAddressConstants.RESOURCE_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 {
-        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(HOST_IPADDRESS);
-            generator.setParameter(HostIPAddressConstants.RESOURCE_ID, ids.get(HostIPAddressConstants.RESOURCE_ID));
-            generator.setParameter(HostIPAddressConstants.IP_ADDRESS, ids.get(HostIPAddressConstants.IP_ADDRESS));
-            Query q = generator.selectQuery(em);
-            HostIPAddress hostIPAddress = (HostIPAddress) q.getSingleResult();
-            HostIPAddressResource hostIPAddressResource =
-                    (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
-            em.getTransaction().commit();
-            em.close();
-            return hostIPAddressResource;
-        } 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> hostIPAddressResources = new ArrayList<Resource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
-            List results;
-            if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
-                generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        HostIPAddress hostIPAddress = (HostIPAddress) result;
-                        HostIPAddressResource hostIPAddressResource =
-                                (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
-                        hostIPAddressResources.add(hostIPAddressResource);
-                    }
-                }
-            } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
-                generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        HostIPAddress hostIPAddress = (HostIPAddress) result;
-                        HostIPAddressResource hostIPAddressResource =
-                                (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
-                        hostIPAddressResources.add(hostIPAddressResource);
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for Host IPAddress Resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for Host IPAddress 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 hostIPAddressResources;
-    }
-
-    @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> hostIPAddressResourceIDs = new ArrayList<String>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
-            List results;
-            if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
-                generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        HostIPAddress hostIPAddress = (HostIPAddress) result;
-                        hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
-                    }
-                }
-            } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
-                generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        HostIPAddress hostIPAddress = (HostIPAddress) result;
-                        hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for Host IP Address resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for Host IPAddress 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 hostIPAddressResourceIDs;
-    }
-
-    public void save() throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            HostIPAddress existingHostIP = em.find(HostIPAddress.class, new HostIPAddressPK(resourceID,ipaddress));
-            em.close();
-
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
-            if (existingHostIP !=  null){
-                existingHostIP.setIpaddress(ipaddress);
-                existingHostIP.setResourceID(resourceID);
-                existingHostIP.setComputeResource(computeResource);
-                em.merge(existingHostIP);
-            }else {
-                HostIPAddress hostIPAddress = new HostIPAddress();
-                hostIPAddress.setIpaddress(ipaddress);
-                hostIPAddress.setResourceID(resourceID);
-                hostIPAddress.setComputeResource(computeResource);
-                em.persist(hostIPAddress);
-            }
-            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();
-            HostIPAddress hostIPAddress = em.find(HostIPAddress.class, new HostIPAddressPK(ids.get(HostIPAddressConstants.RESOURCE_ID),
-                    ids.get(HostIPAddressConstants.IP_ADDRESS)));
-
-            em.close();
-            return hostIPAddress != 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 getResourceID() {
-        return resourceID;
-    }
-
-    public void setResourceID(String resourceID) {
-        this.resourceID = resourceID;
-    }
-
-    public String getIpaddress() {
-        return ipaddress;
-    }
-
-    public void setIpaddress(String ipaddress) {
-        this.ipaddress = ipaddress;
-    }
-
-    public ComputeResourceResource getComputeHostResource() {
-        return computeHostResource;
-    }
-
-    public void setComputeHostResource(ComputeResourceResource computeHostResource) {
-        this.computeHostResource = computeHostResource;
-    }
-}

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/JobManagerCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobManagerCommandResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobManagerCommandResource.java
deleted file mode 100644
index e177cd3..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobManagerCommandResource.java
+++ /dev/null
@@ -1,307 +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.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.JobManagerCommand;
-import org.apache.aiaravata.application.catalog.data.model.JobManagerCommand_PK;
-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 JobManagerCommandResource extends AbstractResource {
-	private final static Logger logger = LoggerFactory.getLogger(JobManagerCommandResource.class);
-	private String resourceJobManagerId;
-	private ResourceJobManagerResource resourceJobManagerResource;
-	private String commandType;
-	private String command;
-	
-	@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(JOB_MANAGER_COMMAND);
-			generator.setParameter(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID));
-			generator.setParameter(JobManagerCommandConstants.COMMAND_TYPE, ids.get(JobManagerCommandConstants.COMMAND_TYPE));
-			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(JOB_MANAGER_COMMAND);
-			generator.setParameter(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID));
-			generator.setParameter(JobManagerCommandConstants.COMMAND_TYPE, ids.get(JobManagerCommandConstants.COMMAND_TYPE));
-			Query q = generator.selectQuery(em);
-			JobManagerCommand jobManagerCommand = (JobManagerCommand) q.getSingleResult();
-			JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
-			em.getTransaction().commit();
-			em.close();
-			return jobManagerCommandResource;
-		} 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> jobManagerCommandResources = new ArrayList<Resource>();
-		EntityManager em = null;
-		try {
-			em = AppCatalogJPAUtils.getEntityManager();
-			em.getTransaction().begin();
-			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
-			Query q;
-			if ((fieldName.equals(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(JobManagerCommandConstants.COMMAND_TYPE)) || (fieldName.equals(JobManagerCommandConstants.COMMAND))) {
-				generator.setParameter(fieldName, value);
-				q = generator.selectQuery(em);
-				List<?> results = q.getResultList();
-				for (Object result : results) {
-					JobManagerCommand jobManagerCommand = (JobManagerCommand) result;
-					JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
-					jobManagerCommandResources.add(jobManagerCommandResource);
-				}
-			} else {
-				em.getTransaction().commit();
-					em.close();
-				logger.error("Unsupported field name for Job Manager Command Resource.", new IllegalArgumentException());
-				throw new IllegalArgumentException("Unsupported field name for Job Manager Command 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 jobManagerCommandResources;
-	}
-
-    @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> jobManagerCommandResourceIDs = new ArrayList<String>();
-		EntityManager em = null;
-		try {
-			em = AppCatalogJPAUtils.getEntityManager();
-			em.getTransaction().begin();
-			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
-			Query q;
-			if ((fieldName.equals(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(JobManagerCommandConstants.COMMAND_TYPE)) || (fieldName.equals(JobManagerCommandConstants.COMMAND))) {
-				generator.setParameter(fieldName, value);
-				q = generator.selectQuery(em);
-				List<?> results = q.getResultList();
-				for (Object result : results) {
-					JobManagerCommand jobManagerCommand = (JobManagerCommand) result;
-					JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
-					jobManagerCommandResourceIDs.add(jobManagerCommandResource.getResourceJobManagerId());
-				}
-			} else {
-				em.getTransaction().commit();
-					em.close();
-				logger.error("Unsupported field name for Job Manager Command Resource.", new IllegalArgumentException());
-				throw new IllegalArgumentException("Unsupported field name for Job Manager Command 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 jobManagerCommandResourceIDs;
-	}
-	
-	@Override
-	public void save() throws AppCatalogException {
-		EntityManager em = null;
-		try {
-			em = AppCatalogJPAUtils.getEntityManager();
-			JobManagerCommand existingJobManagerCommand = em.find(JobManagerCommand.class, new JobManagerCommand_PK(resourceJobManagerId, commandType));
-			em.close();
-			JobManagerCommand jobManagerCommand;
-			em = AppCatalogJPAUtils.getEntityManager();
-			em.getTransaction().begin();
-			if (existingJobManagerCommand == null) {
-				jobManagerCommand = new JobManagerCommand();
-			} else {
-				jobManagerCommand = existingJobManagerCommand;
-			}
-			jobManagerCommand.setResourceJobManagerId(getResourceJobManagerId());
-			ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
-			jobManagerCommand.setResourceJobManager(resourceJobManager);
-			jobManagerCommand.setCommandType(getCommandType());
-			jobManagerCommand.setCommand(getCommand());
-			if (existingJobManagerCommand == null) {
-				em.persist(jobManagerCommand);
-			} else {
-				em.merge(jobManagerCommand);
-			}
-			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();
-			JobManagerCommand jobManagerCommand = em.find(JobManagerCommand.class, new JobManagerCommand_PK(ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID), ids.get(JobManagerCommandConstants.COMMAND_TYPE)));
-			em.close();
-			return jobManagerCommand != 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 getCommandType() {
-		return commandType;
-	}
-	
-	public String getCommand() {
-		return command;
-	}
-	
-	public void setResourceJobManagerId(String resourceJobManagerId) {
-		this.resourceJobManagerId=resourceJobManagerId;
-	}
-	
-	public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
-		this.resourceJobManagerResource=resourceJobManagerResource;
-	}
-	
-	public void setCommandType(String commandType) {
-		this.commandType=commandType;
-	}
-	
-	public void setCommand(String command) {
-		this.command=command;
-	}
-}

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/JobSubmissionInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionInterfaceResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionInterfaceResource.java
deleted file mode 100644
index a5acbef..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionInterfaceResource.java
+++ /dev/null
@@ -1,339 +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.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.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface;
-import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface_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.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class JobSubmissionInterfaceResource extends AbstractResource {
-	private final static Logger logger = LoggerFactory.getLogger(JobSubmissionInterfaceResource.class);
-	private String jobSubmissionInterfaceId;
-	private String computeResourceId;
-	private ComputeResourceResource computeHostResource;
-	private String jobSubmissionProtocol;
-	private int priorityOrder;
-    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 {
-		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(JOB_SUBMISSION_INTERFACE);
-			generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
-			generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_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(JOB_SUBMISSION_INTERFACE);
-			generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
-			generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID));
-			Query q = generator.selectQuery(em);
-			JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) q.getSingleResult();
-			JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
-			em.getTransaction().commit();
-			em.close();
-			return jobSubmissionInterfaceResource;
-		} 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> jobSubmissionInterfaceResources = new ArrayList<Resource>();
-		EntityManager em = null;
-		try {
-			em = AppCatalogJPAUtils.getEntityManager();
-			em.getTransaction().begin();
-			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
-			Query q;
-			if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
-				generator.setParameter(fieldName, value);
-				q = generator.selectQuery(em);
-				List<?> results = q.getResultList();
-				for (Object result : results) {
-					JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
-					JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
-					jobSubmissionInterfaceResources.add(jobSubmissionInterfaceResource);
-				}
-			} else {
-				em.getTransaction().commit();
-					em.close();
-				logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
-				throw new IllegalArgumentException("Unsupported field name for Job Submission Interface 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 jobSubmissionInterfaceResources;
-	}
-
-    @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> jobSubmissionInterfaceResourceIDs = new ArrayList<String>();
-		EntityManager em = null;
-		try {
-			em = AppCatalogJPAUtils.getEntityManager();
-			em.getTransaction().begin();
-			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
-			Query q;
-			if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
-				generator.setParameter(fieldName, value);
-				q = generator.selectQuery(em);
-				List<?> results = q.getResultList();
-				for (Object result : results) {
-					JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
-					JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
-					jobSubmissionInterfaceResourceIDs.add(jobSubmissionInterfaceResource.getComputeResourceId());
-				}
-			} else {
-				em.getTransaction().commit();
-					em.close();
-				logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
-				throw new IllegalArgumentException("Unsupported field name for Job Submission Interface 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 jobSubmissionInterfaceResourceIDs;
-	}
-	
-	@Override
-	public void save() throws AppCatalogException {
-		EntityManager em = null;
-		try {
-			em = AppCatalogJPAUtils.getEntityManager();
-			JobSubmissionInterface existingJobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(jobSubmissionInterfaceId, computeResourceId));
-			em.close();
-			JobSubmissionInterface jobSubmissionInterface;
-			em = AppCatalogJPAUtils.getEntityManager();
-			em.getTransaction().begin();
-			if (existingJobSubmissionInterface == null) {
-				jobSubmissionInterface = new JobSubmissionInterface();
-                jobSubmissionInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
-			} else {
-				jobSubmissionInterface = existingJobSubmissionInterface;
-                jobSubmissionInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
-			}
-			jobSubmissionInterface.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
-			jobSubmissionInterface.setComputeResourceId(getComputeResourceId());
-			ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
-			jobSubmissionInterface.setComputeResource(computeResource);
-			jobSubmissionInterface.setJobSubmissionProtocol(getJobSubmissionProtocol());
-			jobSubmissionInterface.setPriorityOrder(getPriorityOrder());
-			if (existingJobSubmissionInterface == null) {
-				em.persist(jobSubmissionInterface);
-			} else {
-				em.merge(jobSubmissionInterface);
-			}
-			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();
-			JobSubmissionInterface jobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID), ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)));
-			em.close();
-			return jobSubmissionInterface != 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 getJobSubmissionInterfaceId() {
-		return jobSubmissionInterfaceId;
-	}
-	
-	public String getComputeResourceId() {
-		return computeResourceId;
-	}
-	
-	public ComputeResourceResource getComputeHostResource() {
-		return computeHostResource;
-	}
-	
-	public String getJobSubmissionProtocol() {
-		return jobSubmissionProtocol;
-	}
-	
-	public int getPriorityOrder() {
-		return priorityOrder;
-	}
-	
-	public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
-		this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
-	}
-	
-	public void setComputeResourceId(String computeResourceId) {
-		this.computeResourceId=computeResourceId;
-	}
-	
-	public void setComputeHostResource(ComputeResourceResource computeHostResource) {
-		this.computeHostResource=computeHostResource;
-	}
-	
-	public void setJobSubmissionProtocol(String jobSubmissionProtocol) {
-		this.jobSubmissionProtocol=jobSubmissionProtocol;
-	}
-	
-	public void setPriorityOrder(int priorityOrder) {
-		this.priorityOrder=priorityOrder;
-	}
-}
\ No newline at end of file

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/JobSubmissionProtocolResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionProtocolResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionProtocolResource.java
deleted file mode 100644
index d6134af..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionProtocolResource.java
+++ /dev/null
@@ -1,359 +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.ComputeResource;
-//import org.apache.aiaravata.application.catalog.data.model.JobSubmissionProtocol;
-//import org.apache.aiaravata.application.catalog.data.model.JobSubmissionProtocolPK;
-//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 JobSubmissionProtocolResource extends AbstractResource {
-//
-//    private final static Logger logger = LoggerFactory.getLogger(JobSubmissionProtocolResource.class);
-//
-//    private String resourceID;
-//    private String submissionID;
-//    private String jobType;
-//    private ComputeResourceResource computeHostResource;
-//
-//    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(JOB_SUBMISSION_PROTOCOL);
-//            generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, ids.get(JobSubmissionProtocolConstants.RESOURCE_ID));
-//            generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID));
-//            generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, ids.get(JobSubmissionProtocolConstants.JOB_TYPE));
-//            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(JOB_SUBMISSION_PROTOCOL);
-//            generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, ids.get(JobSubmissionProtocolConstants.RESOURCE_ID));
-//            generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID));
-//            generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, ids.get(JobSubmissionProtocolConstants.JOB_TYPE));
-//            Query q = generator.selectQuery(em);
-//            JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) q.getSingleResult();
-//            JobSubmissionProtocolResource jobSubmissionProtocolResource =
-//                    (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-//            em.getTransaction().commit();
-//            em.close();
-//            return jobSubmissionProtocolResource;
-//        } 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> jobSubmissionProtocolResourceList = new ArrayList<Resource>();
-//        EntityManager em = null;
-//        try {
-//            em = AppCatalogJPAUtils.getEntityManager();
-//            em.getTransaction().begin();
-//            Query q;
-//            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_PROTOCOL);
-//            List results;
-//            if (fieldName.equals(JobSubmissionProtocolConstants.SUBMISSION_ID)) {
-//                generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, value);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-//                        JobSubmissionProtocolResource jobSubmissionProtocolResource =
-//                                (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-//                        jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
-//                    }
-//                }
-//            } else if (fieldName.equals(JobSubmissionProtocolConstants.JOB_TYPE)) {
-//                generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, value);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-//                        JobSubmissionProtocolResource jobSubmissionProtocolResource =
-//                                (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-//                        jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
-//                    }
-//                }
-//            } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
-//                generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-//                        JobSubmissionProtocolResource jobSubmissionProtocolResource =
-//                                (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-//                        jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
-//                    }
-//                }
-//            } else {
-//                em.getTransaction().commit();
-//                em.close();
-//                logger.error("Unsupported field name for Job Submission Protocol Resource.", new IllegalArgumentException());
-//                throw new IllegalArgumentException("Unsupported field name for Job Submission Protocol 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 jobSubmissionProtocolResourceList;
-//    }
-//
-//    @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> jobSubmissionProtocolIDs = new ArrayList<String>();
-//        EntityManager em = null;
-//        try {
-//            em = AppCatalogJPAUtils.getEntityManager();
-//            em.getTransaction().begin();
-//            Query q;
-//            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_PROTOCOL);
-//            List results;
-//            if (fieldName.equals(JobSubmissionProtocolConstants.SUBMISSION_ID)) {
-//                generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, value);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-//                        jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
-//                    }
-//                }
-//            } else if (fieldName.equals(JobSubmissionProtocolConstants.RESOURCE_ID)) {
-//                generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, value);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-//                        jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
-//                    }
-//                }
-//            } else if (fieldName.equals(JobSubmissionProtocolConstants.JOB_TYPE)) {
-//                generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, value);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-//                        jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
-//                    }
-//                }
-//            } else {
-//                em.getTransaction().commit();
-//                em.close();
-//                logger.error("Unsupported field name for Job Submission Protocol resource.", new IllegalArgumentException());
-//                throw new IllegalArgumentException("Unsupported field name for Job Submission Protocol 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 jobSubmissionProtocolIDs;
-//    }
-//
-//    public void save() throws AppCatalogException {
-//        EntityManager em = null;
-//        try {
-//            em = AppCatalogJPAUtils.getEntityManager();
-//            JobSubmissionProtocol existingJobSubProtocol = em.find(JobSubmissionProtocol.class, new JobSubmissionProtocolPK(resourceID, submissionID, jobType));
-//            em.close();
-//
-//            em = AppCatalogJPAUtils.getEntityManager();
-//            em.getTransaction().begin();
-//            ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
-//            if (existingJobSubProtocol != null) {
-//                existingJobSubProtocol.setJobType(jobType);
-//                existingJobSubProtocol.setSubmissionID(submissionID);
-//                existingJobSubProtocol.setComputeResource(computeResource);
-//                existingJobSubProtocol.setResourceID(resourceID);
-//                em.merge(existingJobSubProtocol);
-//            } else {
-//                JobSubmissionProtocol jobSubmissionProtocol = new JobSubmissionProtocol();
-//                jobSubmissionProtocol.setJobType(jobType);
-//                jobSubmissionProtocol.setSubmissionID(submissionID);
-//                jobSubmissionProtocol.setResourceID(resourceID);
-//                jobSubmissionProtocol.setComputeResource(computeResource);
-//                em.persist(jobSubmissionProtocol);
-//            }
-//            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();
-//            JobSubmissionProtocol jobSubmissionProtocol = em.find(JobSubmissionProtocol.class, new JobSubmissionProtocolPK(ids.get(JobSubmissionProtocolConstants.RESOURCE_ID),
-//                    ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID), ids.get(JobSubmissionProtocolConstants.JOB_TYPE)));
-//
-//            em.close();
-//            return jobSubmissionProtocol != 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 getResourceID() {
-//        return resourceID;
-//    }
-//
-//    public void setResourceID(String resourceID) {
-//        this.resourceID = resourceID;
-//    }
-//
-//    public String getSubmissionID() {
-//        return submissionID;
-//    }
-//
-//    public void setSubmissionID(String submissionID) {
-//        this.submissionID = submissionID;
-//    }
-//
-//    public String getJobType() {
-//        return jobType;
-//    }
-//
-//    public void setJobType(String jobType) {
-//        this.jobType = jobType;
-//    }
-//
-//    public ComputeResourceResource getComputeHostResource() {
-//        return computeHostResource;
-//    }
-//
-//    public void setComputeHostResource(ComputeResourceResource computeHostResource) {
-//        this.computeHostResource = computeHostResource;
-//    }
-//}

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/LibraryApendPathResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryApendPathResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryApendPathResource.java
deleted file mode 100644
index 1f2286d..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryApendPathResource.java
+++ /dev/null
@@ -1,292 +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.LibraryApendPath;
-import org.apache.aiaravata.application.catalog.data.model.LibraryApendPath_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 LibraryApendPathResource extends AbstractResource {
-    private final static Logger logger = LoggerFactory.getLogger(LibraryApendPathResource.class);
-    private String deploymentId;
-    private String name;
-    private String value;
-    private AppDeploymentResource appDeploymentResource;
-
-    public String getDeploymentId() {
-        return deploymentId;
-    }
-
-    public void setDeploymentId(String deploymentId) {
-        this.deploymentId = deploymentId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-
-    public AppDeploymentResource getAppDeploymentResource() {
-        return appDeploymentResource;
-    }
-
-    public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
-        this.appDeploymentResource = appDeploymentResource;
-    }
-
-    @Override
-    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(LIBRARY_APEND_PATH);
-            generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, ids.get(LibraryApendPathConstants.DEPLOYMENT_ID));
-            if (ids.get(LibraryApendPathConstants.NAME) != null){
-                generator.setParameter(LibraryApendPathConstants.NAME, ids.get(LibraryApendPathConstants.NAME));
-            }
-            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)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(LIBRARY_APEND_PATH);
-            generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, ids.get(LibraryApendPathConstants.DEPLOYMENT_ID));
-            generator.setParameter(LibraryApendPathConstants.NAME, ids.get(LibraryApendPathConstants.NAME));
-            Query q = generator.selectQuery(em);
-            LibraryApendPath libraryApendPath = (LibraryApendPath) q.getSingleResult();
-            LibraryApendPathResource resource =
-                    (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, libraryApendPath);
-            em.getTransaction().commit();
-            em.close();
-            return resource;
-        } 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> libApPathList = new ArrayList<Resource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_APEND_PATH);
-            List results;
-            if (fieldName.equals(LibraryApendPathConstants.DEPLOYMENT_ID)) {
-                generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        LibraryApendPath prepandPath = (LibraryApendPath) result;
-                        LibraryApendPathResource resource =
-                                (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, prepandPath);
-                        libApPathList.add(resource);
-                    }
-                }
-            } else if (fieldName.equals(LibraryApendPathConstants.NAME)) {
-                generator.setParameter(LibraryApendPathConstants.NAME, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        LibraryApendPath prepandPath = (LibraryApendPath) result;
-                        LibraryApendPathResource resource =
-                                (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, prepandPath);
-                        libApPathList.add(resource);
-                    }
-                }
-            }else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for libraryApendPath resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for libraryApendPath 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 libApPathList;
-    }
-
-    @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 {
-        logger.error("Unsupported for objects with a composite identifier");
-        throw new AppCatalogException("Unsupported for objects with a composite identifier");
-    }
-
-    @Override
-    public void save() throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            LibraryApendPath existigApendPath = em.find(LibraryApendPath.class, new LibraryApendPath_PK(deploymentId, name));
-            em.close();
-
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-
-            ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
-            if (existigApendPath !=  null){
-                existigApendPath.setValue(value);
-                existigApendPath.setApplicationDeployment(deployment);
-                em.merge(existigApendPath);
-            }else {
-                LibraryApendPath apendPath = new LibraryApendPath();
-                apendPath.setDeploymentID(deploymentId);
-                apendPath.setName(name);
-                apendPath.setValue(value);
-                apendPath.setApplicationDeployment(deployment);
-                em.persist(apendPath);
-            }
-            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)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();
-            LibraryApendPath apendPath = em.find(LibraryApendPath.class,
-                    new LibraryApendPath_PK(ids.get(LibraryApendPathConstants.DEPLOYMENT_ID),
-                            ids.get(LibraryApendPathConstants.NAME)));
-            em.close();
-            return apendPath != 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();
-            }
-        }
-    }
-}
\ No newline at end of file

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/LibraryPrepandPathResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryPrepandPathResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryPrepandPathResource.java
deleted file mode 100644
index e4a9b33..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryPrepandPathResource.java
+++ /dev/null
@@ -1,291 +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.LibraryPrepandPath;
-import org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath_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 LibraryPrepandPathResource extends AbstractResource {
-    private final static Logger logger = LoggerFactory.getLogger(LibraryPrepandPathResource.class);
-    private String deploymentId;
-    private String name;
-    private String value;
-    private AppDeploymentResource appDeploymentResource;
-
-    public String getDeploymentId() {
-        return deploymentId;
-    }
-
-    public void setDeploymentId(String deploymentId) {
-        this.deploymentId = deploymentId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-
-    public AppDeploymentResource getAppDeploymentResource() {
-        return appDeploymentResource;
-    }
-
-    public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
-        this.appDeploymentResource = appDeploymentResource;
-    }
-
-    @Override
-    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(LIBRARY_PREPAND_PATH);
-            generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID));
-            if (ids.get(LibraryPrepandPathConstants.NAME) != null){
-                generator.setParameter(LibraryPrepandPathConstants.NAME, ids.get(LibraryPrepandPathConstants.NAME));
-            }
-            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)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(LIBRARY_PREPAND_PATH);
-            generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID));
-            generator.setParameter(LibraryPrepandPathConstants.NAME, ids.get(LibraryPrepandPathConstants.NAME));
-            Query q = generator.selectQuery(em);
-            LibraryPrepandPath libraryPrepandPath = (LibraryPrepandPath) q.getSingleResult();
-            LibraryPrepandPathResource resource =
-                    (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, libraryPrepandPath);
-            em.getTransaction().commit();
-            em.close();
-            return resource;
-        } 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> libPrepPathList = new ArrayList<Resource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_PREPAND_PATH);
-            List results;
-            if (fieldName.equals(LibraryPrepandPathConstants.DEPLOYMENT_ID)) {
-                generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        LibraryPrepandPath prepandPath = (LibraryPrepandPath) result;
-                        LibraryPrepandPathResource resource =
-                                (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, prepandPath);
-                        libPrepPathList.add(resource);
-                    }
-                }
-            } else if (fieldName.equals(LibraryPrepandPathConstants.NAME)) {
-                generator.setParameter(LibraryPrepandPathConstants.NAME, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        LibraryPrepandPath prepandPath = (LibraryPrepandPath) result;
-                        LibraryPrepandPathResource resource =
-                                (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, prepandPath);
-                        libPrepPathList.add(resource);
-                    }
-                }
-            }else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for libraryPrepandPath resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for libraryPrepandPath 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 libPrepPathList;
-    }
-
-    @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 {
-        logger.error("Unsupported for objects with a composite identifier");
-        throw new AppCatalogException("Unsupported for objects with a composite identifier");
-    }
-
-    @Override
-    public void save() throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            LibraryPrepandPath existigPrepPath = em.find(LibraryPrepandPath.class, new LibraryPrepandPath_PK(deploymentId, name));
-            em.close();
-
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
-            if (existigPrepPath !=  null){
-                existigPrepPath.setValue(value);
-                existigPrepPath.setApplicationDeployment(deployment);
-                em.merge(existigPrepPath);
-            }else {
-                LibraryPrepandPath prepandPath = new LibraryPrepandPath();
-                prepandPath.setDeploymentID(deploymentId);
-                prepandPath.setName(name);
-                prepandPath.setValue(value);
-                prepandPath.setApplicationDeployment(deployment);
-                em.persist(prepandPath);
-            }
-            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)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();
-            LibraryPrepandPath prepandPath = em.find(LibraryPrepandPath.class,
-                                                          new LibraryPrepandPath_PK(ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID),
-                                                                                    ids.get(LibraryPrepandPathConstants.NAME)));
-            em.close();
-            return prepandPath != 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();
-            }
-        }
-    }
-}


Mime
View raw message