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/07/07 19:57:20 UTC
git commit: adding module load cmd table
Repository: airavata
Updated Branches:
refs/heads/master a509e5a43 -> fa44d6277
adding module load cmd table
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/fa44d627
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/fa44d627
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/fa44d627
Branch: refs/heads/master
Commit: fa44d6277f4cc1b0261420cd01e40370bcd2bd65
Parents: a509e5a
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Mon Jul 7 13:57:16 2014 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Mon Jul 7 13:57:16 2014 -0400
----------------------------------------------------------------------
.../data/model/ApplicationDeployment.java | 10 -
.../catalog/data/model/ModuleLoadCmd.java | 70 +++++
.../catalog/data/model/ModuleLoadCmd_PK.java | 63 ++++
.../data/resources/AbstractResource.java | 7 +
.../data/resources/AppDeploymentResource.java | 11 -
.../data/resources/ModuleLoadCmdResource.java | 288 +++++++++++++++++++
.../catalog/data/util/AppCatalogJPAUtils.java | 87 ++----
.../data/util/AppCatalogResourceType.java | 3 +-
.../data/util/AppCatalogThriftConversion.java | 42 +--
.../src/main/resources/META-INF/persistence.xml | 1 +
.../src/main/resources/appcatalog-derby.sql | 9 +-
.../src/test/resources/appcatalog-derby.sql | 9 +-
.../computeresource/ModuleCMDGenerator.java | 82 ++++++
modules/registry/pom.xml | 1 +
14 files changed, 555 insertions(+), 128 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/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 fe4d73d..24fda20 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
@@ -38,8 +38,6 @@ public class ApplicationDeployment implements Serializable {
private String executablePath;
@Column(name = "APPLICATION_DESC")
private String applicationDesc;
- @Column(name = "ENV_MODULE_LOAD_CMD")
- private String envModuleLoaString;
@Column(name = "PARALLELISM")
private String parallelism;
@@ -92,14 +90,6 @@ public class ApplicationDeployment implements Serializable {
this.applicationDesc = applicationDesc;
}
- public String getEnvModuleLoaString() {
- return envModuleLoaString;
- }
-
- public void setEnvModuleLoaString(String envModuleLoaString) {
- this.envModuleLoaString = envModuleLoaString;
- }
-
public ApplicationModule getApplicationModule() {
return applicationModule;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd.java
new file mode 100644
index 0000000..7204390
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd.java
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name = "MODULE_LOAD_CMD")
+@IdClass(ModuleLoadCmd_PK.class)
+public class ModuleLoadCmd implements Serializable {
+
+ @Id
+ @Column(name = "CMD")
+ private String cmd;
+
+ @Id
+ @Column(name = "APP_DEPLOYMENT_ID")
+ private String appDeploymentId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "APP_DEPLOYMENT_ID")
+ private ApplicationDeployment applicationDeployment;
+
+ public String getCmd() {
+ return cmd;
+ }
+
+ public String getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public ApplicationDeployment getApplicationDeployment() {
+ return applicationDeployment;
+ }
+
+ public void setCmd(String cmd) {
+ this.cmd=cmd;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId=appDeploymentId;
+ }
+
+ public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
+ this.applicationDeployment=applicationDeployment;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd_PK.java
new file mode 100644
index 0000000..cb38153
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd_PK.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * 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.model;
+
+import java.io.Serializable;
+
+public class ModuleLoadCmd_PK implements Serializable {
+ private String cmd;
+ private String appDeploymentId;
+
+ public ModuleLoadCmd_PK(){
+ }
+
+ public ModuleLoadCmd_PK(String cmd, String appDeploymentId){
+ this.cmd = cmd;
+ this.appDeploymentId = appDeploymentId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getCmd() {
+ return cmd;
+ }
+
+ public String getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public void setCmd(String cmd) {
+ this.cmd=cmd;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId=appDeploymentId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/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 90f1788..5cecd6d 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
@@ -58,6 +58,7 @@ public abstract class AbstractResource implements Resource {
public static final String LOCAL_SUBMISSION = "LocalSubmission";
public static final String LOCAL_DATA_MOVEMENT = "LocalDataMovement";
public static final String SSH_JOB_SUBMISSION = "SshJobSubmission";
+ public static final String MODULE_LOAD_CMD = "ModuleLoadCmd";
// Compute Resource Table
public final class ComputeResourceConstants {
@@ -317,4 +318,10 @@ public abstract class AbstractResource implements Resource {
public static final String SECURITY_PROTOCOL = "securityProtocol";
public static final String SSH_PORT = "sshPort";
}
+
+ // Module Load Cmd Table
+ public final class ModuleLoadCmdConstants {
+ public static final String CMD = "cmd";
+ public static final String APP_DEPLOYMENT_ID = "appDeploymentId";
+ }
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/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
index da4bf2d..db75acf 100644
--- 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
@@ -45,7 +45,6 @@ public class AppDeploymentResource extends AbstractResource {
private String executablePath;
private String parallelism;
private String appDes;
- private String envModuleLoadCMD;
private ComputeResourceResource hostResource;
private AppModuleResource moduleResource;
@@ -89,14 +88,6 @@ public class AppDeploymentResource extends AbstractResource {
this.appDes = appDes;
}
- public String getEnvModuleLoadCMD() {
- return envModuleLoadCMD;
- }
-
- public void setEnvModuleLoadCMD(String envModuleLoadCMD) {
- this.envModuleLoadCMD = envModuleLoadCMD;
- }
-
public ComputeResourceResource getHostResource() {
return hostResource;
}
@@ -294,7 +285,6 @@ public class AppDeploymentResource extends AbstractResource {
existingDeployment.setComputeResource(computeHost);
existingDeployment.setHostID(hostId);
existingDeployment.setExecutablePath(executablePath);
- existingDeployment.setEnvModuleLoaString(envModuleLoadCMD);
existingDeployment.setParallelism(parallelism);
em.merge(existingDeployment);
}else {
@@ -306,7 +296,6 @@ public class AppDeploymentResource extends AbstractResource {
deployment.setApplicationModule(applicationModule);
deployment.setComputeResource(computeHost);
deployment.setExecutablePath(executablePath);
- deployment.setEnvModuleLoaString(envModuleLoadCMD);
deployment.setParallelism(parallelism);
em.persist(deployment);
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java
new file mode 100644
index 0000000..d06699c
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java
@@ -0,0 +1,288 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
+import org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd;
+import org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ModuleLoadCmdResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ModuleLoadCmdResource.class);
+ private String cmd;
+ private String appDeploymentId;
+ private AppDeploymentResource appDeploymentResource;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) identifier;
+ } else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
+ generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
+ generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_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(MODULE_LOAD_CMD);
+ generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
+ generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID));
+ Query q = generator.selectQuery(em);
+ ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) q.getSingleResult();
+ ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
+ em.getTransaction().commit();
+ em.close();
+ return moduleLoadCmdResource;
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ @Override
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> moduleLoadCmdResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
+ Query q;
+ if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
+ ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
+ moduleLoadCmdResources.add(moduleLoadCmdResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Module Load Cmd Resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return moduleLoadCmdResources;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> moduleLoadCmdResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
+ Query q;
+ if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
+ ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
+ moduleLoadCmdResourceIDs.add(moduleLoadCmdResource.getAppDeploymentId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Module Load Cmd Resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return moduleLoadCmdResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ModuleLoadCmd existingModuleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(cmd, appDeploymentId));
+ em.close();
+ ModuleLoadCmd moduleLoadCmd;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingModuleLoadCmd == null) {
+ moduleLoadCmd = new ModuleLoadCmd();
+ } else {
+ moduleLoadCmd = existingModuleLoadCmd;
+ }
+ moduleLoadCmd.setCmd(getCmd());
+ moduleLoadCmd.setAppDeploymentId(getAppDeploymentId());
+ ApplicationDeployment applicationDeployment = em.find(ApplicationDeployment.class, getAppDeploymentId());
+ moduleLoadCmd.setApplicationDeployment(applicationDeployment);
+ if (existingModuleLoadCmd == null) {
+ em.persist(moduleLoadCmd);
+ } else {
+ em.merge(moduleLoadCmd);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ @Override
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) identifier;
+ } else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ModuleLoadCmd moduleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(ids.get(ModuleLoadCmdConstants.CMD), ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID)));
+ em.close();
+ return moduleLoadCmd != null;
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public String getCmd() {
+ return cmd;
+ }
+
+ public String getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public AppDeploymentResource getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setCmd(String cmd) {
+ this.cmd=cmd;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId=appDeploymentId;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
+ this.appDeploymentResource=appDeploymentResource;
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/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 d9e10f1..5038924 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
@@ -28,75 +28,8 @@ import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
-import org.apache.aiaravata.application.catalog.data.model.AppEnvironment;
-import org.apache.aiaravata.application.catalog.data.model.AppModuleMapping;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInput;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationModule;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationOutput;
-import org.apache.aiaravata.application.catalog.data.model.BatchQueue;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResourcePreference;
-import org.apache.aiaravata.application.catalog.data.model.DataMovementInterface;
-import org.apache.aiaravata.application.catalog.data.model.DataMovementProtocol;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHExport;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHPostJobCommand;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHPreJobCommand;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission;
-import org.apache.aiaravata.application.catalog.data.model.GatewayProfile;
-import org.apache.aiaravata.application.catalog.data.model.GlobusGKEndpoint;
-import org.apache.aiaravata.application.catalog.data.model.GlobusJobSubmission;
-import org.apache.aiaravata.application.catalog.data.model.GridftpDataMovement;
-import org.apache.aiaravata.application.catalog.data.model.GridftpEndpoint;
-import org.apache.aiaravata.application.catalog.data.model.HostAlias;
-import org.apache.aiaravata.application.catalog.data.model.HostIPAddress;
-import org.apache.aiaravata.application.catalog.data.model.JobManagerCommand;
-import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface;
-import org.apache.aiaravata.application.catalog.data.model.JobSubmissionProtocol;
-import org.apache.aiaravata.application.catalog.data.model.LibraryApendPath;
-import org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath;
-import org.apache.aiaravata.application.catalog.data.model.LocalDataMovement;
-import org.apache.aiaravata.application.catalog.data.model.LocalSubmission;
-import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
-import org.apache.aiaravata.application.catalog.data.model.SshJobSubmission;
-import org.apache.aiaravata.application.catalog.data.model.ScpDataMovement;
-import org.apache.aiaravata.application.catalog.data.resources.AppDeploymentResource;
-import org.apache.aiaravata.application.catalog.data.resources.AppEnvironmentResource;
-import org.apache.aiaravata.application.catalog.data.resources.AppInterfaceResource;
-import org.apache.aiaravata.application.catalog.data.resources.AppModuleMappingResource;
-import org.apache.aiaravata.application.catalog.data.resources.AppModuleResource;
-import org.apache.aiaravata.application.catalog.data.resources.ApplicationInputResource;
-import org.apache.aiaravata.application.catalog.data.resources.ApplicationOutputResource;
-import org.apache.aiaravata.application.catalog.data.resources.BatchQueueResource;
-import org.apache.aiaravata.application.catalog.data.resources.ComputeHostPreferenceResource;
-import org.apache.aiaravata.application.catalog.data.resources.ComputeResourceResource;
-import org.apache.aiaravata.application.catalog.data.resources.ComputeResourceFileSystemResource;
-import org.apache.aiaravata.application.catalog.data.resources.DataMovementInterfaceResource;
-import org.apache.aiaravata.application.catalog.data.resources.DataMovementProtocolResource;
-import org.apache.aiaravata.application.catalog.data.resources.GSISSHExportResource;
-import org.apache.aiaravata.application.catalog.data.resources.GSISSHPostJobCommandResource;
-import org.apache.aiaravata.application.catalog.data.resources.GSISSHPreJobCommandResource;
-import org.apache.aiaravata.application.catalog.data.resources.GSISSHSubmissionResource;
-import org.apache.aiaravata.application.catalog.data.resources.GatewayProfileResource;
-import org.apache.aiaravata.application.catalog.data.resources.GlobusGKEndpointResource;
-import org.apache.aiaravata.application.catalog.data.resources.GlobusJobSubmissionResource;
-import org.apache.aiaravata.application.catalog.data.resources.GridftpDataMovementResource;
-import org.apache.aiaravata.application.catalog.data.resources.GridftpEndpointResource;
-import org.apache.aiaravata.application.catalog.data.resources.HostAliasResource;
-import org.apache.aiaravata.application.catalog.data.resources.HostIPAddressResource;
-import org.apache.aiaravata.application.catalog.data.resources.JobManagerCommandResource;
-import org.apache.aiaravata.application.catalog.data.resources.JobSubmissionInterfaceResource;
-import org.apache.aiaravata.application.catalog.data.resources.JobSubmissionProtocolResource;
-import org.apache.aiaravata.application.catalog.data.resources.LibraryApendPathResource;
-import org.apache.aiaravata.application.catalog.data.resources.LibraryPrepandPathResource;
-import org.apache.aiaravata.application.catalog.data.resources.LocalDataMovementResource;
-import org.apache.aiaravata.application.catalog.data.resources.LocalSubmissionResource;
-import org.apache.aiaravata.application.catalog.data.resources.Resource;
-import org.apache.aiaravata.application.catalog.data.resources.ResourceJobManagerResource;
-import org.apache.aiaravata.application.catalog.data.resources.SshJobSubmissionResource;
-import org.apache.aiaravata.application.catalog.data.resources.ScpDataMovementResource;
+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;
@@ -391,6 +324,13 @@ public class AppCatalogJPAUtils {
logger.error("Object should be a Local Data Movement.", new IllegalArgumentException());
throw new IllegalArgumentException("Object should be a Local Data Movement.");
}
+ case MODULE_LOAD_CMD:
+ if (o instanceof ModuleLoadCmd){
+ return createModuleLoadCmd((ModuleLoadCmd) o);
+ }else{
+ logger.error("Object should be a Module Load Cmd.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Module Load Cmd.");
+ }
default:
logger.error("Illegal data type..", new IllegalArgumentException());
throw new IllegalArgumentException("Illegal data type..");
@@ -612,7 +552,6 @@ public class AppCatalogJPAUtils {
resource.setDeploymentId(o.getDeploymentID());
resource.setAppDes(o.getApplicationDesc());
resource.setAppModuleId(o.getAppModuleID());
- resource.setEnvModuleLoadCMD(o.getEnvModuleLoaString());
resource.setHostId(o.getHostID());
resource.setExecutablePath(o.getExecutablePath());
resource.setParallelism(o.getParallelism());
@@ -708,4 +647,12 @@ public class AppCatalogJPAUtils {
resource.setGatewayProfile((GatewayProfileResource)createGatewayProfile(o.getGatewayProfile()));
return resource;
}
+
+ private static Resource createModuleLoadCmd(ModuleLoadCmd o) {
+ ModuleLoadCmdResource moduleLoadCmdResource = new ModuleLoadCmdResource();
+ moduleLoadCmdResource.setCmd(o.getCmd());
+ moduleLoadCmdResource.setAppDeploymentId(o.getAppDeploymentId());
+ moduleLoadCmdResource.setAppDeploymentResource((AppDeploymentResource)createApplicationDeployment(o.getApplicationDeployment()));
+ return moduleLoadCmdResource;
+ }
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java
index fafb0da..6071e39 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java
@@ -55,5 +55,6 @@ public enum AppCatalogResourceType {
RESOURCE_JOB_MANAGER,
JOB_MANAGER_COMMAND,
LOCAL_SUBMISSION,
- LOCAL_DATA_MOVEMENT
+ LOCAL_DATA_MOVEMENT,
+ MODULE_LOAD_CMD
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
index 8dfbdac..8c81525 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
@@ -29,37 +29,7 @@ import java.util.Map;
import java.util.Set;
import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
-import org.apache.aiaravata.application.catalog.data.resources.AppDeploymentResource;
-import org.apache.aiaravata.application.catalog.data.resources.AppEnvironmentResource;
-import org.apache.aiaravata.application.catalog.data.resources.AppInterfaceResource;
-import org.apache.aiaravata.application.catalog.data.resources.AppModuleMappingResource;
-import org.apache.aiaravata.application.catalog.data.resources.AppModuleResource;
-import org.apache.aiaravata.application.catalog.data.resources.ApplicationInputResource;
-import org.apache.aiaravata.application.catalog.data.resources.ApplicationOutputResource;
-import org.apache.aiaravata.application.catalog.data.resources.BatchQueueResource;
-import org.apache.aiaravata.application.catalog.data.resources.ComputeHostPreferenceResource;
-import org.apache.aiaravata.application.catalog.data.resources.ComputeResourceFileSystemResource;
-import org.apache.aiaravata.application.catalog.data.resources.ComputeResourceResource;
-import org.apache.aiaravata.application.catalog.data.resources.DataMovementInterfaceResource;
-import org.apache.aiaravata.application.catalog.data.resources.DataMovementProtocolResource;
-import org.apache.aiaravata.application.catalog.data.resources.GatewayProfileResource;
-import org.apache.aiaravata.application.catalog.data.resources.GlobusGKEndpointResource;
-import org.apache.aiaravata.application.catalog.data.resources.GridftpDataMovementResource;
-import org.apache.aiaravata.application.catalog.data.resources.GridftpEndpointResource;
-import org.apache.aiaravata.application.catalog.data.resources.HostAliasResource;
-import org.apache.aiaravata.application.catalog.data.resources.HostIPAddressResource;
-import org.apache.aiaravata.application.catalog.data.resources.JobManagerCommandResource;
-import org.apache.aiaravata.application.catalog.data.resources.JobSubmissionInterfaceResource;
-import org.apache.aiaravata.application.catalog.data.resources.JobSubmissionProtocolResource;
-import org.apache.aiaravata.application.catalog.data.resources.LibraryApendPathResource;
-import org.apache.aiaravata.application.catalog.data.resources.LibraryPrepandPathResource;
-import org.apache.aiaravata.application.catalog.data.resources.LocalDataMovementResource;
-import org.apache.aiaravata.application.catalog.data.resources.LocalSubmissionResource;
-import org.apache.aiaravata.application.catalog.data.resources.Resource;
-import org.apache.aiaravata.application.catalog.data.resources.ResourceJobManagerResource;
-import org.apache.aiaravata.application.catalog.data.resources.ScpDataMovementResource;
-import org.apache.aiaravata.application.catalog.data.resources.SshJobSubmissionResource;
+import org.apache.aiaravata.application.catalog.data.resources.*;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
@@ -587,9 +557,13 @@ public class AppCatalogThriftConversion {
description.setParallelism(ApplicationParallelismType.valueOf(resource.getParallelism()));
}
description.setAppDeploymentDescription(resource.getAppDes());
- //TODO ModuleLoadCmds is a list now. need to create a table for this and the jpa layer
-// description.setModuleLoadCmds(resource.getEnvModuleLoadCMD());
-
+ ModuleLoadCmdResource cmdResource = new ModuleLoadCmdResource();
+ List<Resource> moduleLoadCmds = cmdResource.get(AbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, resource.getDeploymentId());
+ if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
+ for (Resource moduleLoadCmd : moduleLoadCmds){
+ description.addToModuleLoadCmds(((ModuleLoadCmdResource) moduleLoadCmd).getCmd());
+ }
+ }
LibraryPrepandPathResource prepandPathResource = new LibraryPrepandPathResource();
List<Resource> libPrepandPaths = prepandPathResource.get(AbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
if (libPrepandPaths != null && !libPrepandPaths.isEmpty()){
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml b/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml
index 3d6e299..64937a2 100644
--- a/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml
+++ b/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml
@@ -40,6 +40,7 @@
<class>org.apache.aiaravata.application.catalog.data.model.SshJobSubmission</class>
<class>org.apache.aiaravata.application.catalog.data.model.ApplicationModule</class>
<class>org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment</class>
+ <class>org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd</class>
<class>org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath</class>
<class>org.apache.aiaravata.application.catalog.data.model.LibraryApendPath</class>
<class>org.apache.aiaravata.application.catalog.data.model.AppEnvironment</class>
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/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 2b39c8a..6a196d7 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
@@ -172,12 +172,19 @@ CREATE TABLE APPLICATION_DEPLOYMENT
EXECUTABLE_PATH VARCHAR(255),
PARALLELISM VARCHAR(255),
APPLICATION_DESC VARCHAR(255),
- ENV_MODULE_LOAD_CMD 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
);
+CREATE TABLE MODULE_LOAD_CMD
+(
+ CMD VARCHAR (255) NOT NULL,
+ APP_DEPLOYMENT_ID VARCHAR (255) NOT NULL,
+ PRIMARY KEY (APP_DEPLOYMENT_ID,CMD),
+ FOREIGN KEY (APP_DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
CREATE TABLE LIBRARY_PREPAND_PATH
(
DEPLOYMENT_ID VARCHAR(255),
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql b/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql
index 2b39c8a..6a196d7 100644
--- a/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql
+++ b/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql
@@ -172,12 +172,19 @@ CREATE TABLE APPLICATION_DEPLOYMENT
EXECUTABLE_PATH VARCHAR(255),
PARALLELISM VARCHAR(255),
APPLICATION_DESC VARCHAR(255),
- ENV_MODULE_LOAD_CMD 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
);
+CREATE TABLE MODULE_LOAD_CMD
+(
+ CMD VARCHAR (255) NOT NULL,
+ APP_DEPLOYMENT_ID VARCHAR (255) NOT NULL,
+ PRIMARY KEY (APP_DEPLOYMENT_ID,CMD),
+ FOREIGN KEY (APP_DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
CREATE TABLE LIBRARY_PREPAND_PATH
(
DEPLOYMENT_ID VARCHAR(255),
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java
new file mode 100644
index 0000000..2b08708
--- /dev/null
+++ b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java
@@ -0,0 +1,82 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+import java.util.Arrays;
+
+public class ModuleCMDGenerator {
+ private static SQLData createSQLData() {
+ SQLData data = new SQLData();
+ data.setTableName("MODULE_LOAD_CMD");
+ data.getFieldData().put("CMD", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+ data.getFieldData().put("APP_DEPLOYMENT_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+ data.getPrimaryKeys().add("APP_DEPLOYMENT_ID");
+ data.getPrimaryKeys().add("CMD");
+ data.getForiegnKeys().put("APP_DEPLOYMENT_ID", new SQLData.ForiegnKeyData("APPLICATION_DEPLOYMENT(DEPLOYMENT_ID)","ApplicationDeployment","AppDeploymentResource"));
+ return data;
+ }
+ public static void testSqlGen() {
+ SQLData data = createSQLData();
+ SQLGenerator sqlGenerator = new SQLGenerator();
+ System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+ }
+
+ public static void testJPAClassGen() {
+ SQLData data = createSQLData();
+ JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+ jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+ JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+ System.out.println(jpaClassGenerator.generateJPAClass(model));
+ System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+ System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+ }
+
+ public static void testJPAResourceClassGen() {
+ SQLData data = createSQLData();
+ JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+ JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+ JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+ jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+ jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+ jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+ jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+ JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+ System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+ System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+ System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+ System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+
+ }
+ public static void main(String[] args) {
+ testSqlGen();
+ testJPAClassGen();
+ testJPAResourceClassGen();
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/fa44d627/modules/registry/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/pom.xml b/modules/registry/pom.xml
index 51d7da5..03578a9 100644
--- a/modules/registry/pom.xml
+++ b/modules/registry/pom.xml
@@ -33,6 +33,7 @@
<module>registry-api</module>
<module>registry-cpi</module>
<module>airavata-jpa-registry</module>
+ <!--<module>jpa-gen</module>-->
</modules>
</profile>
</profiles>