You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2011/08/12 02:55:27 UTC
svn commit: r1156926 - in /oodt/trunk: ./
app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/
app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/
app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/vi...
Author: mattmann
Date: Fri Aug 12 00:55:26 2011
New Revision: 1156926
URL: http://svn.apache.org/viewvc?rev=1156926&view=rev
Log:
- fix for OODT-208 WorkflowConditions should be identifiable as optional or required
Added:
oodt/trunk/workflow/src/main/resources/examples/optional.workflow.xml (with props)
Modified:
oodt/trunk/CHANGES.txt
oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java
oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java
oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowProcessor.java
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/LuceneWorkflowInstanceRepository.java
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowCondition.java
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java
oodt/trunk/workflow/src/main/resources/examples/conditions.xml
oodt/trunk/workflow/src/main/resources/examples/events.xml
oodt/trunk/workflow/src/main/resources/examples/tasks.xml
oodt/trunk/workflow/src/main/resources/examples/wengine/GranuleMaps.xml
oodt/trunk/workflow/src/main/resources/examples/wengine/hello-goodbye.xml
oodt/trunk/workflow/src/main/resources/workflow.sql
oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowRepository.java
oodt/trunk/workflow/src/testdata/workflow.sql
Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Fri Aug 12 00:55:26 2011
@@ -4,6 +4,9 @@ Apache OODT Change Log
Release 0.4: Current Development
--------------------------------------------
+* OODT-208 WorkflowConditions should be identifiable as optional
+ or required (mattmann)
+
* OODT-209 Workflow Manager Dynamic Workflows (mattmann)
* OODT-211 Sub Workflows (mattmann, per OODT-70)
Modified: oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java
URL: http://svn.apache.org/viewvc/oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java (original)
+++ oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java Fri Aug 12 00:55:26 2011
@@ -52,6 +52,7 @@ public class ModelNode {
private List<String> excusedSubProcessorIds;
private Metadata staticMetadata;
private long timeout;
+ private boolean optional;
public ModelNode(File file) {
super();
@@ -68,6 +69,7 @@ public class ModelNode {
this.excusedSubProcessorIds = new Vector<String>();
this.staticMetadata = new Metadata();
this.timeout = -1;
+ this.optional = false;
}
public ModelNode(File file, String modelId) {
@@ -348,4 +350,18 @@ public class ModelNode {
this.timeout = timeout;
}
+ /**
+ * @return the optional
+ */
+ public boolean isOptional() {
+ return optional;
+ }
+
+ /**
+ * @param optional the optional to set
+ */
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
}
Modified: oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java (original)
+++ oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java Fri Aug 12 00:55:26 2011
@@ -226,6 +226,7 @@ public class XmlWorkflowModelRepository
preConditions.setAttribute("execution", graph.getPreConditions()
.getModel().getExecutionType());
preConditions.setAttribute("timeout", String.valueOf(graph.getModel().getTimeout()));
+ preConditions.setAttribute("optional", String.valueOf(graph.getModel().isOptional()));
for (ModelGraph preCondition : graph.getPreConditions().getChildren()) {
saveGraph(preCondition, preConditions, document);
}
@@ -244,6 +245,7 @@ public class XmlWorkflowModelRepository
postConditions.setAttribute("execution", graph.getPostConditions()
.getModel().getExecutionType());
postConditions.setAttribute("timeout", String.valueOf(graph.getModel().getTimeout()));
+ postConditions.setAttribute("optional", String.valueOf(graph.getModel().isOptional()));
for (ModelGraph postCondition : graph.getPostConditions().getChildren()) {
saveGraph(postCondition, postConditions, document);
}
@@ -317,6 +319,7 @@ public class XmlWorkflowModelRepository
List<String> excused = new Vector<String>();
String clazz = null;
long timeout = -1;
+ boolean optional = false;
boolean entryPoint = false;
NamedNodeMap attributes = workflowNode.getElement().getAttributes();
@@ -342,7 +345,11 @@ public class XmlWorkflowModelRepository
timeout = node.getNodeValue() != null
&& !node.getNodeValue().equals("") ? Long.valueOf(node
.getNodeValue()) : -1;
- } else if (node.getNodeName().startsWith("p:")) {
+ }
+ else if(node.getNodeName().equals("optional")){
+ optional = Boolean.valueOf(node.getNodeValue());
+ }
+ else if (node.getNodeName().startsWith("p:")) {
staticMetadata.replaceMetadata(node.getNodeName().substring(2),
node.getNodeValue());
}
@@ -380,6 +387,7 @@ public class XmlWorkflowModelRepository
modelNode.setInstanceClass(clazz);
modelNode.setEntryPoint(entryPoint);
modelNode.setTimeout(timeout);
+ modelNode.setOptional(optional);
loadConfiguration(rootElements, workflowNode, modelNode, globalConfGroups);
Modified: oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java
URL: http://svn.apache.org/viewvc/oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java (original)
+++ oodt/trunk/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java Fri Aug 12 00:55:26 2011
@@ -361,6 +361,7 @@ public class DefaultPropView extends Vie
masterPanel.add(this.getExecusedIds(state.getSelected()));
if (state.getSelected().getModel().getExecutionType().equals("condition")) {
masterPanel.add(this.getTimeout(state.getSelected(), state));
+ masterPanel.add(this.getOptional(state.getSelected(), state));
}
JScrollPane scrollPane = new JScrollPane(table = this.createTable(state),
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
@@ -701,6 +702,34 @@ public class DefaultPropView extends Vie
return panel;
}
+ private JPanel getOptional(final ModelGraph graph, final ViewState state) {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+ panel.setBorder(new EtchedBorder());
+ panel.add(new JLabel("Optional:"), BorderLayout.NORTH);
+ JPanel checkBoxes = new JPanel();
+ checkBoxes.setLayout(new GridLayout(1, 1));
+ Checkbox checkbox = new Checkbox("ignore", graph.getModel().isOptional());
+ checkBoxes.add(checkbox);
+ checkbox.addItemListener(new ItemListener() {
+
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.DESELECTED)
+ graph.getModel().setOptional(false);
+ else if (e.getStateChange() == ItemEvent.SELECTED)
+ graph.getModel().setOptional(true);
+ else
+ return;
+ DefaultPropView.this.notifyListeners();
+ DefaultPropView.this.refreshView(state);
+ }
+
+ });
+ panel.add(checkBoxes, BorderLayout.CENTER);
+ return panel;
+ }
+
+
private JPanel getExecusedIds(final ModelGraph graph) {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowProcessor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowProcessor.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowProcessor.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowProcessor.java Fri Aug 12 00:55:26 2011
@@ -291,9 +291,9 @@ public abstract class WorkflowProcessor
}
// actually perform the evaluation
- if (!timedOut(c) &&
- !cInst.evaluate(this.workflowInstance.getSharedContext(),
- c.getCondConfig())) {
+ boolean result = false;
+ if (!(result = cInst.evaluate(this.workflowInstance.getSharedContext(),
+ c.getCondConfig())) && !isOptional(c, result) && !timedOut(c)){
return false;
}
}
@@ -301,6 +301,18 @@ public abstract class WorkflowProcessor
return true;
}
+ protected boolean isOptional(WorkflowCondition condition, boolean result) {
+ if (condition.isOptional()) {
+ LOG.log(Level.WARNING, "Condition: [" + condition.getConditionId()
+ + "] is optional: evaluation results: ["+result+"] ignored");
+ return true;
+ } else {
+ LOG.log(Level.INFO, "Condition: [" + condition.getConditionId()
+ + "] is required: evaluation results: ["+result+"] included.");
+ return false;
+ }
+ }
+
protected boolean timedOut(WorkflowCondition condition) {
if (condition.getTimeoutSeconds() == -1)
return false;
Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/LuceneWorkflowInstanceRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/LuceneWorkflowInstanceRepository.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/LuceneWorkflowInstanceRepository.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/LuceneWorkflowInstanceRepository.java Fri Aug 12 00:55:26 2011
@@ -600,6 +600,8 @@ public class LuceneWorkflowInstanceRepos
.getOrder()), Field.Store.YES, Field.Index.NO));
doc.add(new Field(taskId + "_condition_timeout", String.valueOf(cond
.getTimeoutSeconds()), Field.Store.YES, Field.Index.NO));
+ doc.add(new Field(taskId+"_condition_optional", String.valueOf(cond.isOptional()),
+ Field.Store.YES, Field.Index.NO));
}
}
}
@@ -712,6 +714,7 @@ public class LuceneWorkflowInstanceRepos
String[] condOrders = doc.getValues(taskId + "_condition_order");
String[] condIds = doc.getValues(taskId + "_condition_id");
String[] condTimeouts = doc.getValues(taskId+"_condition_timeout");
+ String[] condOptionals = doc.getValues(taskId+"_condition_optional");
if (condNames == null) {
return condList;
@@ -720,7 +723,8 @@ public class LuceneWorkflowInstanceRepos
if (condNames.length != condClasses.length
|| condNames.length != condOrders.length
|| condNames.length != condIds.length
- || condNames.length != condTimeouts.length) {
+ || condNames.length != condTimeouts.length
+ || condNames.length != condOptionals.length) {
LOG.log(Level.WARNING,
"Condition arrays are not of same size when "
+ "rebuilding from given Document");
@@ -734,6 +738,7 @@ public class LuceneWorkflowInstanceRepos
cond.setConditionName(condNames[i]);
cond.setOrder(Integer.parseInt(condOrders[i]));
cond.setTimeoutSeconds(Long.parseLong(condTimeouts[i]));
+ cond.setOptional(Boolean.valueOf(condOptionals[i]));
}
return condList;
Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java Fri Aug 12 00:55:26 2011
@@ -550,6 +550,7 @@ public class PackagedWorkflowRepository
cond.setConditionName(graph.getModelName());
cond.setConditionInstanceClassName(graph.getClazz());
cond.setTimeoutSeconds(graph.getTimeout());
+ cond.setOptional(graph.isOptional());
cond.setCondConfig(convertToConditionConfiguration(staticMetadata));
if (cond.getConditionName() == null
@@ -702,6 +703,8 @@ public class PackagedWorkflowRepository
private String clazz;
private long timeout;
+
+ private boolean optional;
private Graph parent;
@@ -767,6 +770,7 @@ public class PackagedWorkflowRepository
this.children = new Vector<Graph>();
this.parent = null;
this.timeout = -1;
+ this.optional = false;
}
/**
@@ -984,6 +988,20 @@ public class PackagedWorkflowRepository
this.timeout = timeout;
}
+ /**
+ * @return the optional
+ */
+ public boolean isOptional() {
+ return optional;
+ }
+
+ /**
+ * @param optional the optional to set
+ */
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
}
private class ParentChildWorkflow extends Workflow {
@@ -1028,6 +1046,8 @@ public class PackagedWorkflowRepository
buf.append(cond.getConditionInstanceClassName());
buf.append(",timeout=");
buf.append(cond.getTimeoutSeconds());
+ buf.append(",optiona=");
+ buf.append(cond.isOptional());
buf.append(",config=");
buf.append(cond.getCondConfig().getProperties());
buf.append("]");
Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java Fri Aug 12 00:55:26 2011
@@ -356,7 +356,8 @@ public class XMLWorkflowRepository imple
+ condition.getClass().getName() + ", id="
+ condition.getConditionId() + ", name="
+ condition.getConditionName() + ", timeout="
- + condition.getTimeoutSeconds()+ ", order="
+ + condition.getTimeoutSeconds()+ ", optional="
+ + condition.isOptional()+", order="
+ condition.getOrder() + "]");
System.out.println("Configuration: ");
Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowCondition.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowCondition.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowCondition.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowCondition.java Fri Aug 12 00:55:26 2011
@@ -45,6 +45,8 @@ public class WorkflowCondition {
protected WorkflowConditionConfiguration condConfig;
private long timeoutSeconds;
+
+ private boolean optional;
/**
* <p>
@@ -80,6 +82,7 @@ public class WorkflowCondition {
this.order = order;
this.timeoutSeconds = -1;
this.condConfig = new WorkflowConditionConfiguration();
+ this.optional = false;
}
/**
@@ -180,4 +183,18 @@ public class WorkflowCondition {
this.timeoutSeconds = timeoutSeconds;
}
+ /**
+ * @return the optional
+ */
+ public boolean isOptional() {
+ return optional;
+ }
+
+ /**
+ * @param optional the optional to set
+ */
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
}
Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java Fri Aug 12 00:55:26 2011
@@ -108,6 +108,7 @@ public final class DbStructFactory {
.getInt("workflow_condition_id")));
condition.setConditionName(rs.getString("workflow_condition_name"));
condition.setTimeoutSeconds(rs.getLong("workflow_condition_timeout"));
+ condition.setOptional(rs.getBoolean("workflow_condition_optional"));
if (setOrder) {
condition.setOrder(rs.getInt("condition_order"));
}
Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java Fri Aug 12 00:55:26 2011
@@ -368,6 +368,7 @@ public final class XmlRpcStructFactory {
condition.put("name", c.getConditionName());
condition.put("order", String.valueOf(c.getOrder()));
condition.put("timeout", String.valueOf(c.getTimeoutSeconds()));
+ condition.put("optional", String.valueOf(c.isOptional()));
condition.put("configuration", getXmlRpcWorkflowConditionConfig(c.getCondConfig()));
return condition;
@@ -483,6 +484,7 @@ public final class XmlRpcStructFactory {
condition.setOrder(Integer.valueOf((String) cond.get("order"))
.intValue());
condition.setTimeoutSeconds(Long.valueOf((String)cond.get("timeout")));
+ condition.setOptional(Boolean.valueOf((String)cond.get("optional")));
condition.setCondConfig(getWorkflowConditionConfigurationFromXmlRpc((Hashtable)cond.get("configuration")));
return condition;
}
Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java Fri Aug 12 00:55:26 2011
@@ -162,6 +162,7 @@ public final class XmlStructFactory {
.getConditionName());
workflowCondition.setOrder(i + 1);
workflowCondition.setTimeoutSeconds(condition.getTimeoutSeconds());
+ workflowCondition.setOptional(condition.isOptional());
workflowCondition.setCondConfig(condition.getTaskConfig());
conditionList.add(workflowCondition);
}
@@ -207,6 +208,7 @@ public final class XmlStructFactory {
condition.setTimeoutSeconds(Long.valueOf(conditionElement.getAttribute("timeout") != null &&
!conditionElement.getAttribute("timeout").equals("")
? conditionElement.getAttribute("timeout"):"-1"));
+ condition.setOptional(Boolean.valueOf(conditionElement.getAttribute("optional")));
// load its configuration
Element configElement = getFirstElement("configuration", conditionElement);
Modified: oodt/trunk/workflow/src/main/resources/examples/conditions.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/examples/conditions.xml?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/examples/conditions.xml (original)
+++ oodt/trunk/workflow/src/main/resources/examples/conditions.xml Fri Aug 12 00:55:26 2011
@@ -24,4 +24,5 @@
</configuration>
</condition>
<condition id="urn:oodt:TimeoutCondition" name="Timeout Condition" class="org.apache.oodt.cas.workflow.examples.FalseCondition" timeout="30"/>
+ <condition id="urn:oodt:OptionalCondition" name="Optional Condition" class="org.apache.oodt.cas.workflow.examples.FalseCondition" optional="true"/>
</cas:conditions>
Modified: oodt/trunk/workflow/src/main/resources/examples/events.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/examples/events.xml?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/examples/events.xml (original)
+++ oodt/trunk/workflow/src/main/resources/examples/events.xml Fri Aug 12 00:55:26 2011
@@ -43,6 +43,9 @@
<event name="timeout">
<workflow id="urn:oodt:timeoutWorkflow"/>
</event>
+ <event name="optional">
+ <workflow id="urn:oodt:optionalWorkflow"/>
+ </event>
<event name="GenericFileIngest">
<workflow id="urn:oodt:mailWorkflow"/>
</event>
Added: oodt/trunk/workflow/src/main/resources/examples/optional.workflow.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/examples/optional.workflow.xml?rev=1156926&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/resources/examples/optional.workflow.xml (added)
+++ oodt/trunk/workflow/src/main/resources/examples/optional.workflow.xml Fri Aug 12 00:55:26 2011
@@ -0,0 +1,21 @@
+<!--
+ 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.
+-->
+<cas:workflow xmlns:cas="http://oodt.jpl.nasa.gov/1.0/cas" name="Optional Workflow" id="urn:oodt:optionalWorkflow">
+ <tasks>
+ <task id="urn:oodt:OptionalTask"/>
+ </tasks>
+</cas:workflow>
Propchange: oodt/trunk/workflow/src/main/resources/examples/optional.workflow.xml
------------------------------------------------------------------------------
svn:executable = *
Modified: oodt/trunk/workflow/src/main/resources/examples/tasks.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/examples/tasks.xml?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/examples/tasks.xml (original)
+++ oodt/trunk/workflow/src/main/resources/examples/tasks.xml Fri Aug 12 00:55:26 2011
@@ -123,4 +123,14 @@
<metfield name="numSeconds" />
</requiredMetFields>
</task>
+ <task id="urn:oodt:OptionalTask" name="Optional Task"
+ class="org.apache.oodt.cas.workflow.examples.LongTask">
+ <conditions>
+ <condition id="urn:oodt:OptionalCondition"/>
+ </conditions>
+ <configuration/>
+ <requiredMetFields>
+ <metfield name="numSeconds"/>
+ </requiredMetFields>
+ </task>
</cas:tasks>
Modified: oodt/trunk/workflow/src/main/resources/examples/wengine/GranuleMaps.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/examples/wengine/GranuleMaps.xml?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/examples/wengine/GranuleMaps.xml (original)
+++ oodt/trunk/workflow/src/main/resources/examples/wengine/GranuleMaps.xml Fri Aug 12 00:55:26 2011
@@ -125,7 +125,7 @@
<property name="QueueName" value="java"/>
</configuration>
</condition>
- <condition id="urn:npp:MOA_ORBITS_FileBased" name="MOA_ORBITS_FileBased" class="org.apache.oodt.cas.pge.condition.PGETaskWorkflowCondition">
+ <condition id="urn:npp:MOA_ORBITS_FileBased" name="MOA_ORBITS_FileBased" class="org.apache.oodt.cas.pge.condition.PGETaskWorkflowCondition" optional="true">
<configuration>
<!-- query properties -->
<property name="PGETask/Condition/ProductTypeNames" value="MOA_ORBITS"/>
Modified: oodt/trunk/workflow/src/main/resources/examples/wengine/hello-goodbye.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/examples/wengine/hello-goodbye.xml?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/examples/wengine/hello-goodbye.xml (original)
+++ oodt/trunk/workflow/src/main/resources/examples/wengine/hello-goodbye.xml Fri Aug 12 00:55:26 2011
@@ -139,6 +139,10 @@
</condition>
<condition id="urn:oodt:TimeoutCondition" name="Timeout Condition"
class="org.apache.oodt.cas.workflow.examples.FalseCondition" timeout="30"/>
+
+ <condition id="urn:oodt:OptionalCondition" name="Optional Condition"
+ class="org.apache.oodt.cas.workflow.examples.FalseCondition" optional="true"/>
+
Modified: oodt/trunk/workflow/src/main/resources/workflow.sql
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/workflow.sql?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/workflow.sql (original)
+++ oodt/trunk/workflow/src/main/resources/workflow.sql Fri Aug 12 00:55:26 2011
@@ -63,7 +63,8 @@ CREATE TABLE workflow_conditions
(workflow_condition_id int NOT NULL PRIMARY KEY,
workflow_condition_name varchar(255) NOT NULL,
workflow_condition_class varchar(255) NOT NULL,
-workflow_condition_timeout int);
+workflow_condition_timeout int,
+workflow_optional boolean DEFAULT false);
CREATE TABLE workflow_condition_map
(workflow_task_id int NOT NULL,
Modified: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowRepository.java?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowRepository.java (original)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowRepository.java Fri Aug 12 00:55:26 2011
@@ -99,7 +99,7 @@ public class TestWorkflowRepository exte
}
assertNotNull(workflows);
- assertEquals(9, workflows.size());
+ assertEquals(10, workflows.size());
}
public void testGetWorkflowsForEvent() {
Modified: oodt/trunk/workflow/src/testdata/workflow.sql
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/testdata/workflow.sql?rev=1156926&r1=1156925&r2=1156926&view=diff
==============================================================================
--- oodt/trunk/workflow/src/testdata/workflow.sql (original)
+++ oodt/trunk/workflow/src/testdata/workflow.sql Fri Aug 12 00:55:26 2011
@@ -47,7 +47,8 @@ CREATE TABLE workflow_conditions
(workflow_condition_id int NOT NULL PRIMARY KEY,
workflow_condition_name varchar(255) NOT NULL,
workflow_condition_class varchar(255) NOT NULL,
-workflow_condition_timeout int NOT NULL);
+workflow_condition_timeout int NOT NULL,
+workflow_condition_optional boolean DEFAULT false);
CREATE TABLE workflow_condition_map
(workflow_task_id int NOT NULL,
@@ -64,7 +65,7 @@ CREATE TABLE workflow_condition_configur
property_name varchar(1000) NOT NULL,
property_value varchar(1000) NOT NULL);
-INSERT INTO workflow_conditions VALUES ('1', 'CheckCond', 'org.apache.oodt.cas.workflow.examples.CheckForMetadataKeys', 30);
+INSERT INTO workflow_conditions VALUES ('1', 'CheckCond', 'org.apache.oodt.cas.workflow.examples.CheckForMetadataKeys', 30, false);
INSERT INTO workflow_condition_configuration VALUES ('1', 'reqMetKeys', 'Met1,Met2,Met3');
-INSERT INTO workflow_conditions VALUES ('2', 'FalseCond', 'org.apache.oodt.cas.workflow.examples.FalseCondition', 10);
-INSERT INTO workflow_conditions VALUES ('3', 'TrueCond', 'org.apache.oodt.cas.workflow.examples.TrueCondition', 30);
+INSERT INTO workflow_conditions VALUES ('2', 'FalseCond', 'org.apache.oodt.cas.workflow.examples.FalseCondition', 10, true);
+INSERT INTO workflow_conditions VALUES ('3', 'TrueCond', 'org.apache.oodt.cas.workflow.examples.TrueCondition', 30, true);