You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2014/12/24 21:16:59 UTC
[2/3] airavata git commit: adding prejobcommands and postjobcommands
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommandPK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommandPK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommandPK.java
new file mode 100644
index 0000000..907415e
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommandPK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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 PostJobCommandPK implements Serializable {
+ private String deploymentId;
+ private String command;
+
+ public PostJobCommandPK(String submissionID, String command) {
+ this.deploymentId = submissionID;
+ this.command = command;
+ }
+
+ public PostJobCommandPK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommand.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommand.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommand.java
new file mode 100644
index 0000000..02e8a65
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommand.java
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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;
+
+@Entity
+@Table(name = "PREJOB_COMMAND")
+@IdClass(PreJobCommandPK.class)
+public class PreJobCommand implements Serializable {
+ @Id
+ @Column(name = "APPDEPLOYMENT_ID")
+ private String deploymentId;
+ @Id
+ @Column(name = "COMMAND")
+ private String command;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "APPDEPLOYMENT_ID")
+ private ApplicationDeployment applicationDeployment;
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public ApplicationDeployment getApplicationDeployment() {
+ return applicationDeployment;
+ }
+
+ public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
+ this.applicationDeployment = applicationDeployment;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommandPK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommandPK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommandPK.java
new file mode 100644
index 0000000..9382335
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommandPK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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 PreJobCommandPK implements Serializable {
+ private String deploymentId;
+ private String command;
+
+ public PreJobCommandPK(String deploymentId, String command) {
+ this.deploymentId = deploymentId;
+ this.command = command;
+ }
+
+ public PreJobCommandPK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/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 459d656..df005db 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
@@ -28,8 +28,8 @@ public abstract class AbstractResource implements Resource {
public static final String HOST_IPADDRESS = "HostIPAddress";
public static final String GSISSH_SUBMISSION = "GSISSHSubmission";
public static final String GSISSH_EXPORT = "GSISSHExport";
- public static final String GSISSH_PREJOBCOMMAND = "GSISSHPreJobCommand";
- public static final String GSISSH_POSTJOBCOMMAND = "GSISSHPostJobCommand";
+ public static final String PRE_JOBCOMMAND = "PreJobCommand";
+ public static final String POST_JOBCOMMAND = "PostJobCommand";
public static final String GLOBUS_SUBMISSION = "GlobusJobSubmission";
public static final String UNICORE_JOB_SUBMISSION = "UnicoreJobSubmission";
public static final String GLOBUS_GK_ENDPOINT = "GlobusGKEndpoint";
@@ -100,14 +100,14 @@ public abstract class AbstractResource implements Resource {
}
// GSSISSH Pre Job Command Table
- public final class GSISSHPreJobCommandConstants {
- public static final String SUBMISSION_ID = "submissionID";
+ public final class PreJobCommandConstants {
+ public static final String DEPLOYMENT_ID = "deploymentId";
public static final String COMMAND = "command";
}
// GSSISSH Post Job Command Table
- public final class GSISSHPostJobCommandConstants {
- public static final String SUBMISSION_ID = "submissionID";
+ public final class PostJobCommandConstants {
+ public static final String DEPLOYMENT_ID = "deploymentId";
public static final String COMMAND = "command";
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHPostJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHPostJobCommandResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHPostJobCommandResource.java
deleted file mode 100644
index bd891db..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHPostJobCommandResource.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHPostJobCommand;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHPostJobCommandPK;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class GSISSHPostJobCommandResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GSISSHPostJobCommandResource.class);
-
- private String submissionID;
- private String command;
-
- private GSISSHSubmissionResource gsisshSubmissionResource;
-
-
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(GSISSH_POSTJOBCOMMAND);
- generator.setParameter(GSISSHPostJobCommandConstants.SUBMISSION_ID,
- ids.get(GSISSHPostJobCommandConstants.SUBMISSION_ID));
- generator.setParameter(GSISSHPostJobCommandConstants.COMMAND, ids.get(GSISSHPostJobCommandConstants.COMMAND));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_POSTJOBCOMMAND);
- generator.setParameter(GSISSHPostJobCommandConstants.SUBMISSION_ID,
- ids.get(GSISSHPostJobCommandConstants.SUBMISSION_ID));
- generator.setParameter(GSISSHPostJobCommandConstants.COMMAND, ids.get(GSISSHPostJobCommandConstants.COMMAND));
- Query q = generator.selectQuery(em);
- GSISSHPostJobCommand gsisshPostJobCommand = (GSISSHPostJobCommand) q.getSingleResult();
- GSISSHPostJobCommandResource gsisshPostJobCommandResource =
- (GSISSHPostJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_POSTJOBCOMMAND, gsisshPostJobCommand);
- em.getTransaction().commit();
- em.close();
- return gsisshPostJobCommandResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gsiSSHPostJobCommandResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_POSTJOBCOMMAND);
- List results;
- if (fieldName.equals(GSISSHPostJobCommandConstants.SUBMISSION_ID)) {
- generator.setParameter(GSISSHPostJobCommandConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHPostJobCommand gsisshPostJobCommand = (GSISSHPostJobCommand) result;
- GSISSHPostJobCommandResource gsisshPostJobCommandResource =
- (GSISSHPostJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_POSTJOBCOMMAND, gsisshPostJobCommand);
- gsiSSHPostJobCommandResources.add(gsisshPostJobCommandResource);
- }
- }
- } else if (fieldName.equals(GSISSHPostJobCommandConstants.COMMAND)) {
- generator.setParameter(GSISSHPostJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHPostJobCommand gsisshPostJobCommand = (GSISSHPostJobCommand) result;
- GSISSHPostJobCommandResource gsisshPostJobCommandResource =
- (GSISSHPostJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_POSTJOBCOMMAND, gsisshPostJobCommand);
- gsiSSHPostJobCommandResources.add(gsisshPostJobCommandResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Post Job Command Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Post Job Command Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHPostJobCommandResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gsiSSHPostJobResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_POSTJOBCOMMAND);
- List results;
- if (fieldName.equals(GSISSHPostJobCommandConstants.SUBMISSION_ID)) {
- generator.setParameter(GSISSHPostJobCommandConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHPostJobCommand gsisshPostJobCommand = (GSISSHPostJobCommand) result;
- gsiSSHPostJobResourceIDs.add(gsisshPostJobCommand.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHPostJobCommandConstants.COMMAND)) {
- generator.setParameter(GSISSHPostJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHPostJobCommand gsisshPostJobCommand = (GSISSHPostJobCommand) result;
- gsiSSHPostJobResourceIDs.add(gsisshPostJobCommand.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Post Job resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Post JOb Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHPostJobResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GSISSHPostJobCommand existingPostJobCommand = em.find(GSISSHPostJobCommand.class,
- new GSISSHPostJobCommandPK(submissionID, command));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- GSISSHSubmission gsisshSubmission = em.find(GSISSHSubmission.class, submissionID);
- if (existingPostJobCommand != null){
- existingPostJobCommand.setSubmissionID(submissionID);
- existingPostJobCommand.setCommand(command);
- existingPostJobCommand.setGsisshSubmission(gsisshSubmission);
- em.merge(existingPostJobCommand);
- }else {
- GSISSHPostJobCommand gsisshPostJobCommand = new GSISSHPostJobCommand();
- gsisshPostJobCommand.setSubmissionID(submissionID);
- gsisshPostJobCommand.setCommand(command);
- gsisshPostJobCommand.setGsisshSubmission(gsisshSubmission);
- em.persist(gsisshPostJobCommand);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GSISSHPostJobCommand gsisshPostJobCommand = em.find(GSISSHPostJobCommand.class, new GSISSHPostJobCommandPK(
- ids.get(GSISSHPostJobCommandConstants.SUBMISSION_ID),
- ids.get(GSISSHPostJobCommandConstants.COMMAND)));
-
- em.close();
- return gsisshPostJobCommand != 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 getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public GSISSHSubmissionResource getGsisshSubmissionResource() {
- return gsisshSubmissionResource;
- }
-
- public void setGsisshSubmissionResource(GSISSHSubmissionResource gsisshSubmissionResource) {
- this.gsisshSubmissionResource = gsisshSubmissionResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHPreJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHPreJobCommandResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHPreJobCommandResource.java
deleted file mode 100644
index 7d3e2cd..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHPreJobCommandResource.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHPreJobCommand;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHPreJobCommandPK;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class GSISSHPreJobCommandResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GSISSHPreJobCommandResource.class);
-
- private String submissionID;
- private String command;
-
- private GSISSHSubmissionResource gsisshSubmissionResource;
-
-
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(GSISSH_PREJOBCOMMAND);
- generator.setParameter(GSISSHPreJobCommandConstants.SUBMISSION_ID,
- ids.get(GSISSHPreJobCommandConstants.SUBMISSION_ID));
- generator.setParameter(GSISSHPreJobCommandConstants.COMMAND, ids.get(GSISSHPreJobCommandConstants.COMMAND));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_PREJOBCOMMAND);
- generator.setParameter(GSISSHPreJobCommandConstants.SUBMISSION_ID,
- ids.get(GSISSHPreJobCommandConstants.SUBMISSION_ID));
- generator.setParameter(GSISSHPreJobCommandConstants.COMMAND, ids.get(GSISSHPreJobCommandConstants.COMMAND));
- Query q = generator.selectQuery(em);
- GSISSHPreJobCommand gsisshPreJobCommand = (GSISSHPreJobCommand) q.getSingleResult();
- GSISSHPreJobCommandResource gsisshPreJobCommandResource =
- (GSISSHPreJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_PREJOBCOMMAND, gsisshPreJobCommand);
- em.getTransaction().commit();
- em.close();
- return gsisshPreJobCommandResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gsiSSHPreJobResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_PREJOBCOMMAND);
- List results;
- if (fieldName.equals(GSISSHPreJobCommandConstants.SUBMISSION_ID)) {
- generator.setParameter(GSISSHPreJobCommandConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHPreJobCommand gsisshPreJobCommand = (GSISSHPreJobCommand) result;
- GSISSHPreJobCommandResource gsisshPreJobCommandResource =
- (GSISSHPreJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_PREJOBCOMMAND, gsisshPreJobCommand);
- gsiSSHPreJobResources.add(gsisshPreJobCommandResource);
- }
- }
- } else if (fieldName.equals(GSISSHPreJobCommandConstants.COMMAND)) {
- generator.setParameter(GSISSHPreJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHPreJobCommand gsisshPreJobCommand = (GSISSHPreJobCommand) result;
- GSISSHPreJobCommandResource gsisshPreJobCommandResource =
- (GSISSHPreJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_PREJOBCOMMAND, gsisshPreJobCommand);
- gsiSSHPreJobResources.add(gsisshPreJobCommandResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Pre Job Command Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Pre Job Command Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHPreJobResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gsiSSHPreJobResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_PREJOBCOMMAND);
- List results;
- if (fieldName.equals(GSISSHPreJobCommandConstants.SUBMISSION_ID)) {
- generator.setParameter(GSISSHPreJobCommandConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHPreJobCommand gsisshPreJobCommand = (GSISSHPreJobCommand) result;
- gsiSSHPreJobResourceIDs.add(gsisshPreJobCommand.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHPreJobCommandConstants.COMMAND)) {
- generator.setParameter(GSISSHPreJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHPreJobCommand gsisshPreJobCommand = (GSISSHPreJobCommand) result;
- gsiSSHPreJobResourceIDs.add(gsisshPreJobCommand.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Pre Job resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Pre JOb Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHPreJobResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GSISSHPreJobCommand existingGSIsshPreJobCommand = em.find(GSISSHPreJobCommand.class,
- new GSISSHPreJobCommandPK(submissionID, command));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- GSISSHSubmission gsisshSubmission = em.find(GSISSHSubmission.class, submissionID);
- if (existingGSIsshPreJobCommand != null){
- existingGSIsshPreJobCommand.setSubmissionID(submissionID);
- existingGSIsshPreJobCommand.setCommand(command);
- existingGSIsshPreJobCommand.setGsisshSubmission(gsisshSubmission);
- em.merge(existingGSIsshPreJobCommand);
- }else {
- GSISSHPreJobCommand gsisshPreJobCommand = new GSISSHPreJobCommand();
- gsisshPreJobCommand.setSubmissionID(submissionID);
- gsisshPreJobCommand.setCommand(command);
- gsisshPreJobCommand.setGsisshSubmission(gsisshSubmission);
- em.persist(gsisshPreJobCommand);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GSISSHPreJobCommand gsisshPreJobCommand = em.find(GSISSHPreJobCommand.class, new GSISSHPreJobCommandPK(
- ids.get(GSISSHPreJobCommandConstants.SUBMISSION_ID),
- ids.get(GSISSHPreJobCommandConstants.COMMAND)));
-
- em.close();
- return gsisshPreJobCommand != 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 getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public GSISSHSubmissionResource getGsisshSubmissionResource() {
- return gsisshSubmissionResource;
- }
-
- public void setGsisshSubmissionResource(GSISSHSubmissionResource gsisshSubmissionResource) {
- this.gsisshSubmissionResource = gsisshSubmissionResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java
new file mode 100644
index 0000000..f832c65
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java
@@ -0,0 +1,331 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
+import org.apache.aiaravata.application.catalog.data.model.PostJobCommand;
+import org.apache.aiaravata.application.catalog.data.model.PostJobCommandPK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class PostJobCommandResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(PostJobCommandResource.class);
+
+ private String appDeploymentId;
+ private String command;
+
+ private AppDeploymentResource appDeploymentResource;
+
+
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map){
+ ids = (HashMap)identifier;
+ }else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(POST_JOBCOMMAND);
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
+ generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
+ Query q = generator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map){
+ ids = (HashMap)identifier;
+ }else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
+ generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
+ Query q = generator.selectQuery(em);
+ PostJobCommand postJobCommand = (PostJobCommand) q.getSingleResult();
+ PostJobCommandResource postJobCommandResource =
+ (PostJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
+ em.getTransaction().commit();
+ em.close();
+ return postJobCommandResource;
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> gsiSSHPostJobCommandResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ PostJobCommandResource postJobCommandResource =
+ (PostJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
+ gsiSSHPostJobCommandResources.add(postJobCommandResource);
+ }
+ }
+ } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
+ generator.setParameter(PostJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ PostJobCommandResource postJobCommandResource =
+ (PostJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
+ gsiSSHPostJobCommandResources.add(postJobCommandResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Post Job Command Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Post Job Command Resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return gsiSSHPostJobCommandResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gsiSSHPostJobResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
+ }
+ }
+ } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
+ generator.setParameter(PostJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Post Job resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Post JOb Resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return gsiSSHPostJobResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ PostJobCommand existingPostJobCommand = em.find(PostJobCommand.class,
+ new PostJobCommandPK(appDeploymentId, command));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
+ if (existingPostJobCommand != null){
+ existingPostJobCommand.setDeploymentId(appDeploymentId);
+ existingPostJobCommand.setCommand(command);
+ existingPostJobCommand.setDeployment(deployment);
+ em.merge(existingPostJobCommand);
+ }else {
+ PostJobCommand postJobCommand = new PostJobCommand();
+ postJobCommand.setDeploymentId(appDeploymentId);
+ postJobCommand.setCommand(command);
+ postJobCommand.setDeployment(deployment);
+ em.persist(postJobCommand);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map){
+ ids = (HashMap)identifier;
+ }else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ PostJobCommand postJobCommand = em.find(PostJobCommand.class, new PostJobCommandPK(
+ ids.get(PostJobCommandConstants.DEPLOYMENT_ID),
+ ids.get(PostJobCommandConstants.COMMAND)));
+
+ em.close();
+ return postJobCommand != 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 getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId = appDeploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public AppDeploymentResource getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java
new file mode 100644
index 0000000..aee27f5
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java
@@ -0,0 +1,331 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
+import org.apache.aiaravata.application.catalog.data.model.PreJobCommand;
+import org.apache.aiaravata.application.catalog.data.model.PreJobCommandPK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class PreJobCommandResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(PreJobCommandResource.class);
+
+ private String appDeploymentId;
+ private String command;
+
+ private AppDeploymentResource appDeploymentResource;
+
+
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map){
+ ids = (HashMap)identifier;
+ }else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
+ generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
+ Query q = generator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map){
+ ids = (HashMap)identifier;
+ }else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
+ generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
+ Query q = generator.selectQuery(em);
+ PreJobCommand preJobCommand = (PreJobCommand) q.getSingleResult();
+ PreJobCommandResource preJobCommandResource =
+ (PreJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
+ em.getTransaction().commit();
+ em.close();
+ return preJobCommandResource;
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> gsiSSHPreJobResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ PreJobCommandResource preJobCommandResource =
+ (PreJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
+ gsiSSHPreJobResources.add(preJobCommandResource);
+ }
+ }
+ } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
+ generator.setParameter(PreJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ PreJobCommandResource preJobCommandResource =
+ (PreJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
+ gsiSSHPreJobResources.add(preJobCommandResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Pre Job Command Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Pre Job Command Resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return gsiSSHPreJobResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gsiSSHPreJobResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
+ }
+ }
+ } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
+ generator.setParameter(PreJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Pre Job resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Pre JOb Resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return gsiSSHPreJobResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ PreJobCommand existingGSIsshPreJobCommand = em.find(PreJobCommand.class,
+ new PreJobCommandPK(appDeploymentId, command));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
+ if (existingGSIsshPreJobCommand != null){
+ existingGSIsshPreJobCommand.setDeploymentId(appDeploymentId);
+ existingGSIsshPreJobCommand.setCommand(command);
+ existingGSIsshPreJobCommand.setApplicationDeployment(deployment);
+ em.merge(existingGSIsshPreJobCommand);
+ }else {
+ PreJobCommand preJobCommand = new PreJobCommand();
+ preJobCommand.setDeploymentId(appDeploymentId);
+ preJobCommand.setCommand(command);
+ preJobCommand.setApplicationDeployment(deployment);
+ em.persist(preJobCommand);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new AppCatalogException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map){
+ ids = (HashMap)identifier;
+ }else {
+ logger.error("Identifier should be a map with the field name and it's value");
+ throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+ }
+
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ PreJobCommand preJobCommand = em.find(PreJobCommand.class, new PreJobCommandPK(
+ ids.get(PreJobCommandConstants.DEPLOYMENT_ID),
+ ids.get(PreJobCommandConstants.COMMAND)));
+
+ em.close();
+ return preJobCommand != 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 getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId = appDeploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public AppDeploymentResource getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/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 6b99bd9..0dbf54c 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
@@ -130,16 +130,16 @@ public class AppCatalogJPAUtils {
logger.error("Object should be a GSISSH Export.", new IllegalArgumentException());
throw new IllegalArgumentException("Object should be a GSISSH Export.");
}
- case GSISSH_PREJOBCOMMAND:
- if (o instanceof GSISSHPreJobCommand){
- return createGSISSHPreJObCommand((GSISSHPreJobCommand) o);
+ case PRE_JOBCOMMAND:
+ if (o instanceof PreJobCommand){
+ return createPreJobCommand((PreJobCommand) o);
}else {
logger.error("Object should be a GSISSHPreJobCommand.", new IllegalArgumentException());
throw new IllegalArgumentException("Object should be a GSISSHPreJobCommand.");
}
- case GSISSH_POSTJOBCOMMAND:
- if (o instanceof GSISSHPostJobCommand){
- return createGSISSHPostJObCommand((GSISSHPostJobCommand) o);
+ case POST_JOBCOMMAND:
+ if (o instanceof PostJobCommand){
+ return createPostJObCommand((PostJobCommand) o);
}else {
logger.error("Object should be a GSISSHPostJobCommand.", new IllegalArgumentException());
throw new IllegalArgumentException("Object should be a GSISSHPostJobCommand.");
@@ -540,22 +540,22 @@ public class AppCatalogJPAUtils {
return resource;
}
- private static Resource createGSISSHPreJObCommand(GSISSHPreJobCommand o){
- GSISSHPreJobCommandResource resource = new GSISSHPreJobCommandResource();
+ private static Resource createPreJobCommand(PreJobCommand o){
+ PreJobCommandResource resource = new PreJobCommandResource();
if (o != null) {
- resource.setSubmissionID(o.getSubmissionID());
+ resource.setAppDeploymentId(o.getDeploymentId());
resource.setCommand(o.getCommand());
- resource.setGsisshSubmissionResource((GSISSHSubmissionResource)createGSSISSHSubmission(o.getGsisshSubmission()));
+ resource.setAppDeploymentResource((AppDeploymentResource) createApplicationDeployment(o.getApplicationDeployment()));
}
return resource;
}
- private static Resource createGSISSHPostJObCommand(GSISSHPostJobCommand o){
- GSISSHPostJobCommandResource resource = new GSISSHPostJobCommandResource();
+ private static Resource createPostJObCommand(PostJobCommand o){
+ PostJobCommandResource resource = new PostJobCommandResource();
if (o != null){
- resource.setSubmissionID(o.getSubmissionID());
+ resource.setAppDeploymentId(o.getDeploymentId());
resource.setCommand(o.getCommand());
- resource.setGsisshSubmissionResource((GSISSHSubmissionResource)createGSSISSHSubmission(o.getGsisshSubmission()));
+ resource.setAppDeploymentResource((AppDeploymentResource) createApplicationDeployment(o.getDeployment()));
}
return resource;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/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 cbaef5e..81b12d8 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
@@ -27,8 +27,8 @@ public enum AppCatalogResourceType {
HOST_IPADDRESS,
GSISSH_SUBMISSION,
GSISSH_EXPORT,
- GSISSH_PREJOBCOMMAND,
- GSISSH_POSTJOBCOMMAND,
+ PRE_JOBCOMMAND,
+ POST_JOBCOMMAND,
GLOBUS_SUBMISSION,
UNICORE_JOB_SUBMISSION,
GLOBUS_GK_ENDPOINT,
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
index 5cdd04a..df695d1 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
@@ -22,6 +22,8 @@
package org.apache.aiaravata.application.catalog.data.util;
import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.PostJobCommand;
+import org.apache.aiaravata.application.catalog.data.model.PreJobCommand;
import org.apache.aiaravata.application.catalog.data.resources.*;
import org.apache.airavata.model.Workflow;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
@@ -629,6 +631,20 @@ public class AppCatalogThriftConversion {
if (appEnvList != null && !appEnvList.isEmpty()){
description.setSetEnvironment(getAppEnvPaths(appEnvList));
}
+ PreJobCommandResource preJobCommandResource = new PreJobCommandResource();
+ List<Resource> preJobCommands = preJobCommandResource.get(AbstractResource.PreJobCommandConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+ if (preJobCommands != null && !preJobCommands.isEmpty()){
+ for (Resource prejobCommand : preJobCommands){
+ description.addToPreJobCommands(((PreJobCommandResource) prejobCommand).getCommand());
+ }
+ }
+ PostJobCommandResource postJobCommandResource = new PostJobCommandResource();
+ List<Resource> postJobCommands = postJobCommandResource.get(AbstractResource.PostJobCommandConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+ if (postJobCommands != null && !postJobCommands.isEmpty()){
+ for (Resource postjobCommand : postJobCommands){
+ description.addToPostJobCommands(((PreJobCommandResource) postjobCommand).getCommand());
+ }
+ }
return description;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/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 bc0ad60..e85eb3f 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
@@ -28,8 +28,8 @@
<class>org.apache.aiaravata.application.catalog.data.model.GlobusGKEndpoint</class>
<class>org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission</class>
<class>org.apache.aiaravata.application.catalog.data.model.GSISSHExport</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GSISSHPreJobCommand</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GSISSHPostJobCommand</class>
+ <class>org.apache.aiaravata.application.catalog.data.model.PreJobCommand</class>
+ <class>org.apache.aiaravata.application.catalog.data.model.PostJobCommand</class>
<class>org.apache.aiaravata.application.catalog.data.model.UnicoreJobSubmission</class>
<class>org.apache.aiaravata.application.catalog.data.model.HostAlias</class>
<class>org.apache.aiaravata.application.catalog.data.model.HostIPAddress</class>
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/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 d576430..34fa021 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
@@ -64,21 +64,7 @@ CREATE TABLE GSISSH_EXPORT
FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
);
-CREATE TABLE GSISSH_PREJOBCOMMAND
-(
- SUBMISSION_ID VARCHAR(255),
- COMMAND VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID, COMMAND),
- FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
-);
-CREATE TABLE GSISSH_POSTJOBCOMMAND
-(
- SUBMISSION_ID VARCHAR(255),
- COMMAND VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID, COMMAND),
- FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
-);
CREATE TABLE GLOBUS_SUBMISSION
(
@@ -216,6 +202,22 @@ CREATE TABLE MODULE_LOAD_CMD
FOREIGN KEY (APP_DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
);
+CREATE TABLE PREJOB_COMMAND
+(
+ APPDEPLOYMENT_ID VARCHAR(255),
+ COMMAND VARCHAR(255),
+ PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
+ FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE POSTJOB_COMMAND
+(
+ APPDEPLOYMENT_ID VARCHAR(255),
+ COMMAND VARCHAR(255),
+ PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
+ FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
CREATE TABLE LIBRARY_PREPAND_PATH
(
DEPLOYMENT_ID VARCHAR(255),
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
index a9889af..7cea574 100644
--- a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
+++ b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
@@ -228,6 +228,22 @@ CREATE TABLE APP_ENVIRONMENT
FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
);
+CREATE TABLE PREJOB_COMMAND
+(
+ APPDEPLOYMENT_ID VARCHAR(255),
+ COMMAND VARCHAR(255),
+ PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
+ FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(APPDEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE POSTJOB_COMMAND
+(
+ APPLICATION_DEPLOYMENT VARCHAR(255),
+ COMMAND VARCHAR(255),
+ PRIMARY KEY(APPLICATION_DEPLOYMENT, COMMAND),
+ FOREIGN KEY (APPLICATION_DEPLOYMENT) REFERENCES APPLICATION_DEPLOYMENT(APPLICATION_DEPLOYMENT) ON DELETE CASCADE
+);
+
CREATE TABLE APPLICATION_INTERFACE
(
INTERFACE_ID VARCHAR(255),
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql b/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql
index a98fef6..34fa021 100644
--- a/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql
+++ b/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql
@@ -26,6 +26,7 @@ CREATE TABLE COMPUTE_RESOURCE
RESOURCE_DESCRIPTION VARCHAR (255),
CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ MAX_MEMORY_NODE INTEGER,
PRIMARY KEY (RESOURCE_ID)
);
@@ -63,21 +64,7 @@ CREATE TABLE GSISSH_EXPORT
FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
);
-CREATE TABLE GSISSH_PREJOBCOMMAND
-(
- SUBMISSION_ID VARCHAR(255),
- COMMAND VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID, COMMAND),
- FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
-);
-CREATE TABLE GSISSH_POSTJOBCOMMAND
-(
- SUBMISSION_ID VARCHAR(255),
- COMMAND VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID, COMMAND),
- FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
-);
CREATE TABLE GLOBUS_SUBMISSION
(
@@ -215,6 +202,22 @@ CREATE TABLE MODULE_LOAD_CMD
FOREIGN KEY (APP_DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
);
+CREATE TABLE PREJOB_COMMAND
+(
+ APPDEPLOYMENT_ID VARCHAR(255),
+ COMMAND VARCHAR(255),
+ PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
+ FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE POSTJOB_COMMAND
+(
+ APPDEPLOYMENT_ID VARCHAR(255),
+ COMMAND VARCHAR(255),
+ PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
+ FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
CREATE TABLE LIBRARY_PREPAND_PATH
(
DEPLOYMENT_ID VARCHAR(255),
@@ -286,6 +289,7 @@ CREATE TABLE APPLICATION_OUTPUT
OUTPUT_VALUE VARCHAR(255),
DATA_TYPE VARCHAR(255),
VALIDITY_TYPE VARCHAR(255),
+ COMMANDLINE_TYPE VARCHAR(255),
DATA_MOVEMENT SMALLINT,
DATA_NAME_LOCATION VARCHAR(255),
PRIMARY KEY(INTERFACE_ID,OUTPUT_KEY),
@@ -326,6 +330,7 @@ CREATE TABLE BATCH_QUEUE
QUEUE_NAME VARCHAR(255) NOT NULL,
MAX_PROCESSORS INTEGER,
MAX_NODES INTEGER,
+ MAX_MEMORY INTEGER,
PRIMARY KEY (COMPUTE_RESOURCE_ID,QUEUE_NAME),
FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
);
http://git-wip-us.apache.org/repos/asf/airavata/blob/99fdd58a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
index 266c0e4..33c83e5 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
@@ -215,7 +215,7 @@ public class GFACGSISSHUtils {
}
for (InputDataObjectType inputDataObjectType : sortedInputSet) {
if (inputDataObjectType.getAddedToCommandLine() != null
- && inputDataObjectType.getAddedToCommandLine() == CommandLineType.EXCLUSIVE) {
+ && inputDataObjectType.getAddedToCommandLine() == CommandLineType.EXPLICIT) {
continue;
}
if (inputDataObjectType.getApplicationArgument() != null
@@ -234,7 +234,7 @@ public class GFACGSISSHUtils {
if (outputParam instanceof OutputDataObjectType) {
OutputDataObjectType output = (OutputDataObjectType) outputParam;
if (output.getValue() != null && !output.getValue().equals("") && output.getAddedToCommandLine() != null
- && output.getAddedToCommandLine() == CommandLineType.INCLUSIVE) {
+ && output.getAddedToCommandLine() == CommandLineType.IMPLICIT) {
inputValues.add(output.getValue());
}
}