You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2014/06/27 21:25:09 UTC

git commit: adding app deployement related resource classes - AIRAVATA-1302

Repository: airavata
Updated Branches:
  refs/heads/master 91e2c0a61 -> 407c9bac8


adding app deployement related resource classes - AIRAVATA-1302


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

Branch: refs/heads/master
Commit: 407c9bac813bb83e22c0f4bb3a7659daa781db2a
Parents: 91e2c0a
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Fri Jun 27 15:25:02 2014 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Fri Jun 27 15:25:02 2014 -0400

----------------------------------------------------------------------
 .../data/model/ApplicationDeployment.java       |  33 +-
 .../data/resources/AbstractResource.java        |  64 ++++
 .../data/resources/AppDeploymentResource.java   | 342 +++++++++++++++++++
 .../data/resources/AppModuleResource.java       | 274 +++++++++++++++
 .../data/resources/ComputeHostResource.java     |  12 +-
 .../data/resources/HostAliasResource.java       |   8 -
 .../resources/LibraryApendPathResource.java     | 280 +++++++++++++++
 .../resources/LibraryPrepandPathResource.java   | 280 +++++++++++++++
 .../catalog/data/util/AppCatalogJPAUtils.java   | 110 +++++-
 .../src/main/resources/appcatalog-derby.sql     |   1 -
 10 files changed, 1362 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/407c9bac/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationDeployment.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationDeployment.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationDeployment.java
