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 26DADDD1F for ; Fri, 2 Nov 2012 22:22:30 +0000 (UTC) Received: (qmail 51466 invoked by uid 500); 2 Nov 2012 22:22:30 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 51438 invoked by uid 500); 2 Nov 2012 22:22:30 -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 51430 invoked by uid 99); 2 Nov 2012 22:22:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Nov 2012 22:22:30 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Nov 2012 22:22:28 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0DADA23889D7 for ; Fri, 2 Nov 2012 22:22:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1405183 - in /airavata/trunk/modules: airavata-client/src/main/java/org/apache/airavata/client/api/ airavata-client/src/main/java/org/apache/airavata/client/impl/ registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance... Date: Fri, 02 Nov 2012 22:22:07 -0000 To: commits@airavata.apache.org From: samindaw@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121102222208.0DADA23889D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: samindaw Date: Fri Nov 2 22:22:07 2012 New Revision: 1405183 URL: http://svn.apache.org/viewvc?rev=1405183&view=rev Log: add functions to the API to return workflow inputs, return all workflows (published & private), work with published workflows from airavata api, search experiments by their name Added: airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/WorkflowData.java (with props) Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/WorkflowManager.java airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/WorkflowManager.java URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/WorkflowManager.java?rev=1405183&r1=1405182&r2=1405183&view=diff ============================================================================== --- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/WorkflowManager.java (original) +++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/WorkflowManager.java Fri Nov 2 22:22:07 2012 @@ -22,8 +22,11 @@ package org.apache.airavata.client.api; import java.util.List; +import java.util.Map; import org.apache.airavata.workflow.model.wf.Workflow; +import org.apache.airavata.workflow.model.wf.WorkflowData; +import org.apache.airavata.workflow.model.wf.WorkflowInput; public interface WorkflowManager { @@ -184,6 +187,29 @@ public interface WorkflowManager { * @param templateID * @return */ - public List getWorkflowServiceNodeIDs(String templateID) throws AiravataAPIInvocationException;; + public List getWorkflowServiceNodeIDs(String templateID) throws AiravataAPIInvocationException; + + + + //--------------------------------------------------------------------------------- + + + public boolean isPublishedWorkflowExists(String workflowName) throws AiravataAPIInvocationException; + public void publishWorkflow(String workflowName, String publishWorkflowName) throws AiravataAPIInvocationException; + public void publishWorkflow(String workflowName) throws AiravataAPIInvocationException; + + public String getPublishedWorkflowGraphXML(String workflowName) throws AiravataAPIInvocationException; + public Workflow getPublishedWorkflow(String workflowName) throws AiravataAPIInvocationException; + public List getPublishedWorkflowNames() throws AiravataAPIInvocationException; + public Map getPublishedWorkflows() throws AiravataAPIInvocationException; + + public void removePublishedWorkflow(String workflowName)throws AiravataAPIInvocationException; + + public List getWorkflowInputs(String workflowName) throws AiravataAPIInvocationException, Exception; + + public List getWorkflowInputs(WorkflowData workflowData) throws AiravataAPIInvocationException, Exception; + + public List getAllWorkflows() throws AiravataAPIInvocationException; + } Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java?rev=1405183&r1=1405182&r2=1405183&view=diff ============================================================================== --- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java (original) +++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java Fri Nov 2 22:22:07 2012 @@ -22,15 +22,18 @@ package org.apache.airavata.client.impl; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.airavata.client.AiravataClient; import org.apache.airavata.client.api.AiravataAPIInvocationException; import org.apache.airavata.client.api.WorkflowManager; -import org.apache.airavata.registry.api.exception.RegistryException; import org.apache.airavata.common.utils.XMLUtil; +import org.apache.airavata.registry.api.exception.RegistryException; import org.apache.airavata.workflow.model.wf.Workflow; +import org.apache.airavata.workflow.model.wf.WorkflowData; +import org.apache.airavata.workflow.model.wf.WorkflowInput; public class WorkflowManagerImpl implements WorkflowManager { private AiravataClient client; @@ -213,4 +216,117 @@ public class WorkflowManagerImpl impleme return getWorkflow(templateID).getWorkflowServiceNodeIDs(); } + @Override + public boolean isPublishedWorkflowExists(String workflowName) + throws AiravataAPIInvocationException { + try { + return getClient().getRegistry().isPublishedWorkflowExists(workflowName); + } catch (RegistryException e) { + throw new AiravataAPIInvocationException(e); + } + } + + @Override + public void publishWorkflow(String workflowName, String publishWorkflowName) + throws AiravataAPIInvocationException { + try { + getClient().getRegistry().publishWorkflow(workflowName, publishWorkflowName); + } catch (Exception e) { + throw new AiravataAPIInvocationException(e); + } + } + + @Override + public void publishWorkflow(String workflowName) + throws AiravataAPIInvocationException { + try { + getClient().getRegistry().publishWorkflow(workflowName); + } catch (Exception e) { + throw new AiravataAPIInvocationException(e); + } + } + + @Override + public String getPublishedWorkflowGraphXML(String workflowName) + throws AiravataAPIInvocationException { + try { + return getClient().getRegistry().getPublishedWorkflowGraphXML(workflowName); + } catch (Exception e) { + throw new AiravataAPIInvocationException(e); + } + } + + @Override + public Workflow getPublishedWorkflow(String workflowName) + throws AiravataAPIInvocationException { + return getWorkflowFromString(getPublishedWorkflowGraphXML(workflowName)); + } + + @Override + public List getPublishedWorkflowNames() + throws AiravataAPIInvocationException { + try { + return getClient().getRegistry().getPublishedWorkflowNames(); + } catch (RegistryException e) { + throw new AiravataAPIInvocationException(e); + } + } + + @Override + public Map getPublishedWorkflows() + throws AiravataAPIInvocationException { + try { + Map workflows=new HashMap(); + Map publishedWorkflows = getClient().getRegistry().getPublishedWorkflows(); + for (String name : publishedWorkflows.keySet()) { + workflows.put(name, getWorkflowFromString(publishedWorkflows.get(name))); + } + return workflows; + } catch (RegistryException e) { + throw new AiravataAPIInvocationException(e); + } + } + + @Override + public void removePublishedWorkflow(String workflowName) + throws AiravataAPIInvocationException { + try { + getClient().getRegistry().removePublishedWorkflow(workflowName); + } catch (Exception e) { + throw new AiravataAPIInvocationException(e); + } + } + + @Override + public List getWorkflowInputs(String workflowName) throws AiravataAPIInvocationException, Exception { + return getWorkflow(workflowName).getWorkflowInputs(); + } + + @Override + public List getWorkflowInputs(WorkflowData workflowData) throws AiravataAPIInvocationException, Exception { + if (workflowData.isPublished()){ + return getWorkflowFromString(getClient().getRegistry().getPublishedWorkflowGraphXML(workflowData.getName())).getWorkflowInputs(); + }else{ + return getWorkflowInputs(workflowData.getName()); + } + } + + @Override + public List getAllWorkflows() throws AiravataAPIInvocationException { + List list = new ArrayList(); + List workflowTemplateIds = getWorkflowTemplateIds(); + try { + for (String id : workflowTemplateIds) { + list.add(new WorkflowData(id,null,false)); + } + List publishedWorkflowNames = getClient().getRegistry().getPublishedWorkflowNames(); + for (String id : publishedWorkflowNames) { + list.add(new WorkflowData(id,null,false)); + } + return list; + } catch (RegistryException e) { + throw new AiravataAPIInvocationException(e); + } + } + } Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1405183&r1=1405182&r2=1405183&view=diff ============================================================================== --- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java (original) +++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java Fri Nov 2 22:22:07 2012 @@ -22,27 +22,43 @@ package org.apache.airavata.persistance. import java.net.URI; import java.net.URISyntaxException; -import java.sql.*; +import java.sql.Timestamp; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.regex.Pattern; -import org.apache.airavata.registry.api.exception.RegistryException; import org.apache.airavata.commons.gfac.type.ApplicationDeploymentDescription; import org.apache.airavata.commons.gfac.type.HostDescription; import org.apache.airavata.commons.gfac.type.ServiceDescription; import org.apache.airavata.persistance.registry.jpa.JPAResourceAccessor; import org.apache.airavata.persistance.registry.jpa.ResourceUtils; -import org.apache.airavata.persistance.registry.jpa.resources.*; +import org.apache.airavata.persistance.registry.jpa.resources.ApplicationDescriptorResource; +import org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource; +import org.apache.airavata.persistance.registry.jpa.resources.ExperimentDataResource; +import org.apache.airavata.persistance.registry.jpa.resources.ExperimentDataRetriever; +import org.apache.airavata.persistance.registry.jpa.resources.ExperimentMetadataResource; +import org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource; +import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource; +import org.apache.airavata.persistance.registry.jpa.resources.GramDataResource; +import org.apache.airavata.persistance.registry.jpa.resources.HostDescriptorResource; +import org.apache.airavata.persistance.registry.jpa.resources.NodeDataResource; +import org.apache.airavata.persistance.registry.jpa.resources.ProjectResource; +import org.apache.airavata.persistance.registry.jpa.resources.PublishWorkflowResource; +import org.apache.airavata.persistance.registry.jpa.resources.ServiceDescriptorResource; +import org.apache.airavata.persistance.registry.jpa.resources.UserWorkflowResource; +import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource; +import org.apache.airavata.persistance.registry.jpa.resources.WorkflowDataResource; import org.apache.airavata.registry.api.AiravataExperiment; import org.apache.airavata.registry.api.AiravataRegistry2; import org.apache.airavata.registry.api.AiravataUser; import org.apache.airavata.registry.api.Gateway; import org.apache.airavata.registry.api.ResourceMetadata; import org.apache.airavata.registry.api.WorkspaceProject; +import org.apache.airavata.registry.api.exception.RegistryException; import org.apache.airavata.registry.api.exception.UnimplementedRegistryOperationException; import org.apache.airavata.registry.api.exception.gateway.DescriptorAlreadyExistsException; import org.apache.airavata.registry.api.exception.gateway.DescriptorDoesNotExistsException; @@ -1387,4 +1403,19 @@ public class AiravataJPARegistry extends } + @Override + public List searchExperiments(String user, String experimentNameRegex) + throws RegistryException { + Pattern pattern = Pattern.compile(experimentNameRegex); + List filteredExperiments=new ArrayList(); + List allExperimentMetaInformation = getAllExperimentMetaInformation(user); + for (ExperimentData experimentData : allExperimentMetaInformation) { + if (experimentData.getExperimentName()!=null && pattern.matcher(experimentData.getExperimentName()).find()){ + filteredExperiments.add(experimentData); + } + } + return filteredExperiments; + } + + } Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java?rev=1405183&r1=1405182&r2=1405183&view=diff ============================================================================== --- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java (original) +++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java Fri Nov 2 22:22:07 2012 @@ -262,6 +262,8 @@ public interface ProvenanceRegistry exte public ExperimentData getExperimentMetaInformation(String experimentId)throws RegistryException; public List getAllExperimentMetaInformation(String user)throws RegistryException; + + public List searchExperiments(String user, String experimentNameRegex)throws RegistryException; /** * Return experiment ids of experiments launched by the given user @@ -326,4 +328,5 @@ public interface ProvenanceRegistry exte public void updateWorkflowNodeType(WorkflowInstanceNode node, WorkflowNodeType type) throws RegistryException; public void addWorkflowInstanceNode(String workflowInstance, String nodeId) throws RegistryException; + } \ No newline at end of file Added: airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/WorkflowData.java URL: http://svn.apache.org/viewvc/airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/WorkflowData.java?rev=1405183&view=auto ============================================================================== --- airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/WorkflowData.java (added) +++ airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/WorkflowData.java Fri Nov 2 22:22:07 2012 @@ -0,0 +1,66 @@ +/* + * + * 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.workflow.model.wf; + +public class WorkflowData { + private String graphXML; + private boolean published; + private String name; + private boolean lazyLoaded; + + public WorkflowData(String name, String graphXml, boolean published) { + setName(name); + setGraphXML(graphXml); + setPublished(published); + setLazyLoaded(graphXml==null); + } + + public String getGraphXML() throws Exception { + if (isLazyLoaded()){ + throw new Exception("This workflow data is lazy loaded. Please use the API to retrieve the workflow graph!!!"); + } + return graphXML; + } + public void setGraphXML(String graphXML) { + this.graphXML = graphXML; + } + public boolean isPublished() { + return published; + } + public void setPublished(boolean published) { + this.published = published; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + public boolean isLazyLoaded() { + return lazyLoaded; + } + + private void setLazyLoaded(boolean lazyLoaded) { + this.lazyLoaded = lazyLoaded; + } +} Propchange: airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/WorkflowData.java ------------------------------------------------------------------------------ svn:mime-type = text/plain