Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6719B1811B for ; Mon, 8 Feb 2016 16:48:52 +0000 (UTC) Received: (qmail 62001 invoked by uid 500); 8 Feb 2016 16:48:45 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 61385 invoked by uid 500); 8 Feb 2016 16:48:45 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 60439 invoked by uid 99); 8 Feb 2016 16:48:44 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2016 16:48:44 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 98B2DE00A0; Mon, 8 Feb 2016 16:48:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: chathuri@apache.org To: commits@airavata.apache.org Date: Mon, 08 Feb 2016 16:49:13 -0000 Message-Id: <4d4440dee7b34268a241fb5fe8f874bd@git.apache.org> In-Reply-To: <3c0d9fcde42b4a9096a9ceb6ffd1d650@git.apache.org> References: <3c0d9fcde42b4a9096a9ceb6ffd1d650@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [31/50] [abbrv] airavata git commit: adding workflow related resource layer http://git-wip-us.apache.org/repos/asf/airavata/blob/2a2782a6/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java deleted file mode 100644 index 8c03213..0000000 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java +++ /dev/null @@ -1,437 +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.airavata.registry.core.app.catalog.resources; - -import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.AiravataUtils; -import org.apache.airavata.registry.core.app.catalog.model.Workflow; -import org.apache.airavata.registry.core.app.catalog.util.AppCatalogJPAUtils; -import org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator; -import org.apache.airavata.registry.core.app.catalog.util.AppCatalogResourceType; -import org.apache.airavata.registry.cpi.AppCatalogException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.persistence.EntityManager; -import javax.persistence.Query; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.List; - -public class WorkflowResource extends AppCatAbstractResource { - private final static Logger logger = LoggerFactory.getLogger(WorkflowResource.class); - private String wfName; - private String createdUser; - private String graph; - private String wfTemplateId; - private Timestamp createdTime; - private Timestamp updatedTime; - private String image; - private String gatewayId; - - public Timestamp getCreatedTime() { - return createdTime; - } - - public void setCreatedTime(Timestamp createdTime) { - this.createdTime = createdTime; - } - - public Timestamp getUpdatedTime() { - return updatedTime; - } - - public void setUpdatedTime(Timestamp updatedTime) { - this.updatedTime = updatedTime; - } - - public String getImage() { - return image; - } - - public void setImage(String image) { - this.image = image; - } - - public String getGatewayId() { - return gatewayId; - } - - public void setGatewayId(String gatewayId) { - this.gatewayId = gatewayId; - } - - @Override - public void remove(Object identifier) throws AppCatalogException { - EntityManager em = null; - try { - em = AppCatalogJPAUtils.getEntityManager(); - em.getTransaction().begin(); - AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW); - generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier); - Query q = generator.deleteQuery(em); - q.executeUpdate(); - em.getTransaction().commit(); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - 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 AppCatalogResource get(Object identifier) throws AppCatalogException { - EntityManager em = null; - try { - em = AppCatalogJPAUtils.getEntityManager(); - em.getTransaction().begin(); - AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW); - generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier); - Query q = generator.selectQuery(em); - Workflow workflow = (Workflow) q.getSingleResult(); - WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow); - em.getTransaction().commit(); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - em.close(); - } - return workflowResource; - } 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 get(String fieldName, Object value) throws AppCatalogException { - List workflowResources = new ArrayList(); - EntityManager em = null; - try { - em = AppCatalogJPAUtils.getEntityManager(); - em.getTransaction().begin(); - AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW); - Query q; - if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) { - generator.setParameter(fieldName, value); - q = generator.selectQuery(em); - List results = q.getResultList(); - for (Object result : results) { - Workflow workflow = (Workflow) result; - WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow); - workflowResources.add(workflowResource); - } - } else { - em.getTransaction().commit(); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - em.close(); - } - logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException()); - throw new IllegalArgumentException("Unsupported field name for Workflow Resource."); - } - em.getTransaction().commit(); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - 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 workflowResources; - } - - @Override - public List getAll() throws AppCatalogException { - List workflows = new ArrayList(); - EntityManager em = null; - try { - em = AppCatalogJPAUtils.getEntityManager(); - em.getTransaction().begin(); - AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW); - generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId); - Query q = generator.selectQuery(em); - List results = q.getResultList(); - if (results.size() != 0) { - for (Object result : results) { - Workflow workflow = (Workflow) result; - WorkflowResource wfResource = - (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow); - workflows.add(wfResource); - } - } - em.getTransaction().commit(); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - 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 workflows; - } - - @Override - public List getAllIds() throws AppCatalogException { - List workflowIds = new ArrayList(); - EntityManager em = null; - try { - em = AppCatalogJPAUtils.getEntityManager(); - em.getTransaction().begin(); - AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW); - generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId); - Query q = generator.selectQuery(em); - List results = q.getResultList(); - if (results.size() != 0) { - for (Object result : results) { - Workflow workflow = (Workflow) result; - workflowIds.add(workflow.getWfTemplateId()); - } - } - em.getTransaction().commit(); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - 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 workflowIds; - } - - @Override - public List getIds(String fieldName, Object value) throws AppCatalogException { - List workflowResourceIDs = new ArrayList(); - EntityManager em = null; - try { - em = AppCatalogJPAUtils.getEntityManager(); - em.getTransaction().begin(); - AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW); - Query q; - if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) { - generator.setParameter(fieldName, value); - q = generator.selectQuery(em); - List results = q.getResultList(); - for (Object result : results) { - Workflow workflow = (Workflow) result; - WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow); - workflowResourceIDs.add(workflowResource.getWfTemplateId()); - } - } else { - em.getTransaction().commit(); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - em.close(); - } - logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException()); - throw new IllegalArgumentException("Unsupported field name for Workflow Resource."); - } - em.getTransaction().commit(); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - 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 workflowResourceIDs; - } - - @Override - public void save() throws AppCatalogException { - EntityManager em = null; - try { - em = AppCatalogJPAUtils.getEntityManager(); - Workflow existingWorkflow = em.find(Workflow.class, wfTemplateId); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - em.close(); - } - Workflow workflow; - em = AppCatalogJPAUtils.getEntityManager(); - em.getTransaction().begin(); - if (existingWorkflow == null) { - workflow = new Workflow(); - workflow.setCreationTime(AiravataUtils.getCurrentTimestamp()); - } else { - workflow = existingWorkflow; - workflow.setUpdateTime(AiravataUtils.getCurrentTimestamp()); - } - workflow.setWfName(getWfName()); - workflow.setCreatedUser(getCreatedUser()); - workflow.setGatewayId(gatewayId); - if (getGraph() != null){ - workflow.setGraph(getGraph().toCharArray()); - } - if (image != null){ - workflow.setImage(image.getBytes()); - } - workflow.setWfTemplateId(getWfTemplateId()); - if (existingWorkflow == null) { - em.persist(workflow); - } else { - em.merge(workflow); - } - em.getTransaction().commit(); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - em.close(); - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - throw new AppCatalogException(e); - } finally { - if (em != null && em.isOpen()) { - if (em.getTransaction().isActive()) { - em.getTransaction().rollback(); - } - em.close(); - } - } - } - - @Override - public boolean isExists(Object identifier) throws AppCatalogException { - EntityManager em = null; - try { - em = AppCatalogJPAUtils.getEntityManager(); - Workflow workflow = em.find(Workflow.class, identifier); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - em.close(); - } - return workflow != 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 getWfName() { - return wfName; - } - - public String getCreatedUser() { - return createdUser; - } - - public String getGraph() { - return graph; - } - - public String getWfTemplateId() { - return wfTemplateId; - } - - public void setWfName(String wfName) { - this.wfName=wfName; - } - - public void setCreatedUser(String createdUser) { - this.createdUser=createdUser; - } - - public void setGraph(String graph) { - this.graph=graph; - } - - public void setWfTemplateId(String wfTemplateId) { - this.wfTemplateId=wfTemplateId; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/2a2782a6/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java index 2a7d47e..5cfca50 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java @@ -42,9 +42,9 @@ public class AppCatalogJPAUtils { private static final String APPCATALOG_VALIDATION_QUERY = "appcatalog.validationQuery"; private static final String JPA_CACHE_SIZE = "jpa.cache.size"; private static final String JPA_CACHE_ENABLED = "cache.enable"; - @PersistenceUnit(unitName="appcatalog_data") + @PersistenceUnit(unitName = "appcatalog_data") protected static EntityManagerFactory factory; - @PersistenceContext(unitName="appcatalog_data") + @PersistenceContext(unitName = "appcatalog_data") private static EntityManager appCatEntityManager; public static EntityManager getEntityManager() throws ApplicationSettingsException { @@ -63,8 +63,8 @@ public class AppCatalogJPAUtils { // For app catalog, we don't need caching // properties.put("openjpa.DataCache","" + readServerProperties(JPA_CACHE_ENABLED) + "(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)"); // properties.put("openjpa.QueryCache","" + readServerProperties(JPA_CACHE_ENABLED) + "(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)"); - properties.put("openjpa.RemoteCommitProvider","sjvm"); - properties.put("openjpa.Log","DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"); + properties.put("openjpa.RemoteCommitProvider", "sjvm"); + properties.put("openjpa.Log", "DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"); properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)"); properties.put("openjpa.jdbc.QuerySQLCache", "false"); properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true"); @@ -74,7 +74,7 @@ public class AppCatalogJPAUtils { return appCatEntityManager; } - private static String readServerProperties (String propertyName) throws ApplicationSettingsException { + private static String readServerProperties(String propertyName) throws ApplicationSettingsException { try { return ServerSettings.getSetting(propertyName); } catch (ApplicationSettingsException e) { @@ -84,118 +84,117 @@ public class AppCatalogJPAUtils { } /** - * * @param type model type - * @param o model type instance + * @param o model type instance * @return corresponding resource object */ public static AppCatalogResource getResource(AppCatalogResourceType type, Object o) { - switch (type){ - case COMPUTE_RESOURCE: - if (o instanceof ComputeResource){ - return createComputeResource((ComputeResource) o); - }else{ - logger.error("Object should be a Compute Resource.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Compute Resource."); - } + switch (type) { + case COMPUTE_RESOURCE: + if (o instanceof ComputeResource) { + return createComputeResource((ComputeResource) o); + } else { + logger.error("Object should be a Compute Resource.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Compute Resource."); + } case HOST_ALIAS: - if (o instanceof HostAlias){ + if (o instanceof HostAlias) { return createHostAlias((HostAlias) o); - }else { + } else { logger.error("Object should be a Host Alias.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a Host Alias."); } case HOST_IPADDRESS: - if (o instanceof HostIPAddress){ + if (o instanceof HostIPAddress) { return createHostIPAddress((HostIPAddress) o); - }else { + } else { logger.error("Object should be a Host IPAdress.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a Host IPAdress."); } case GSISSH_SUBMISSION: - if (o instanceof GSISSHSubmission){ + if (o instanceof GSISSHSubmission) { return createGSSISSHSubmission((GSISSHSubmission) o); - }else { + } else { logger.error("Object should be a GSISSH Submission", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a GSISSH Submission."); } case UNICORE_JOB_SUBMISSION: - if (o instanceof UnicoreJobSubmission){ + if (o instanceof UnicoreJobSubmission) { return createUnicoreJobSubmission((UnicoreJobSubmission) o); - }else { + } else { logger.error("Object should be a GSISSH Submission", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a GSISSH Submission."); } case UNICORE_DATA_MOVEMENT: - if (o instanceof UnicoreDataMovement){ + if (o instanceof UnicoreDataMovement) { return createUnicoreDataMovement((UnicoreDataMovement) o); - }else { + } else { logger.error("Object should be a GSISSH Submission", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a GSISSH Submission."); } case GSISSH_EXPORT: - if (o instanceof GSISSHExport){ + if (o instanceof GSISSHExport) { return createGSISSHExport((GSISSHExport) o); - }else { + } else { logger.error("Object should be a GSISSH Export.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a GSISSH Export."); } case PRE_JOBCOMMAND: - if (o instanceof PreJobCommand){ + if (o instanceof PreJobCommand) { return createPreJobCommand((PreJobCommand) o); - }else { + } else { logger.error("Object should be a GSISSHPreJobCommand.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a GSISSHPreJobCommand."); } case POST_JOBCOMMAND: - if (o instanceof PostJobCommand){ + if (o instanceof PostJobCommand) { return createPostJObCommand((PostJobCommand) o); - }else { + } else { logger.error("Object should be a GSISSHPostJobCommand.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a GSISSHPostJobCommand."); } case GLOBUS_SUBMISSION: - if (o instanceof GlobusJobSubmission){ + if (o instanceof GlobusJobSubmission) { return createGlobusJobSubmission((GlobusJobSubmission) o); - }else { + } else { logger.error("Object should be a GlobusJobSubmission.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a GlobusJobSubmission."); } case GLOBUS_GK_ENDPOINT: - if (o instanceof GlobusGKEndpoint){ + if (o instanceof GlobusGKEndpoint) { return createGlobusEndpoint((GlobusGKEndpoint) o); - }else { + } else { logger.error("Object should be a GlobusJobSubmission.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a GlobusJobSubmission."); } case SSH_JOB_SUBMISSION: - if (o instanceof SshJobSubmission){ - return createSshJobSubmission((SshJobSubmission) o); - }else{ - logger.error("Object should be a Ssh Job Submission.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Ssh Job Submission."); - } + if (o instanceof SshJobSubmission) { + return createSshJobSubmission((SshJobSubmission) o); + } else { + logger.error("Object should be a Ssh Job Submission.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Ssh Job Submission."); + } case SCP_DATA_MOVEMENT: - if (o instanceof ScpDataMovement){ - return createScpDataMovement((ScpDataMovement) o); - }else{ - logger.error("Object should be a Scp Data Movement.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Scp Data Movement."); - } + if (o instanceof ScpDataMovement) { + return createScpDataMovement((ScpDataMovement) o); + } else { + logger.error("Object should be a Scp Data Movement.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Scp Data Movement."); + } case GRIDFTP_DATA_MOVEMENT: - if (o instanceof GridftpDataMovement){ - return createGridftpDataMovement((GridftpDataMovement) o); - }else{ - logger.error("Object should be a Gridftp Data Movement.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Gridftp Data Movement."); - } + if (o instanceof GridftpDataMovement) { + return createGridftpDataMovement((GridftpDataMovement) o); + } else { + logger.error("Object should be a Gridftp Data Movement.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Gridftp Data Movement."); + } case GRIDFTP_ENDPOINT: - if (o instanceof GridftpEndpoint){ - return createGridftpEndpoint((GridftpEndpoint) o); - }else{ - logger.error("Object should be a Gridftp Endpoint.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Gridftp Endpoint."); - } + if (o instanceof GridftpEndpoint) { + return createGridftpEndpoint((GridftpEndpoint) o); + } else { + logger.error("Object should be a Gridftp Endpoint.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Gridftp Endpoint."); + } // case JOB_SUBMISSION_PROTOCOL: // if (o instanceof JobSubmissionProtocol){ // return createJobSubmissionProtocol((JobSubmissionProtocol) o); @@ -211,159 +210,159 @@ public class AppCatalogJPAUtils { // throw new IllegalArgumentException("Object should be a DataMovementProtocol."); // } case APPLICATION_MODULE: - if (o instanceof ApplicationModule){ + if (o instanceof ApplicationModule) { return createApplicationModule((ApplicationModule) o); - }else { + } else { logger.error("Object should be a Application Module.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a Application Module."); } case APPLICATION_DEPLOYMENT: - if (o instanceof ApplicationDeployment){ + if (o instanceof ApplicationDeployment) { return createApplicationDeployment((ApplicationDeployment) o); - }else { + } else { logger.error("Object should be a Application Deployment.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a Application Deployment."); } case LIBRARY_PREPAND_PATH: - if (o instanceof LibraryPrepandPath){ + if (o instanceof LibraryPrepandPath) { return createLibraryPrepPathResource((LibraryPrepandPath) o); - }else { + } else { logger.error("Object should be a Library Prepand path.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a Library Prepand path."); } case LIBRARY_APEND_PATH: - if (o instanceof LibraryApendPath){ + if (o instanceof LibraryApendPath) { return createLibraryApendPathResource((LibraryApendPath) o); - }else { + } else { logger.error("Object should be a Library Apend path.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a Library Apend."); } case APP_ENVIRONMENT: - if (o instanceof AppEnvironment){ + if (o instanceof AppEnvironment) { return createAppEnvironmentResource((AppEnvironment) o); - }else { + } else { logger.error("Object should be a AppEnvironment.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a AppEnvironment."); } case APPLICATION_INTERFACE: - if (o instanceof ApplicationInterface){ + if (o instanceof ApplicationInterface) { return createAppInterfaceResource((ApplicationInterface) o); - }else { + } else { logger.error("Object should be a ApplicationInterface.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a ApplicationInterface."); } case APP_MODULE_MAPPING: - if (o instanceof AppModuleMapping){ + if (o instanceof AppModuleMapping) { return createAppModMappingResource((AppModuleMapping) o); - }else { + } else { logger.error("Object should be a AppModuleMapping.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a AppModuleMapping."); } case APPLICATION_OUTPUT: - if (o instanceof ApplicationIntOutput){ + if (o instanceof ApplicationIntOutput) { return createApplicationOutput((ApplicationIntOutput) o); - }else { + } else { logger.error("Object should be a ApplicationOutput.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a ApplicationOutput."); } case GATEWAY_PROFILE: - if (o instanceof GatewayProfile){ + if (o instanceof GatewayProfile) { return createGatewayProfile((GatewayProfile) o); - }else { + } else { logger.error("Object should be a GatewayProfile.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a GatewayProfile."); } case COMPUTE_RESOURCE_PREFERENCE: - if (o instanceof ComputeResourcePreference){ + if (o instanceof ComputeResourcePreference) { return createComputeResourcePref((ComputeResourcePreference) o); - }else { + } else { logger.error("Object should be a Compute Resource Preference.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a Compute Resource Preference."); } case STORAGE_PREFERENCE: - if (o instanceof StoragePreference){ + if (o instanceof StoragePreference) { return createStoragePref((StoragePreference) o); - }else { + } else { logger.error("Object should be a data storage Preference.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a data storage Preference."); } case STORAGE_RESOURCE: - if (o instanceof StorageResource){ + if (o instanceof StorageResource) { return createStorageResource((StorageResource) o); - }else { + } else { logger.error("Object should be a storage resource.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a storage resource."); } case STORAGE_INTERFACE: - if (o instanceof StorageInterface){ + if (o instanceof StorageInterface) { return createStorageInterface((StorageInterface) o); - }else { + } else { logger.error("Object should be a storage interface.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a storage interface."); } case APPLICATION_INPUT: - if (o instanceof ApplicationIntInput){ + if (o instanceof ApplicationIntInput) { return createApplicationInput((ApplicationIntInput) o); - }else { + } else { logger.error("Object should be a ApplicationInput.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a ApplicationInput."); } case BATCH_QUEUE: - if (o instanceof BatchQueue){ - return createBatchQueue((BatchQueue) o); - }else{ - logger.error("Object should be a Batch Queue.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Batch Queue."); - } + if (o instanceof BatchQueue) { + return createBatchQueue((BatchQueue) o); + } else { + logger.error("Object should be a Batch Queue.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Batch Queue."); + } case COMPUTE_RESOURCE_FILE_SYSTEM: - if (o instanceof ComputeResourceFileSystem){ - return createComputeResourceFileSystem((ComputeResourceFileSystem) o); - }else{ - logger.error("Object should be a Compute Resource File System.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Compute Resource File System."); - } + if (o instanceof ComputeResourceFileSystem) { + return createComputeResourceFileSystem((ComputeResourceFileSystem) o); + } else { + logger.error("Object should be a Compute Resource File System.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Compute Resource File System."); + } case JOB_SUBMISSION_INTERFACE: - if (o instanceof JobSubmissionInterface){ - return createJobSubmissionInterface((JobSubmissionInterface) o); - }else{ - logger.error("Object should be a Job Submission Interface.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Job Submission Interface."); - } + if (o instanceof JobSubmissionInterface) { + return createJobSubmissionInterface((JobSubmissionInterface) o); + } else { + logger.error("Object should be a Job Submission Interface.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Job Submission Interface."); + } case DATA_MOVEMENT_INTERFACE: - if (o instanceof DataMovementInterface){ - return createDataMovementInterface((DataMovementInterface) o); - }else{ - logger.error("Object should be a Data Movement Interface.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Data Movement Interface."); - } + if (o instanceof DataMovementInterface) { + return createDataMovementInterface((DataMovementInterface) o); + } else { + logger.error("Object should be a Data Movement Interface.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Data Movement Interface."); + } case RESOURCE_JOB_MANAGER: - if (o instanceof ResourceJobManager){ - return createResourceJobManager((ResourceJobManager) o); - }else{ - logger.error("Object should be a Resource Job Manager.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Resource Job Manager."); - } + if (o instanceof ResourceJobManager) { + return createResourceJobManager((ResourceJobManager) o); + } else { + logger.error("Object should be a Resource Job Manager.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Resource Job Manager."); + } case JOB_MANAGER_COMMAND: - if (o instanceof JobManagerCommand){ - return createJobManagerCommand((JobManagerCommand) o); - }else{ - logger.error("Object should be a Job Manager Command.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Job Manager Command."); - } - case LOCAL_SUBMISSION: - if (o instanceof LocalSubmission){ - return createLocalSubmission((LocalSubmission) o); - }else{ - logger.error("Object should be a Local Submission.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Local Submission."); - } - case LOCAL_DATA_MOVEMENT: - if (o instanceof LocalDataMovement){ - return createLocalDataMovement((LocalDataMovement) o); - }else{ - logger.error("Object should be a Local Data Movement.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Local Data Movement."); - } + if (o instanceof JobManagerCommand) { + return createJobManagerCommand((JobManagerCommand) o); + } else { + logger.error("Object should be a Job Manager Command.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Job Manager Command."); + } + case LOCAL_SUBMISSION: + if (o instanceof LocalSubmission) { + return createLocalSubmission((LocalSubmission) o); + } else { + logger.error("Object should be a Local Submission.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Local Submission."); + } + case LOCAL_DATA_MOVEMENT: + if (o instanceof LocalDataMovement) { + return createLocalDataMovement((LocalDataMovement) o); + } else { + logger.error("Object should be a Local Data Movement.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a Local Data Movement."); + } case MODULE_LOAD_CMD: if (o instanceof ModuleLoadCmd) { return createModuleLoadCmd((ModuleLoadCmd) o); @@ -371,31 +370,10 @@ public class AppCatalogJPAUtils { logger.error("Object should be a Module Load Cmd.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a Module Load Cmd."); } - case WORKFLOW: - if (o instanceof Workflow) { - return createWorkflow((Workflow) o); - } else { - logger.error("Object should be a Workflow.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Workflow."); - } - case WORKFLOW_INPUT: - if (o instanceof WorkflowInput){ - return createWorflowInput((WorkflowInput) o); - }else { - logger.error("Object should be a Workflow Input.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Workflow Input."); - } - case WORKFLOW_OUTPUT: - if (o instanceof WorkflowOutput){ - return createWorkflowOutput((WorkflowOutput) o); - }else { - logger.error("Object should be a Workflow Output.", new IllegalArgumentException()); - throw new IllegalArgumentException("Object should be a Workflow Output."); - } case GATEWAY_CLIENT_CREDENTIAL: - if (o instanceof GatewayClientCredential){ + if (o instanceof GatewayClientCredential) { return createGatewayClientCredential((GatewayClientCredential) o); - }else { + } else { logger.error("Object should be a Gateway Client Credential.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a Gateway Client Credential."); } @@ -404,103 +382,103 @@ public class AppCatalogJPAUtils { throw new IllegalArgumentException("Illegal data type.."); } } - - private static AppCatalogResource createLocalDataMovement(LocalDataMovement o) { - LocalDataMovementResource localDataMovementResource = new LocalDataMovementResource(); - if (o != null){ + + private static AppCatalogResource createLocalDataMovement(LocalDataMovement o) { + LocalDataMovementResource localDataMovementResource = new LocalDataMovementResource(); + if (o != null) { localDataMovementResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId()); } - return localDataMovementResource; - } - + return localDataMovementResource; + } + private static AppCatalogResource createLocalSubmission(LocalSubmission o) { - LocalSubmissionResource localSubmissionResource = new LocalSubmissionResource(); - if (o != null){ + LocalSubmissionResource localSubmissionResource = new LocalSubmissionResource(); + if (o != null) { localSubmissionResource.setResourceJobManagerId(o.getResourceJobManagerId()); - localSubmissionResource.setResourceJobManagerResource((ResourceJobManagerResource)createResourceJobManager(o.getResourceJobManager())); + localSubmissionResource.setResourceJobManagerResource((ResourceJobManagerResource) createResourceJobManager(o.getResourceJobManager())); localSubmissionResource.setJobSubmissionInterfaceId(o.getJobSubmissionInterfaceId()); localSubmissionResource.setCreatedTime(o.getCreationTime()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { localSubmissionResource.setUpdatedTime(o.getUpdateTime()); } } - return localSubmissionResource; - } - + return localSubmissionResource; + } + private static AppCatalogResource createJobManagerCommand(JobManagerCommand o) { - JobManagerCommandResource jobManagerCommandResource = new JobManagerCommandResource(); - if (o != null){ + JobManagerCommandResource jobManagerCommandResource = new JobManagerCommandResource(); + if (o != null) { jobManagerCommandResource.setResourceJobManagerId(o.getResourceJobManagerId()); - jobManagerCommandResource.setResourceJobManagerResource((ResourceJobManagerResource)createResourceJobManager(o.getResourceJobManager())); + jobManagerCommandResource.setResourceJobManagerResource((ResourceJobManagerResource) createResourceJobManager(o.getResourceJobManager())); jobManagerCommandResource.setCommandType(o.getCommandType()); jobManagerCommandResource.setCommand(o.getCommand()); } - return jobManagerCommandResource; - } - + return jobManagerCommandResource; + } + private static AppCatalogResource createResourceJobManager(ResourceJobManager o) { - ResourceJobManagerResource resourceJobManagerResource = new ResourceJobManagerResource(); + ResourceJobManagerResource resourceJobManagerResource = new ResourceJobManagerResource(); if (o != null) { resourceJobManagerResource.setResourceJobManagerId(o.getResourceJobManagerId()); resourceJobManagerResource.setPushMonitoringEndpoint(o.getPushMonitoringEndpoint()); resourceJobManagerResource.setJobManagerBinPath(o.getJobManagerBinPath()); resourceJobManagerResource.setResourceJobManagerType(o.getResourceJobManagerType()); resourceJobManagerResource.setCreatedTime(o.getCreationTime()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { resourceJobManagerResource.setUpdatedTime(o.getUpdateTime()); } } - return resourceJobManagerResource; - } - + return resourceJobManagerResource; + } + private static AppCatalogResource createDataMovementInterface(DataMovementInterface o) { - DataMovementInterfaceResource dataMovementInterfaceResource = new DataMovementInterfaceResource(); + DataMovementInterfaceResource dataMovementInterfaceResource = new DataMovementInterfaceResource(); if (o != null) { dataMovementInterfaceResource.setComputeResourceId(o.getComputeResourceId()); - dataMovementInterfaceResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource())); + dataMovementInterfaceResource.setComputeHostResource((ComputeResourceResource) createComputeResource(o.getComputeResource())); dataMovementInterfaceResource.setDataMovementProtocol(o.getDataMovementProtocol()); dataMovementInterfaceResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId()); dataMovementInterfaceResource.setPriorityOrder(o.getPriorityOrder()); dataMovementInterfaceResource.setCreatedTime(o.getCreationTime()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { dataMovementInterfaceResource.setUpdatedTime(o.getUpdateTime()); } } - return dataMovementInterfaceResource; - } - + return dataMovementInterfaceResource; + } + private static AppCatalogResource createJobSubmissionInterface(JobSubmissionInterface o) { - JobSubmissionInterfaceResource jobSubmissionInterfaceResource = new JobSubmissionInterfaceResource(); + JobSubmissionInterfaceResource jobSubmissionInterfaceResource = new JobSubmissionInterfaceResource(); if (o != null) { jobSubmissionInterfaceResource.setJobSubmissionInterfaceId(o.getJobSubmissionInterfaceId()); jobSubmissionInterfaceResource.setComputeResourceId(o.getComputeResourceId()); - jobSubmissionInterfaceResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource())); + jobSubmissionInterfaceResource.setComputeHostResource((ComputeResourceResource) createComputeResource(o.getComputeResource())); jobSubmissionInterfaceResource.setJobSubmissionProtocol(o.getJobSubmissionProtocol()); jobSubmissionInterfaceResource.setPriorityOrder(o.getPriorityOrder()); jobSubmissionInterfaceResource.setCreatedTime(o.getCreationTime()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { jobSubmissionInterfaceResource.setUpdatedTime(o.getUpdateTime()); } } - return jobSubmissionInterfaceResource; - } - + return jobSubmissionInterfaceResource; + } + private static AppCatalogResource createComputeResourceFileSystem(ComputeResourceFileSystem o) { - ComputeResourceFileSystemResource computeResourceFileSystemResource = new ComputeResourceFileSystemResource(); - if (o != null){ + ComputeResourceFileSystemResource computeResourceFileSystemResource = new ComputeResourceFileSystemResource(); + if (o != null) { computeResourceFileSystemResource.setComputeResourceId(o.getComputeResourceId()); - computeResourceFileSystemResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource())); + computeResourceFileSystemResource.setComputeHostResource((ComputeResourceResource) createComputeResource(o.getComputeResource())); computeResourceFileSystemResource.setPath(o.getPath()); computeResourceFileSystemResource.setFileSystem(o.getFileSystem()); } - return computeResourceFileSystemResource; - } - + return computeResourceFileSystemResource; + } + private static AppCatalogResource createBatchQueue(BatchQueue o) { - BatchQueueResource batchQueueResource = new BatchQueueResource(); - if (o != null){ + BatchQueueResource batchQueueResource = new BatchQueueResource(); + if (o != null) { batchQueueResource.setComputeResourceId(o.getComputeResourceId()); - batchQueueResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource())); + batchQueueResource.setComputeHostResource((ComputeResourceResource) createComputeResource(o.getComputeResource())); batchQueueResource.setMaxRuntime(o.getMaxRuntime()); batchQueueResource.setMaxJobInQueue(o.getMaxJobInQueue()); batchQueueResource.setQueueDescription(o.getQueueDescription()); @@ -509,10 +487,11 @@ public class AppCatalogJPAUtils { batchQueueResource.setMaxNodes(o.getMaxNodes()); batchQueueResource.setMaxMemory(o.getMaxMemory()); } - return batchQueueResource; - } + return batchQueueResource; + } + private static AppCatalogResource createComputeResource(ComputeResource o) { - ComputeResourceResource computeResourceResource = new ComputeResourceResource(); + ComputeResourceResource computeResourceResource = new ComputeResourceResource(); if (o != null) { computeResourceResource.setResourceDescription(o.getResourceDescription()); computeResourceResource.setResourceId(o.getResourceId()); @@ -520,29 +499,29 @@ public class AppCatalogJPAUtils { computeResourceResource.setCreatedTime(o.getCreationTime()); computeResourceResource.setEnabled(o.getEnabled()); computeResourceResource.setMaxMemoryPerNode(o.getMaxMemoryPerNode()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { computeResourceResource.setUpdatedTime(o.getUpdateTime()); } } - return computeResourceResource; - } + return computeResourceResource; + } private static AppCatalogResource createHostAlias(HostAlias o) { HostAliasAppResource aliasResource = new HostAliasAppResource(); - if (o != null){ + if (o != null) { aliasResource.setResourceID(o.getResourceID()); aliasResource.setAlias(o.getAlias()); - aliasResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource())); + aliasResource.setComputeHostResource((ComputeResourceResource) createComputeResource(o.getComputeResource())); } return aliasResource; } private static AppCatalogResource createHostIPAddress(HostIPAddress o) { HostIPAddressResource ipAddressResource = new HostIPAddressResource(); - if (o != null){ + if (o != null) { ipAddressResource.setResourceID(o.getResourceID()); ipAddressResource.setIpaddress(o.getIpaddress()); - ipAddressResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource())); + ipAddressResource.setComputeHostResource((ComputeResourceResource) createComputeResource(o.getComputeResource())); } return ipAddressResource; } @@ -558,8 +537,7 @@ public class AppCatalogJPAUtils { } return submissionResource; } - - + private static AppCatalogResource createUnicoreJobSubmission(UnicoreJobSubmission o) { UnicoreJobSubmissionResource submissionResource = new UnicoreJobSubmissionResource(); if (o != null) { @@ -579,18 +557,18 @@ public class AppCatalogJPAUtils { } return dataMovementResource; } - - private static AppCatalogResource createGSISSHExport(GSISSHExport o){ + + private static AppCatalogResource createGSISSHExport(GSISSHExport o) { GSISSHExportResource resource = new GSISSHExportResource(); if (o != null) { resource.setSubmissionID(o.getSubmissionID()); resource.setExport(o.getExport()); - resource.setGsisshSubmissionResource((GSISSHSubmissionResource)createGSSISSHSubmission(o.getGsisshJobSubmission())); + resource.setGsisshSubmissionResource((GSISSHSubmissionResource) createGSSISSHSubmission(o.getGsisshJobSubmission())); } return resource; } - private static AppCatalogResource createPreJobCommand(PreJobCommand o){ + private static AppCatalogResource createPreJobCommand(PreJobCommand o) { PreJobCommandResource resource = new PreJobCommandResource(); if (o != null) { resource.setAppDeploymentId(o.getDeploymentId()); @@ -601,9 +579,9 @@ public class AppCatalogJPAUtils { return resource; } - private static AppCatalogResource createPostJObCommand(PostJobCommand o){ + private static AppCatalogResource createPostJObCommand(PostJobCommand o) { PostJobCommandResource resource = new PostJobCommandResource(); - if (o != null){ + if (o != null) { resource.setAppDeploymentId(o.getDeploymentId()); resource.setCommand(o.getCommand()); resource.setOrder(o.getOrder()); @@ -614,7 +592,7 @@ public class AppCatalogJPAUtils { private static AppCatalogResource createGlobusJobSubmission(GlobusJobSubmission o) { GlobusJobSubmissionResource resource = new GlobusJobSubmissionResource(); - if (o != null){ + if (o != null) { resource.setSubmissionID(o.getSubmissionID()); resource.setResourceJobManager(o.getResourceJobManager()); resource.setSecurityProtocol(o.getSecurityProtocol()); @@ -624,15 +602,15 @@ public class AppCatalogJPAUtils { private static AppCatalogResource createGlobusEndpoint(GlobusGKEndpoint o) { GlobusGKEndpointResource resource = new GlobusGKEndpointResource(); - if (o != null){ + if (o != null) { resource.setSubmissionID(o.getSubmissionID()); resource.setEndpoint(o.getEndpoint()); - resource.setGlobusJobSubmissionResource((GlobusJobSubmissionResource)createGlobusJobSubmission(o.getGlobusSubmission())); + resource.setGlobusJobSubmissionResource((GlobusJobSubmissionResource) createGlobusJobSubmission(o.getGlobusSubmission())); } return resource; } - - private static AppCatalogResource createSshJobSubmission(SshJobSubmission o) { + + private static AppCatalogResource createSshJobSubmission(SshJobSubmission o) { SshJobSubmissionResource sshJobSubmissionResource = new SshJobSubmissionResource(); if (o != null) { sshJobSubmissionResource.setResourceJobManagerId(o.getResourceJobManagerId()); @@ -643,7 +621,7 @@ public class AppCatalogJPAUtils { sshJobSubmissionResource.setSshPort(o.getSshPort()); sshJobSubmissionResource.setMonitorMode(o.getMonitorMode()); sshJobSubmissionResource.setCreatedTime(o.getCreationTime()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { sshJobSubmissionResource.setUpdatedTime(o.getUpdateTime()); } } @@ -651,47 +629,47 @@ public class AppCatalogJPAUtils { } private static AppCatalogResource createScpDataMovement(ScpDataMovement o) { - ScpDataMovementResource scpDataMovementResource = new ScpDataMovementResource(); - if (o != null){ + ScpDataMovementResource scpDataMovementResource = new ScpDataMovementResource(); + if (o != null) { scpDataMovementResource.setQueueDescription(o.getQueueDescription()); scpDataMovementResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId()); scpDataMovementResource.setSecurityProtocol(o.getSecurityProtocol()); scpDataMovementResource.setAlternativeScpHostname(o.getAlternativeScpHostname()); scpDataMovementResource.setSshPort(o.getSshPort()); scpDataMovementResource.setCreatedTime(o.getCreationTime()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { scpDataMovementResource.setUpdatedTime(o.getUpdateTime()); } } - return scpDataMovementResource; - } + return scpDataMovementResource; + } private static AppCatalogResource createGridftpDataMovement(GridftpDataMovement o) { - GridftpDataMovementResource gridftpDataMovementResource = new GridftpDataMovementResource(); - if (o != null){ + GridftpDataMovementResource gridftpDataMovementResource = new GridftpDataMovementResource(); + if (o != null) { gridftpDataMovementResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId()); gridftpDataMovementResource.setSecurityProtocol(o.getSecurityProtocol()); gridftpDataMovementResource.setCreatedTime(o.getCreationTime()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { gridftpDataMovementResource.setUpdatedTime(o.getUpdateTime()); } } - return gridftpDataMovementResource; - } + return gridftpDataMovementResource; + } private static AppCatalogResource createGridftpEndpoint(GridftpEndpoint o) { - GridftpEndpointResource gridftpEndpointResource = new GridftpEndpointResource(); - if (o != null){ + GridftpEndpointResource gridftpEndpointResource = new GridftpEndpointResource(); + if (o != null) { gridftpEndpointResource.setEndpoint(o.getEndpoint()); gridftpEndpointResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId()); - gridftpEndpointResource.setGridftpDataMovementResource((GridftpDataMovementResource)createGridftpDataMovement(o.getGridftpDataMovement())); + gridftpEndpointResource.setGridftpDataMovementResource((GridftpDataMovementResource) createGridftpDataMovement(o.getGridftpDataMovement())); gridftpEndpointResource.setCreatedTime(o.getCreationTime()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { gridftpEndpointResource.setUpdatedTime(o.getUpdateTime()); } } - return gridftpEndpointResource; - } + return gridftpEndpointResource; + } // private static Resource createJobSubmissionProtocol(JobSubmissionProtocol o) { // JobSubmissionProtocolResource resource = new JobSubmissionProtocolResource(); @@ -717,14 +695,14 @@ public class AppCatalogJPAUtils { private static AppCatalogResource createApplicationModule(ApplicationModule o) { AppModuleResource moduleResource = new AppModuleResource(); - if (o != null){ + if (o != null) { moduleResource.setModuleId(o.getModuleID()); moduleResource.setModuleDesc(o.getModuleDesc()); moduleResource.setGatewayId(o.getGatewayId()); moduleResource.setModuleName(o.getModuleName()); moduleResource.setModuleVersion(o.getModuleVersion()); moduleResource.setCreatedTime(o.getCreationTime()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { moduleResource.setUpdatedTime(o.getUpdateTime()); } } @@ -733,7 +711,7 @@ public class AppCatalogJPAUtils { private static AppCatalogResource createApplicationDeployment(ApplicationDeployment o) { AppDeploymentResource resource = new AppDeploymentResource(); - if (o != null){ + if (o != null) { resource.setDeploymentId(o.getDeploymentID()); resource.setAppDes(o.getApplicationDesc()); resource.setAppModuleId(o.getAppModuleID()); @@ -744,7 +722,7 @@ public class AppCatalogJPAUtils { resource.setModuleResource((AppModuleResource) createApplicationModule(o.getApplicationModule())); resource.setHostResource((ComputeResourceResource) createComputeResource(o.getComputeResource())); resource.setCreatedTime(o.getCreationTime()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { resource.setUpdatedTime(o.getUpdateTime()); } } @@ -753,7 +731,7 @@ public class AppCatalogJPAUtils { private static AppCatalogResource createLibraryPrepPathResource(LibraryPrepandPath o) { LibraryPrepandPathResource resource = new LibraryPrepandPathResource(); - if (o != null){ + if (o != null) { resource.setDeploymentId(o.getDeploymentID()); resource.setName(o.getName()); resource.setValue(o.getValue()); @@ -764,36 +742,36 @@ public class AppCatalogJPAUtils { private static AppCatalogResource createLibraryApendPathResource(LibraryApendPath o) { LibraryApendPathResource resource = new LibraryApendPathResource(); - if (o != null){ + if (o != null) { resource.setDeploymentId(o.getDeploymentID()); resource.setName(o.getName()); resource.setValue(o.getValue()); - resource.setAppDeploymentResource((AppDeploymentResource)createApplicationDeployment(o.getApplicationDeployment())); + resource.setAppDeploymentResource((AppDeploymentResource) createApplicationDeployment(o.getApplicationDeployment())); } return resource; } private static AppCatalogResource createAppEnvironmentResource(AppEnvironment o) { AppEnvironmentResource resource = new AppEnvironmentResource(); - if (o != null){ + if (o != null) { resource.setDeploymentId(o.getDeploymentID()); resource.setName(o.getName()); resource.setValue(o.getValue()); resource.setOrder(o.getOrder()); - resource.setAppDeploymentResource((AppDeploymentResource)createApplicationDeployment(o.getApplicationDeployment())); + resource.setAppDeploymentResource((AppDeploymentResource) createApplicationDeployment(o.getApplicationDeployment())); } return resource; } private static AppCatalogResource createAppInterfaceResource(ApplicationInterface o) { AppInterfaceResource resource = new AppInterfaceResource(); - if (o != null){ + if (o != null) { resource.setInterfaceId(o.getInterfaceID()); resource.setAppName(o.getAppName()); resource.setAppDescription(o.getAppDescription()); resource.setCreatedTime(o.getCreationTime()); resource.setGatewayId(o.getGatewayId()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { resource.setUpdatedTime(o.getUpdateTime()); } } @@ -802,7 +780,7 @@ public class AppCatalogJPAUtils { private static AppCatalogResource createAppModMappingResource(AppModuleMapping o) { AppModuleMappingAppCatalogResourceAppCat resource = new AppModuleMappingAppCatalogResourceAppCat(); - if (o != null){ + if (o != null) { resource.setInterfaceId(o.getInterfaceID()); resource.setModuleId(o.getModuleID()); } @@ -811,7 +789,7 @@ public class AppCatalogJPAUtils { private static AppCatalogResource createApplicationInput(ApplicationIntInput o) { ApplicationInputResource resource = new ApplicationInputResource(); - if (o != null){ + if (o != null) { resource.setInterfaceID(o.getInterfaceID()); resource.setInputKey(o.getInputKey()); resource.setInputVal(o.getInputVal()); @@ -824,36 +802,14 @@ public class AppCatalogJPAUtils { resource.setRequired(o.isRequired()); resource.setRequiredToCMD(o.isRequiredToCMD()); resource.setDataStaged(o.isDataStaged()); - resource.setAppInterfaceResource((AppInterfaceResource)createAppInterfaceResource(o.getApplicationInterface())); - } - return resource; - } - - private static AppCatalogResource createWorflowInput(WorkflowInput o) { - WorkflowInputResource resource = new WorkflowInputResource(); - if (o != null){ - resource.setWfTemplateId(o.getWfTemplateId()); - resource.setInputKey(o.getInputKey()); - if (o.getInputVal() != null){ - resource.setInputVal(new String(o.getInputVal())); - } - resource.setDataType(o.getDataType()); - resource.setMetadata(o.getMetadata()); - resource.setAppArgument(o.getAppArgument()); - resource.setInputOrder(o.getInputOrder()); - resource.setUserFriendlyDesc(o.getUserFriendlyDesc()); - resource.setStandardInput(o.isStandardInput()); - resource.setRequired(o.isRequired()); - resource.setRequiredToCMD(o.isRequiredToCMD()); - resource.setDataStaged(o.isDataStaged()); - resource.setWorkflowResource((WorkflowResource)createWorkflow(o.getWorkflow())); + resource.setAppInterfaceResource((AppInterfaceResource) createAppInterfaceResource(o.getApplicationInterface())); } return resource; } private static AppCatalogResource createApplicationOutput(ApplicationIntOutput o) { ApplicationOutputResource resource = new ApplicationOutputResource(); - if (o != null){ + if (o != null) { resource.setInterfaceID(o.getInterfaceID()); resource.setOutputKey(o.getOutputKey()); resource.setOutputVal(o.getOutputVal()); @@ -865,31 +821,14 @@ public class AppCatalogJPAUtils { resource.setSearchQuery(o.getSearchQuery()); resource.setAppArgument(o.getApplicationArgument()); resource.setOutputStreaming(o.isOutputStreaming()); - resource.setAppInterfaceResource((AppInterfaceResource)createAppInterfaceResource(o.getApplicationInterface())); - } - return resource; - } - - private static AppCatalogResource createWorkflowOutput(WorkflowOutput o) { - WorkflowOutputResource resource = new WorkflowOutputResource(); - if (o != null){ - resource.setWfTemplateId(o.getWfTemplateId()); - resource.setOutputKey(o.getOutputKey()); - if (o.getOutputVal() != null){ - resource.setOutputVal(new String(o.getOutputVal())); - } - resource.setDataType(o.getDataType()); - resource.setValidityType(o.getValidityType()); - resource.setDataMovement(o.isDataMovement()); - resource.setDataNameLocation(o.getDataNameLocation()); - resource.setWorkflowResource((WorkflowResource)createWorkflow(o.getWorkflow())); + resource.setAppInterfaceResource((AppInterfaceResource) createAppInterfaceResource(o.getApplicationInterface())); } return resource; } private static AppCatalogResource createGatewayClientCredential(GatewayClientCredential o) { GatewayClientCredentialResource resource = new GatewayClientCredentialResource(); - if (o != null){ + if (o != null) { resource.setClientKey(o.getClientKey()); resource.setClientSecret(o.getClientSecret()); resource.setGatewayId(o.getGatewayId()); @@ -903,7 +842,7 @@ public class AppCatalogJPAUtils { resource.setGatewayID(o.getGatewayID()); resource.setCreatedTime(o.getCreationTime()); resource.setCredentialStoreToken(o.getCredentialStoreToken()); - if (o.getUpdateTime() != null){ + if (o.getUpdateTime() != null) { resource.setUpdatedTime(o.getUpdateTime()); } } @@ -960,38 +899,20 @@ public class AppCatalogJPAUtils { resource.setDataMovementInterfaceId(o.getDataMovementInterfaceId()); resource.setDataMovementProtocol(o.getDataMovementProtocol()); resource.setPriorityOrder(o.getPriorityOrder()); - resource.setStorageResourceResource((StorageResourceResource)createStorageResource(o.getStorageResource())); + resource.setStorageResourceResource((StorageResourceResource) createStorageResource(o.getStorageResource())); } return resource; } private static AppCatalogResource createModuleLoadCmd(ModuleLoadCmd o) { ModuleLoadCmdResource moduleLoadCmdResource = new ModuleLoadCmdResource(); - if (o != null){ + if (o != null) { moduleLoadCmdResource.setCmd(o.getCmd()); moduleLoadCmdResource.setAppDeploymentId(o.getAppDeploymentId()); moduleLoadCmdResource.setOrder(o.getOrder()); - moduleLoadCmdResource.setAppDeploymentResource((AppDeploymentResource)createApplicationDeployment(o.getApplicationDeployment())); + moduleLoadCmdResource.setAppDeploymentResource((AppDeploymentResource) createApplicationDeployment(o.getApplicationDeployment())); } return moduleLoadCmdResource; } - - private static AppCatalogResource createWorkflow(Workflow o) { - WorkflowResource workflowResource = new WorkflowResource(); - workflowResource.setWfName(o.getWfName()); - workflowResource.setCreatedUser(o.getCreatedUser()); - if (o.getGraph() != null){ - workflowResource.setGraph(new String(o.getGraph())); - } - if (o.getImage() != null){ - workflowResource.setImage(new String(o.getImage())); - } - workflowResource.setCreatedTime(o.getCreationTime()); - if (o.getUpdateTime() != null){ - workflowResource.setUpdatedTime(o.getUpdateTime()); - } - workflowResource.setWfTemplateId(o.getWfTemplateId()); - workflowResource.setGatewayId(o.getGatewayId()); - return workflowResource; - } } + http://git-wip-us.apache.org/repos/asf/airavata/blob/2a2782a6/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java index 66a8a03..e30ea06 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java @@ -63,8 +63,5 @@ public enum AppCatalogResourceType { LOCAL_DATA_MOVEMENT, MODULE_LOAD_CMD, ClOUD_SUBMISSION, - WORKFLOW, - WORKFLOW_INPUT, - WORKFLOW_OUTPUT, GATEWAY_CLIENT_CREDENTIAL, } http://git-wip-us.apache.org/repos/asf/airavata/blob/2a2782a6/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java index 1420fd1..056181f 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java @@ -21,7 +21,6 @@ package org.apache.airavata.registry.core.app.catalog.util; -import org.apache.airavata.model.Workflow; import org.apache.airavata.model.appcatalog.appdeployment.*; import org.apache.airavata.model.appcatalog.appinterface.*; import org.apache.airavata.model.appcatalog.computeresource.*; @@ -846,30 +845,6 @@ public class AppCatalogThriftConversion { return preferences; } - public static InputDataObjectType getWorkflowInput (WorkflowInputResource resource){ - InputDataObjectType input = new InputDataObjectType(); - input.setName(resource.getInputKey()); - input.setApplicationArgument(resource.getAppArgument()); - input.setInputOrder(resource.getInputOrder()); - input.setType(DataType.valueOf(resource.getDataType())); - input.setMetaData(resource.getMetadata()); - input.setUserFriendlyDescription(resource.getUserFriendlyDesc()); - input.setIsRequired(resource.getRequired()); - input.setRequiredToAddedToCommandLine(resource.getRequiredToCMD()); - input.setDataStaged(resource.isDataStaged()); - return input; - } - - public static List getWFInputs(List resources){ - List inputResources = new ArrayList(); - if (resources != null && !resources.isEmpty()){ - for (AppCatalogResource resource : resources){ - inputResources.add(getWorkflowInput((WorkflowInputResource) resource)); - } - } - return inputResources; - } - public static GatewayResourceProfile getGatewayResourceProfile(GatewayProfileResource gw, List preferences, List storagePreferences){ GatewayResourceProfile gatewayProfile = new GatewayResourceProfile(); gatewayProfile.setGatewayID(gw.getGatewayID()); @@ -879,18 +854,4 @@ public class AppCatalogThriftConversion { return gatewayProfile; } - public static Workflow getWorkflow (WorkflowResource resource) throws AppCatalogException { - Workflow workflow = new Workflow(); - workflow.setTemplateId(resource.getWfTemplateId()); - workflow.setGraph(resource.getGraph()); - workflow.setName(resource.getWfName()); - if (resource.getImage() != null){ - workflow.setImage(resource.getImage().getBytes()); - } - WorkflowInputResource inputResource = new WorkflowInputResource(); - List resources = inputResource.get(AppCatAbstractResource.WFInputConstants.WF_TEMPLATE_ID, resource.getWfTemplateId()); - workflow.setWorkflowInputs(getWFInputs(resources)); - - return workflow; - } } http://git-wip-us.apache.org/repos/asf/airavata/blob/2a2782a6/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/ComponentStatus.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/ComponentStatus.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/ComponentStatus.java index b6353b4..92c06de 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/ComponentStatus.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/ComponentStatus.java @@ -43,6 +43,13 @@ public class ComponentStatus implements Serializable { @Column(name = "UPDATE_TIME") private Timestamp updateTime; + @Column(name = "TEMPLATE_ID") + private String templateId; + + @ManyToOne(cascade= CascadeType.MERGE) + @JoinColumn(name = "TEMPLATE_ID") + private Workflow workflow; + public String getStatusId() { return statusId; } @@ -74,5 +81,21 @@ public class ComponentStatus implements Serializable { public void setUpdateTime(Timestamp updateTime) { this.updateTime = updateTime; } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public Workflow getWorkflow() { + return workflow; + } + + public void setWorkflow(Workflow workflow) { + this.workflow = workflow; + } } http://git-wip-us.apache.org/repos/asf/airavata/blob/2a2782a6/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Edge.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Edge.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Edge.java index 48ececb..8078000 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Edge.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Edge.java @@ -48,6 +48,9 @@ public class Edge implements Serializable { @Column(name = "DESCRIPTION") private String description; + @Column(name = "CREATED_TIME") + private Timestamp createdTime; + @ManyToOne(cascade= CascadeType.MERGE) @JoinColumn(name = "TEMPLATE_ID") private Workflow workflow; @@ -99,5 +102,13 @@ public class Edge implements Serializable { public void setWorkflow(Workflow workflow) { this.workflow = workflow; } + + public Timestamp getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(Timestamp createdTime) { + this.createdTime = createdTime; + } } http://git-wip-us.apache.org/repos/asf/airavata/blob/2a2782a6/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Node.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Node.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Node.java index 0711ad5..54bd079 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Node.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Node.java @@ -24,6 +24,7 @@ package org.apache.airavata.registry.core.workflow.catalog.model; import javax.persistence.*; import java.io.Serializable; +import java.sql.Timestamp; @Entity @Table(name = "NODE") @@ -53,6 +54,9 @@ public class Node implements Serializable { @Column(name = "APPLICATION_NAME") private String applicationName; + @Column(name = "CREATED_TIME") + private Timestamp createdTime; + @ManyToOne(cascade= CascadeType.MERGE) @JoinColumn(name = "TEMPLATE_ID") private Workflow workflow; @@ -120,5 +124,13 @@ public class Node implements Serializable { public void setApplicationName(String applicationName) { this.applicationName = applicationName; } + + public Timestamp getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(Timestamp createdTime) { + this.createdTime = createdTime; + } } http://git-wip-us.apache.org/repos/asf/airavata/blob/2a2782a6/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Port.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Port.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Port.java index f0be41f..0badd6e 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Port.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/workflow/catalog/model/Port.java @@ -24,6 +24,7 @@ package org.apache.airavata.registry.core.workflow.catalog.model; import javax.persistence.*; import java.io.Serializable; +import java.sql.Timestamp; @Entity @Table(name = "PORT") @@ -47,6 +48,9 @@ public class Port implements Serializable { @Column(name = "DESCRIPTION") private String description; + @Column(name = "CREATED_TIME") + private Timestamp createdTime; + @ManyToOne(cascade= CascadeType.MERGE) @JoinColumn(name = "TEMPLATE_ID") private Workflow workflow; @@ -98,5 +102,13 @@ public class Port implements Serializable { public void setPortId(String portId) { this.portId = portId; } + + public Timestamp getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(Timestamp createdTime) { + this.createdTime = createdTime; + } }