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:34 UTC
[2/3] git commit: AIRAVATA-1236
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