index ad7bf7c..f202ba5 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationDeployment.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationDeployment.java
@@ -37,10 +37,6 @@ public class ApplicationDeployment {
     private String executablePath;
     @Column(name = "APPLICATION_DESC")
     private String applicationDesc;
-    @Column(name = "APPLICATION_VERSION")
-    private String applicationVersion;
-    @Column(name = "MODULE_LOAD_STRING")
-    private String moduleLoadString;
     @Column(name = "ENV_MODULE_LOAD_CMD")
     private String envModuleLoaString;
 
@@ -48,6 +44,11 @@ public class ApplicationDeployment {
     @JoinColumn(name = "APP_MODULE_ID")
     private ApplicationModule applicationModule;
 
+    @ManyToOne(cascade= CascadeType.MERGE)
+    @JoinColumn(name = "COMPUTE_HOSTID")
+    private ComputeResource computeResource;
+
+
     public String getDeployementID() {
         return deployementID;
     }
@@ -88,22 +89,6 @@ public class ApplicationDeployment {
         this.applicationDesc = applicationDesc;
     }
 
-    public String getApplicationVersion() {
-        return applicationVersion;
-    }
-
-    public void setApplicationVersion(String applicationVersion) {
-        this.applicationVersion = applicationVersion;
-    }
-
-    public String getModuleLoadString() {
-        return moduleLoadString;
-    }
-
-    public void setModuleLoadString(String moduleLoadString) {
-        this.moduleLoadString = moduleLoadString;
-    }
-
     public String getEnvModuleLoaString() {
         return envModuleLoaString;
     }
@@ -119,4 +104,12 @@ public class ApplicationDeployment {
     public void setApplicationModule(ApplicationModule applicationModule) {
         this.applicationModule = applicationModule;
     }
+
+    public ComputeResource getComputeResource() {
+        return computeResource;
+    }
+
+    public void setComputeResource(ComputeResource computeResource) {
+        this.computeResource = computeResource;
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/407c9bac/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
index 4677381..19e02d8 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
@@ -146,5 +146,69 @@ public abstract class AbstractResource implements Resource{
         public static final String MODULE_DESC = "moduleDesc";
     }
 
+    public final class ApplicationDeploymentConstants {
+        public static final String APP_MODULE_ID = "appModuleID";
+        public static final String DEPLOYMENT_ID = "deployementID";
+        public static final String COMPUTE_HOST_ID = "hostID";
+        public static final String EXECUTABLE_PATH = "executablePath";
+        public static final String APPLICATION_DESC = "applicationDesc";
+        public static final String ENV_MODULE_LOAD_CMD = "envModuleLoaString";
+    }
+
+    public final class LibraryPrepandPathConstants {
+        public static final String DEPLOYMENT_ID = "deployementID";
+        public static final String NAME = "name";
+        public static final String VALUE = "value";
+    }
+
+    public final class LibraryApendPathConstants {
+        public static final String DEPLOYMENT_ID = "deployementID";
+        public static final String NAME = "name";
+        public static final String VALUE = "value";
+    }
+
+    public final class AppEnvironmentConstants {
+        public static final String DEPLOYMENT_ID = "deployementID";
+        public static final String NAME = "name";
+        public static final String VALUE = "value";
+    }
+
+    public final class ApplicationInterfaceConstants {
+        public static final String INTERFACE_ID = "interfaceID";
+        public static final String APPLICATION_NAME = "appName";
+    }
+
+    public final class AppModuleMappingConstants {
+        public static final String INTERFACE_ID = "interfaceID";
+        public static final String MODULE_ID = "moduleID";
+    }
+
+    public final class AppInputConstants {
+        public static final String INTERFACE_ID = "interfaceID";
+        public static final String INPUT_KEY = "inputKey";
+        public static final String INPUT_VALUE = "inputVal";
+        public static final String DATA_TYPE = "dataType";
+        public static final String METADATA = "metadata";
+        public static final String APP_PARAMETER = "appParameter";
+        public static final String APP_UI_DESCRIPTION = "appUIDesc";
+    }
+
+    public final class AppOutputConstants {
+        public static final String INTERFACE_ID = "interfaceID";
+        public static final String OUTPUT_KEY = "outputKey";
+        public static final String OUTPUT_VALUE = "outputVal";
+        public static final String DATA_TYPE = "dataType";
+        public static final String METADATA = "metadata";
+    }
+
+    public final class GatewayProfileConstants {
+        public static final String GATEWAY_ID = "gatewayID";
+        public static final String GATEWAY_NAME = "gatewayName";
+        public static final String GATEWAY_DESC = "gatewayDesc";
+        public static final String PREFERED_RESOURCE = "preferedResource";
+    }
+
+
+
 
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/407c9bac/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppDeploymentResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppDeploymentResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppDeploymentResource.java
new file mode 100644
index 0000000..2e404e6
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppDeploymentResource.java
@@ -0,0 +1,342 @@
+/*
+ *
+ * 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.ApplicationModule;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AppDeploymentResource extends AbstractResource {
+    private final static Logger logger = LoggerFactory.getLogger(AppDeploymentResource.class);
+    private String deploymentId;
+    private String appModuleId;
+    private String hostId;
+    private String executablePath;
+    private String appDes;
+    private String envModuleLoadCMD;
+    private ComputeHostResource hostResource;
+    private AppModuleResource moduleResource;
+
+    public String getDeploymentId() {
+        return deploymentId;
+    }
+
+    public void setDeploymentId(String deploymentId) {
+        this.deploymentId = deploymentId;
+    }
+
+    public String getAppModuleId() {
+        return appModuleId;
+    }
+
+    public void setAppModuleId(String appModuleId) {
+        this.appModuleId = appModuleId;
+    }
+
+    public String getHostId() {
+        return hostId;
+    }
+
+    public void setHostId(String hostId) {
+        this.hostId = hostId;
+    }
+
+    public String getExecutablePath() {
+        return executablePath;
+    }
+
+    public void setExecutablePath(String executablePath) {
+        this.executablePath = executablePath;
+    }
+
+    public String getAppDes() {
+        return appDes;
+    }
+
+    public void setAppDes(String appDes) {
+        this.appDes = appDes;
+    }
+
+    public String getEnvModuleLoadCMD() {
+        return envModuleLoadCMD;
+    }
+
+    public void setEnvModuleLoadCMD(String envModuleLoadCMD) {
+        this.envModuleLoadCMD = envModuleLoadCMD;
+    }
+
+    public ComputeHostResource getHostResource() {
+        return hostResource;
+    }
+
+    public void setHostResource(ComputeHostResource hostResource) {
+        this.hostResource = hostResource;
+    }
+
+    public AppModuleResource getModuleResource() {
+        return moduleResource;
+    }
+
+    public void setModuleResource(AppModuleResource moduleResource) {
+        this.moduleResource = moduleResource;
+    }
+
+    @Override
+    public void remove(Object identifier) throws AppCatalogException {
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+            generator.setParameter(ApplicationDeploymentConstants.DEPLOYMENT_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(APPLICATION_DEPLOYMENT);
+            generator.setParameter(ApplicationDeploymentConstants.DEPLOYMENT_ID, identifier);
+            Query q = generator.selectQuery(em);
+            ApplicationDeployment deployment = (ApplicationDeployment) q.getSingleResult();
+            AppDeploymentResource deploymentResource =
+                    (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
+            em.getTransaction().commit();
+            em.close();
+            return deploymentResource;
+        } 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> appDeployments = new ArrayList<Resource>();
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            Query q;
+            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+            List results;
+            if (fieldName.equals(ApplicationDeploymentConstants.APP_MODULE_ID)) {
+                generator.setParameter(ApplicationDeploymentConstants.APP_MODULE_ID, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        ApplicationDeployment deployment = (ApplicationDeployment) result;
+                        AppDeploymentResource deploymentResource =
+                                (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
+                        appDeployments.add(deploymentResource);
+                    }
+                }
+            } else if (fieldName.equals(ApplicationDeploymentConstants.COMPUTE_HOST_ID)) {
+                generator.setParameter(ApplicationDeploymentConstants.COMPUTE_HOST_ID, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        ApplicationDeployment deployment = (ApplicationDeployment) result;
+                        AppDeploymentResource deploymentResource =
+                                (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
+                        appDeployments.add(deploymentResource);
+                    }
+                }
+            }else {
+                em.getTransaction().commit();
+                em.close();
+                logger.error("Unsupported field name for app deployment resource.", new IllegalArgumentException());
+                throw new IllegalArgumentException("Unsupported field name for app deployment 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 appDeployments;
+    }
+
+    @Override
+    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+        List<String> appDeployments = new ArrayList<String>();
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            Query q;
+            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+            List results;
+            if (fieldName.equals(ApplicationDeploymentConstants.APP_MODULE_ID)) {
+                generator.setParameter(ApplicationDeploymentConstants.APP_MODULE_ID, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        ApplicationDeployment deployment = (ApplicationDeployment) result;
+                        appDeployments.add(deployment.getDeployementID());
+                    }
+                }
+            } else if (fieldName.equals(ApplicationDeploymentConstants.COMPUTE_HOST_ID)) {
+                generator.setParameter(ApplicationDeploymentConstants.COMPUTE_HOST_ID, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        ApplicationDeployment deployment = (ApplicationDeployment) result;
+                        appDeployments.add(deployment.getDeployementID());
+                    }
+                }
+            }else {
+                em.getTransaction().commit();
+                em.close();
+                logger.error("Unsupported field name for app deployment resource.", new IllegalArgumentException());
+                throw new IllegalArgumentException("Unsupported field name for app deployment 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 appDeployments;
+    }
+
+    @Override
+    public void save() throws AppCatalogException {
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            ApplicationDeployment existingDeployment = em.find(ApplicationDeployment.class, deploymentId);
+            em.close();
+
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            ApplicationModule applicationModule = em.find(ApplicationModule.class, appModuleId);
+            ComputeResource computeHost = em.find(ComputeResource.class, hostId);
+            if (existingDeployment !=  null){
+                existingDeployment.setApplicationDesc(appDes);
+                existingDeployment.setAppModuleID(appModuleId);
+                existingDeployment.setApplicationModule(applicationModule);
+                existingDeployment.setComputeResource(computeHost);
+                existingDeployment.setExecutablePath(executablePath);
+                existingDeployment.setEnvModuleLoaString(envModuleLoadCMD);
+                em.merge(existingDeployment);
+            }else {
+                ApplicationDeployment deployment  = new ApplicationDeployment();
+                deployment.setApplicationDesc(appDes);
+                deployment.setAppModuleID(appModuleId);
+                deployment.setApplicationModule(applicationModule);
+                deployment.setComputeResource(computeHost);
+                deployment.setExecutablePath(executablePath);
+                deployment.setEnvModuleLoaString(envModuleLoadCMD);
+                em.persist(deployment);
+            }
+            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();
+            ApplicationDeployment deployment = em.find(ApplicationDeployment.class, identifier);
+            em.close();
+            return deployment != 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();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/407c9bac/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleResource.java
new file mode 100644
index 0000000..32e060a
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleResource.java
@@ -0,0 +1,274 @@
+/*
+ *
+ * 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.ApplicationModule;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AppModuleResource extends AbstractResource {
+    private final static Logger logger = LoggerFactory.getLogger(AppModuleResource.class);
+    private String moduleId;
+    private String moduleName;
+    private String moduleVersion;
+    private String moduleDesc;
+
+    public String getModuleId() {
+        return moduleId;
+    }
+
+    public void setModuleId(String moduleId) {
+        this.moduleId = moduleId;
+    }
+
+    public String getModuleName() {
+        return moduleName;
+    }
+
+    public void setModuleName(String moduleName) {
+        this.moduleName = moduleName;
+    }
+
+    public String getModuleVersion() {
+        return moduleVersion;
+    }
+
+    public void setModuleVersion(String moduleVersion) {
+        this.moduleVersion = moduleVersion;
+    }
+
+    public String getModuleDesc() {
+        return moduleDesc;
+    }
+
+    public void setModuleDesc(String moduleDesc) {
+        this.moduleDesc = moduleDesc;
+    }
+
+    @Override
+    public void remove(Object identifier) throws AppCatalogException {
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_MODULE);
+            generator.setParameter(ApplicationModuleConstants.MODULE_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(APPLICATION_MODULE);
+            generator.setParameter(ApplicationModuleConstants.MODULE_ID, identifier);
+            Query q = generator.selectQuery(em);
+            ApplicationModule applicationModule = (ApplicationModule) q.getSingleResult();
+            AppModuleResource appModuleResource =
+                    (AppModuleResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, applicationModule);
+            em.getTransaction().commit();
+            em.close();
+            return appModuleResource;
+        } 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> moduleResources = new ArrayList<Resource>();
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            Query q;
+            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
+            List results;
+            if (fieldName.equals(ApplicationModuleConstants.MODULE_NAME)) {
+                generator.setParameter(ApplicationModuleConstants.MODULE_NAME, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        ApplicationModule applicationModule = (ApplicationModule) result;
+                        AppModuleResource moduleResource =
+                                (AppModuleResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, applicationModule);
+                        moduleResources.add(moduleResource);
+                    }
+                }
+            } else {
+                em.getTransaction().commit();
+                em.close();
+                logger.error("Unsupported field name for app module resource.", new IllegalArgumentException());
+                throw new IllegalArgumentException("Unsupported field name for app module 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 moduleResources;
+    }
+
+    @Override
+    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+        List<String> moduleResources = new ArrayList<String>();
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            Query q;
+            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
+            List results;
+            if (fieldName.equals(ApplicationModuleConstants.MODULE_NAME)) {
+                generator.setParameter(ApplicationModuleConstants.MODULE_NAME, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        ApplicationModule applicationModule = (ApplicationModule) result;
+                        moduleResources.add(applicationModule.getModuleID());
+                    }
+                }
+            } else {
+                em.getTransaction().commit();
+                em.close();
+                logger.error("Unsupported field name for app module resource.", new IllegalArgumentException());
+                throw new IllegalArgumentException("Unsupported field name for app module 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 moduleResources;
+    }
+
+    @Override
+    public void save() throws AppCatalogException {
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            ApplicationModule existingModule = em.find(ApplicationModule.class, moduleId);
+            em.close();
+
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            if (existingModule !=  null){
+                existingModule.setModuleName(moduleName);
+                existingModule.setModuleVersion(moduleVersion);
+                existingModule.setModuleDesc(moduleDesc);
+                em.merge(existingModule);
+            }else {
+                ApplicationModule applicationModule = new ApplicationModule();
+                applicationModule.setModuleID(moduleId);
+                applicationModule.setModuleName(moduleName);
+                applicationModule.setModuleVersion(moduleVersion);
+                applicationModule.setModuleDesc(moduleDesc);
+                em.persist(applicationModule);
+            }
+            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();
+            ApplicationModule applicationModule = em.find(ApplicationModule.class, identifier);
+            em.close();
+            return applicationModule != 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();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/407c9bac/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeHostResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeHostResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeHostResource.java
index 9b915dd..14dc2e1 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeHostResource.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeHostResource.java
@@ -118,11 +118,11 @@ public class ComputeHostResource extends AbstractResource {
             generator.setParameter(ComputeResourceConstants.RESOURCE_ID, identifier);
             Query q = generator.selectQuery(em);
             ComputeResource computeResource = (ComputeResource) q.getSingleResult();
-            ComputeHostResource workerResource =
+            ComputeHostResource computeHostResource =
                     (ComputeHostResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
             em.getTransaction().commit();
             em.close();
-            return workerResource;
+            return computeHostResource;
         } catch (ApplicationSettingsException e) {
             logger.error(e.getMessage(), e);
             throw new AppCatalogException(e);
@@ -153,9 +153,9 @@ public class ComputeHostResource extends AbstractResource {
                 if (results.size() != 0) {
                     for (Object result : results) {
                         ComputeResource computeResource = (ComputeResource) result;
-                        ComputeHostResource projectResource =
+                        ComputeHostResource computeHostResource =
                                 (ComputeHostResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
-                        computeHostResources.add(projectResource);
+                        computeHostResources.add(computeHostResource);
                     }
                 }
             } else if (fieldName.equals(ComputeResourceConstants.PREFERED_SUBMISSION_PROTOCOL)) {
@@ -289,9 +289,9 @@ public class ComputeHostResource extends AbstractResource {
         EntityManager em = null;
         try {
             em = AppCatalogJPAUtils.getEntityManager();
-            ComputeHostResource computeHostResource = em.find(ComputeHostResource.class, identifier);
+            ComputeResource computeResource = em.find(ComputeResource.class, identifier);
             em.close();
-            return computeHostResource != null;
+            return computeResource != null;
         } catch (ApplicationSettingsException e) {
             logger.error(e.getMessage(), e);
             throw new AppCatalogException(e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/407c9bac/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostAliasResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostAliasResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostAliasResource.java
index 37ddcc6..083c6b1 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostAliasResource.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostAliasResource.java
@@ -7,7 +7,6 @@ import org.apache.aiaravata.application.catalog.data.model.HostAliasPK;
 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;
 
@@ -17,15 +16,11 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class HostAliasResource extends AbstractResource {
-
     private final static Logger logger = LoggerFactory.getLogger(HostAliasResource.class);
-
     private String resourceID;
     private String alias;
     private ComputeHostResource computeHostResource;
 
-
-
     public void remove(Object identifier) throws AppCatalogException {
 
     }
@@ -35,7 +30,6 @@ public class HostAliasResource extends AbstractResource {
     }
 
     public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
-
         List<Resource> hostAliasResources = new ArrayList<Resource>();
         EntityManager em = null;
         try {
@@ -156,7 +150,6 @@ public class HostAliasResource extends AbstractResource {
                 ComputeResource computeResource = em.find(ComputeResource.class, computeHostResource.getResoureId());
                 existingHostAlias.setComputeResource(computeResource);
                 existingHostAlias.setResourceID(resourceID);
-
                 em.merge(existingHostAlias);
             }else {
                 HostAlias hostAlias = new HostAlias();
@@ -164,7 +157,6 @@ public class HostAliasResource extends AbstractResource {
                 hostAlias.setResourceID(resourceID);
                 ComputeResource computeResource = em.find(ComputeResource.class, computeHostResource.getResoureId());
                 hostAlias.setComputeResource(computeResource);
-
                 em.persist(computeResource);
             }
             em.getTransaction().commit();

http://git-wip-us.apache.org/repos/asf/airavata/blob/407c9bac/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
new file mode 100644
index 0000000..7100c8f
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryApendPathResource.java
@@ -0,0 +1,280 @@
+/*
+ *
+ * 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));
+            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();
+            LibraryPrepandPathResource resource =
+                    (LibraryPrepandPathResource) 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<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 prepandPath = new LibraryApendPath();
+                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();
+            LibraryApendPath apendPath = em.find(LibraryApendPath.class,
+                    new LibraryApendPath_PK(ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID),
+                            ids.get(LibraryPrepandPathConstants.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/407c9bac/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
new file mode 100644
index 0000000..6fca4a3
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryPrepandPathResource.java
@@ -0,0 +1,280 @@
+/*
+ *
+ * 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));
+            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<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();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/407c9bac/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
index 6b763e5..3f427f2 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
@@ -21,8 +21,8 @@
 
 package org.apache.aiaravata.application.catalog.data.util;
 
-import org.apache.aiaravata.application.catalog.data.resources.ComputeHostResource;
-import org.apache.aiaravata.application.catalog.data.resources.Resource;
+import org.apache.aiaravata.application.catalog.data.model.*;
+import org.apache.aiaravata.application.catalog.data.resources.*;
 import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.slf4j.Logger;
@@ -87,25 +87,121 @@ public class AppCatalogJPAUtils {
     public static Resource getResource(AppCatalogResourceType type, Object o) {
         switch (type){
             case COMPUTE_RESOURCE:
-                if (o instanceof ComputeHostResource){
-                    return createComputeResource((ComputeHostResource)o);
+                if (o instanceof ComputeResource){
+                    return createComputeResource((ComputeResource) o);
                 }else {
                     logger.error("Object should be a Compute Resource.", new IllegalArgumentException());
                     throw new IllegalArgumentException("Object should be a Compute Resource.");
                 }
+            case HOST_ALIAS:
+                if (o instanceof HostAlias){
+                    return createHostAlias((HostAlias) o);
+                }else {
+                    logger.error("Object should be a Host Alias.", new IllegalArgumentException());
+                    throw new IllegalArgumentException("Object should be a Host Alias.");
+                }
+            case HOST_IPADDRESS:
+                if (o instanceof HostIPAddress){
+                    return createHostIPAddress((HostIPAddress) o);
+                }else {
+                    logger.error("Object should be a Host IPAdress.", new IllegalArgumentException());
+                    throw new IllegalArgumentException("Object should be a Host IPAdress.");
+                }
+            case APPLICATION_MODULE:
+                if (o instanceof ApplicationModule){
+                    return createApplicationModule((ApplicationModule) o);
+                }else {
+                    logger.error("Object should be a Application Module.", new IllegalArgumentException());
+                    throw new IllegalArgumentException("Object should be a Application Module.");
+                }
+            case APPLICATION_DEPLOYMENT:
+                if (o instanceof ApplicationDeployment){
+                    return createApplicationDeployment((ApplicationDeployment) o);
+                }else {
+                    logger.error("Object should be a Application Deployment.", new IllegalArgumentException());
+                    throw new IllegalArgumentException("Object should be a Application Deployment.");
+                }
+            case LIBRARY_PREPAND_PATH:
+                if (o instanceof LibraryPrepandPath){
+                    return createLibraryPrepPathResource((LibraryPrepandPath) o);
+                }else {
+                    logger.error("Object should be a Library Prepand path.", new IllegalArgumentException());
+                    throw new IllegalArgumentException("Object should be a Library Prepand path.");
+                }
+            case LIBRARY_APEND_PATH:
+                if (o instanceof LibraryApendPath){
+                    return createLibraryApendPathResource((LibraryApendPath) o);
+                }else {
+                    logger.error("Object should be a Library Apend path.", new IllegalArgumentException());
+                    throw new IllegalArgumentException("Object should be a Library Apend.");
+                }
             default:
                 logger.error("Illegal data type..", new IllegalArgumentException());
                 throw new IllegalArgumentException("Illegal data type..");
         }
     }
 
-    private static Resource createComputeResource(ComputeHostResource o) {
+    private static Resource createComputeResource(ComputeResource o) {
         ComputeHostResource hostResource = new ComputeHostResource();
-        hostResource.setResoureId(o.getResoureId());
+        hostResource.setResoureId(o.getResourceID());
         hostResource.setHostName(o.getHostName());
         hostResource.setDescription(o.getDescription());
         hostResource.setScratchLocation(o.getScratchLocation());
-        hostResource.setPreferredJobSubmissionProtocol(o.getPreferredJobSubmissionProtocol());
+        hostResource.setPreferredJobSubmissionProtocol(o.getPreferredJobSubProtocol());
         return hostResource;
     }
+
+    private static Resource createHostAlias(HostAlias o) {
+        HostAliasResource aliasResource = new HostAliasResource();
+        aliasResource.setResourceID(o.getResourceID());
+        aliasResource.setAlias(o.getAlias());
+        return aliasResource;
+    }
+
+    private static Resource createHostIPAddress(HostIPAddress o) {
+        HostAliasResource aliasResource = new HostAliasResource();
+        aliasResource.setResourceID(o.getResourceID());
+        aliasResource.setAlias(o.getIpaddress());
+        return aliasResource;
+    }
+
+    private static Resource createApplicationModule(ApplicationModule o) {
+        AppModuleResource moduleResource = new AppModuleResource();
+        moduleResource.setModuleId(o.getModuleID());
+        moduleResource.setModuleDesc(o.getModuleDesc());
+        moduleResource.setModuleName(o.getModuleName());
+        moduleResource.setModuleVersion(o.getModuleVersion());
+        return moduleResource;
+    }
+
+    private static Resource createApplicationDeployment(ApplicationDeployment o) {
+        AppDeploymentResource resource = new AppDeploymentResource();
+        resource.setDeploymentId(o.getDeployementID());
+        resource.setAppDes(o.getApplicationDesc());
+        resource.setAppModuleId(o.getAppModuleID());
+        resource.setEnvModuleLoadCMD(o.getEnvModuleLoaString());
+        resource.setHostId(o.getHostID());
+        resource.setExecutablePath(o.getExecutablePath());
+        resource.setModuleResource((AppModuleResource)createApplicationModule(o.getApplicationModule()));
+        resource.setHostResource((ComputeHostResource)createComputeResource(o.getComputeResource()));
+        return resource;
+    }
+
+    private static Resource createLibraryPrepPathResource(LibraryPrepandPath o) {
+        LibraryPrepandPathResource resource = new LibraryPrepandPathResource();
+        resource.setDeploymentId(o.getDeploymentID());
+        resource.setName(o.getName());
+        resource.setValue(o.getValue());
+        resource.setAppDeploymentResource((AppDeploymentResource)createApplicationDeployment(o.getApplicationDeployment()));
+        return resource;
+    }
+
+    private static Resource createLibraryApendPathResource(LibraryApendPath o) {
+        LibraryApendPathResource resource = new LibraryApendPathResource();
+        resource.setDeploymentId(o.getDeploymentID());
+        resource.setName(o.getName());
+        resource.setValue(o.getValue());
+        resource.setAppDeploymentResource((AppDeploymentResource)createApplicationDeployment(o.getApplicationDeployment()));
+        return resource;
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/407c9bac/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
index 6895ade..2ad6f14 100644
--- a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
+++ b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
@@ -157,7 +157,6 @@ CREATE TABLE APPLICATION_DEPLOYMENT
          EXECUTABLE_PATH VARCHAR(255),
          APPLICATION_DESC VARCHAR(255),
          ENV_MODULE_LOAD_CMD VARCHAR(255),
-         MODULE_LOAD_STRING VARCHAR(255),
          PRIMARY KEY(DEPLOYMENT_ID),
          FOREIGN KEY (COMPUTE_HOSTID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
          FOREIGN KEY (APP_MODULE_ID) REFERENCES APPLICATION_MODULE(MODULE_ID) ON DELETE CASCADE