You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/07/05 02:47:33 UTC
[1/3] AIRAVATA-1236
Repository: airavata
Updated Branches:
refs/heads/master 429505a38 -> 2e04f68d0
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/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 4d6fe9b..b59da71 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
@@ -39,6 +39,7 @@ 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;
@@ -68,6 +69,7 @@ import org.apache.aiaravata.application.catalog.data.resources.BatchQueueResourc
import org.apache.aiaravata.application.catalog.data.resources.ComputeHostPreferenceResource;
import org.apache.aiaravata.application.catalog.data.resources.ComputeHostResource;
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;
@@ -346,12 +348,29 @@ public class AppCatalogJPAUtils {
logger.error("Object should be a Job Submission Interface.", new IllegalArgumentException());
throw new IllegalArgumentException("Object should be a Job Submission Interface.");
}
+ case DATA_MOVEMENT_INTERFACE:
+ if (o instanceof DataMovementInterface){
+ return createDataMovementInterface((DataMovementInterface) o);
+ }else{
+ logger.error("Object should be a Data Movement Interface.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Data Movement Interface.");
+ }
default:
logger.error("Illegal data type..", new IllegalArgumentException());
throw new IllegalArgumentException("Illegal data type..");
}
}
+ private static Resource createDataMovementInterface(DataMovementInterface o) {
+ DataMovementInterfaceResource dataMovementInterfaceResource = new DataMovementInterfaceResource();
+ dataMovementInterfaceResource.setComputeResourceId(o.getComputeResourceId());
+ dataMovementInterfaceResource.setComputeHostResource((ComputeHostResource)createComputeResource(o.getComputeResource()));
+ dataMovementInterfaceResource.setDataMovementProtocol(o.getDataMovementProtocol());
+ dataMovementInterfaceResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId());
+ dataMovementInterfaceResource.setPriorityOrder(o.getPriorityOrder());
+ return dataMovementInterfaceResource;
+ }
+
private static Resource createJobSubmissionInterface(JobSubmissionInterface o) {
JobSubmissionInterfaceResource jobSubmissionInterfaceResource = new JobSubmissionInterfaceResource();
jobSubmissionInterfaceResource.setJobSubmissionInterfaceId(o.getJobSubmissionInterfaceId());
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/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 e8ee430..c4f9d6f 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
@@ -50,5 +50,6 @@ public enum AppCatalogResourceType {
COMPUTE_RESOURCE_PREFERENCE,
BATCH_QUEUE,
COMPUTE_RESOURCE_FILE_SYSTEM,
- JOB_SUBMISSION_INTERFACE
+ JOB_SUBMISSION_INTERFACE,
+ DATA_MOVEMENT_INTERFACE
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/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 da522a9..ffb1b3b 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
@@ -52,7 +52,7 @@
<class>org.apache.aiaravata.application.catalog.data.model.BatchQueue</class>
<class>org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem</class>
<class>org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface</class>
- <class>org.apache.aiaravata.application.catalog.data.model.BatchQueue</class>
+ <class>org.apache.aiaravata.application.catalog.data.model.DataMovementInterface</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
</persistence>
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/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 c111759..faae2b1 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
@@ -287,5 +287,16 @@ CREATE TABLE JOB_SUBMISSION_INTERFACE
FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
);
+CREATE TABLE DATA_MOVEMENT_INTERFACE
+(
+ COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
+ DATA_MOVEMENT_PROTOCOL VARCHAR (255) NOT NULL,
+ DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+ PRIORITY_ORDER INTEGER,
+ PRIMARY KEY (COMPUTE_RESOURCE_ID,DATA_MOVEMENT_INTERFACE_ID),
+ FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+);
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/registry/jpa-gen/src/main/java/appcatalog/BatchQueueGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/BatchQueueGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/BatchQueueGenerator.java
index 7e760e1..ad904b5 100644
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/BatchQueueGenerator.java
+++ b/modules/registry/jpa-gen/src/main/java/appcatalog/BatchQueueGenerator.java
@@ -56,9 +56,11 @@ public class BatchQueueGenerator {
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() {
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/registry/jpa-gen/src/main/java/appcatalog/DataMovementInterfaceGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/DataMovementInterfaceGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/DataMovementInterfaceGenerator.java
new file mode 100644
index 0000000..fdb5d8f
--- /dev/null
+++ b/modules/registry/jpa-gen/src/main/java/appcatalog/DataMovementInterfaceGenerator.java
@@ -0,0 +1,85 @@
+/*
+ *
+ * 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;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class DataMovementInterfaceGenerator {
+ private static SQLData createSQLData() {
+ SQLData data = new SQLData();
+ data.setTableName("DATA_MOVEMENT_INTERFACE");
+ data.getFieldData().put("COMPUTE_RESOURCE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+ data.getFieldData().put("DATA_MOVEMENT_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+ data.getFieldData().put("DATA_MOVEMENT_PROTOCOL", Arrays.asList(new String[]{"VARCHAR", "(255)","NOT", "NULL"}));
+ data.getFieldData().put("PRIORITY_ORDER", Arrays.asList(new String[]{"INTEGER"}));
+ data.getPrimaryKeys().add("COMPUTE_RESOURCE_ID");
+ data.getPrimaryKeys().add("DATA_MOVEMENT_INTERFACE_ID");
+ data.getForiegnKeys().put("COMPUTE_RESOURCE_ID", new SQLData.ForiegnKeyData("COMPUTE_RESOURCE(RESOURCE_ID)","ComputeResource","ComputeHostResource"));
+ 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/8288ee0f/modules/registry/jpa-gen/src/main/java/appcatalog/FileSystemsGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/FileSystemsGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/FileSystemsGenerator.java
index b3194e4..09d1f29 100644
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/FileSystemsGenerator.java
+++ b/modules/registry/jpa-gen/src/main/java/appcatalog/FileSystemsGenerator.java
@@ -52,9 +52,11 @@ public class FileSystemsGenerator {
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() {
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/registry/jpa-gen/src/main/java/appcatalog/JobSubmissionInterfaceGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/JobSubmissionInterfaceGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/JobSubmissionInterfaceGenerator.java
index f556e51..12e4fea 100644
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/JobSubmissionInterfaceGenerator.java
+++ b/modules/registry/jpa-gen/src/main/java/appcatalog/JobSubmissionInterfaceGenerator.java
@@ -53,9 +53,11 @@ public class JobSubmissionInterfaceGenerator {
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() {
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/registry/jpa-gen/src/main/java/generators/JPAClassGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/generators/JPAClassGenerator.java b/modules/registry/jpa-gen/src/main/java/generators/JPAClassGenerator.java
index 7672577..bbb35e2 100644
--- a/modules/registry/jpa-gen/src/main/java/generators/JPAClassGenerator.java
+++ b/modules/registry/jpa-gen/src/main/java/generators/JPAClassGenerator.java
@@ -31,6 +31,8 @@ import model.SQLData;
public class JPAClassGenerator extends AbstractGenerator{
// private static final Logger log = LoggerFactory.getLogger(JPAClassGenerator.class);
+ private String jpaClassPackageName;
+
public JPAClassModel createJPAClassModel(SQLData sqlData){
JPAClassModel model = new JPAClassModel();
model.generatePKClass=sqlData.getPrimaryKeys().size()>1;
@@ -189,5 +191,25 @@ public class JPAClassGenerator extends AbstractGenerator{
classStr=addLines(classStr,"}");
return classStr;
}
+
+ public String generatePersistenceXmlEntry(JPAClassModel model){
+ String xmlEntry=null;
+ xmlEntry=addLines(xmlEntry,"<persistence xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.0\">");
+ xmlEntry=addLines(xmlEntry,tabs(1)+"<persistence-unit name=\"appcatalog_data\">");
+ xmlEntry=addLines(xmlEntry,tabs(2)+"<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>");
+ xmlEntry=addLines(xmlEntry,tabs(2)+"<class>"+getJpaClassPackageName()+"."+model.className+"</class>");
+ xmlEntry=addLines(xmlEntry,tabs(2)+"<exclude-unlisted-classes>true</exclude-unlisted-classes>");
+ xmlEntry=addLines(xmlEntry,tabs(1)+"</persistence-unit>");
+ xmlEntry=addLines(xmlEntry,"</persistence>");
+ return xmlEntry;
+ }
+
+ public String getJpaClassPackageName() {
+ return jpaClassPackageName;
+ }
+
+ public void setJpaClassPackageName(String jpaClassPackageName) {
+ this.jpaClassPackageName = jpaClassPackageName;
+ }
}
[2/3] git commit: AIRAVATA-1236
Posted by sa...@apache.org.
AIRAVATA-1236
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/8288ee0f
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/8288ee0f
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/8288ee0f
Branch: refs/heads/master
Commit: 8288ee0fb980e602a7d2547ce555e08ac15c13f4
Parents: b103e79
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Fri Jul 4 20:46:51 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Fri Jul 4 20:46:51 2014 -0400
----------------------------------------------------------------------
.../catalog/data/model/BatchQueue.java | 133 ++++++++
.../catalog/data/model/BatchQueue_PK.java | 60 ++++
.../data/model/ComputeResourceFileSystem.java | 89 +++++
.../model/ComputeResourceFileSystem_PK.java | 59 ++++
.../data/model/DataMovementInterface.java | 100 ++++++
.../data/model/DataMovementInterface_PK.java | 59 ++++
.../catalog/data/model/GSISSHExport.java | 12 +-
.../data/model/GSISSHPostJobCommand.java | 12 +-
.../catalog/data/model/GSISSHPreJobCommand.java | 12 +-
.../data/model/JobSubmissionInterface.java | 100 ++++++
.../data/model/JobSubmissionInterface_PK.java | 59 ++++
.../data/resources/AbstractResource.java | 9 +
.../data/resources/BatchQueueResource.java | 337 +++++++++++++++++++
.../ComputeResourceFileSystemResource.java | 297 ++++++++++++++++
.../DataMovementInterfaceResource.java | 307 +++++++++++++++++
.../JobSubmissionInterfaceResource.java | 307 +++++++++++++++++
.../catalog/data/util/AppCatalogJPAUtils.java | 19 ++
.../data/util/AppCatalogResourceType.java | 3 +-
.../src/main/resources/META-INF/persistence.xml | 2 +-
.../src/main/resources/appcatalog-derby.sql | 11 +
.../java/appcatalog/BatchQueueGenerator.java | 2 +
.../DataMovementInterfaceGenerator.java | 85 +++++
.../java/appcatalog/FileSystemsGenerator.java | 2 +
.../JobSubmissionInterfaceGenerator.java | 2 +
.../main/java/generators/JPAClassGenerator.java | 22 ++
25 files changed, 2089 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue.java
new file mode 100644
index 0000000..2deadfb
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue.java
@@ -0,0 +1,133 @@
+/*
+ *
+ * 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;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "BATCH_QUEUE")
+@IdClass(BatchQueue_PK.class)
+public class BatchQueue implements Serializable {
+
+ @Id
+ @Column(name = "COMPUTE_RESOURCE_ID")
+ private String computeResourceId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "COMPUTE_RESOURCE_ID")
+ private ComputeResource computeResource;
+
+ @Column(name = "MAX_RUNTIME")
+ private int maxRuntime;
+
+ @Column(name = "MAX_JOB_IN_QUEUE")
+ private int maxJobInQueue;
+
+ @Column(name = "QUEUE_DESCRIPTION")
+ private String queueDescription;
+
+ @Id
+ @Column(name = "QUEUE_NAME")
+ private String queueName;
+
+ @Column(name = "MAX_PROCESSORS")
+ private int maxProcessors;
+
+ @Column(name = "MAX_NODES")
+ private int maxNodes;
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResource getComputeResource() {
+ return computeResource;
+ }
+
+ public int getMaxRuntime() {
+ return maxRuntime;
+ }
+
+ public int getMaxJobInQueue() {
+ return maxJobInQueue;
+ }
+
+ public String getQueueDescription() {
+ return queueDescription;
+ }
+
+ public String getQueueName() {
+ return queueName;
+ }
+
+ public int getMaxProcessors() {
+ return maxProcessors;
+ }
+
+ public int getMaxNodes() {
+ return maxNodes;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeResource(ComputeResource computeResource) {
+ this.computeResource=computeResource;
+ }
+
+ public void setMaxRuntime(int maxRuntime) {
+ this.maxRuntime=maxRuntime;
+ }
+
+ public void setMaxJobInQueue(int maxJobInQueue) {
+ this.maxJobInQueue=maxJobInQueue;
+ }
+
+ public void setQueueDescription(String queueDescription) {
+ this.queueDescription=queueDescription;
+ }
+
+ public void setQueueName(String queueName) {
+ this.queueName=queueName;
+ }
+
+ public void setMaxProcessors(int maxProcessors) {
+ this.maxProcessors=maxProcessors;
+ }
+
+ public void setMaxNodes(int maxNodes) {
+ this.maxNodes=maxNodes;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue_PK.java
new file mode 100644
index 0000000..367c45f
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue_PK.java
@@ -0,0 +1,60 @@
+/*
+ *
+ * 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 BatchQueue_PK implements Serializable {
+ private String computeResourceId;
+ private String queueName;
+ public BatchQueue_PK(String computeResourceId, String queueName){
+ this.computeResourceId = computeResourceId;
+ this.queueName = queueName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public String getQueueName() {
+ return queueName;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setQueueName(String queueName) {
+ this.queueName=queueName;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem.java
new file mode 100644
index 0000000..184056a
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem.java
@@ -0,0 +1,89 @@
+/*
+ *
+ * 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;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "COMPUTE_RESOURCE_FILE_SYSTEM")
+@IdClass(ComputeResourceFileSystem_PK.class)
+public class ComputeResourceFileSystem implements Serializable {
+
+ @Id
+ @Column(name = "COMPUTE_RESOURCE_ID")
+ private String computeResourceId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "COMPUTE_RESOURCE_ID")
+ private ComputeResource computeResource;
+
+ @Column(name = "PATH")
+ private String path;
+
+ @Id
+ @Column(name = "FILE_SYSTEM")
+ private String fileSystem;
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResource getComputeResource() {
+ return computeResource;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getFileSystem() {
+ return fileSystem;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeResource(ComputeResource computeResource) {
+ this.computeResource=computeResource;
+ }
+
+ public void setPath(String path) {
+ this.path=path;
+ }
+
+ public void setFileSystem(String fileSystem) {
+ this.fileSystem=fileSystem;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem_PK.java
new file mode 100644
index 0000000..77ff37a
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem_PK.java
@@ -0,0 +1,59 @@
+/*
+ *
+ * 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 ComputeResourceFileSystem_PK implements Serializable {
+ private String computeResourceId;
+ private String fileSystem;
+ public ComputeResourceFileSystem_PK(String computeResourceId, String fileSystem){
+ this.computeResourceId = computeResourceId;
+ this.fileSystem = fileSystem;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public String getFileSystem() {
+ return fileSystem;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setFileSystem(String fileSystem) {
+ this.fileSystem=fileSystem;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface.java
new file mode 100644
index 0000000..ff5e962
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface.java
@@ -0,0 +1,100 @@
+/*
+ *
+ * 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;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "DATA_MOVEMENT_INTERFACE")
+@IdClass(DataMovementInterface_PK.class)
+public class DataMovementInterface implements Serializable {
+
+ @Id
+ @Column(name = "COMPUTE_RESOURCE_ID")
+ private String computeResourceId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "COMPUTE_RESOURCE_ID")
+ private ComputeResource computeResource;
+
+ @Column(name = "DATA_MOVEMENT_PROTOCOL")
+ private String dataMovementProtocol;
+
+ @Id
+ @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
+ private String dataMovementInterfaceId;
+
+ @Column(name = "PRIORITY_ORDER")
+ private int priorityOrder;
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResource getComputeResource() {
+ return computeResource;
+ }
+
+ public String getDataMovementProtocol() {
+ return dataMovementProtocol;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public int getPriorityOrder() {
+ return priorityOrder;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeResource(ComputeResource computeResource) {
+ this.computeResource=computeResource;
+ }
+
+ public void setDataMovementProtocol(String dataMovementProtocol) {
+ this.dataMovementProtocol=dataMovementProtocol;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setPriorityOrder(int priorityOrder) {
+ this.priorityOrder=priorityOrder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface_PK.java
new file mode 100644
index 0000000..a2b4810
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface_PK.java
@@ -0,0 +1,59 @@
+/*
+ *
+ * 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 DataMovementInterface_PK implements Serializable {
+ private String computeResourceId;
+ private String dataMovementInterfaceId;
+ public DataMovementInterface_PK(String computeResourceId, String dataMovementInterfaceId){
+ this.computeResourceId = computeResourceId;
+ this.dataMovementInterfaceId = dataMovementInterfaceId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExport.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExport.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExport.java
index d3896f6..c4d305b 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExport.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExport.java
@@ -21,11 +21,17 @@
package org.apache.aiaravata.application.catalog.data.model;
-import org.apache.airavata.model.appcatalog.computeresource.GSISSHJobSubmission;
-
-import javax.persistence.*;
import java.io.Serializable;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
@Entity
@Table(name = "GSISSH_EXPORT")
@IdClass(GSISSHExportPK.class)
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHPostJobCommand.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHPostJobCommand.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHPostJobCommand.java
index 5d2582d..86c78d9 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHPostJobCommand.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHPostJobCommand.java
@@ -21,11 +21,17 @@
package org.apache.aiaravata.application.catalog.data.model;
-import org.apache.airavata.model.appcatalog.computeresource.GSISSHJobSubmission;
-
-import javax.persistence.*;
import java.io.Serializable;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
@Entity
@Table(name = "GSISSH_POSTJOBCOMMAND")
@IdClass(GSISSHPostJobCommandPK.class)
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHPreJobCommand.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHPreJobCommand.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHPreJobCommand.java
index 7e393b8..06472af 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHPreJobCommand.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHPreJobCommand.java
@@ -21,11 +21,17 @@
package org.apache.aiaravata.application.catalog.data.model;
-import org.apache.airavata.model.appcatalog.computeresource.GSISSHJobSubmission;
-
-import javax.persistence.*;
import java.io.Serializable;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
@Entity
@Table(name = "GSISSH_PREJOBCOMMAND")
@IdClass(GSISSHPreJobCommandPK.class)
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface.java
new file mode 100644
index 0000000..d8114c6
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface.java
@@ -0,0 +1,100 @@
+/*
+ *
+ * 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;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "JOB_SUBMISSION_INTERFACE")
+@IdClass(JobSubmissionInterface_PK.class)
+public class JobSubmissionInterface implements Serializable {
+
+ @Id
+ @Column(name = "JOB_SUBMISSION_INTERFACE_ID")
+ private String jobSubmissionInterfaceId;
+
+ @Id
+ @Column(name = "COMPUTE_RESOURCE_ID")
+ private String computeResourceId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "COMPUTE_RESOURCE_ID")
+ private ComputeResource computeResource;
+
+ @Column(name = "JOB_SUBMISSION_PROTOCOL")
+ private String jobSubmissionProtocol;
+
+ @Column(name = "PRIORITY_ORDER")
+ private int priorityOrder;
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResource getComputeResource() {
+ return computeResource;
+ }
+
+ public String getJobSubmissionProtocol() {
+ return jobSubmissionProtocol;
+ }
+
+ public int getPriorityOrder() {
+ return priorityOrder;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeResource(ComputeResource computeResource) {
+ this.computeResource=computeResource;
+ }
+
+ public void setJobSubmissionProtocol(String jobSubmissionProtocol) {
+ this.jobSubmissionProtocol=jobSubmissionProtocol;
+ }
+
+ public void setPriorityOrder(int priorityOrder) {
+ this.priorityOrder=priorityOrder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface_PK.java
new file mode 100644
index 0000000..3ae2a3b
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface_PK.java
@@ -0,0 +1,59 @@
+/*
+ *
+ * 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 JobSubmissionInterface_PK implements Serializable {
+ private String jobSubmissionInterfaceId;
+ private String computeResourceId;
+ public JobSubmissionInterface_PK(String jobSubmissionInterfaceId, String computeResourceId){
+ this.jobSubmissionInterfaceId = jobSubmissionInterfaceId;
+ this.computeResourceId = computeResourceId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/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 4166e1e..cc25d9d 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
@@ -52,6 +52,7 @@ public abstract class AbstractResource implements Resource {
public static final String BATCH_QUEUE = "BatchQueue";
public static final String COMPUTE_RESOURCE_FILE_SYSTEM = "ComputeResourceFileSystem";
public static final String JOB_SUBMISSION_INTERFACE = "JobSubmissionInterface";
+ public static final String DATA_MOVEMENT_INTERFACE = "DataMovementInterface";
// Compute Resource Table
public final class ComputeResourceConstants {
@@ -254,4 +255,12 @@ public abstract class AbstractResource implements Resource {
public static final String JOB_SUBMISSION_PROTOCOL = "jobSubmissionProtocol";
public static final String PRIORITY_ORDER = "priorityOrder";
}
+
+ // Data Movement Interface Table
+ public final class DataMovementInterfaceConstants {
+ public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+ public static final String DATA_MOVEMENT_PROTOCOL = "dataMovementProtocol";
+ public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
+ public static final String PRIORITY_ORDER = "priorityOrder";
+ }
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/BatchQueueResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/BatchQueueResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/BatchQueueResource.java
new file mode 100644
index 0000000..23f2c42
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/BatchQueueResource.java
@@ -0,0 +1,337 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.BatchQueue;
+import org.apache.aiaravata.application.catalog.data.model.BatchQueue_PK;
+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;
+
+public class BatchQueueResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(BatchQueueResource.class);
+ private String computeResourceId;
+ private ComputeHostResource computeHostResource;
+ private int maxRuntime;
+ private int maxJobInQueue;
+ private String queueDescription;
+ private String queueName;
+ private int maxProcessors;
+ private int maxNodes;
+
+ @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(BATCH_QUEUE);
+ generator.setParameter(BatchQueueConstants.COMPUTE_RESOURCE_ID, ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(BatchQueueConstants.QUEUE_NAME, ids.get(BatchQueueConstants.QUEUE_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<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(BATCH_QUEUE);
+ generator.setParameter(BatchQueueConstants.COMPUTE_RESOURCE_ID, ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(BatchQueueConstants.QUEUE_NAME, ids.get(BatchQueueConstants.QUEUE_NAME));
+ Query q = generator.selectQuery(em);
+ BatchQueue batchQueue = (BatchQueue) q.getSingleResult();
+ BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
+ em.getTransaction().commit();
+ em.close();
+ return batchQueueResource;
+ } 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> batchQueueResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
+ Query q;
+ if ((fieldName.equals(BatchQueueConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(BatchQueueConstants.MAX_RUNTIME)) || (fieldName.equals(BatchQueueConstants.MAX_JOB_IN_QUEUE)) || (fieldName.equals(BatchQueueConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(BatchQueueConstants.QUEUE_NAME)) || (fieldName.equals(BatchQueueConstants.MAX_PROCESSORS)) || (fieldName.equals(BatchQueueConstants.MAX_NODES))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ BatchQueue batchQueue = (BatchQueue) result;
+ BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
+ batchQueueResources.add(batchQueueResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Batch Queue Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Batch Queue 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 batchQueueResources;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> batchQueueResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
+ Query q;
+ if ((fieldName.equals(BatchQueueConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(BatchQueueConstants.MAX_RUNTIME)) || (fieldName.equals(BatchQueueConstants.MAX_JOB_IN_QUEUE)) || (fieldName.equals(BatchQueueConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(BatchQueueConstants.QUEUE_NAME)) || (fieldName.equals(BatchQueueConstants.MAX_PROCESSORS)) || (fieldName.equals(BatchQueueConstants.MAX_NODES))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ BatchQueue batchQueue = (BatchQueue) result;
+ BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
+ batchQueueResourceIDs.add(batchQueueResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Batch Queue Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Batch Queue 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 batchQueueResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ BatchQueue existingBatchQueue = em.find(BatchQueue.class, new BatchQueue_PK(computeResourceId, queueName));
+ em.close();
+ BatchQueue batchQueue;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingBatchQueue == null) {
+ batchQueue = new BatchQueue();
+ } else {
+ batchQueue = existingBatchQueue;
+ }
+ batchQueue.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ batchQueue.setComputeResource(computeResource);
+ batchQueue.setMaxRuntime(getMaxRuntime());
+ batchQueue.setMaxJobInQueue(getMaxJobInQueue());
+ batchQueue.setQueueDescription(getQueueDescription());
+ batchQueue.setQueueName(getQueueName());
+ batchQueue.setMaxProcessors(getMaxProcessors());
+ batchQueue.setMaxNodes(getMaxNodes());
+ if (existingBatchQueue == null) {
+ em.persist(batchQueue);
+ } else {
+ em.merge(batchQueue);
+ }
+ 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();
+ BatchQueue batchQueue = em.find(BatchQueue.class, new BatchQueue_PK(ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID), ids.get(BatchQueueConstants.QUEUE_NAME)));
+ em.close();
+ return batchQueue != 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 getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeHostResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public int getMaxRuntime() {
+ return maxRuntime;
+ }
+
+ public int getMaxJobInQueue() {
+ return maxJobInQueue;
+ }
+
+ public String getQueueDescription() {
+ return queueDescription;
+ }
+
+ public String getQueueName() {
+ return queueName;
+ }
+
+ public int getMaxProcessors() {
+ return maxProcessors;
+ }
+
+ public int getMaxNodes() {
+ return maxNodes;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeHostResource computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setMaxRuntime(int maxRuntime) {
+ this.maxRuntime=maxRuntime;
+ }
+
+ public void setMaxJobInQueue(int maxJobInQueue) {
+ this.maxJobInQueue=maxJobInQueue;
+ }
+
+ public void setQueueDescription(String queueDescription) {
+ this.queueDescription=queueDescription;
+ }
+
+ public void setQueueName(String queueName) {
+ this.queueName=queueName;
+ }
+
+ public void setMaxProcessors(int maxProcessors) {
+ this.maxProcessors=maxProcessors;
+ }
+
+ public void setMaxNodes(int maxNodes) {
+ this.maxNodes=maxNodes;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceFileSystemResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceFileSystemResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceFileSystemResource.java
new file mode 100644
index 0000000..04e8646
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceFileSystemResource.java
@@ -0,0 +1,297 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ComputeResourceFileSystemResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ComputeResourceFileSystemResource.class);
+ private String computeResourceId;
+ private ComputeHostResource computeHostResource;
+ private String path;
+ private String fileSystem;
+
+ @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(COMPUTE_RESOURCE_FILE_SYSTEM);
+ generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
+ 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(COMPUTE_RESOURCE_FILE_SYSTEM);
+ generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
+ Query q = generator.selectQuery(em);
+ ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) q.getSingleResult();
+ ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+ em.getTransaction().commit();
+ em.close();
+ return computeResourceFileSystemResource;
+ } 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> computeResourceFileSystemResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+ Query q;
+ if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
+ ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+ computeResourceFileSystemResources.add(computeResourceFileSystemResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute Resource File System 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 computeResourceFileSystemResources;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> computeResourceFileSystemResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+ Query q;
+ if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
+ ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+ computeResourceFileSystemResourceIDs.add(computeResourceFileSystemResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute Resource File System 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 computeResourceFileSystemResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ComputeResourceFileSystem existingComputeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(computeResourceId, fileSystem));
+ em.close();
+ ComputeResourceFileSystem computeResourceFileSystem;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingComputeResourceFileSystem == null) {
+ computeResourceFileSystem = new ComputeResourceFileSystem();
+ } else {
+ computeResourceFileSystem = existingComputeResourceFileSystem;
+ }
+ computeResourceFileSystem.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ computeResourceFileSystem.setComputeResource(computeResource);
+ computeResourceFileSystem.setPath(getPath());
+ computeResourceFileSystem.setFileSystem(getFileSystem());
+ if (existingComputeResourceFileSystem == null) {
+ em.persist(computeResourceFileSystem);
+ } else {
+ em.merge(computeResourceFileSystem);
+ }
+ 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();
+ ComputeResourceFileSystem computeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID), ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM)));
+ em.close();
+ return computeResourceFileSystem != 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 getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeHostResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getFileSystem() {
+ return fileSystem;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeHostResource computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setPath(String path) {
+ this.path=path;
+ }
+
+ public void setFileSystem(String fileSystem) {
+ this.fileSystem=fileSystem;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementInterfaceResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementInterfaceResource.java
new file mode 100644
index 0000000..53a22b7
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementInterfaceResource.java
@@ -0,0 +1,307 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.DataMovementInterface;
+import org.apache.aiaravata.application.catalog.data.model.DataMovementInterface_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DataMovementInterfaceResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(DataMovementInterfaceResource.class);
+ private String computeResourceId;
+ private ComputeHostResource computeHostResource;
+ private String dataMovementProtocol;
+ private String dataMovementInterfaceId;
+ private int priorityOrder;
+
+ @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(DATA_MOVEMENT_INTERFACE);
+ generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID));
+ Query q = generator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ @Override
+ public Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) identifier;
+ } else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+ generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID));
+ Query q = generator.selectQuery(em);
+ DataMovementInterface dataMovementInterface = (DataMovementInterface) q.getSingleResult();
+ DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+ em.getTransaction().commit();
+ em.close();
+ return dataMovementInterfaceResource;
+ } 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> dataMovementInterfaceResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+ Query q;
+ if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
+ DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+ dataMovementInterfaceResources.add(dataMovementInterfaceResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return dataMovementInterfaceResources;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> dataMovementInterfaceResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+ Query q;
+ if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
+ DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+ dataMovementInterfaceResourceIDs.add(dataMovementInterfaceResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return dataMovementInterfaceResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ DataMovementInterface existingDataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(computeResourceId, dataMovementInterfaceId));
+ em.close();
+ DataMovementInterface dataMovementInterface;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingDataMovementInterface == null) {
+ dataMovementInterface = new DataMovementInterface();
+ } else {
+ dataMovementInterface = existingDataMovementInterface;
+ }
+ dataMovementInterface.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ dataMovementInterface.setComputeResource(computeResource);
+ dataMovementInterface.setDataMovementProtocol(getDataMovementProtocol());
+ dataMovementInterface.setDataMovementInterfaceId(getDataMovementInterfaceId());
+ dataMovementInterface.setPriorityOrder(getPriorityOrder());
+ if (existingDataMovementInterface == null) {
+ em.persist(dataMovementInterface);
+ } else {
+ em.merge(dataMovementInterface);
+ }
+ 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();
+ DataMovementInterface dataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID), ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)));
+ em.close();
+ return dataMovementInterface != 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 getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeHostResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public String getDataMovementProtocol() {
+ return dataMovementProtocol;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public int getPriorityOrder() {
+ return priorityOrder;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeHostResource computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setDataMovementProtocol(String dataMovementProtocol) {
+ this.dataMovementProtocol=dataMovementProtocol;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setPriorityOrder(int priorityOrder) {
+ this.priorityOrder=priorityOrder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8288ee0f/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionInterfaceResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionInterfaceResource.java
new file mode 100644
index 0000000..e76b784
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionInterfaceResource.java
@@ -0,0 +1,307 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface;
+import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JobSubmissionInterfaceResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(JobSubmissionInterfaceResource.class);
+ private String jobSubmissionInterfaceId;
+ private String computeResourceId;
+ private ComputeHostResource computeHostResource;
+ private String jobSubmissionProtocol;
+ private int priorityOrder;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) identifier;
+ } else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
+ generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
+ generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID));
+ Query q = generator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ @Override
+ public Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) identifier;
+ } else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
+ generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
+ generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID));
+ Query q = generator.selectQuery(em);
+ JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) q.getSingleResult();
+ JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
+ em.getTransaction().commit();
+ em.close();
+ return jobSubmissionInterfaceResource;
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ @Override
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> jobSubmissionInterfaceResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
+ Query q;
+ if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
+ JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
+ jobSubmissionInterfaceResources.add(jobSubmissionInterfaceResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Job Submission Interface Resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return jobSubmissionInterfaceResources;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> jobSubmissionInterfaceResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
+ Query q;
+ if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
+ JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
+ jobSubmissionInterfaceResourceIDs.add(jobSubmissionInterfaceResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Job Submission Interface Resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return jobSubmissionInterfaceResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ JobSubmissionInterface existingJobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(jobSubmissionInterfaceId, computeResourceId));
+ em.close();
+ JobSubmissionInterface jobSubmissionInterface;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingJobSubmissionInterface == null) {
+ jobSubmissionInterface = new JobSubmissionInterface();
+ } else {
+ jobSubmissionInterface = existingJobSubmissionInterface;
+ }
+ jobSubmissionInterface.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+ jobSubmissionInterface.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ jobSubmissionInterface.setComputeResource(computeResource);
+ jobSubmissionInterface.setJobSubmissionProtocol(getJobSubmissionProtocol());
+ jobSubmissionInterface.setPriorityOrder(getPriorityOrder());
+ if (existingJobSubmissionInterface == null) {
+ em.persist(jobSubmissionInterface);
+ } else {
+ em.merge(jobSubmissionInterface);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ @Override
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) identifier;
+ } else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ JobSubmissionInterface jobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID), ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)));
+ em.close();
+ return jobSubmissionInterface != null;
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeHostResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public String getJobSubmissionProtocol() {
+ return jobSubmissionProtocol;
+ }
+
+ public int getPriorityOrder() {
+ return priorityOrder;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeHostResource computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setJobSubmissionProtocol(String jobSubmissionProtocol) {
+ this.jobSubmissionProtocol=jobSubmissionProtocol;
+ }
+
+ public void setPriorityOrder(int priorityOrder) {
+ this.priorityOrder=priorityOrder;
+ }
+}
\ No newline at end of file
[3/3] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/airavata
Posted by sa...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/airavata
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2e04f68d
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2e04f68d
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2e04f68d
Branch: refs/heads/master
Commit: 2e04f68d079311b685365f60d532ad84941fb105
Parents: 8288ee0 429505a
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Fri Jul 4 20:47:20 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Fri Jul 4 20:47:20 2014 -0400
----------------------------------------------------------------------
.../lib/computeResourceModel_types.cpp | 518 +++++++-----
.../resources/lib/computeResourceModel_types.h | 193 +++--
.../Model/AppCatalog/ComputeResource/Types.php | 523 ++++++++-----
.../ComputeResourceDescription.java | 483 +++++-------
.../computeresource/GlobusJobSubmission.java | 150 +---
.../computeresource/GridFTPDataMovement.java | 32 +-
.../computeresource/JobManagerCommand.java | 101 +++
.../computeresource/JobSubmissionProtocol.java | 9 +-
.../computeresource/LOCALSubmission.java | 144 +---
.../computeresource/ResourceJobManager.java | 781 ++++++++++++++++++-
.../computeresource/ResourceJobManagerType.java | 83 ++
.../computeresource/SSHJobSubmission.java | 142 +---
.../computeResourceModel.thrift | 86 +-
13 files changed, 1996 insertions(+), 1249 deletions(-)
----------------------------------------------------------------------