[jboss-svn-commits] JBL Code SVN: r12249 - in labs/jbossrules/trunk/drools-core: src/main/java/org/drools and 18 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed May 30 20:21:38 EDT 2007
Author: KrisVerlaenen
Date: 2007-05-30 20:21:38 -0400 (Wed, 30 May 2007)
New Revision: 12249
Added:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/WorkingMemoryInMemoryLogger.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/RuleFlowGroupLogEvent.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/RuleFlowLogEvent.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowCompletedEvent.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEvent.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEventListener.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEventSupport.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupActivatedEvent.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupDeactivatedEvent.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupEvent.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowStartedEvent.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/Process.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/impl/ProcessImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/DataType.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/DataTypeFactory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/ProcessInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/impl/ProcessInstanceImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Connection.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Constraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/EndNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Join.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Node.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcess.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcessValidationError.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcessValidator.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleSetNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Split.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/StartNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Variable.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/ConnectionImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/ConstraintImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/EndNodeImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/JoinImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/NodeImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidationErrorImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidatorImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleSetNodeImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/SplitImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/StartNodeImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/VariableImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/RuleFlowNodeInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/RuleFlowProcessInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/EndNodeInstanceImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowJoinInstanceImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowNodeInstanceImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowProcessInstanceImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSequenceNodeInstanceImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSplitInstanceImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/StartNodeInstanceImpl.java
Removed:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/IProcess.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/impl/Process.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/IDataType.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/IDataTypeFactory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/IProcessInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/impl/ProcessInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IConnection.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IEndNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IJoin.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/INode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcess.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcessValidationError.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcessValidator.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleSetNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/ISplit.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IStartNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IVariable.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Connection.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Constraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/EndNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Join.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Node.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcess.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidationError.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidator.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleSetNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Split.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/StartNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Variable.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/IRuleFlowNodeInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/IRuleFlowProcessInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/EndNodeInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowJoinInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowNodeInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowProcessInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSequenceNodeInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSplitInstance.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/StartNodeInstance.java
Modified:
labs/jbossrules/trunk/drools-core/.classpath
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/WorkingMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/WorkingMemoryLogger.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/ActivationLogEvent.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/LogEvent.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultAgenda.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/EventSupport.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalRuleFlowGroup.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalWorkingMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/RuleFlowGroupImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Package.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/InstanceDataTypeFactory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/NewInstanceDataTypeFactory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/BooleanDataType.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/FloatDataType.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/IntegerDataType.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/ListDataType.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/StringDataType.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/UndefinedDataType.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java
Log:
JBRRULES-770: Expose the enter and exit events for RuleFlow
- core + IDE (audit view) now supports 4 events for ruleflow (groups)
JBRULES-893: Realtime audit view
- First code for realtime audit view when selecting WorkingMemoryInMemoryLogger
JBRULES-894: Support for .package files in IDE
- .package files supported
Minor fixed for ruleflow
- empty ruleflow-groups now automatically deactivate when triggered
- fixed bug in split instance lookup
- removed all Ixxx interfaces in ruleflow
Modified: labs/jbossrules/trunk/drools-core/.classpath
===================================================================
--- labs/jbossrules/trunk/drools-core/.classpath 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/.classpath 2007-05-31 00:21:38 UTC (rev 12249)
@@ -5,8 +5,8 @@
<classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/>
<classpathentry kind="var" path="M2_REPO/org/mvel/mvel14/1.2beta21/mvel14-1.2beta21.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/>
<classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/>
</classpath>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -22,7 +22,7 @@
import java.util.Set;
import org.drools.rule.Package;
-import org.drools.ruleflow.common.core.IProcess;
+import org.drools.ruleflow.common.core.Process;
/**
* Active collection of <code>Rule</code>s.
@@ -127,11 +127,11 @@
void removePackage(String packageName);
- void addProcess(IProcess process);
+ void addProcess(Process process);
void removeProcess(String id);
- IProcess getProcess(String id);
+ Process getProcess(String id);
void removeRule(String packageName,
String ruleName);
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/WorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/WorkingMemory.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/WorkingMemory.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -22,8 +22,9 @@
import java.util.Map;
import org.drools.event.AgendaEventListener;
+import org.drools.event.RuleFlowEventListener;
import org.drools.event.WorkingMemoryEventListener;
-import org.drools.ruleflow.common.instance.IProcessInstance;
+import org.drools.ruleflow.common.instance.ProcessInstance;
import org.drools.spi.AgendaFilter;
import org.drools.spi.AgendaGroup;
import org.drools.spi.AsyncExceptionHandler;
@@ -81,6 +82,22 @@
public void removeEventListener(AgendaEventListener listener);
/**
+ * Add an event listener.
+ *
+ * @param listener
+ * The listener to add.
+ */
+ public void addEventListener(RuleFlowEventListener listener);
+
+ /**
+ * Remove an event listener.
+ *
+ * @param listener
+ * The listener to remove.
+ */
+ public void removeEventListener(RuleFlowEventListener listener);
+
+ /**
* Returns all event listeners.
*
* @return listeners The listeners.
@@ -284,5 +301,5 @@
/**
* Starts a new process instance for the process with the given id.
*/
- IProcessInstance startProcess(String processId);
+ ProcessInstance startProcess(String processId);
}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/WorkingMemoryInMemoryLogger.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/WorkingMemoryInMemoryLogger.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/WorkingMemoryInMemoryLogger.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,73 @@
+package org.drools.audit;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.io.ObjectOutputStream;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.WorkingMemory;
+import org.drools.audit.event.LogEvent;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * A logger of events generated by a working memory.
+ * It stores its information in memory, so it can be retrieved later.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen </a>
+ */
+public class WorkingMemoryInMemoryLogger extends WorkingMemoryLogger {
+
+ private final List events = new ArrayList();
+
+ /**
+ * Creates a new WorkingMemoryInMemoryLogger for the given working memory.
+ * @param workingMemory
+ */
+ public WorkingMemoryInMemoryLogger(final WorkingMemory workingMemory) {
+ super( workingMemory );
+ }
+
+ public String getEvents() {
+ final XStream xstream = new XStream();
+ StringWriter writer = new StringWriter();
+ try {
+ final ObjectOutputStream out = xstream.createObjectOutputStream(writer);
+ out.writeObject( this.events );
+ out.close();
+ } catch (Throwable t) {
+ throw new RuntimeException("Unable to create event output: " + t.getMessage());
+ }
+ return writer.toString();
+ }
+
+ /**
+ * Clears all the events in the log.
+ */
+ public void clear() {
+ this.events.clear();
+ }
+
+ /**
+ * @see org.drools.audit.WorkingMemoryLogger
+ */
+ public void logEventCreated(final LogEvent logEvent) {
+ this.events.add( logEvent );
+ }
+}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/WorkingMemoryLogger.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/WorkingMemoryLogger.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/WorkingMemoryLogger.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -26,6 +26,8 @@
import org.drools.audit.event.ILogEventFilter;
import org.drools.audit.event.LogEvent;
import org.drools.audit.event.ObjectLogEvent;
+import org.drools.audit.event.RuleFlowGroupLogEvent;
+import org.drools.audit.event.RuleFlowLogEvent;
import org.drools.common.InternalFactHandle;
import org.drools.event.ActivationCancelledEvent;
import org.drools.event.ActivationCreatedEvent;
@@ -37,6 +39,11 @@
import org.drools.event.ObjectAssertedEvent;
import org.drools.event.ObjectModifiedEvent;
import org.drools.event.ObjectRetractedEvent;
+import org.drools.event.RuleFlowCompletedEvent;
+import org.drools.event.RuleFlowEventListener;
+import org.drools.event.RuleFlowGroupActivatedEvent;
+import org.drools.event.RuleFlowGroupDeactivatedEvent;
+import org.drools.event.RuleFlowStartedEvent;
import org.drools.event.WorkingMemoryEventListener;
import org.drools.rule.Declaration;
import org.drools.spi.Activation;
@@ -59,7 +66,8 @@
public abstract class WorkingMemoryLogger
implements
WorkingMemoryEventListener,
- AgendaEventListener {
+ AgendaEventListener,
+ RuleFlowEventListener {
private final List filters = new ArrayList();
private WorkingMemory workingMemory;
@@ -73,6 +81,7 @@
this.workingMemory = workingMemory;
workingMemory.addEventListener( (WorkingMemoryEventListener) this );
workingMemory.addEventListener( (AgendaEventListener) this );
+ workingMemory.addEventListener( (RuleFlowEventListener) this );
}
/**
@@ -171,8 +180,9 @@
filterLogEvent( new ActivationLogEvent( LogEvent.ACTIVATION_CREATED,
getActivationId( event.getActivation() ),
event.getActivation().getRule().getName(),
- extractDeclarations( event.getActivation() ) ) );
- }
+ extractDeclarations( event.getActivation() ),
+ event.getActivation().getRule().getRuleFlowGroup() ) );
+ }
/**
* @see org.drools.event.AgendaEventListener
@@ -182,7 +192,8 @@
filterLogEvent( new ActivationLogEvent( LogEvent.ACTIVATION_CANCELLED,
getActivationId( event.getActivation() ),
event.getActivation().getRule().getName(),
- extractDeclarations( event.getActivation() ) ) );
+ extractDeclarations( event.getActivation() ),
+ event.getActivation().getRule().getRuleFlowGroup() ) );
}
/**
@@ -193,7 +204,8 @@
filterLogEvent( new ActivationLogEvent( LogEvent.BEFORE_ACTIVATION_FIRE,
getActivationId( event.getActivation() ),
event.getActivation().getRule().getName(),
- extractDeclarations( event.getActivation() ) ) );
+ extractDeclarations( event.getActivation() ),
+ event.getActivation().getRule().getRuleFlowGroup() ) );
}
/**
@@ -204,7 +216,8 @@
filterLogEvent( new ActivationLogEvent( LogEvent.AFTER_ACTIVATION_FIRE,
getActivationId( event.getActivation() ),
event.getActivation().getRule().getName(),
- extractDeclarations( event.getActivation() ) ) );
+ extractDeclarations( event.getActivation() ),
+ event.getActivation().getRule().getRuleFlowGroup() ) );
}
/**
@@ -284,4 +297,33 @@
final WorkingMemory workingMemory) {
// we don't audit this yet
}
+
+ public void ruleFlowStarted(RuleFlowStartedEvent event,
+ WorkingMemory workingMemory) {
+ filterLogEvent( new RuleFlowLogEvent( LogEvent.RULEFLOW_CREATED,
+ event.getRuleFlowProcessInstance().getProcess().getId(),
+ event.getRuleFlowProcessInstance().getProcess().getName() ) );
+ }
+
+ public void ruleFlowCompleted(RuleFlowCompletedEvent event,
+ WorkingMemory workingMemory) {
+ filterLogEvent( new RuleFlowLogEvent( LogEvent.RULEFLOW_COMPLETED,
+ event.getRuleFlowProcessInstance().getProcess().getId(),
+ event.getRuleFlowProcessInstance().getProcess().getName() ) );
+ }
+
+ public void ruleFlowGroupActivated(RuleFlowGroupActivatedEvent event,
+ WorkingMemory workingMemory) {
+ filterLogEvent( new RuleFlowGroupLogEvent( LogEvent.RULEFLOW_GROUP_ACTIVATED,
+ event.getRuleFlowGroup().getName(),
+ event.getRuleFlowGroup().size() ) );
+ }
+
+ public void ruleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent event,
+ WorkingMemory workingMemory) {
+ filterLogEvent( new RuleFlowGroupLogEvent( LogEvent.RULEFLOW_GROUP_DEACTIVATED,
+ event.getRuleFlowGroup().getName(),
+ event.getRuleFlowGroup().size() ) );
+ }
+
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/ActivationLogEvent.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/ActivationLogEvent.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/ActivationLogEvent.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -39,6 +39,7 @@
private String activationId;
private String rule;
private String declarations;
+ private String ruleFlowGroup;
/**
* Create a new activation log event.
@@ -53,11 +54,13 @@
public ActivationLogEvent(final int type,
final String activationId,
final String rule,
- final String declarations) {
+ final String declarations,
+ final String ruleFlowGroup) {
super( type );
this.activationId = activationId;
this.rule = rule;
this.declarations = declarations;
+ this.ruleFlowGroup = ruleFlowGroup;
}
/**
@@ -87,6 +90,10 @@
public String getDeclarations() {
return this.declarations;
}
+
+ public String getRuleFlowGroup() {
+ return ruleFlowGroup;
+ }
public String toString() {
@@ -106,6 +113,6 @@
msg = "BEFORE ACTIVATION FIRED";
break;
}
- return msg + " rule:" + this.rule + " activationId:" + this.activationId + " declarations: " + this.declarations;
+ return msg + " rule:" + this.rule + " activationId:" + this.activationId + " declarations: " + this.declarations + (ruleFlowGroup == null ? "" : " ruleflow-group: " + ruleFlowGroup);
}
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/LogEvent.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/LogEvent.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/LogEvent.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -24,23 +24,26 @@
*/
public class LogEvent {
- public static final int OBJECT_ASSERTED = 1;
- public static final int OBJECT_MODIFIED = 2;
- public static final int OBJECT_RETRACTED = 3;
+ public static final int OBJECT_ASSERTED = 1;
+ public static final int OBJECT_MODIFIED = 2;
+ public static final int OBJECT_RETRACTED = 3;
- public static final int ACTIVATION_CREATED = 4;
- public static final int ACTIVATION_CANCELLED = 5;
- public static final int BEFORE_ACTIVATION_FIRE = 6;
- public static final int AFTER_ACTIVATION_FIRE = 7;
+ public static final int ACTIVATION_CREATED = 4;
+ public static final int ACTIVATION_CANCELLED = 5;
+ public static final int BEFORE_ACTIVATION_FIRE = 6;
+ public static final int AFTER_ACTIVATION_FIRE = 7;
+ public static final int RULEFLOW_CREATED = 8;
+ public static final int RULEFLOW_COMPLETED = 9;
+ public static final int RULEFLOW_GROUP_ACTIVATED = 10;
+ public static final int RULEFLOW_GROUP_DEACTIVATED = 11;
+
private int type;
/**
* Creates a new log event.
*
- * @param type The type of the log event. This can be OBJECT_ASSERTED,
- * OBJECT_MODIFIED, OBJECT_RETRACTED, ACTIVATION_CREATED, ACTIVATION_CANCELLED,
- * BEFORE_ACTIVATION_FIRE or AFTER_ACTIVATION_FIRE.
+ * @param type The type of the log event.
*/
public LogEvent(final int type) {
this.type = type;
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/RuleFlowGroupLogEvent.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/RuleFlowGroupLogEvent.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/RuleFlowGroupLogEvent.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,67 @@
+package org.drools.audit.event;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * A ruleflow-group event logged by the WorkingMemoryLogger.
+ * It is a snapshot of the event as it was thrown by the working memory.
+ * It contains the ruleflow group name and its size.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen </a>
+ */
+public class RuleFlowGroupLogEvent extends LogEvent {
+
+ private String groupName;
+ private int size;
+
+ /**
+ * Create a new ruleflow group log event.
+ *
+ * @param type The type of event. This can only be RULEFLOW_GROUP_ACTIVATED or RULEFLOW_GROUP_DEACTIVATED.
+ * @param groupName The name of the ruleflow group
+ * @param size The size of the ruleflow group
+ */
+ public RuleFlowGroupLogEvent(final int type,
+ final String groupName,
+ final int size) {
+ super( type );
+ this.groupName = groupName;
+ this.size = size;
+ }
+
+ public String getGroupName() {
+ return this.groupName;
+ }
+
+ public int getSize() {
+ return this.size;
+ }
+
+ public String toString() {
+
+ String msg = null;
+ switch ( this.getType() ) {
+ case RULEFLOW_GROUP_ACTIVATED :
+ msg = "RULEFLOW GROUP ACTIVATED";
+ break;
+ case RULEFLOW_GROUP_DEACTIVATED :
+ msg = "ACTIVATION GROUP DEACTIVATED";
+ break;
+ }
+ return msg + " group:" + this.groupName + "[size=" + this.size + "]";
+ }
+}
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/RuleFlowLogEvent.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/RuleFlowLogEvent.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/event/RuleFlowLogEvent.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,67 @@
+package org.drools.audit.event;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * A ruleflow event logged by the WorkingMemoryLogger.
+ * It is a snapshot of the event as it was thrown by the working memory.
+ * It contains the process name and id.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen </a>
+ */
+public class RuleFlowLogEvent extends LogEvent {
+
+ private String processId;
+ private String processName;
+
+ /**
+ * Create a new ruleflow log event.
+ *
+ * @param type The type of event. This can only be RULEFLOW_CREATED or RULEFLOW_COMPLETED.
+ * @param processId The id of the process
+ * @param processName The name of the process
+ */
+ public RuleFlowLogEvent(final int type,
+ final String processId,
+ final String processName) {
+ super( type );
+ this.processId = processId;
+ this.processName = processName;
+ }
+
+ public String getProcessId() {
+ return this.processId;
+ }
+
+ public String getProcessName() {
+ return this.processName;
+ }
+
+ public String toString() {
+
+ String msg = null;
+ switch ( this.getType() ) {
+ case RULEFLOW_CREATED :
+ msg = "RULEFLOW STARTED";
+ break;
+ case RULEFLOW_COMPLETED :
+ msg = "ACTIVATION CREATED";
+ break;
+ }
+ return msg + " process:" + this.processName + "[id=" + this.processId + "]";
+ }
+}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -44,7 +44,7 @@
import org.drools.rule.Package;
import org.drools.rule.PackageCompilationData;
import org.drools.rule.Rule;
-import org.drools.ruleflow.common.core.IProcess;
+import org.drools.ruleflow.common.core.Process;
import org.drools.spi.FactHandleFactory;
import org.drools.util.ObjectHashSet;
@@ -219,8 +219,8 @@
return this.factHandleFactory.newInstance();
}
- public IProcess[] getProcesses() {
- return (IProcess[]) this.processes.values().toArray( new IProcess[this.processes.size()] );
+ public Process[] getProcesses() {
+ return (Process[]) this.processes.values().toArray( new Process[this.processes.size()] );
}
public Package[] getPackages() {
@@ -463,7 +463,7 @@
protected abstract void removeRule(Rule rule);
- public synchronized void addProcess(final IProcess process) {
+ public synchronized void addProcess(final Process process) {
this.processes.put( process.getId(),
process );
}
@@ -472,8 +472,8 @@
this.processes.remove( id );
}
- public IProcess getProcess(final String id) {
- return (IProcess) this.processes.get( id );
+ public Process getProcess(final String id) {
+ return (Process) this.processes.get( id );
}
protected synchronized void addStatefulSession(final StatefulSession statefulSession) {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -44,14 +44,16 @@
import org.drools.base.ShadowProxy;
import org.drools.event.AgendaEventListener;
import org.drools.event.AgendaEventSupport;
+import org.drools.event.RuleFlowEventListener;
+import org.drools.event.RuleFlowEventSupport;
import org.drools.event.WorkingMemoryEventListener;
import org.drools.event.WorkingMemoryEventSupport;
import org.drools.rule.Rule;
-import org.drools.ruleflow.common.core.IProcess;
-import org.drools.ruleflow.common.instance.IProcessInstance;
-import org.drools.ruleflow.core.IRuleFlowProcess;
-import org.drools.ruleflow.instance.IRuleFlowProcessInstance;
-import org.drools.ruleflow.instance.impl.RuleFlowProcessInstance;
+import org.drools.ruleflow.common.core.Process;
+import org.drools.ruleflow.common.instance.ProcessInstance;
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+import org.drools.ruleflow.instance.impl.RuleFlowProcessInstanceImpl;
import org.drools.spi.Activation;
import org.drools.spi.AgendaFilter;
import org.drools.spi.AgendaGroup;
@@ -114,6 +116,8 @@
protected final AgendaEventSupport agendaEventSupport = new AgendaEventSupport( this );
+ protected final RuleFlowEventSupport ruleFlowEventSupport = new RuleFlowEventSupport( this );
+
/** The <code>RuleBase</code> with which this memory is associated. */
protected transient InternalRuleBase ruleBase;
@@ -241,6 +245,33 @@
}
}
+ public void addEventListener(final RuleFlowEventListener listener) {
+ try {
+ this.lock.lock();
+ this.ruleFlowEventSupport.addEventListener( listener );
+ } finally {
+ this.lock.unlock();
+ }
+ }
+
+ public void removeEventListener(final RuleFlowEventListener listener) {
+ try {
+ this.lock.lock();
+ this.ruleFlowEventSupport.removeEventListener( listener );
+ } finally {
+ this.lock.unlock();
+ }
+ }
+
+ public List getRuleFlowEventListeners() {
+ try {
+ this.lock.lock();
+ return this.ruleFlowEventSupport.getEventListeners();
+ } finally {
+ this.lock.unlock();
+ }
+ }
+
public FactHandleFactory getFactHandleFactory() {
return this.handleFactory;
}
@@ -986,12 +1017,16 @@
}
public void executeQueuedActions() {
- for ( final Iterator it = this.actionQueue.iterator(); it.hasNext(); ) {
- final WorkingMemoryAction action = (WorkingMemoryAction) it.next();
- it.remove();
- action.execute( this );
- }
-
+ while (!actionQueue.isEmpty()) {
+ final WorkingMemoryAction action = (WorkingMemoryAction) actionQueue.get(0);
+ actionQueue.remove(0);
+ action.execute( this );
+ }
+// for ( final Iterator it = this.actionQueue.iterator(); it.hasNext(); ) {
+// final WorkingMemoryAction action = (WorkingMemoryAction) it.next();
+// it.remove();
+// action.execute( this );
+// }
}
public void queueWorkingMemoryAction(final WorkingMemoryAction action) {
@@ -1042,6 +1077,10 @@
return this.agendaEventSupport;
}
+ public RuleFlowEventSupport getRuleFlowEventSupport() {
+ return this.ruleFlowEventSupport;
+ }
+
/**
* Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda
* Scheduler used for duration rules.
@@ -1086,16 +1125,19 @@
}
}
- public IProcessInstance startProcess(final String processId) {
- final IProcess process = getRuleBase().getProcess( processId );
+ public ProcessInstance startProcess(final String processId) {
+ final Process process = getRuleBase().getProcess( processId );
if ( process == null ) {
throw new IllegalArgumentException( "Unknown process ID: " + processId );
}
- if ( process instanceof IRuleFlowProcess ) {
- final IRuleFlowProcessInstance processInstance = new RuleFlowProcessInstance();
- processInstance.setAgenda( this.agenda );
+ if ( process instanceof RuleFlowProcess ) {
+ final RuleFlowProcessInstance processInstance = new RuleFlowProcessInstanceImpl();
+ processInstance.setWorkingMemory( this );
processInstance.setProcess( process );
processInstance.start();
+
+ getRuleFlowEventSupport().fireRuleFlowProcessStarted(processInstance);
+
return processInstance;
} else {
throw new IllegalArgumentException( "Unknown process type: " + process.getClass() );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultAgenda.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultAgenda.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultAgenda.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -279,6 +279,8 @@
RuleFlowGroup ruleFlowGroup = (RuleFlowGroup) this.ruleFlowGroups.get( name );
if ( ruleFlowGroup == null ) {
ruleFlowGroup = new RuleFlowGroupImpl( name );
+ ((InternalRuleFlowGroup) ruleFlowGroup).setWorkingMemory(
+ (InternalWorkingMemory) getWorkingMemory() );
this.ruleFlowGroups.put( name,
ruleFlowGroup );
}
@@ -286,7 +288,7 @@
}
public void activateRuleFlowGroup(final String name) {
- ((InternalRuleFlowGroup) getRuleFlowGroup( name )).setActive( true );
+ ((InternalRuleFlowGroup) getRuleFlowGroup( name )).setActive( true );
}
public void deactivateRuleFlowGroup(final String name) {
@@ -392,7 +394,7 @@
if ( item.getRuleFlowGroupNode() != null ) {
final InternalRuleFlowGroup ruleFlowGroup = item.getRuleFlowGroupNode().getRuleFlowGroup();
- ruleFlowGroup.removeActivation( item, this.workingMemory );
+ ruleFlowGroup.removeActivation( item );
}
eventsupport.getAgendaEventSupport().fireActivationCancelled( item,
@@ -428,7 +430,7 @@
if ( activation.getRuleFlowGroupNode() != null ) {
final InternalRuleFlowGroup ruleFlowGroup = activation.getRuleFlowGroupNode().getRuleFlowGroup();
- ruleFlowGroup.removeActivation( activation, this.workingMemory );
+ ruleFlowGroup.removeActivation( activation );
}
eventsupport.getAgendaEventSupport().fireActivationCancelled( activation,
@@ -504,7 +506,7 @@
if ( activation.getRuleFlowGroupNode() != null ) {
final InternalRuleFlowGroup ruleFlowGroup = activation.getRuleFlowGroupNode().getRuleFlowGroup();
- ruleFlowGroup.removeActivation( activation, this.workingMemory );
+ ruleFlowGroup.removeActivation( activation );
}
eventsupport.getAgendaEventSupport().fireAfterActivationFired( activation );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/EventSupport.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/EventSupport.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/EventSupport.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -19,11 +19,21 @@
import java.util.List;
import org.drools.event.AgendaEventSupport;
+import org.drools.event.RuleFlowEventSupport;
+import org.drools.event.WorkingMemoryEventSupport;
public interface EventSupport {
- public List getAgendaEventListeners();
+
+ List getAgendaEventListeners();
- public List getWorkingMemoryEventListeners();
+ List getWorkingMemoryEventListeners();
+
+ List getRuleFlowEventListeners();
- public AgendaEventSupport getAgendaEventSupport();
+ AgendaEventSupport getAgendaEventSupport();
+
+ WorkingMemoryEventSupport getWorkingMemoryEventSupport();
+
+ RuleFlowEventSupport getRuleFlowEventSupport();
+
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalRuleFlowGroup.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalRuleFlowGroup.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalRuleFlowGroup.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,7 +1,6 @@
package org.drools.common;
-import org.drools.ruleflow.instance.IRuleFlowNodeInstance;
-import org.drools.ruleflow.instance.IRuleFlowProcessInstance;
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
import org.drools.spi.Activation;
import org.drools.spi.RuleFlowGroup;
@@ -9,9 +8,13 @@
extends
RuleFlowGroup {
+ void setWorkingMemory(InternalWorkingMemory workingMemory);
+
+ InternalWorkingMemory getWorkingMemory();
+
void addActivation(Activation activation);
- void removeActivation(final Activation activation, InternalWorkingMemory workingMemory);
+ void removeActivation(final Activation activation);
/**
* Activates or deactivates this <code>RuleFlowGroup</code>.
@@ -30,6 +33,6 @@
void triggerCompleted();
- IRuleFlowProcessInstance getProcessInstance();
+ RuleFlowProcessInstance getProcessInstance();
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalWorkingMemory.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalWorkingMemory.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -3,7 +3,6 @@
import org.drools.FactException;
import org.drools.FactHandle;
import org.drools.WorkingMemory;
-import org.drools.event.AgendaEventSupport;
import org.drools.rule.Rule;
import org.drools.spi.Activation;
import org.drools.spi.FactHandleFactory;
@@ -24,8 +23,6 @@
public ObjectHashMap getFactHandleMap();
- public AgendaEventSupport getAgendaEventSupport();
-
public TruthMaintenanceSystem getTruthMaintenanceSystem();
public void executeQueuedActions();
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/RuleFlowGroupImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/RuleFlowGroupImpl.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/RuleFlowGroupImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -16,10 +16,9 @@
* limitations under the License.
*/
-import org.drools.ruleflow.instance.IRuleFlowNodeInstance;
-import org.drools.ruleflow.instance.impl.RuleFlowSequenceNodeInstance;
+import org.drools.ruleflow.instance.RuleFlowNodeInstance;
+import org.drools.ruleflow.instance.impl.RuleFlowSequenceNodeInstanceImpl;
import org.drools.spi.Activation;
-import org.drools.spi.RuleFlowGroup;
import org.drools.util.LinkedList;
import org.drools.util.LinkedList.LinkedListIterator;
@@ -37,16 +36,17 @@
* @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
*
*/
-public class RuleFlowGroupImpl extends RuleFlowSequenceNodeInstance
+public class RuleFlowGroupImpl extends RuleFlowSequenceNodeInstanceImpl
implements
InternalRuleFlowGroup {
private static final long serialVersionUID = 320L;
- private final String name;
- private boolean active = false;
- private final LinkedList list;
- private boolean autoDeactivate = true;
+ private InternalWorkingMemory workingMemory;
+ private final String name;
+ private boolean active = false;
+ private final LinkedList list;
+ private boolean autoDeactivate = true;
/**
* Construct a <code>RuleFlowGroupImpl</code> with the given name.
@@ -62,6 +62,14 @@
public String getName() {
return this.name;
}
+
+ public void setWorkingMemory(InternalWorkingMemory workingMemory) {
+ this.workingMemory = workingMemory;
+ }
+
+ public InternalWorkingMemory getWorkingMemory() {
+ return this.workingMemory;
+ }
public void setActive(final boolean active) {
if ( this.active == active ) {
@@ -69,7 +77,18 @@
}
this.active = active;
if ( active ) {
- triggerActivations();
+ if ( this.list.isEmpty() ) {
+ if ( this.autoDeactivate ) {
+ // if the list of activations is empty and
+ // auto-deactivate is on, deactivate this group
+ WorkingMemoryAction action = new DeactivateCallback( this );
+ this.workingMemory.queueWorkingMemoryAction( action );
+ }
+ } else {
+ triggerActivations();
+ }
+ ((EventSupport) this.workingMemory).getRuleFlowEventSupport()
+ .fireRuleFlowGroupActivated(this);
} else {
final LinkedListIterator it = this.list.iterator();
for ( RuleFlowGroupNode node = (RuleFlowGroupNode) it.next(); node != null; node = (RuleFlowGroupNode) it.next() ) {
@@ -79,6 +98,8 @@
activation.getActivationGroupNode().getActivationGroup().removeActivation( activation );
}
}
+ ((EventSupport) this.workingMemory).getRuleFlowEventSupport()
+ .fireRuleFlowGroupDeactivated(this);
}
}
@@ -128,15 +149,15 @@
}
}
- public void removeActivation(final Activation activation, InternalWorkingMemory workingMemory) {
+ public void removeActivation(final Activation activation) {
final RuleFlowGroupNode node = activation.getRuleFlowGroupNode();
this.list.remove( node );
activation.setActivationGroupNode( null );
if ( this.autoDeactivate ) {
if ( this.list.isEmpty() ) {
- // deactivate callback
- WorkingMemoryAction action = new DeactivateCallback( this );
- workingMemory.queueWorkingMemoryAction( action );
+ // deactivate callback
+ WorkingMemoryAction action = new DeactivateCallback( this );
+ this.workingMemory.queueWorkingMemoryAction( action );
}
}
}
@@ -169,7 +190,7 @@
return this.name.hashCode();
}
- public void trigger(final IRuleFlowNodeInstance parent) {
+ public void trigger(final RuleFlowNodeInstance parent) {
setActive( true );
}
@@ -181,7 +202,9 @@
}
public void execute(InternalWorkingMemory workingMemory) {
+ // check whether ruleflow group is still empty first
if ( this.ruleFlowGroup.isEmpty() ) {
+ // deactivate ruleflow group
this.ruleFlowGroup.setActive( false );
// only trigger next node if this RuleFlowGroup was
// triggered from inside a process instance
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowCompletedEvent.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowCompletedEvent.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowCompletedEvent.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,35 @@
+package org.drools.event;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+
+/**
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowCompletedEvent extends RuleFlowEvent {
+
+ private static final long serialVersionUID = 7872024884293495713L;
+
+ public RuleFlowCompletedEvent(final RuleFlowProcessInstance instance) {
+ super( instance );
+ }
+
+ public String toString() {
+ return "==>[RuleFlowCompleted(name=" + getRuleFlowProcessInstance().getRuleFlowProcess().getName() + "; id=" + getRuleFlowProcessInstance().getRuleFlowProcess().getId() + ")]";
+ }
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEvent.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEvent.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEvent.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,38 @@
+package org.drools.event;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.EventObject;
+
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+
+/**
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowEvent extends EventObject {
+
+ private static final long serialVersionUID = -5749534819339516020L;
+
+ public RuleFlowEvent(final RuleFlowProcessInstance instance) {
+ super( instance );
+ }
+
+ public RuleFlowProcessInstance getRuleFlowProcessInstance() {
+ return (RuleFlowProcessInstance) getSource();
+ }
+
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEventListener.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEventListener.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEventListener.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,40 @@
+package org.drools.event;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.EventListener;
+
+import org.drools.WorkingMemory;
+
+/**
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface RuleFlowEventListener extends EventListener {
+
+ void ruleFlowStarted(RuleFlowStartedEvent event,
+ WorkingMemory workingMemory);
+
+ void ruleFlowCompleted(RuleFlowCompletedEvent event,
+ WorkingMemory workingMemory);
+
+ void ruleFlowGroupActivated(RuleFlowGroupActivatedEvent event,
+ WorkingMemory workingMemory);
+
+ void ruleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent event,
+ WorkingMemory workingMemory);
+
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEventSupport.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEventSupport.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowEventSupport.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,115 @@
+package org.drools.event;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.drools.WorkingMemory;
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+import org.drools.spi.RuleFlowGroup;
+
+/**
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowEventSupport implements Serializable {
+
+ private static final long serialVersionUID = -4300367587017885998L;
+ private final List listeners = Collections.synchronizedList( new ArrayList() );
+ private final WorkingMemory workingMemory;
+
+ public RuleFlowEventSupport(final WorkingMemory workingMemory) {
+ this.workingMemory = workingMemory;
+ }
+
+ public void addEventListener(final RuleFlowEventListener listener) {
+ if ( !this.listeners.contains( listener ) ) {
+ this.listeners.add( listener );
+ }
+ }
+
+ public void removeEventListener(final RuleFlowEventListener listener) {
+ this.listeners.remove( listener );
+ }
+
+ public List getEventListeners() {
+ return Collections.unmodifiableList( this.listeners );
+ }
+
+ public int size() {
+ return this.listeners.size();
+ }
+
+ public boolean isEmpty() {
+ return this.listeners.isEmpty();
+ }
+
+ public void fireRuleFlowProcessStarted(final RuleFlowProcessInstance instance) {
+ if ( this.listeners.isEmpty() ) {
+ return;
+ }
+
+ final RuleFlowStartedEvent event = new RuleFlowStartedEvent( instance );
+
+ for ( int i = 0, size = this.listeners.size(); i < size; i++ ) {
+ ((RuleFlowEventListener) this.listeners.get( i ))
+ .ruleFlowStarted( event, this.workingMemory );
+ }
+ }
+
+ public void fireRuleFlowProcessCompleted(final RuleFlowProcessInstance instance) {
+ if ( this.listeners.isEmpty() ) {
+ return;
+ }
+
+ final RuleFlowCompletedEvent event = new RuleFlowCompletedEvent( instance );
+
+ for ( int i = 0, size = this.listeners.size(); i < size; i++ ) {
+ ((RuleFlowEventListener) this.listeners.get( i ))
+ .ruleFlowCompleted( event, this.workingMemory );
+ }
+ }
+
+ public void fireRuleFlowGroupActivated(final RuleFlowGroup ruleFlowGroup) {
+ if ( this.listeners.isEmpty() ) {
+ return;
+ }
+
+ final RuleFlowGroupActivatedEvent event = new RuleFlowGroupActivatedEvent( ruleFlowGroup );
+
+ for ( int i = 0, size = this.listeners.size(); i < size; i++ ) {
+ ((RuleFlowEventListener) this.listeners.get( i ))
+ .ruleFlowGroupActivated( event, this.workingMemory );
+ }
+ }
+
+ public void fireRuleFlowGroupDeactivated(final RuleFlowGroup ruleFlowGroup) {
+ if ( this.listeners.isEmpty() ) {
+ return;
+ }
+
+ final RuleFlowGroupDeactivatedEvent event = new RuleFlowGroupDeactivatedEvent( ruleFlowGroup );
+
+ for ( int i = 0, size = this.listeners.size(); i < size; i++ ) {
+ ((RuleFlowEventListener) this.listeners.get( i ))
+ .ruleFlowGroupDeactivated( event, this.workingMemory );
+ }
+ }
+
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupActivatedEvent.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupActivatedEvent.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupActivatedEvent.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,35 @@
+package org.drools.event;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import org.drools.spi.RuleFlowGroup;
+
+/**
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowGroupActivatedEvent extends RuleFlowGroupEvent {
+
+ private static final long serialVersionUID = 6711533652198215540L;
+
+ public RuleFlowGroupActivatedEvent(final RuleFlowGroup ruleFlowGroup) {
+ super( ruleFlowGroup );
+ }
+
+ public String toString() {
+ return "==>[RuleFlowGroupActivated(name=" + getRuleFlowGroup().getName() + "; size=" + getRuleFlowGroup().size() + ")]";
+ }
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupDeactivatedEvent.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupDeactivatedEvent.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupDeactivatedEvent.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,35 @@
+package org.drools.event;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import org.drools.spi.RuleFlowGroup;
+
+/**
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowGroupDeactivatedEvent extends RuleFlowGroupEvent {
+
+ private static final long serialVersionUID = -1711498907240105797L;
+
+ public RuleFlowGroupDeactivatedEvent(final RuleFlowGroup ruleFlowGroup) {
+ super( ruleFlowGroup );
+ }
+
+ public String toString() {
+ return "==>[RuleFlowGroupDeactivated(name=" + getRuleFlowGroup().getName() + "; size=" + getRuleFlowGroup().size() + ")]";
+ }
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupEvent.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupEvent.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowGroupEvent.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,38 @@
+package org.drools.event;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.EventObject;
+
+import org.drools.spi.RuleFlowGroup;
+
+/**
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowGroupEvent extends EventObject {
+
+ private static final long serialVersionUID = 6913064387373163807L;
+
+ public RuleFlowGroupEvent(final RuleFlowGroup ruleFlowGroup) {
+ super( ruleFlowGroup );
+ }
+
+ public RuleFlowGroup getRuleFlowGroup() {
+ return (RuleFlowGroup) getSource();
+ }
+
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowStartedEvent.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowStartedEvent.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/RuleFlowStartedEvent.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,35 @@
+package org.drools.event;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+
+/**
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowStartedEvent extends RuleFlowEvent {
+
+ private static final long serialVersionUID = 6711533652198215540L;
+
+ public RuleFlowStartedEvent(final RuleFlowProcessInstance instance) {
+ super( instance );
+ }
+
+ public String toString() {
+ return "==>[RuleFlowStarted(name=" + getRuleFlowProcessInstance().getRuleFlowProcess().getName() + "; id=" + getRuleFlowProcessInstance().getRuleFlowProcess().getId() + ")]";
+ }
+}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -22,6 +22,7 @@
import org.drools.common.AgendaGroupImpl;
import org.drools.common.AgendaItem;
import org.drools.common.BaseNode;
+import org.drools.common.EventSupport;
import org.drools.common.InternalAgenda;
import org.drools.common.InternalFactHandle;
import org.drools.common.InternalRuleFlowGroup;
@@ -181,7 +182,7 @@
memory.getTupleMemory().add( tuple );
item.setActivated( true );
- workingMemory.getAgendaEventSupport().fireActivationCreated( item,
+ ((EventSupport) workingMemory).getAgendaEventSupport().fireActivationCreated( item,
workingMemory );
} else {
// -----------------
@@ -310,7 +311,7 @@
// We only want to fire an event on a truly new Activation and not on an Activation as a result of a modify
if ( fireActivationCreated ) {
- workingMemory.getAgendaEventSupport().fireActivationCreated( item,
+ ((EventSupport) workingMemory).getAgendaEventSupport().fireActivationCreated( item,
workingMemory );
}
}
@@ -371,11 +372,10 @@
if ( activation.getRuleFlowGroupNode() != null ) {
final InternalRuleFlowGroup ruleFlowGroup = activation.getRuleFlowGroupNode().getRuleFlowGroup();
- ruleFlowGroup.removeActivation( activation,
- workingMemory );
+ ruleFlowGroup.removeActivation( activation );
}
- workingMemory.getAgendaEventSupport().fireActivationCancelled( activation,
+ ((EventSupport) workingMemory).getAgendaEventSupport().fireActivationCancelled( activation,
workingMemory );
((InternalAgenda) workingMemory.getAgenda()).decreaseActiveActivations();
} else {
@@ -427,7 +427,7 @@
if ( activation.isActivated() ) {
activation.remove();
- workingMemory.getAgendaEventSupport().fireActivationCancelled( activation,
+ ((EventSupport) workingMemory).getAgendaEventSupport().fireActivationCancelled( activation,
workingMemory );
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Package.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Package.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Package.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -33,8 +33,8 @@
import org.drools.common.ObjectInputStreamWithLoader;
import org.drools.facttemplates.FactTemplate;
-import org.drools.ruleflow.common.core.IProcess;
-import org.drools.ruleflow.core.impl.RuleFlowProcess;
+import org.drools.ruleflow.common.core.Process;
+import org.drools.ruleflow.core.impl.RuleFlowProcessImpl;
import org.drools.util.StringUtils;
/**
@@ -289,7 +289,7 @@
/**
* Add a rule flow to this package.
*/
- public void addRuleFlow(IProcess process) {
+ public void addRuleFlow(Process process) {
if (this.ruleFlows == Collections.EMPTY_MAP) {
this.ruleFlows = new HashMap();
}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/IProcess.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/IProcess.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/IProcess.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,83 +0,0 @@
-package org.drools.ruleflow.common.core;
-
-import java.io.Serializable;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-/**
- * Represents a some process definition.
- * A process has a name and a unique id.
- * When a new version of a process is created, the name stays the same,
- * but the id and the version of the process should be different.
- * Different types of processes could be defined (like RuleFlow).
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IProcess extends Serializable {
-
- /**
- * Sets the id of this process.
- * The id should uniquely identify this process.
- * @param id the id of the process
- */
- void setId(String id);
-
- /**
- * Returns the id of this process.
- * @return the id of this process
- */
- String getId();
-
- /**
- * Sets the name of this process.
- * @param name the name of this process
- */
- void setName(String name);
-
- /**
- * Returns the name of this process.
- * If no name is specified, null is returned.
- * @return the name of this process
- */
- String getName();
-
- /**
- * Sets the version of this process.
- * @param version the version of this process
- */
- void setVersion(String version);
-
- /**
- * Returns the version of this process.
- * If no version is specified, null is returned.
- * @return the version of this process
- */
- String getVersion();
-
- /**
- * Sets the type of this process.
- * @param type the type of this process
- */
- void setType(String type);
-
- /**
- * Returns the type of this process.
- * @return the type of this process
- */
- String getType();
-
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/Process.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/IProcess.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/Process.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/Process.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,83 @@
+package org.drools.ruleflow.common.core;
+
+import java.io.Serializable;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Represents a some process definition.
+ * A process has a name and a unique id.
+ * When a new version of a process is created, the name stays the same,
+ * but the id and the version of the process should be different.
+ * Different types of processes could be defined (like RuleFlow).
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface Process extends Serializable {
+
+ /**
+ * Sets the id of this process.
+ * The id should uniquely identify this process.
+ * @param id the id of the process
+ */
+ void setId(String id);
+
+ /**
+ * Returns the id of this process.
+ * @return the id of this process
+ */
+ String getId();
+
+ /**
+ * Sets the name of this process.
+ * @param name the name of this process
+ */
+ void setName(String name);
+
+ /**
+ * Returns the name of this process.
+ * If no name is specified, null is returned.
+ * @return the name of this process
+ */
+ String getName();
+
+ /**
+ * Sets the version of this process.
+ * @param version the version of this process
+ */
+ void setVersion(String version);
+
+ /**
+ * Returns the version of this process.
+ * If no version is specified, null is returned.
+ * @return the version of this process
+ */
+ String getVersion();
+
+ /**
+ * Sets the type of this process.
+ * @param type the type of this process
+ */
+ void setType(String type);
+
+ /**
+ * Returns the type of this process.
+ * @return the type of this process
+ */
+ String getType();
+
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/impl/Process.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/impl/Process.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/impl/Process.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,81 +0,0 @@
-package org.drools.ruleflow.common.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.io.Serializable;
-
-import org.drools.ruleflow.common.core.IProcess;
-
-/**
- * Default implementation of a Process
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class Process
- implements
- IProcess,
- Serializable {
- private static final long serialVersionUID = 3904955335549399096L;
-
- private String id;
- private String name;
- private String version;
- private String type;
-
- public void setId(final String id) {
- this.id = id;
- }
-
- public String getId() {
- return this.id;
- }
-
- public void setName(final String name) {
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setVersion(final String version) {
- this.version = version;
- }
-
- public String getVersion() {
- return this.version;
- }
-
- public String getType() {
- return this.type;
- }
-
- public void setType(final String type) {
- this.type = type;
- }
-
- public boolean equals(final Object o) {
- if ( o instanceof Process ) {
- return ((Process) o).getName().equals( this.name ) && ((Process) o).getVersion().equals( this.version );
- }
- return false;
- }
-
- public int hashCode() {
- return this.name.hashCode() + 3 * this.version.hashCode();
- }
-}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/impl/ProcessImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/impl/Process.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/impl/ProcessImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/core/impl/ProcessImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,79 @@
+package org.drools.ruleflow.common.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.io.Serializable;
+
+/**
+ * Default implementation of a Process
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ProcessImpl
+ implements
+ org.drools.ruleflow.common.core.Process,
+ Serializable {
+ private static final long serialVersionUID = 3904955335549399096L;
+
+ private String id;
+ private String name;
+ private String version;
+ private String type;
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setVersion(final String version) {
+ this.version = version;
+ }
+
+ public String getVersion() {
+ return this.version;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public boolean equals(final Object o) {
+ if ( o instanceof ProcessImpl ) {
+ return ((ProcessImpl) o).getName().equals( this.name ) && ((ProcessImpl) o).getVersion().equals( this.version );
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return this.name.hashCode() + 3 * this.version.hashCode();
+ }
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/DataType.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/IDataType.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/DataType.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/DataType.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,35 @@
+package org.drools.ruleflow.common.datatype;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.io.Serializable;
+
+/**
+ * Abstract representation of a datatype.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface DataType
+ extends
+ Serializable {
+
+ /**
+ * Returns true if the given value is a valid value of this data type.
+ */
+ boolean verifyDataType(Object value);
+
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/DataTypeFactory.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/IDataTypeFactory.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/DataTypeFactory.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/DataTypeFactory.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,28 @@
+package org.drools.ruleflow.common.datatype;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * A factory for creating a datatype.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface DataTypeFactory {
+
+ DataType createDataType();
+
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/IDataType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/IDataType.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/IDataType.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,35 +0,0 @@
-package org.drools.ruleflow.common.datatype;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.io.Serializable;
-
-/**
- * Abstract representation of a datatype.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IDataType
- extends
- Serializable {
-
- /**
- * Returns true if the given value is a valid value of this data type.
- */
- boolean verifyDataType(Object value);
-
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/IDataTypeFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/IDataTypeFactory.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/IDataTypeFactory.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,28 +0,0 @@
-package org.drools.ruleflow.common.datatype;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-/**
- * A factory for creating a datatype.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IDataTypeFactory {
-
- IDataType createDataType();
-
-}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/InstanceDataTypeFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/InstanceDataTypeFactory.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/InstanceDataTypeFactory.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-import org.drools.ruleflow.common.datatype.IDataType;
-import org.drools.ruleflow.common.datatype.IDataTypeFactory;
+import org.drools.ruleflow.common.datatype.DataType;
+import org.drools.ruleflow.common.datatype.DataTypeFactory;
/**
* A data type factory that always returns the same instance of a given class.
@@ -26,19 +26,19 @@
*/
public class InstanceDataTypeFactory
implements
- IDataTypeFactory {
+ DataTypeFactory {
private Class dataTypeClass;
- private IDataType instance;
+ private DataType instance;
public InstanceDataTypeFactory(final Class dataTypeClass) {
this.dataTypeClass = dataTypeClass;
}
- public IDataType createDataType() {
+ public DataType createDataType() {
if ( this.instance == null ) {
try {
- this.instance = (IDataType) this.dataTypeClass.newInstance();
+ this.instance = (DataType) this.dataTypeClass.newInstance();
} catch ( final IllegalAccessException e ) {
throw new RuntimeException( "Could not create data type for class " + this.dataTypeClass,
e );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/NewInstanceDataTypeFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/NewInstanceDataTypeFactory.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/NewInstanceDataTypeFactory.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-import org.drools.ruleflow.common.datatype.IDataType;
-import org.drools.ruleflow.common.datatype.IDataTypeFactory;
+import org.drools.ruleflow.common.datatype.DataType;
+import org.drools.ruleflow.common.datatype.DataTypeFactory;
/**
* A data type factory that always returns a new instance of a given class.
@@ -26,7 +26,7 @@
*/
public class NewInstanceDataTypeFactory
implements
- IDataTypeFactory {
+ DataTypeFactory {
private Class dataTypeClass;
@@ -34,9 +34,9 @@
this.dataTypeClass = dataTypeClass;
}
- public IDataType createDataType() {
+ public DataType createDataType() {
try {
- return (IDataType) this.dataTypeClass.newInstance();
+ return (DataType) this.dataTypeClass.newInstance();
} catch ( final IllegalAccessException e ) {
throw new RuntimeException( "Could not create data type for class " + this.dataTypeClass,
e );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/BooleanDataType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/BooleanDataType.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/BooleanDataType.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import org.drools.ruleflow.common.datatype.IDataType;
+import org.drools.ruleflow.common.datatype.DataType;
/**
* Representation of a boolean datatype.
@@ -25,7 +25,7 @@
*/
public final class BooleanDataType
implements
- IDataType {
+ DataType {
private static final long serialVersionUID = 3617855257384989752L;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/FloatDataType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/FloatDataType.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/FloatDataType.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import org.drools.ruleflow.common.datatype.IDataType;
+import org.drools.ruleflow.common.datatype.DataType;
/**
* Representation of a float datatype.
@@ -25,7 +25,7 @@
*/
public final class FloatDataType
implements
- IDataType {
+ DataType {
private static final long serialVersionUID = 3257008760991069747L;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/IntegerDataType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/IntegerDataType.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/IntegerDataType.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import org.drools.ruleflow.common.datatype.IDataType;
+import org.drools.ruleflow.common.datatype.DataType;
/**
* Representation of an integer datatype.
@@ -25,7 +25,7 @@
*/
public class IntegerDataType
implements
- IDataType {
+ DataType {
private static final long serialVersionUID = 3256443611980838707L;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/ListDataType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/ListDataType.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/ListDataType.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -20,7 +20,7 @@
import java.util.Iterator;
import java.util.List;
-import org.drools.ruleflow.common.datatype.IDataType;
+import org.drools.ruleflow.common.datatype.DataType;
/**
* Representation of a list datatype.
@@ -30,18 +30,18 @@
*/
public class ListDataType
implements
- IDataType,
+ DataType,
Serializable {
private static final long serialVersionUID = 3689069551774415161L;
- private IDataType dataType;
+ private DataType dataType;
- public void setDataType(final IDataType dataType) {
+ public void setDataType(final DataType dataType) {
this.dataType = dataType;
}
- public IDataType getDataType() {
+ public DataType getDataType() {
return this.dataType;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/StringDataType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/StringDataType.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/StringDataType.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import org.drools.ruleflow.common.datatype.IDataType;
+import org.drools.ruleflow.common.datatype.DataType;
/**
* Representation of a string datatype.
@@ -25,7 +25,7 @@
*/
public class StringDataType
implements
- IDataType {
+ DataType {
private static final long serialVersionUID = 3258416135924758834L;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/UndefinedDataType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/UndefinedDataType.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/datatype/impl/type/UndefinedDataType.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import org.drools.ruleflow.common.datatype.IDataType;
+import org.drools.ruleflow.common.datatype.DataType;
/**
* Representation of an undefined datatype.
@@ -25,7 +25,7 @@
*/
public final class UndefinedDataType
implements
- IDataType {
+ DataType {
private static final long serialVersionUID = 3690196546763699768L;
private static UndefinedDataType instance;
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/IProcessInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/IProcessInstance.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/IProcessInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,52 +0,0 @@
-package org.drools.ruleflow.common.instance;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.io.Serializable;
-
-import org.drools.ruleflow.common.core.IProcess;
-
-/**
- * A process instance is the representation of a process during its execution.
- * It contains all the runtime status information about the running process.
- * A process can have multiple instances.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IProcessInstance
- extends
- Serializable {
-
- int STATE_PENDING = 0;
- int STATE_ACTIVE = 1;
- int STATE_COMPLETED = 2;
- int STATE_ABORTED = 3;
- int STATE_SUSPENDED = 4;
-
- void setId(long id);
-
- long getId();
-
- void setProcess(IProcess process);
-
- IProcess getProcess();
-
- void setState(int state);
-
- int getState();
-
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/ProcessInstance.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/IProcessInstance.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/ProcessInstance.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/ProcessInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,52 @@
+package org.drools.ruleflow.common.instance;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.io.Serializable;
+
+import org.drools.ruleflow.common.core.Process;
+
+/**
+ * A process instance is the representation of a process during its execution.
+ * It contains all the runtime status information about the running process.
+ * A process can have multiple instances.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface ProcessInstance
+ extends
+ Serializable {
+
+ int STATE_PENDING = 0;
+ int STATE_ACTIVE = 1;
+ int STATE_COMPLETED = 2;
+ int STATE_ABORTED = 3;
+ int STATE_SUSPENDED = 4;
+
+ void setId(long id);
+
+ long getId();
+
+ void setProcess(Process process);
+
+ Process getProcess();
+
+ void setState(int state);
+
+ int getState();
+
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/impl/ProcessInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/impl/ProcessInstance.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/impl/ProcessInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,69 +0,0 @@
-package org.drools.ruleflow.common.instance.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import org.drools.ruleflow.common.core.IProcess;
-import org.drools.ruleflow.common.instance.IProcessInstance;
-
-/**
- * Default implementation of a process instance.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public abstract class ProcessInstance
- implements
- IProcessInstance {
-
- private long id;
- private IProcess process;
- private int state = STATE_PENDING;
-
- public void setId(final long id) {
- this.id = id;
- }
-
- public long getId() {
- return this.id;
- }
-
- public void setProcess(final IProcess process) {
- this.process = process;
- }
-
- public IProcess getProcess() {
- return this.process;
- }
-
- public void setState(final int state) {
- this.state = state;
- }
-
- public int getState() {
- return this.state;
- }
-
- public String toString() {
- final StringBuffer b = new StringBuffer( "ProcessInstance " );
- b.append( getId() );
- b.append( " [processId=" );
- b.append( this.process.getId() );
- b.append( ",state=" );
- b.append( this.state );
- b.append( "]" );
- return b.toString();
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/impl/ProcessInstanceImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/impl/ProcessInstance.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/impl/ProcessInstanceImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/common/instance/impl/ProcessInstanceImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,68 @@
+package org.drools.ruleflow.common.instance.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import org.drools.ruleflow.common.core.Process;
+
+/**
+ * Default implementation of a process instance.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class ProcessInstanceImpl
+ implements
+ org.drools.ruleflow.common.instance.ProcessInstance {
+
+ private long id;
+ private Process process;
+ private int state = STATE_PENDING;
+
+ public void setId(final long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+ public void setProcess(final Process process) {
+ this.process = process;
+ }
+
+ public Process getProcess() {
+ return this.process;
+ }
+
+ public void setState(final int state) {
+ this.state = state;
+ }
+
+ public int getState() {
+ return this.state;
+ }
+
+ public String toString() {
+ final StringBuffer b = new StringBuffer( "ProcessInstance " );
+ b.append( getId() );
+ b.append( " [processId=" );
+ b.append( this.process.getId() );
+ b.append( ",state=" );
+ b.append( this.state );
+ b.append( "]" );
+ return b.toString();
+ }
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Connection.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IConnection.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Connection.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Connection.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,58 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Represents a connection between two nodes in a RuleFlow.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface Connection {
+
+ /**
+ * The connection type
+ */
+ int TYPE_NORMAL = 1;
+ int TYPE_ABORT = 2;
+
+ /**
+ * Returns the from node of the connection.
+ * @return the from node of the connection.
+ */
+ Node getFrom();
+
+ /**
+ * Returns the to node of the connection
+ * @return the to node of the connection
+ */
+ Node getTo();
+
+ /**
+ * Returns the connection type
+ * @return the connection type
+ */
+ int getType();
+
+ /**
+ * Destroys the connection. This method also removes the
+ * connection on the <code>to</code> and <code>from</code> nodes.
+ * Onces a connection is destroyed, all methods throw
+ * an <code>IllegalStateException</code>.
+ */
+ void terminate();
+
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Constraint.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IConstraint.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Constraint.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Constraint.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,65 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Represents a constraint in a RuleFlow.
+ * Can be used to specify conditions in (X)OR-splits.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface Constraint {
+
+ /**
+ * Typically this method returns the constraint
+ * @return the constraint
+ */
+ String getConstraint();
+
+ /**
+ * Method for setting the constraint
+ * @param constraint the constraint
+ */
+ void setConstraint(String constraint);
+
+ /**
+ * Returns the name of the constraint
+ * @return the name of the constraint
+ */
+ String getName();
+
+ /**
+ * Sets the name of the constraint
+ * @param name the name of the constraint
+ */
+ void setName(String name);
+
+ /**
+ * Returns the priority of the constriant
+ *
+ * @return the priority of the constraint
+ */
+ int getPriority();
+
+ /**
+ * Method for setting the priority of the constraint
+ *
+ * @param priority the priority of the constraint
+ */
+ void setPriority(int priority);
+
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/EndNode.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IEndNode.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/EndNode.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/EndNode.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,35 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Represents an end node in a RuleFlow.
+ * An end node has one incoming and no outgoing connections.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface EndNode
+ extends
+ Node {
+
+ /**
+ * Convenience method for returning the incoming <code>IConnection</code>.
+ * @return the incoming <code>IConnection</code>
+ */
+ Connection getFrom();
+
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IConnection.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IConnection.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IConnection.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,58 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-/**
- * Represents a connection between two nodes in a RuleFlow.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IConnection {
-
- /**
- * The connection type
- */
- int TYPE_NORMAL = 1;
- int TYPE_ABORT = 2;
-
- /**
- * Returns the from node of the connection.
- * @return the from node of the connection.
- */
- INode getFrom();
-
- /**
- * Returns the to node of the connection
- * @return the to node of the connection
- */
- INode getTo();
-
- /**
- * Returns the connection type
- * @return the connection type
- */
- int getType();
-
- /**
- * Destroys the connection. This method also removes the
- * connection on the <code>to</code> and <code>from</code> nodes.
- * Onces a connection is destroyed, all methods throw
- * an <code>IllegalStateException</code>.
- */
- void terminate();
-
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IConstraint.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IConstraint.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,65 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-/**
- * Represents a constraint in a RuleFlow.
- * Can be used to specify conditions in (X)OR-splits.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IConstraint {
-
- /**
- * Typically this method returns the constraint
- * @return the constraint
- */
- String getConstraint();
-
- /**
- * Method for setting the constraint
- * @param constraint the constraint
- */
- void setConstraint(String constraint);
-
- /**
- * Returns the name of the constraint
- * @return the name of the constraint
- */
- String getName();
-
- /**
- * Sets the name of the constraint
- * @param name the name of the constraint
- */
- void setName(String name);
-
- /**
- * Returns the priority of the constriant
- *
- * @return the priority of the constraint
- */
- int getPriority();
-
- /**
- * Method for setting the priority of the constraint
- *
- * @param priority the priority of the constraint
- */
- void setPriority(int priority);
-
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IEndNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IEndNode.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IEndNode.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,35 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-/**
- * Represents an end node in a RuleFlow.
- * An end node has one incoming and no outgoing connections.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IEndNode
- extends
- INode {
-
- /**
- * Convenience method for returning the incoming <code>IConnection</code>.
- * @return the incoming <code>IConnection</code>
- */
- IConnection getFrom();
-
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IJoin.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IJoin.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IJoin.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,66 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-/**
- * Represents a join node in a RuleFlow.
- * A join is a special kind of node with multiple incoming connections and
- * one outgoing connection. The type of join decides when the outgoing
- * connections will be triggered (based on which incoming connections have
- * been triggered).
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IJoin
- extends
- INode {
-
- int TYPE_UNDEFINED = 0;
- /**
- * The outgoing connection of a join of this type is triggered
- * when all its incoming connections have been triggered.
- */
- int TYPE_AND = 1;
- /**
- * The outgoing connection of a join of this type is triggered
- * when one of its incoming connections has been triggered.
- */
- int TYPE_XOR = 2;
-
- /**
- * Sets the type of the join.
- *
- * @param type The type of the join
- * @throws IllegalArgumentException if type is null
- */
- void setType(int type);
-
- /**
- * Returns the type of the join.
- *
- * @return the type of the join.
- */
- int getType();
-
- /**
- * Convenience method for returning the outgoing connection of the join
- *
- * @return the outgoing connection of the join
- */
- IConnection getTo();
-
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/INode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/INode.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/INode.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,71 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * Represents a node in a RuleFlow.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface INode
- extends
- Serializable {
-
- /**
- * Returns the id of the node
- *
- * @return the id of the node
- */
- long getId();
-
- /**
- * Method for setting the id of the node
- *
- * @param id the id of the node
- */
- void setId(long id);
-
- /**
- * Returns the name of the node
- *
- * @return the name of the node
- */
- String getName();
-
- /**
- * Method for setting the name of the node
- *
- * @param name the name of the node
- */
- void setName(String name);
-
- /**
- * Returns the incoming connections
- * @return the incoming connections
- */
- List getIncomingConnections();
-
- /**
- * Returns the outgoing connections
- * @return the outgoing connections
- */
- List getOutgoingConnections();
-
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcess.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcess.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcess.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,93 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.List;
-
-import org.drools.ruleflow.common.core.IProcess;
-
-/**
- * Represents a RuleFlow process.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IRuleFlowProcess
- extends
- IProcess {
-
- /**
- * Returns the start node of this RuleFlow process.
- *
- * @return the start node
- */
- IStartNode getStart();
-
- /**
- * Returns the nodes of this RuleFlow process.
- *
- * @return the nodes of this RuleFlow process
- */
- INode[] getNodes();
-
- /**
- * Returns the node with the given id
- *
- * @param id the node id
- * @return the node with the given id
- * @throws IllegalArgumentException if an unknown id is passed
- */
- INode getNode(long id);
-
- /**
- * Method for adding a node to this RuleFlow process.
- * Note that the node will get an id unique for this process.
- *
- * @param node the node to be added
- * @throws IllegalArgumentException if <code>node</code> is null
- */
- void addNode(INode node);
-
- /**
- * Method for removing a node from this RuleFlow process
- *
- * @param node the node to be removed
- * @throws IllegalArgumentException if <code>node</code> is null or unknown
- */
- void removeNode(INode node);
-
- /**
- * Returns the global variables used in this RuleFlow process
- *
- * @return a list of variables of this RuleFlow process
- */
- List getVariables();
-
- /**
- * Sets the global variables used in this RuleFlow process
- *
- * @param variables the variables
- * @throws IllegalArugmentException if <code>variables</code> is null
- */
- void setVariables(List variables);
-
- /**
- * Returns the names of the global variables used in this RuleFlow process
- *
- * @return the variable names of this RuleFlow process
- */
- String[] getVariableNames();
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcessValidationError.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcessValidationError.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcessValidationError.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,46 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-/**
- * Represents a RuleFlow validation error.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IRuleFlowProcessValidationError {
-
- String NO_PROCESS_NAME = "RuleFlow process has no name.";
- String NO_PROCESS_ID = "RuleFlow process has no id.";
- String NO_START_NODE = "RuleFlow process has no start node.";
- String START_NODE_WITHOUT_OUTGOING_NODES = "Start node has no outgoing connection.";
- String END_NODE_HAS_NO_INCOMING_CONNECTIONS = "End node has no incoming connection.";
- String NO_END_NODE = "No end node found.";
- String RULE_SET_NODE_WITHOUT_INCOMING_CONNECTIONS = "RuleSet node has no incoming connection.";
- String RULE_SET_NODE_WITHOUT_OUTGOING_CONNECTIONS = "RuleSet node has no outgoing connection.";
- String RULE_SET_NODE_WITHOUT_RULE_SET_GROUP = "RuleSet node has no ruleflow-group specified.";
- String SPLIT_WITHOUT_TYPE = "Split node has no type.";
- String SPLIT_WITHOUT_INCOMING_CONNECTION = "Split node has no incoming connection.";
- String SPLIT_NOT_ENOUGH_OUTGOING_CONNECTIONS = "Split node does not have enough outgoing connections.";
- String SPLIT_OUTGOING_CONNECTION_WITHOUT_CONSTRAINT = "An outgoing connection of a split node has no constraint.";
- String JOIN_WITHOUT_TYPE = "Join node has no type.";
- String JOIN_NOT_ENOUGH_INCOMING_CONNECTIONS = "Join node does not have enough incoming connections.";
- String JOIN_WITHOUT_OUTGOING_CONNECTION = "Join node has no outgoing connection.";
- String VARIABLE_WITHOUT_TYPE = "A variable has no type.";
- String ALL_NODES_CONNECTED_TO_START = "A node is not connected to the start node.";
-
- String getType();
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcessValidator.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcessValidator.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcessValidator.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,28 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-/**
- * A validator for validating a RuleFlow process.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IRuleFlowProcessValidator {
-
- IRuleFlowProcessValidationError[] validateProcess(IRuleFlowProcess process);
-
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleSetNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleSetNode.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleSetNode.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,56 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-/**
- * Represents a node containing a set of rules in a RuleFlow.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IRuleSetNode
- extends
- INode {
-
- /**
- * Returns the incoming connection of the RuleSetNode.
- *
- * @return the incoming connection of the RuleSetNode.
- */
- IConnection getFrom();
-
- /**
- * Returns the outgoing connection of the RuleSetNode.
- *
- * @return the outgoing connection of the RuleSetNode.
- */
- IConnection getTo();
-
- /**
- * Returns the ruleflow-group of the RuleSetNode.
- *
- * @return the ruleflow-group of the RuleSetNode.
- */
- String getRuleFlowGroup();
-
- /**
- * Sets the ruleflow-group of the RuleSetNode.
- *
- * @param ruleFlowGroup The ruleflow-group of the RuleSetNode
- * @throws IllegalArgumentException if type is null
- */
- void setRuleFlowGroup(String ruleFlowGroup);
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/ISplit.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/ISplit.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/ISplit.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,117 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.Map;
-
-/**
- * Represents a split node in a RuleFlow.
- * A split is a special kind of node with one incoming connection and
- * multiple outgoing connections. The type of split decides which of the
- * outgoing connections will be triggered when the incoming connection
- * has been triggered.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface ISplit
- extends
- INode {
-
- int TYPE_UNDEFINED = 0;
- /**
- * All outgoing connections of a split of this type are triggered
- * when its incoming connection has been triggered. A split of this
- * type should have no constraints linked to any of its outgoing
- * connections.
- */
- int TYPE_AND = 1;
- /**
- * Exactly one outgoing connection of a split of this type is triggered
- * when its incoming connection has been triggered. Which connection
- * is based on the constraints associated with each of the connections:
- * the connection with the highest priority whose constraint is satisfied
- * is triggered.
- */
- int TYPE_XOR = 2;
- /**
- * One or multiple outgoing connections of a split of this type are
- * triggered when its incoming connection has been triggered. Which
- * connections is based on the constraints associated with each of the
- * connections: all connections whose constraint is satisfied are
- * triggered.
- */
- int TYPE_OR = 3;
-
- /**
- * Sets the type of the split.
- *
- * @param type The type of the split
- * @throws IllegalArgumentException if type is null
- */
- void setType(int type);
-
- /**
- * Returns the type of the split.
- *
- * @return the type of the split.
- */
- int getType();
-
- /**
- * Returns the corresponding constraint of the given outgoing connection
- *
- * @param connection the outgoing connection
- * @return the corresponding constraint of the given outgoing connection
- * @throws IllegalArgumentException if <code>connection</code> is
- * not a valid outgoing connection for this split
- * @throws UnsupportedOperationException if this method is called
- * on a split with split type of something else than XOR or OR
- */
- IConstraint getConstraint(IConnection connection);
-
- /**
- * Method for setting a constraint corresponding to the given
- * outgoing connection
- *
- * @param connection the outgoing connection
- * @param constraint the constraint
- * @throws IllegalArgumentException if <code>connection</code> is
- * not a valid outgoing connection for this split
- * @throws UnsupportedOperationException if the split type is
- * something else than XOR or OR
- */
- void setConstraint(IConnection connection,
- IConstraint constraint);
-
- /**
- * Returns the constraints of the split.
- *
- * @return a map containing for each connection the constraint associated with
- * that connection, or null if no constraint has been specified yet for that connection
- * @throws UnsupportedOperationException if this method is called
- * on a split with split type of something else than XOR or OR
- */
- Map getConstraints();
-
- /**
- * Convenience method for returning the incoming connection of the split.
- *
- * @return the incoming connection ot the split.
- */
- IConnection getFrom();
-
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IStartNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IStartNode.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IStartNode.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,35 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-/**
- * Represents a start node in a RuleFlow.
- * A start node has no incoming and one outgoing connection.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IStartNode
- extends
- INode {
-
- /**
- * Convenience method for returning the outgoing <code>IConnection</code>.
- * @return the outgoing <code>IConnection</code>
- */
- IConnection getTo();
-
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IVariable.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IVariable.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,44 +0,0 @@
-package org.drools.ruleflow.core;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.io.Serializable;
-
-import org.drools.ruleflow.common.datatype.IDataType;
-
-/**
- * Represents a global variable used in a RuleFlow.
- * A variable has a name (should be unique for this process), a datatype
- * and possibly an initial value.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IVariable {
-
- String getName();
-
- void setName(String name);
-
- IDataType getType();
-
- void setType(IDataType type);
-
- Serializable getValue();
-
- void setValue(Serializable value);
-
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Join.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IJoin.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Join.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Join.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,66 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Represents a join node in a RuleFlow.
+ * A join is a special kind of node with multiple incoming connections and
+ * one outgoing connection. The type of join decides when the outgoing
+ * connections will be triggered (based on which incoming connections have
+ * been triggered).
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface Join
+ extends
+ Node {
+
+ int TYPE_UNDEFINED = 0;
+ /**
+ * The outgoing connection of a join of this type is triggered
+ * when all its incoming connections have been triggered.
+ */
+ int TYPE_AND = 1;
+ /**
+ * The outgoing connection of a join of this type is triggered
+ * when one of its incoming connections has been triggered.
+ */
+ int TYPE_XOR = 2;
+
+ /**
+ * Sets the type of the join.
+ *
+ * @param type The type of the join
+ * @throws IllegalArgumentException if type is null
+ */
+ void setType(int type);
+
+ /**
+ * Returns the type of the join.
+ *
+ * @return the type of the join.
+ */
+ int getType();
+
+ /**
+ * Convenience method for returning the outgoing connection of the join
+ *
+ * @return the outgoing connection of the join
+ */
+ Connection getTo();
+
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Node.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/INode.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Node.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Node.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,71 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Represents a node in a RuleFlow.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface Node
+ extends
+ Serializable {
+
+ /**
+ * Returns the id of the node
+ *
+ * @return the id of the node
+ */
+ long getId();
+
+ /**
+ * Method for setting the id of the node
+ *
+ * @param id the id of the node
+ */
+ void setId(long id);
+
+ /**
+ * Returns the name of the node
+ *
+ * @return the name of the node
+ */
+ String getName();
+
+ /**
+ * Method for setting the name of the node
+ *
+ * @param name the name of the node
+ */
+ void setName(String name);
+
+ /**
+ * Returns the incoming connections
+ * @return the incoming connections
+ */
+ List getIncomingConnections();
+
+ /**
+ * Returns the outgoing connections
+ * @return the outgoing connections
+ */
+ List getOutgoingConnections();
+
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcess.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcess.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcess.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcess.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,93 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.List;
+
+import org.drools.ruleflow.common.core.Process;
+
+/**
+ * Represents a RuleFlow process.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface RuleFlowProcess
+ extends
+ Process {
+
+ /**
+ * Returns the start node of this RuleFlow process.
+ *
+ * @return the start node
+ */
+ StartNode getStart();
+
+ /**
+ * Returns the nodes of this RuleFlow process.
+ *
+ * @return the nodes of this RuleFlow process
+ */
+ Node[] getNodes();
+
+ /**
+ * Returns the node with the given id
+ *
+ * @param id the node id
+ * @return the node with the given id
+ * @throws IllegalArgumentException if an unknown id is passed
+ */
+ Node getNode(long id);
+
+ /**
+ * Method for adding a node to this RuleFlow process.
+ * Note that the node will get an id unique for this process.
+ *
+ * @param node the node to be added
+ * @throws IllegalArgumentException if <code>node</code> is null
+ */
+ void addNode(Node node);
+
+ /**
+ * Method for removing a node from this RuleFlow process
+ *
+ * @param node the node to be removed
+ * @throws IllegalArgumentException if <code>node</code> is null or unknown
+ */
+ void removeNode(Node node);
+
+ /**
+ * Returns the global variables used in this RuleFlow process
+ *
+ * @return a list of variables of this RuleFlow process
+ */
+ List getVariables();
+
+ /**
+ * Sets the global variables used in this RuleFlow process
+ *
+ * @param variables the variables
+ * @throws IllegalArugmentException if <code>variables</code> is null
+ */
+ void setVariables(List variables);
+
+ /**
+ * Returns the names of the global variables used in this RuleFlow process
+ *
+ * @return the variable names of this RuleFlow process
+ */
+ String[] getVariableNames();
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcessValidationError.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcessValidationError.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcessValidationError.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcessValidationError.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,46 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Represents a RuleFlow validation error.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface RuleFlowProcessValidationError {
+
+ String NO_PROCESS_NAME = "RuleFlow process has no name.";
+ String NO_PROCESS_ID = "RuleFlow process has no id.";
+ String NO_START_NODE = "RuleFlow process has no start node.";
+ String START_NODE_WITHOUT_OUTGOING_NODES = "Start node has no outgoing connection.";
+ String END_NODE_HAS_NO_INCOMING_CONNECTIONS = "End node has no incoming connection.";
+ String NO_END_NODE = "No end node found.";
+ String RULE_SET_NODE_WITHOUT_INCOMING_CONNECTIONS = "RuleSet node has no incoming connection.";
+ String RULE_SET_NODE_WITHOUT_OUTGOING_CONNECTIONS = "RuleSet node has no outgoing connection.";
+ String RULE_SET_NODE_WITHOUT_RULE_SET_GROUP = "RuleSet node has no ruleflow-group specified.";
+ String SPLIT_WITHOUT_TYPE = "Split node has no type.";
+ String SPLIT_WITHOUT_INCOMING_CONNECTION = "Split node has no incoming connection.";
+ String SPLIT_NOT_ENOUGH_OUTGOING_CONNECTIONS = "Split node does not have enough outgoing connections.";
+ String SPLIT_OUTGOING_CONNECTION_WITHOUT_CONSTRAINT = "An outgoing connection of a split node has no constraint.";
+ String JOIN_WITHOUT_TYPE = "Join node has no type.";
+ String JOIN_NOT_ENOUGH_INCOMING_CONNECTIONS = "Join node does not have enough incoming connections.";
+ String JOIN_WITHOUT_OUTGOING_CONNECTION = "Join node has no outgoing connection.";
+ String VARIABLE_WITHOUT_TYPE = "A variable has no type.";
+ String ALL_NODES_CONNECTED_TO_START = "A node is not connected to the start node.";
+
+ String getType();
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcessValidator.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleFlowProcessValidator.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcessValidator.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleFlowProcessValidator.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,28 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * A validator for validating a RuleFlow process.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface RuleFlowProcessValidator {
+
+ RuleFlowProcessValidationError[] validateProcess(RuleFlowProcess process);
+
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleSetNode.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IRuleSetNode.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleSetNode.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/RuleSetNode.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,56 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Represents a node containing a set of rules in a RuleFlow.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface RuleSetNode
+ extends
+ Node {
+
+ /**
+ * Returns the incoming connection of the RuleSetNode.
+ *
+ * @return the incoming connection of the RuleSetNode.
+ */
+ Connection getFrom();
+
+ /**
+ * Returns the outgoing connection of the RuleSetNode.
+ *
+ * @return the outgoing connection of the RuleSetNode.
+ */
+ Connection getTo();
+
+ /**
+ * Returns the ruleflow-group of the RuleSetNode.
+ *
+ * @return the ruleflow-group of the RuleSetNode.
+ */
+ String getRuleFlowGroup();
+
+ /**
+ * Sets the ruleflow-group of the RuleSetNode.
+ *
+ * @param ruleFlowGroup The ruleflow-group of the RuleSetNode
+ * @throws IllegalArgumentException if type is null
+ */
+ void setRuleFlowGroup(String ruleFlowGroup);
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Split.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/ISplit.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Split.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Split.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,117 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.Map;
+
+/**
+ * Represents a split node in a RuleFlow.
+ * A split is a special kind of node with one incoming connection and
+ * multiple outgoing connections. The type of split decides which of the
+ * outgoing connections will be triggered when the incoming connection
+ * has been triggered.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface Split
+ extends
+ Node {
+
+ int TYPE_UNDEFINED = 0;
+ /**
+ * All outgoing connections of a split of this type are triggered
+ * when its incoming connection has been triggered. A split of this
+ * type should have no constraints linked to any of its outgoing
+ * connections.
+ */
+ int TYPE_AND = 1;
+ /**
+ * Exactly one outgoing connection of a split of this type is triggered
+ * when its incoming connection has been triggered. Which connection
+ * is based on the constraints associated with each of the connections:
+ * the connection with the highest priority whose constraint is satisfied
+ * is triggered.
+ */
+ int TYPE_XOR = 2;
+ /**
+ * One or multiple outgoing connections of a split of this type are
+ * triggered when its incoming connection has been triggered. Which
+ * connections is based on the constraints associated with each of the
+ * connections: all connections whose constraint is satisfied are
+ * triggered.
+ */
+ int TYPE_OR = 3;
+
+ /**
+ * Sets the type of the split.
+ *
+ * @param type The type of the split
+ * @throws IllegalArgumentException if type is null
+ */
+ void setType(int type);
+
+ /**
+ * Returns the type of the split.
+ *
+ * @return the type of the split.
+ */
+ int getType();
+
+ /**
+ * Returns the corresponding constraint of the given outgoing connection
+ *
+ * @param connection the outgoing connection
+ * @return the corresponding constraint of the given outgoing connection
+ * @throws IllegalArgumentException if <code>connection</code> is
+ * not a valid outgoing connection for this split
+ * @throws UnsupportedOperationException if this method is called
+ * on a split with split type of something else than XOR or OR
+ */
+ Constraint getConstraint(Connection connection);
+
+ /**
+ * Method for setting a constraint corresponding to the given
+ * outgoing connection
+ *
+ * @param connection the outgoing connection
+ * @param constraint the constraint
+ * @throws IllegalArgumentException if <code>connection</code> is
+ * not a valid outgoing connection for this split
+ * @throws UnsupportedOperationException if the split type is
+ * something else than XOR or OR
+ */
+ void setConstraint(Connection connection,
+ Constraint constraint);
+
+ /**
+ * Returns the constraints of the split.
+ *
+ * @return a map containing for each connection the constraint associated with
+ * that connection, or null if no constraint has been specified yet for that connection
+ * @throws UnsupportedOperationException if this method is called
+ * on a split with split type of something else than XOR or OR
+ */
+ Map getConstraints();
+
+ /**
+ * Convenience method for returning the incoming connection of the split.
+ *
+ * @return the incoming connection ot the split.
+ */
+ Connection getFrom();
+
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/StartNode.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IStartNode.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/StartNode.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/StartNode.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,35 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Represents a start node in a RuleFlow.
+ * A start node has no incoming and one outgoing connection.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface StartNode
+ extends
+ Node {
+
+ /**
+ * Convenience method for returning the outgoing <code>IConnection</code>.
+ * @return the outgoing <code>IConnection</code>
+ */
+ Connection getTo();
+
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Variable.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/IVariable.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Variable.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/Variable.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,44 @@
+package org.drools.ruleflow.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.io.Serializable;
+
+import org.drools.ruleflow.common.datatype.DataType;
+
+/**
+ * Represents a global variable used in a RuleFlow.
+ * A variable has a name (should be unique for this process), a datatype
+ * and possibly an initial value.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface Variable {
+
+ String getName();
+
+ void setName(String name);
+
+ DataType getType();
+
+ void setType(DataType type);
+
+ Serializable getValue();
+
+ void setValue(Serializable value);
+
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Connection.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Connection.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Connection.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,112 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.io.Serializable;
-
-import org.drools.ruleflow.core.IConnection;
-import org.drools.ruleflow.core.INode;
-
-/**
- * Default implementation of a connection.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class Connection
- implements
- IConnection,
- Serializable {
-
- private static final long serialVersionUID = 320L;
-
- private int type;
- private Node from;
- private Node to;
-
- private Connection() {
- }
-
- /**
- * Creates a new connection, given a from node, a to node
- * and a type.
- *
- * @param from The from node
- * @param to The to node
- * @param type The connection type
- */
- public Connection(final INode from,
- final INode to,
- final int type) {
- if ( from == null ) {
- throw new IllegalArgumentException( "From node is null!" );
- }
- if ( to == null ) {
- throw new IllegalArgumentException( "To node is null!" );
- }
- if ( from.equals( to ) ) {
- throw new IllegalArgumentException( "To and from nodes are the same!" );
- }
- this.from = (Node) from;
- this.to = (Node) to;
- this.type = type;
- this.from.addOutgoingConnection( this );
- this.to.addIncomingConnection( this );
- }
-
- public synchronized void terminate() {
- this.from.removeOutgoingConnection( this );
- this.to.removeIncomingConnection( this );
- this.type = 0;
- this.from = null;
- this.to = null;
- }
-
- public INode getFrom() {
- return this.from;
- }
-
- public INode getTo() {
- return this.to;
- }
-
- public int getType() {
- return this.type;
- }
-
-// public boolean equals(final Object object) {
-// if ( object instanceof Connection ) {
-// final Connection connection = (Connection) object;
-// return this.type == connection.getType() && getFrom().equals( connection.getFrom() ) && getTo().equals( connection.getTo() );
-// }
-// return false;
-// }
-
-// public int hashCode() {
-// return (getFrom() == null ? 0 : getFrom().hashCode()) + 7 * (getTo() == null ? 0 : getTo().hashCode()) + 19 * getType();
-// }
-
- public String toString() {
- final StringBuffer sb = new StringBuffer( "Connection " );
- sb.append( getFrom() );
- sb.append( " - " );
- sb.append( getTo() );
- sb.append( " [type=" );
- sb.append( getType() );
- sb.append( "]" );
- return sb.toString();
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/ConnectionImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Connection.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/ConnectionImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/ConnectionImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,111 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.io.Serializable;
+
+import org.drools.ruleflow.core.Node;
+
+/**
+ * Default implementation of a connection.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ConnectionImpl
+ implements
+ org.drools.ruleflow.core.Connection,
+ Serializable {
+
+ private static final long serialVersionUID = 320L;
+
+ private int type;
+ private NodeImpl from;
+ private NodeImpl to;
+
+ private ConnectionImpl() {
+ }
+
+ /**
+ * Creates a new connection, given a from node, a to node
+ * and a type.
+ *
+ * @param from The from node
+ * @param to The to node
+ * @param type The connection type
+ */
+ public ConnectionImpl(final Node from,
+ final Node to,
+ final int type) {
+ if ( from == null ) {
+ throw new IllegalArgumentException( "From node is null!" );
+ }
+ if ( to == null ) {
+ throw new IllegalArgumentException( "To node is null!" );
+ }
+ if ( from.equals( to ) ) {
+ throw new IllegalArgumentException( "To and from nodes are the same!" );
+ }
+ this.from = (NodeImpl) from;
+ this.to = (NodeImpl) to;
+ this.type = type;
+ this.from.addOutgoingConnection( this );
+ this.to.addIncomingConnection( this );
+ }
+
+ public synchronized void terminate() {
+ this.from.removeOutgoingConnection( this );
+ this.to.removeIncomingConnection( this );
+ this.type = 0;
+ this.from = null;
+ this.to = null;
+ }
+
+ public Node getFrom() {
+ return this.from;
+ }
+
+ public Node getTo() {
+ return this.to;
+ }
+
+ public int getType() {
+ return this.type;
+ }
+
+// public boolean equals(final Object object) {
+// if ( object instanceof Connection ) {
+// final Connection connection = (Connection) object;
+// return this.type == connection.getType() && getFrom().equals( connection.getFrom() ) && getTo().equals( connection.getTo() );
+// }
+// return false;
+// }
+
+// public int hashCode() {
+// return (getFrom() == null ? 0 : getFrom().hashCode()) + 7 * (getTo() == null ? 0 : getTo().hashCode()) + 19 * getType();
+// }
+
+ public String toString() {
+ final StringBuffer sb = new StringBuffer( "Connection " );
+ sb.append( getFrom() );
+ sb.append( " - " );
+ sb.append( getTo() );
+ sb.append( " [type=" );
+ sb.append( getType() );
+ sb.append( "]" );
+ return sb.toString();
+ }
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Constraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Constraint.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Constraint.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,66 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.io.Serializable;
-
-import org.drools.ruleflow.core.IConstraint;
-
-/**
- * Default implementation of a constraint.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class Constraint
- implements
- IConstraint,
- Serializable {
-
- private static final long serialVersionUID = 3257849861633422902L;
-
- private String name;
- private String constraint;
- private int priority;
-
- public String getConstraint() {
- return this.constraint;
- }
-
- public void setConstraint(final String constraint) {
- this.constraint = constraint;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(final String name) {
- this.name = name;
- }
-
- public String toString() {
- return this.name;
- }
-
- public int getPriority() {
- return this.priority;
- }
-
- public void setPriority(final int priority) {
- this.priority = priority;
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/ConstraintImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Constraint.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/ConstraintImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/ConstraintImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,64 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.io.Serializable;
+
+/**
+ * Default implementation of a constraint.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ConstraintImpl
+ implements
+ org.drools.ruleflow.core.Constraint,
+ Serializable {
+
+ private static final long serialVersionUID = 3257849861633422902L;
+
+ private String name;
+ private String constraint;
+ private int priority;
+
+ public String getConstraint() {
+ return this.constraint;
+ }
+
+ public void setConstraint(final String constraint) {
+ this.constraint = constraint;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return this.name;
+ }
+
+ public int getPriority() {
+ return this.priority;
+ }
+
+ public void setPriority(final int priority) {
+ this.priority = priority;
+ }
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/EndNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/EndNode.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/EndNode.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,57 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.List;
-
-import org.drools.ruleflow.core.IConnection;
-import org.drools.ruleflow.core.IEndNode;
-
-/**
- * Default implementation of an end node.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class EndNode extends Node
- implements
- IEndNode {
-
- private static final long serialVersionUID = 3906930075512484153L;
-
- public IConnection getFrom() {
- final List list = getIncomingConnections();
- if ( list.size() > 0 ) {
- return (IConnection) list.get( 0 );
- }
- return null;
- }
-
- protected void validateAddIncomingConnection(final IConnection connection) {
- super.validateAddIncomingConnection( connection );
- if ( getIncomingConnections().size() > 0 ) {
- throw new IllegalArgumentException( "An end node cannot have more than one incoming connection" );
- }
- }
-
- protected void validateAddOutgoingConnection(final IConnection connection) {
- throw new UnsupportedOperationException( "An end node does not have an outgoing connection" );
- }
-
- protected void validateRemoveOutgoingConnection(final IConnection connection) {
- throw new UnsupportedOperationException( "An end node does not have an outgoing connection" );
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/EndNodeImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/EndNode.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/EndNodeImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/EndNodeImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,57 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.List;
+
+import org.drools.ruleflow.core.Connection;
+import org.drools.ruleflow.core.EndNode;
+
+/**
+ * Default implementation of an end node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class EndNodeImpl extends NodeImpl
+ implements
+ EndNode {
+
+ private static final long serialVersionUID = 3906930075512484153L;
+
+ public Connection getFrom() {
+ final List list = getIncomingConnections();
+ if ( list.size() > 0 ) {
+ return (Connection) list.get( 0 );
+ }
+ return null;
+ }
+
+ protected void validateAddIncomingConnection(final Connection connection) {
+ super.validateAddIncomingConnection( connection );
+ if ( getIncomingConnections().size() > 0 ) {
+ throw new IllegalArgumentException( "An end node cannot have more than one incoming connection" );
+ }
+ }
+
+ protected void validateAddOutgoingConnection(final Connection connection) {
+ throw new UnsupportedOperationException( "An end node does not have an outgoing connection" );
+ }
+
+ protected void validateRemoveOutgoingConnection(final Connection connection) {
+ throw new UnsupportedOperationException( "An end node does not have an outgoing connection" );
+ }
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Join.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Join.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Join.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,64 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import org.drools.ruleflow.core.IConnection;
-import org.drools.ruleflow.core.IJoin;
-
-/**
- * Default implementation of a join.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class Join extends Node
- implements
- IJoin {
-
- private static final long serialVersionUID = 3257004367155573815L;
-
- private int type;
-
- public Join() {
- this.type = TYPE_UNDEFINED;
- }
-
- public void setType(final int type) {
- this.type = type;
- }
-
- public int getType() {
- return this.type;
- }
-
- public IConnection getTo() {
- if ( getOutgoingConnections().size() > 0 ) {
- return (IConnection) getOutgoingConnections().get( 0 );
- }
- return null;
- }
-
- protected void validateAddOutgoingConnection(final IConnection connection) {
- super.validateAddOutgoingConnection( connection );
- if ( connection.getType() != IConnection.TYPE_NORMAL ) {
- throw new IllegalArgumentException( "Unknown connection type :" + connection.getType() + ", only NORMAL is allowed as outgoing connection." );
- }
- if ( getOutgoingConnections().size() > 0 ) {
- throw new IllegalArgumentException( "A join cannot have more than one outgoing connection" );
- }
- }
-
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/JoinImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Join.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/JoinImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/JoinImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,64 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import org.drools.ruleflow.core.Connection;
+import org.drools.ruleflow.core.Join;
+
+/**
+ * Default implementation of a join.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class JoinImpl extends NodeImpl
+ implements
+ Join {
+
+ private static final long serialVersionUID = 3257004367155573815L;
+
+ private int type;
+
+ public JoinImpl() {
+ this.type = TYPE_UNDEFINED;
+ }
+
+ public void setType(final int type) {
+ this.type = type;
+ }
+
+ public int getType() {
+ return this.type;
+ }
+
+ public Connection getTo() {
+ if ( getOutgoingConnections().size() > 0 ) {
+ return (Connection) getOutgoingConnections().get( 0 );
+ }
+ return null;
+ }
+
+ protected void validateAddOutgoingConnection(final Connection connection) {
+ super.validateAddOutgoingConnection( connection );
+ if ( connection.getType() != Connection.TYPE_NORMAL ) {
+ throw new IllegalArgumentException( "Unknown connection type :" + connection.getType() + ", only NORMAL is allowed as outgoing connection." );
+ }
+ if ( getOutgoingConnections().size() > 0 ) {
+ throw new IllegalArgumentException( "A join cannot have more than one outgoing connection" );
+ }
+ }
+
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Node.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Node.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Node.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,183 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.drools.ruleflow.core.IConnection;
-import org.drools.ruleflow.core.INode;
-
-/**
- * Default implementation of a node.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public abstract class Node
- implements
- INode,
- Serializable {
-
- protected static final Node[] EMPTY_NODE_ARRAY = new Node[0];
-
- private long id;
- private String name;
- private List incomingConnections;
- private List outgoingConnections;
-
- public Node() {
- this.id = -1;
- this.incomingConnections = new ArrayList();
- this.outgoingConnections = new ArrayList();
- }
-
- public long getId() {
- return this.id;
- }
-
- public void setId(final long id) {
- this.id = id;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(final String name) {
- this.name = name;
- }
-
- public List getIncomingConnections() {
- return Collections.unmodifiableList( this.incomingConnections );
- }
-
- public List getOutgoingConnections() {
- return Collections.unmodifiableList( this.outgoingConnections );
- }
-
- protected void addIncomingConnection(final IConnection connection) {
- validateAddIncomingConnection( connection );
- this.incomingConnections.add( connection );
- }
-
- /**
- * This method validates whether the given connection can be added. If the
- * connection cannot be added, an IllegalArgumentException is thrown.
- * <p>
- *
- * @param connection
- * the incoming connection to be added
- * @throws IllegalArgumentException
- * is thrown if the connection is null, or if a connection is
- * added twice. If subclasses want to change the rules for
- * adding incoming connections the
- * <code>validateAddIncomingConnection(IConnection connection)</code>
- * should be overridden.
- */
- protected void validateAddIncomingConnection(final IConnection connection) {
- if ( connection == null ) {
- throw new IllegalArgumentException( "Connection cannot be null" );
- }
- if ( this.incomingConnections.contains( connection ) ) {
- throw new IllegalArgumentException( "Connection is already added" );
- }
- }
-
- protected void addOutgoingConnection(final IConnection connection) {
- validateAddOutgoingConnection( connection );
- this.outgoingConnections.add( connection );
- }
-
- /**
- * This method validates whether the given connection can be added. If the
- * connection cannot be added, an IllegalArgumentException is thrown.
- * <p>
- *
- * @param connection
- * the outgoin connection to be added
- * @throws IllegalArgumentException
- * is thrown if the connection is null, or if a connection is
- * added twice. If subclasses want to change the rules for
- * adding outgoing connections the
- * <code>validateAddIncomingConnection(IConnection connection)</code>
- * should be overridden.
- */
- protected void validateAddOutgoingConnection(final IConnection connection) {
- if ( connection == null ) {
- throw new IllegalArgumentException( "Connection cannot be null" );
- }
- if ( this.outgoingConnections.contains( connection ) ) {
- throw new IllegalArgumentException( "Connection is already added" );
- }
- }
-
- protected void removeIncomingConnection(final IConnection connection) {
- validateRemoveIncomingConnection( connection );
- this.incomingConnections.remove( connection );
- }
-
- /**
- * This method validates whether the given connection can be removed
- * <p>
- *
- * @param connection
- * the incoming connection
- * @throws IllegalArgumentException
- * is thrown if connectin is null, or unknown. If subclasses
- * want to change the rules for removing incoming connections
- * the
- * <code>validateRemoveIncomingConnection(IConnection connection)</code>
- * should be overridden.
- */
- protected void validateRemoveIncomingConnection(final IConnection connection) {
- if ( connection == null ) {
- throw new IllegalArgumentException( "Connection is null" );
- }
- if ( !this.incomingConnections.contains( connection ) ) {
- throw new IllegalArgumentException( "Given connection <" + connection + "> is not part of the incoming connections" );
- }
- }
-
- protected void removeOutgoingConnection(final IConnection connection) {
- validateRemoveOutgoingConnection( connection );
- this.outgoingConnections.remove( connection );
- }
-
- /**
- * This method validates whether the given connection can be removed
- * <p>
- *
- * @param connection
- * the outgoing connection
- * @throws IllegalArgumentException
- * is thrown if connectin is null, or unknown. If subclasses
- * want to change the rules for removing outgoing connections
- * the
- * <code>validateRemoveOutgoingConnection(IConnection connection)</code>
- * should be overridden.
- */
- protected void validateRemoveOutgoingConnection(final IConnection connection) {
- if ( connection == null ) {
- throw new IllegalArgumentException( "Connection is null" );
- }
- if ( !this.outgoingConnections.contains( connection ) ) {
- throw new IllegalArgumentException( "Given connection <" + connection + "> is not part of the outgoing connections" );
- }
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/NodeImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Node.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/NodeImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/NodeImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,183 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.drools.ruleflow.core.Connection;
+import org.drools.ruleflow.core.Node;
+
+/**
+ * Default implementation of a node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class NodeImpl
+ implements
+ Node,
+ Serializable {
+
+ protected static final NodeImpl[] EMPTY_NODE_ARRAY = new NodeImpl[0];
+
+ private long id;
+ private String name;
+ private List incomingConnections;
+ private List outgoingConnections;
+
+ public NodeImpl() {
+ this.id = -1;
+ this.incomingConnections = new ArrayList();
+ this.outgoingConnections = new ArrayList();
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+ public void setId(final long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public List getIncomingConnections() {
+ return Collections.unmodifiableList( this.incomingConnections );
+ }
+
+ public List getOutgoingConnections() {
+ return Collections.unmodifiableList( this.outgoingConnections );
+ }
+
+ protected void addIncomingConnection(final Connection connection) {
+ validateAddIncomingConnection( connection );
+ this.incomingConnections.add( connection );
+ }
+
+ /**
+ * This method validates whether the given connection can be added. If the
+ * connection cannot be added, an IllegalArgumentException is thrown.
+ * <p>
+ *
+ * @param connection
+ * the incoming connection to be added
+ * @throws IllegalArgumentException
+ * is thrown if the connection is null, or if a connection is
+ * added twice. If subclasses want to change the rules for
+ * adding incoming connections the
+ * <code>validateAddIncomingConnection(IConnection connection)</code>
+ * should be overridden.
+ */
+ protected void validateAddIncomingConnection(final Connection connection) {
+ if ( connection == null ) {
+ throw new IllegalArgumentException( "Connection cannot be null" );
+ }
+ if ( this.incomingConnections.contains( connection ) ) {
+ throw new IllegalArgumentException( "Connection is already added" );
+ }
+ }
+
+ protected void addOutgoingConnection(final Connection connection) {
+ validateAddOutgoingConnection( connection );
+ this.outgoingConnections.add( connection );
+ }
+
+ /**
+ * This method validates whether the given connection can be added. If the
+ * connection cannot be added, an IllegalArgumentException is thrown.
+ * <p>
+ *
+ * @param connection
+ * the outgoin connection to be added
+ * @throws IllegalArgumentException
+ * is thrown if the connection is null, or if a connection is
+ * added twice. If subclasses want to change the rules for
+ * adding outgoing connections the
+ * <code>validateAddIncomingConnection(IConnection connection)</code>
+ * should be overridden.
+ */
+ protected void validateAddOutgoingConnection(final Connection connection) {
+ if ( connection == null ) {
+ throw new IllegalArgumentException( "Connection cannot be null" );
+ }
+ if ( this.outgoingConnections.contains( connection ) ) {
+ throw new IllegalArgumentException( "Connection is already added" );
+ }
+ }
+
+ protected void removeIncomingConnection(final Connection connection) {
+ validateRemoveIncomingConnection( connection );
+ this.incomingConnections.remove( connection );
+ }
+
+ /**
+ * This method validates whether the given connection can be removed
+ * <p>
+ *
+ * @param connection
+ * the incoming connection
+ * @throws IllegalArgumentException
+ * is thrown if connectin is null, or unknown. If subclasses
+ * want to change the rules for removing incoming connections
+ * the
+ * <code>validateRemoveIncomingConnection(IConnection connection)</code>
+ * should be overridden.
+ */
+ protected void validateRemoveIncomingConnection(final Connection connection) {
+ if ( connection == null ) {
+ throw new IllegalArgumentException( "Connection is null" );
+ }
+ if ( !this.incomingConnections.contains( connection ) ) {
+ throw new IllegalArgumentException( "Given connection <" + connection + "> is not part of the incoming connections" );
+ }
+ }
+
+ protected void removeOutgoingConnection(final Connection connection) {
+ validateRemoveOutgoingConnection( connection );
+ this.outgoingConnections.remove( connection );
+ }
+
+ /**
+ * This method validates whether the given connection can be removed
+ * <p>
+ *
+ * @param connection
+ * the outgoing connection
+ * @throws IllegalArgumentException
+ * is thrown if connectin is null, or unknown. If subclasses
+ * want to change the rules for removing outgoing connections
+ * the
+ * <code>validateRemoveOutgoingConnection(IConnection connection)</code>
+ * should be overridden.
+ */
+ protected void validateRemoveOutgoingConnection(final Connection connection) {
+ if ( connection == null ) {
+ throw new IllegalArgumentException( "Connection is null" );
+ }
+ if ( !this.outgoingConnections.contains( connection ) ) {
+ throw new IllegalArgumentException( "Given connection <" + connection + "> is not part of the outgoing connections" );
+ }
+ }
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcess.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcess.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcess.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,134 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.drools.ruleflow.common.core.impl.Process;
-import org.drools.ruleflow.core.IEndNode;
-import org.drools.ruleflow.core.INode;
-import org.drools.ruleflow.core.IRuleFlowProcess;
-import org.drools.ruleflow.core.IStartNode;
-import org.drools.ruleflow.core.IVariable;
-
-/**
- * Default implementation of a RuleFlow process.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class RuleFlowProcess extends Process
- implements
- IRuleFlowProcess {
-
- public static final String RULEFLOW_TYPE = "RuleFlow";
-
- private static final long serialVersionUID = 3257005445309609272L;
-
- private Map nodes;
- private List variables;
- private long lastNodeId;
-
- public RuleFlowProcess() {
- super();
- setType( RULEFLOW_TYPE );
- this.nodes = new HashMap();
- this.variables = new ArrayList();
- }
-
- public IStartNode getStart() {
- for ( final Iterator it = this.nodes.values().iterator(); it.hasNext(); ) {
- final INode node = (INode) it.next();
- if ( node instanceof IStartNode ) {
- return (IStartNode) node;
- }
- }
- return null;
- }
-
- public INode[] getNodes() {
- return (INode[]) this.nodes.values().toArray( new INode[this.nodes.size()] );
- }
-
- public INode getNode(final long id) {
- final Long idLong = new Long( id );
- if ( !this.nodes.containsKey( idLong ) ) {
- throw new IllegalArgumentException( "Unknown node id: " + id );
- }
- return (INode) this.nodes.get( idLong );
- }
-
- private IEndNode getEnd() {
- for ( final Iterator it = this.nodes.values().iterator(); it.hasNext(); ) {
- final INode node = (INode) it.next();
- if ( node instanceof IEndNode ) {
- return (IEndNode) node;
- }
- }
- return null;
- }
-
- public void removeNode(final INode node) {
- if ( node == null ) {
- throw new IllegalArgumentException( "Node is null" );
- }
- final INode n = (INode) this.nodes.remove( new Long( node.getId() ) );
- if ( n == null ) {
- throw new IllegalArgumentException( "Unknown node: " + node );
- }
- }
-
- public List getVariables() {
- return this.variables;
- }
-
- public void setVariables(final List variables) {
- if ( variables == null ) {
- throw new IllegalArgumentException( "Variables is null" );
- }
- this.variables = variables;
- }
-
- public String[] getVariableNames() {
- final String[] result = new String[this.variables.size()];
- for ( int i = 0; i < this.variables.size(); i++ ) {
- result[i] = ((IVariable) this.variables.get( i )).getName();
- }
- return result;
- }
-
- public void addNode(final INode node) {
- validateAddNode( node );
- if ( !this.nodes.containsValue( node ) ) {
- node.setId( ++this.lastNodeId );
- this.nodes.put( new Long( node.getId() ),
- node );
- }
- }
-
- private void validateAddNode(final INode node) {
- if ( (node instanceof IStartNode) && (getStart() != null) ) {
- throw new IllegalArgumentException( "A ruleflow process cannot have more than one start node!" );
- }
- if ( (node instanceof IEndNode) && (getEnd() != null) ) {
- throw new IllegalArgumentException( "A ruleflow process cannot have more than one end node!" );
- }
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcess.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,134 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.ruleflow.common.core.impl.ProcessImpl;
+import org.drools.ruleflow.core.EndNode;
+import org.drools.ruleflow.core.Node;
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.ruleflow.core.StartNode;
+import org.drools.ruleflow.core.Variable;
+
+/**
+ * Default implementation of a RuleFlow process.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowProcessImpl extends ProcessImpl
+ implements
+ RuleFlowProcess {
+
+ public static final String RULEFLOW_TYPE = "RuleFlow";
+
+ private static final long serialVersionUID = 3257005445309609272L;
+
+ private Map nodes;
+ private List variables;
+ private long lastNodeId;
+
+ public RuleFlowProcessImpl() {
+ super();
+ setType( RULEFLOW_TYPE );
+ this.nodes = new HashMap();
+ this.variables = new ArrayList();
+ }
+
+ public StartNode getStart() {
+ for ( final Iterator it = this.nodes.values().iterator(); it.hasNext(); ) {
+ final Node node = (Node) it.next();
+ if ( node instanceof StartNode ) {
+ return (StartNode) node;
+ }
+ }
+ return null;
+ }
+
+ public Node[] getNodes() {
+ return (Node[]) this.nodes.values().toArray( new Node[this.nodes.size()] );
+ }
+
+ public Node getNode(final long id) {
+ final Long idLong = new Long( id );
+ if ( !this.nodes.containsKey( idLong ) ) {
+ throw new IllegalArgumentException( "Unknown node id: " + id );
+ }
+ return (Node) this.nodes.get( idLong );
+ }
+
+ private EndNode getEnd() {
+ for ( final Iterator it = this.nodes.values().iterator(); it.hasNext(); ) {
+ final Node node = (Node) it.next();
+ if ( node instanceof EndNode ) {
+ return (EndNode) node;
+ }
+ }
+ return null;
+ }
+
+ public void removeNode(final Node node) {
+ if ( node == null ) {
+ throw new IllegalArgumentException( "Node is null" );
+ }
+ final Node n = (Node) this.nodes.remove( new Long( node.getId() ) );
+ if ( n == null ) {
+ throw new IllegalArgumentException( "Unknown node: " + node );
+ }
+ }
+
+ public List getVariables() {
+ return this.variables;
+ }
+
+ public void setVariables(final List variables) {
+ if ( variables == null ) {
+ throw new IllegalArgumentException( "Variables is null" );
+ }
+ this.variables = variables;
+ }
+
+ public String[] getVariableNames() {
+ final String[] result = new String[this.variables.size()];
+ for ( int i = 0; i < this.variables.size(); i++ ) {
+ result[i] = ((Variable) this.variables.get( i )).getName();
+ }
+ return result;
+ }
+
+ public void addNode(final Node node) {
+ validateAddNode( node );
+ if ( !this.nodes.containsValue( node ) ) {
+ node.setId( ++this.lastNodeId );
+ this.nodes.put( new Long( node.getId() ),
+ node );
+ }
+ }
+
+ private void validateAddNode(final Node node) {
+ if ( (node instanceof StartNode) && (getStart() != null) ) {
+ throw new IllegalArgumentException( "A ruleflow process cannot have more than one start node!" );
+ }
+ if ( (node instanceof EndNode) && (getEnd() != null) ) {
+ throw new IllegalArgumentException( "A ruleflow process cannot have more than one end node!" );
+ }
+ }
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidationError.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidationError.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidationError.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,43 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import org.drools.ruleflow.core.IRuleFlowProcessValidationError;
-
-/**
- * Default implementation of a RuleFlow validation error.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class RuleFlowProcessValidationError
- implements
- IRuleFlowProcessValidationError {
-
- private String type;
-
- public RuleFlowProcessValidationError(final String type) {
- this.type = type;
- }
-
- public String toString() {
- return this.type;
- }
-
- public String getType() {
- return this.type;
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidationErrorImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidationError.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidationErrorImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidationErrorImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,43 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import org.drools.ruleflow.core.RuleFlowProcessValidationError;
+
+/**
+ * Default implementation of a RuleFlow validation error.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowProcessValidationErrorImpl
+ implements
+ RuleFlowProcessValidationError {
+
+ private String type;
+
+ public RuleFlowProcessValidationErrorImpl(final String type) {
+ this.type = type;
+ }
+
+ public String toString() {
+ return this.type;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidator.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidator.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidator.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,195 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.drools.ruleflow.core.IConnection;
-import org.drools.ruleflow.core.IEndNode;
-import org.drools.ruleflow.core.IJoin;
-import org.drools.ruleflow.core.INode;
-import org.drools.ruleflow.core.IRuleFlowProcess;
-import org.drools.ruleflow.core.IRuleFlowProcessValidationError;
-import org.drools.ruleflow.core.IRuleFlowProcessValidator;
-import org.drools.ruleflow.core.IRuleSetNode;
-import org.drools.ruleflow.core.ISplit;
-import org.drools.ruleflow.core.IStartNode;
-import org.drools.ruleflow.core.IVariable;
-
-/**
- * Default implementation of a RuleFlow validator.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class RuleFlowProcessValidator
- implements
- IRuleFlowProcessValidator {
-
- private static RuleFlowProcessValidator instance;
-
- private RuleFlowProcessValidator() {
- }
-
- public static RuleFlowProcessValidator getInstance() {
- if ( instance == null ) {
- instance = new RuleFlowProcessValidator();
- }
- return instance;
- }
-
- public IRuleFlowProcessValidationError[] validateProcess(final IRuleFlowProcess process) {
- final List errors = new ArrayList();
-
- if ( process.getName() == null ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.NO_PROCESS_NAME ) );
- }
-
- if ( process.getId() == null || "".equals( process.getId() ) ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.NO_PROCESS_ID ) );
- }
-
- // check start node of process
- if ( process.getStart() == null ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.NO_START_NODE ) );
- }
-
- boolean startNodeFound = false;
- boolean endNodeFound = false;
- final INode[] nodes = process.getNodes();
- for ( int i = 0; i < nodes.length; i++ ) {
- final INode node = nodes[i];
- if ( node instanceof IStartNode ) {
- final IStartNode startNode = (IStartNode) node;
- startNodeFound = true;
- if ( startNode.getTo() == null ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.START_NODE_WITHOUT_OUTGOING_NODES ) );
- }
- } else if ( node instanceof IEndNode ) {
- final IEndNode endNode = (IEndNode) node;
- endNodeFound = true;
- if ( endNode.getFrom() == null ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.END_NODE_HAS_NO_INCOMING_CONNECTIONS ) );
- }
- } else if ( node instanceof IRuleSetNode ) {
- final IRuleSetNode ruleSetNode = (IRuleSetNode) node;
- if ( ruleSetNode.getFrom() == null ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.RULE_SET_NODE_WITHOUT_INCOMING_CONNECTIONS ) );
- }
-
- if ( ruleSetNode.getTo() == null ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.RULE_SET_NODE_WITHOUT_OUTGOING_CONNECTIONS ) );
- }
- final String ruleFlowGroup = ruleSetNode.getRuleFlowGroup();
- if ( ruleFlowGroup == null || "".equals( ruleFlowGroup ) ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.RULE_SET_NODE_WITHOUT_RULE_SET_GROUP ) );
- }
- } else if ( node instanceof ISplit ) {
- final ISplit split = (ISplit) node;
- if ( split.getType() == ISplit.TYPE_UNDEFINED ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.SPLIT_WITHOUT_TYPE ) );
- }
- if ( split.getFrom() == null ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.SPLIT_WITHOUT_INCOMING_CONNECTION ) );
- }
- if ( split.getOutgoingConnections().size() < 2 ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.SPLIT_NOT_ENOUGH_OUTGOING_CONNECTIONS ) );
- }
- if ( split.getType() == ISplit.TYPE_XOR || split.getType() == ISplit.TYPE_OR ) {
- for ( final Iterator it = split.getOutgoingConnections().iterator(); it.hasNext(); ) {
- final IConnection connection = (IConnection) it.next();
- if ( split.getConstraint( connection ) == null ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.SPLIT_OUTGOING_CONNECTION_WITHOUT_CONSTRAINT ) );
- }
- }
- }
- } else if ( node instanceof IJoin ) {
- final IJoin join = (IJoin) node;
- if ( join.getType() == IJoin.TYPE_UNDEFINED ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.JOIN_WITHOUT_TYPE ) );
- }
- if ( join.getIncomingConnections().size() < 2 ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.JOIN_NOT_ENOUGH_INCOMING_CONNECTIONS ) );
- }
- if ( join.getTo() == null ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.JOIN_WITHOUT_OUTGOING_CONNECTION ) );
- }
- }
- }
- if ( !startNodeFound ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.NO_START_NODE ) );
- }
- if ( !endNodeFound ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.NO_END_NODE ) );
- }
- for ( final Iterator it = process.getVariables().iterator(); it.hasNext(); ) {
- final IVariable variable = (IVariable) it.next();
- if ( variable.getType() == null ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.VARIABLE_WITHOUT_TYPE ) );
- }
- }
-
- checkAllNodesConnectedToStart( process,
- errors );
-
- return (IRuleFlowProcessValidationError[]) errors.toArray( new IRuleFlowProcessValidationError[errors.size()] );
- }
-
- private void checkAllNodesConnectedToStart(final IRuleFlowProcess process,
- final List errors) {
- final Map processNodes = new HashMap();
- final INode[] nodes = process.getNodes();
- for ( int i = 0; i < nodes.length; i++ ) {
- final INode node = nodes[i];
- processNodes.put( node,
- Boolean.FALSE );
- }
-
- final INode start = process.getStart();
- if ( start != null ) {
- processNode( start,
- processNodes );
- }
-
- for ( final Iterator it = processNodes.keySet().iterator(); it.hasNext(); ) {
- final INode node = (INode) it.next();
- if ( Boolean.FALSE.equals( processNodes.get( node ) ) ) {
- errors.add( new RuleFlowProcessValidationError( IRuleFlowProcessValidationError.ALL_NODES_CONNECTED_TO_START ) );
- }
- }
- }
-
- private void processNode(final INode node,
- final Map nodes) {
- if ( !nodes.containsKey( node ) ) {
- throw new IllegalStateException( "A process node is connected with " + "a node that does not belong to the process." );
- }
- final Boolean prevValue = (Boolean) nodes.put( node,
- Boolean.TRUE );
- if ( prevValue == Boolean.FALSE ) {
- for ( final Iterator it = node.getOutgoingConnections().iterator(); it.hasNext(); ) {
- final IConnection connection = (IConnection) it.next();
- processNode( connection.getTo(),
- nodes );
- }
- }
- }
-
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidatorImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidator.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidatorImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleFlowProcessValidatorImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,195 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.ruleflow.core.Connection;
+import org.drools.ruleflow.core.EndNode;
+import org.drools.ruleflow.core.Join;
+import org.drools.ruleflow.core.Node;
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.ruleflow.core.RuleFlowProcessValidationError;
+import org.drools.ruleflow.core.RuleFlowProcessValidator;
+import org.drools.ruleflow.core.RuleSetNode;
+import org.drools.ruleflow.core.Split;
+import org.drools.ruleflow.core.StartNode;
+import org.drools.ruleflow.core.Variable;
+
+/**
+ * Default implementation of a RuleFlow validator.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowProcessValidatorImpl
+ implements
+ RuleFlowProcessValidator {
+
+ private static RuleFlowProcessValidatorImpl instance;
+
+ private RuleFlowProcessValidatorImpl() {
+ }
+
+ public static RuleFlowProcessValidatorImpl getInstance() {
+ if ( instance == null ) {
+ instance = new RuleFlowProcessValidatorImpl();
+ }
+ return instance;
+ }
+
+ public RuleFlowProcessValidationError[] validateProcess(final RuleFlowProcess process) {
+ final List errors = new ArrayList();
+
+ if ( process.getName() == null ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.NO_PROCESS_NAME ) );
+ }
+
+ if ( process.getId() == null || "".equals( process.getId() ) ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.NO_PROCESS_ID ) );
+ }
+
+ // check start node of process
+ if ( process.getStart() == null ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.NO_START_NODE ) );
+ }
+
+ boolean startNodeFound = false;
+ boolean endNodeFound = false;
+ final Node[] nodes = process.getNodes();
+ for ( int i = 0; i < nodes.length; i++ ) {
+ final Node node = nodes[i];
+ if ( node instanceof StartNode ) {
+ final StartNode startNode = (StartNode) node;
+ startNodeFound = true;
+ if ( startNode.getTo() == null ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.START_NODE_WITHOUT_OUTGOING_NODES ) );
+ }
+ } else if ( node instanceof EndNode ) {
+ final EndNode endNode = (EndNode) node;
+ endNodeFound = true;
+ if ( endNode.getFrom() == null ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.END_NODE_HAS_NO_INCOMING_CONNECTIONS ) );
+ }
+ } else if ( node instanceof RuleSetNode ) {
+ final RuleSetNode ruleSetNode = (RuleSetNode) node;
+ if ( ruleSetNode.getFrom() == null ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.RULE_SET_NODE_WITHOUT_INCOMING_CONNECTIONS ) );
+ }
+
+ if ( ruleSetNode.getTo() == null ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.RULE_SET_NODE_WITHOUT_OUTGOING_CONNECTIONS ) );
+ }
+ final String ruleFlowGroup = ruleSetNode.getRuleFlowGroup();
+ if ( ruleFlowGroup == null || "".equals( ruleFlowGroup ) ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.RULE_SET_NODE_WITHOUT_RULE_SET_GROUP ) );
+ }
+ } else if ( node instanceof Split ) {
+ final Split split = (Split) node;
+ if ( split.getType() == Split.TYPE_UNDEFINED ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.SPLIT_WITHOUT_TYPE ) );
+ }
+ if ( split.getFrom() == null ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.SPLIT_WITHOUT_INCOMING_CONNECTION ) );
+ }
+ if ( split.getOutgoingConnections().size() < 2 ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.SPLIT_NOT_ENOUGH_OUTGOING_CONNECTIONS ) );
+ }
+ if ( split.getType() == Split.TYPE_XOR || split.getType() == Split.TYPE_OR ) {
+ for ( final Iterator it = split.getOutgoingConnections().iterator(); it.hasNext(); ) {
+ final Connection connection = (Connection) it.next();
+ if ( split.getConstraint( connection ) == null ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.SPLIT_OUTGOING_CONNECTION_WITHOUT_CONSTRAINT ) );
+ }
+ }
+ }
+ } else if ( node instanceof Join ) {
+ final Join join = (Join) node;
+ if ( join.getType() == Join.TYPE_UNDEFINED ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.JOIN_WITHOUT_TYPE ) );
+ }
+ if ( join.getIncomingConnections().size() < 2 ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.JOIN_NOT_ENOUGH_INCOMING_CONNECTIONS ) );
+ }
+ if ( join.getTo() == null ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.JOIN_WITHOUT_OUTGOING_CONNECTION ) );
+ }
+ }
+ }
+ if ( !startNodeFound ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.NO_START_NODE ) );
+ }
+ if ( !endNodeFound ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.NO_END_NODE ) );
+ }
+ for ( final Iterator it = process.getVariables().iterator(); it.hasNext(); ) {
+ final Variable variable = (Variable) it.next();
+ if ( variable.getType() == null ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.VARIABLE_WITHOUT_TYPE ) );
+ }
+ }
+
+ checkAllNodesConnectedToStart( process,
+ errors );
+
+ return (RuleFlowProcessValidationError[]) errors.toArray( new RuleFlowProcessValidationError[errors.size()] );
+ }
+
+ private void checkAllNodesConnectedToStart(final RuleFlowProcess process,
+ final List errors) {
+ final Map processNodes = new HashMap();
+ final Node[] nodes = process.getNodes();
+ for ( int i = 0; i < nodes.length; i++ ) {
+ final Node node = nodes[i];
+ processNodes.put( node,
+ Boolean.FALSE );
+ }
+
+ final Node start = process.getStart();
+ if ( start != null ) {
+ processNode( start,
+ processNodes );
+ }
+
+ for ( final Iterator it = processNodes.keySet().iterator(); it.hasNext(); ) {
+ final Node node = (Node) it.next();
+ if ( Boolean.FALSE.equals( processNodes.get( node ) ) ) {
+ errors.add( new RuleFlowProcessValidationErrorImpl( RuleFlowProcessValidationError.ALL_NODES_CONNECTED_TO_START ) );
+ }
+ }
+ }
+
+ private void processNode(final Node node,
+ final Map nodes) {
+ if ( !nodes.containsKey( node ) ) {
+ throw new IllegalStateException( "A process node is connected with " + "a node that does not belong to the process." );
+ }
+ final Boolean prevValue = (Boolean) nodes.put( node,
+ Boolean.TRUE );
+ if ( prevValue == Boolean.FALSE ) {
+ for ( final Iterator it = node.getOutgoingConnections().iterator(); it.hasNext(); ) {
+ final Connection connection = (Connection) it.next();
+ processNode( connection.getTo(),
+ nodes );
+ }
+ }
+ }
+
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleSetNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleSetNode.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleSetNode.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,79 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.drools.ruleflow.core.IConnection;
-import org.drools.ruleflow.core.IRuleSetNode;
-
-/**
- * Default implementation of a RuleSet node.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class RuleSetNode extends Node
- implements
- IRuleSetNode {
-
- private static final long serialVersionUID = 3257285846544691769L;
-
- private String ruleFlowGroup;
-
- public void setRuleFlowGroup(final String ruleFlowGroup) {
- this.ruleFlowGroup = ruleFlowGroup;
- }
-
- public String getRuleFlowGroup() {
- return this.ruleFlowGroup;
- }
-
- public IConnection getFrom() {
- final List list = getIncomingConnections();
- if ( list.size() > 0 ) {
- return (IConnection) list.get( 0 );
- }
- return null;
- }
-
- public IConnection getTo() {
- final List list = getOutgoingConnections();
- if ( list.size() > 0 ) {
- return (IConnection) list.get( 0 );
- }
- return null;
- }
-
- protected void validateAddIncomingConnection(final IConnection connection) {
- super.validateAddIncomingConnection( connection );
- if ( getIncomingConnections().size() > 0 ) {
- throw new IllegalArgumentException( "A RuleSetNode cannot have more than one incoming node" );
- }
- }
-
- protected void validateAddOutgoingConnection(final IConnection connection) {
- super.validateAddOutgoingConnection( connection );
- for ( final Iterator it = getOutgoingConnections().iterator(); it.hasNext(); ) {
- final IConnection conn = (IConnection) it.next();
- if ( conn.getType() == connection.getType() ) {
- throw new IllegalArgumentException( "A RuleSetNode can have at most one outgoing node" );
- }
- }
- }
-
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleSetNodeImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleSetNode.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleSetNodeImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/RuleSetNodeImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,79 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.ruleflow.core.Connection;
+import org.drools.ruleflow.core.RuleSetNode;
+
+/**
+ * Default implementation of a RuleSet node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleSetNodeImpl extends NodeImpl
+ implements
+ RuleSetNode {
+
+ private static final long serialVersionUID = 3257285846544691769L;
+
+ private String ruleFlowGroup;
+
+ public void setRuleFlowGroup(final String ruleFlowGroup) {
+ this.ruleFlowGroup = ruleFlowGroup;
+ }
+
+ public String getRuleFlowGroup() {
+ return this.ruleFlowGroup;
+ }
+
+ public Connection getFrom() {
+ final List list = getIncomingConnections();
+ if ( list.size() > 0 ) {
+ return (Connection) list.get( 0 );
+ }
+ return null;
+ }
+
+ public Connection getTo() {
+ final List list = getOutgoingConnections();
+ if ( list.size() > 0 ) {
+ return (Connection) list.get( 0 );
+ }
+ return null;
+ }
+
+ protected void validateAddIncomingConnection(final Connection connection) {
+ super.validateAddIncomingConnection( connection );
+ if ( getIncomingConnections().size() > 0 ) {
+ throw new IllegalArgumentException( "A RuleSetNode cannot have more than one incoming node" );
+ }
+ }
+
+ protected void validateAddOutgoingConnection(final Connection connection) {
+ super.validateAddOutgoingConnection( connection );
+ for ( final Iterator it = getOutgoingConnections().iterator(); it.hasNext(); ) {
+ final Connection conn = (Connection) it.next();
+ if ( conn.getType() == connection.getType() ) {
+ throw new IllegalArgumentException( "A RuleSetNode can have at most one outgoing node" );
+ }
+ }
+ }
+
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Split.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Split.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Split.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,130 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.drools.ruleflow.core.IConnection;
-import org.drools.ruleflow.core.IConstraint;
-import org.drools.ruleflow.core.ISplit;
-
-/**
- * Default implementation of a split node.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class Split extends Node
- implements
- ISplit {
-
- private static final long serialVersionUID = 3258413949669159736L;
-
- private int type;
- private Map constraints;
-
- public Split() {
- this.type = TYPE_UNDEFINED;
- this.constraints = new HashMap();
- }
-
- public Split(final int type) {
- this.type = type;
- this.constraints = new HashMap();
- }
-
- public void setType(final int type) {
- this.type = type;
- }
-
- public int getType() {
- return this.type;
- }
-
- public IConstraint getConstraint(final IConnection connection) {
- if ( connection == null ) {
- throw new IllegalArgumentException( "connection is null" );
- }
-
- // dirty hack because keys were entered wrong
- // probably caused by xstreams
- final HashMap newMap = new HashMap();
- for ( final Iterator it = this.constraints.entrySet().iterator(); it.hasNext(); ) {
- final Entry entry = (Entry) it.next();
- newMap.put( entry.getKey(),
- entry.getValue() );
- }
- this.constraints = newMap;
-
- if ( this.type == TYPE_OR || this.type == TYPE_XOR ) {
- return (IConstraint) this.constraints.get( connection );
- }
- throw new UnsupportedOperationException( "Constraints are " + "only supported with XOR or OR split types, not with: " + getType() );
- }
-
- public void setConstraint(final IConnection connection,
- final IConstraint constraint) {
- if ( this.type == TYPE_OR || this.type == TYPE_XOR ) {
- if ( connection == null ) {
- throw new IllegalArgumentException( "connection is null" );
- }
- if ( !getOutgoingConnections().contains( connection ) ) {
- throw new IllegalArgumentException( "connection is unknown:" + connection );
- }
- this.constraints.put( connection,
- constraint );
- } else {
- throw new UnsupportedOperationException( "Constraints are " + "only supported with XOR or OR split types, not with type:" + getType() );
- }
- }
-
- public Map getConstraints() {
- if ( this.type == TYPE_OR || this.type == TYPE_XOR ) {
- return Collections.unmodifiableMap( this.constraints );
- }
- throw new UnsupportedOperationException( "Constraints are " + "only supported with XOR or OR split types, not with: " + getType() );
- }
-
- public IConnection getFrom() {
- if ( getIncomingConnections().size() > 0 ) {
- return (IConnection) getIncomingConnections().get( 0 );
- }
- return null;
- }
-
- protected void validateAddIncomingConnection(final IConnection connection) {
- super.validateAddIncomingConnection( connection );
- if ( getIncomingConnections().size() > 0 ) {
- throw new IllegalArgumentException( "A split cannot have more than one incoming connection" );
- }
- }
-
- protected void validateAddOutgoingConnection(final IConnection connection) {
- super.validateAddOutgoingConnection( connection );
- if ( connection.getType() != IConnection.TYPE_NORMAL ) {
- throw new IllegalArgumentException( "Unknown connection type :" + connection.getType() + ", only NORMAL is allowed as outgoing connection." );
- }
- }
-
- public void removeOutgoingConnection(final IConnection connection) {
- super.removeOutgoingConnection( connection );
- this.constraints.remove( connection );
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/SplitImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Split.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/SplitImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/SplitImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,130 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.drools.ruleflow.core.Connection;
+import org.drools.ruleflow.core.Constraint;
+import org.drools.ruleflow.core.Split;
+
+/**
+ * Default implementation of a split node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class SplitImpl extends NodeImpl
+ implements
+ Split {
+
+ private static final long serialVersionUID = 3258413949669159736L;
+
+ private int type;
+ private Map constraints;
+
+ public SplitImpl() {
+ this.type = TYPE_UNDEFINED;
+ this.constraints = new HashMap();
+ }
+
+ public SplitImpl(final int type) {
+ this.type = type;
+ this.constraints = new HashMap();
+ }
+
+ public void setType(final int type) {
+ this.type = type;
+ }
+
+ public int getType() {
+ return this.type;
+ }
+
+ public Constraint getConstraint(final Connection connection) {
+ if ( connection == null ) {
+ throw new IllegalArgumentException( "connection is null" );
+ }
+
+ // dirty hack because keys were entered wrong
+ // probably caused by xstreams
+ final HashMap newMap = new HashMap();
+ for ( final Iterator it = this.constraints.entrySet().iterator(); it.hasNext(); ) {
+ final Entry entry = (Entry) it.next();
+ newMap.put( entry.getKey(),
+ entry.getValue() );
+ }
+ this.constraints = newMap;
+
+ if ( this.type == TYPE_OR || this.type == TYPE_XOR ) {
+ return (Constraint) this.constraints.get( connection );
+ }
+ throw new UnsupportedOperationException( "Constraints are " + "only supported with XOR or OR split types, not with: " + getType() );
+ }
+
+ public void setConstraint(final Connection connection,
+ final Constraint constraint) {
+ if ( this.type == TYPE_OR || this.type == TYPE_XOR ) {
+ if ( connection == null ) {
+ throw new IllegalArgumentException( "connection is null" );
+ }
+ if ( !getOutgoingConnections().contains( connection ) ) {
+ throw new IllegalArgumentException( "connection is unknown:" + connection );
+ }
+ this.constraints.put( connection,
+ constraint );
+ } else {
+ throw new UnsupportedOperationException( "Constraints are " + "only supported with XOR or OR split types, not with type:" + getType() );
+ }
+ }
+
+ public Map getConstraints() {
+ if ( this.type == TYPE_OR || this.type == TYPE_XOR ) {
+ return Collections.unmodifiableMap( this.constraints );
+ }
+ throw new UnsupportedOperationException( "Constraints are " + "only supported with XOR or OR split types, not with: " + getType() );
+ }
+
+ public Connection getFrom() {
+ if ( getIncomingConnections().size() > 0 ) {
+ return (Connection) getIncomingConnections().get( 0 );
+ }
+ return null;
+ }
+
+ protected void validateAddIncomingConnection(final Connection connection) {
+ super.validateAddIncomingConnection( connection );
+ if ( getIncomingConnections().size() > 0 ) {
+ throw new IllegalArgumentException( "A split cannot have more than one incoming connection" );
+ }
+ }
+
+ protected void validateAddOutgoingConnection(final Connection connection) {
+ super.validateAddOutgoingConnection( connection );
+ if ( connection.getType() != Connection.TYPE_NORMAL ) {
+ throw new IllegalArgumentException( "Unknown connection type :" + connection.getType() + ", only NORMAL is allowed as outgoing connection." );
+ }
+ }
+
+ public void removeOutgoingConnection(final Connection connection) {
+ super.removeOutgoingConnection( connection );
+ this.constraints.remove( connection );
+ }
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/StartNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/StartNode.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/StartNode.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,58 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.List;
-
-import org.drools.ruleflow.core.IConnection;
-import org.drools.ruleflow.core.IStartNode;
-
-/**
- * Default implementation of a start node.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class StartNode extends Node
- implements
- IStartNode {
-
- private static final long serialVersionUID = 3257564005806782517L;
-
- public IConnection getTo() {
- final List list = getOutgoingConnections();
- if ( list.size() > 0 ) {
- return (IConnection) list.get( 0 );
- }
- return null;
- }
-
- protected void validateAddOutgoingConnection(final IConnection connection) {
- super.validateAddOutgoingConnection( connection );
- if ( getOutgoingConnections().size() > 0 ) {
- throw new IllegalArgumentException( "A start node cannot have more than one outgoing connection" );
- }
- }
-
- protected void validateAddIncomingConnection(final IConnection connection) {
- throw new UnsupportedOperationException( "A start node does not have an incoming connection" );
- }
-
- protected void validateRemoveIncomingConnection(final IConnection connection) {
- throw new UnsupportedOperationException( "A start node does not have an incoming connection" );
- }
-
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/StartNodeImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/StartNode.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/StartNodeImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/StartNodeImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,58 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.List;
+
+import org.drools.ruleflow.core.Connection;
+import org.drools.ruleflow.core.StartNode;
+
+/**
+ * Default implementation of a start node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class StartNodeImpl extends NodeImpl
+ implements
+ StartNode {
+
+ private static final long serialVersionUID = 3257564005806782517L;
+
+ public Connection getTo() {
+ final List list = getOutgoingConnections();
+ if ( list.size() > 0 ) {
+ return (Connection) list.get( 0 );
+ }
+ return null;
+ }
+
+ protected void validateAddOutgoingConnection(final Connection connection) {
+ super.validateAddOutgoingConnection( connection );
+ if ( getOutgoingConnections().size() > 0 ) {
+ throw new IllegalArgumentException( "A start node cannot have more than one outgoing connection" );
+ }
+ }
+
+ protected void validateAddIncomingConnection(final Connection connection) {
+ throw new UnsupportedOperationException( "A start node does not have an incoming connection" );
+ }
+
+ protected void validateRemoveIncomingConnection(final Connection connection) {
+ throw new UnsupportedOperationException( "A start node does not have an incoming connection" );
+ }
+
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Variable.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Variable.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Variable.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,84 +0,0 @@
-package org.drools.ruleflow.core.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.io.Serializable;
-
-import org.drools.ruleflow.common.datatype.IDataType;
-import org.drools.ruleflow.common.datatype.impl.type.UndefinedDataType;
-import org.drools.ruleflow.core.IVariable;
-
-/**
- * Default implementation of a variable.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class Variable
- implements
- IVariable,
- Serializable {
-
- private static final long serialVersionUID = 320L;
-
- private String name;
- private IDataType type;
- private Serializable value;
-
- public Variable() {
- this.type = UndefinedDataType.getInstance();
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(final String name) {
- this.name = name;
- }
-
- public IDataType getType() {
- return this.type;
- }
-
- public void setType(final IDataType type) {
- if ( type == null ) {
- throw new IllegalArgumentException( "type is null" );
- }
- this.type = type;
- }
-
- public Serializable getValue() {
- return this.value;
- }
-
- public void setValue(final Serializable value) {
- if ( this.type.verifyDataType( value ) ) {
- this.value = value;
- } else {
- final StringBuffer sb = new StringBuffer();
- sb.append( "Value <" );
- sb.append( value );
- sb.append( "> is not valid for datatype: " );
- sb.append( this.type );
- throw new IllegalArgumentException( sb.toString() );
- }
- }
-
- public String toString() {
- return this.name;
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/VariableImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/Variable.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/VariableImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/core/impl/VariableImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,84 @@
+package org.drools.ruleflow.core.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.io.Serializable;
+
+import org.drools.ruleflow.common.datatype.DataType;
+import org.drools.ruleflow.common.datatype.impl.type.UndefinedDataType;
+import org.drools.ruleflow.core.Variable;
+
+/**
+ * Default implementation of a variable.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class VariableImpl
+ implements
+ Variable,
+ Serializable {
+
+ private static final long serialVersionUID = 320L;
+
+ private String name;
+ private DataType type;
+ private Serializable value;
+
+ public VariableImpl() {
+ this.type = UndefinedDataType.getInstance();
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public DataType getType() {
+ return this.type;
+ }
+
+ public void setType(final DataType type) {
+ if ( type == null ) {
+ throw new IllegalArgumentException( "type is null" );
+ }
+ this.type = type;
+ }
+
+ public Serializable getValue() {
+ return this.value;
+ }
+
+ public void setValue(final Serializable value) {
+ if ( this.type.verifyDataType( value ) ) {
+ this.value = value;
+ } else {
+ final StringBuffer sb = new StringBuffer();
+ sb.append( "Value <" );
+ sb.append( value );
+ sb.append( "> is not valid for datatype: " );
+ sb.append( this.type );
+ throw new IllegalArgumentException( sb.toString() );
+ }
+ }
+
+ public String toString() {
+ return this.name;
+ }
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/IRuleFlowNodeInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/IRuleFlowNodeInstance.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/IRuleFlowNodeInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,45 +0,0 @@
-package org.drools.ruleflow.instance;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-/**
- * Represents a node instance in a RuleFlow. This is the runtime counterpart
- * of a node, containing all runtime state. Node instance classes also
- * contain the logic on what to do when it is being triggered (start
- * executing) or completed (end of execution).
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IRuleFlowNodeInstance {
-
- void setId(long id);
-
- long getId();
-
- void setNodeId(long nodeId);
-
- long getNodeId();
-
- void setProcessInstance(IRuleFlowProcessInstance processInstance);
-
- IRuleFlowProcessInstance getProcessInstance();
-
- void trigger(IRuleFlowNodeInstance from);
-
- void triggerCompleted();
-
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/IRuleFlowProcessInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/IRuleFlowProcessInstance.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/IRuleFlowProcessInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,55 +0,0 @@
-package org.drools.ruleflow.instance;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.Collection;
-
-import org.drools.Agenda;
-import org.drools.ruleflow.common.instance.IProcessInstance;
-import org.drools.ruleflow.core.INode;
-import org.drools.ruleflow.core.IRuleFlowProcess;
-
-/**
- * A process instance for a RuleFlow process.
- * Contains a reference to all its node instances, and the agenda that
- * is controlling the RuleFlow process.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface IRuleFlowProcessInstance
- extends
- IProcessInstance {
-
- IRuleFlowProcess getRuleFlowProcess();
-
- void addNodeInstance(IRuleFlowNodeInstance nodeInstance);
-
- void removeNodeInstance(IRuleFlowNodeInstance nodeInstance);
-
- Collection getNodeInstances();
-
- IRuleFlowNodeInstance getFirstNodeInstance(long nodeId);
-
- void setAgenda(Agenda agenda);
-
- Agenda getAgenda();
-
- IRuleFlowNodeInstance getNodeInstance(INode node);
-
- void start();
-
-}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/RuleFlowNodeInstance.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/IRuleFlowNodeInstance.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/RuleFlowNodeInstance.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/RuleFlowNodeInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,45 @@
+package org.drools.ruleflow.instance;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Represents a node instance in a RuleFlow. This is the runtime counterpart
+ * of a node, containing all runtime state. Node instance classes also
+ * contain the logic on what to do when it is being triggered (start
+ * executing) or completed (end of execution).
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface RuleFlowNodeInstance {
+
+ void setId(long id);
+
+ long getId();
+
+ void setNodeId(long nodeId);
+
+ long getNodeId();
+
+ void setProcessInstance(RuleFlowProcessInstance processInstance);
+
+ RuleFlowProcessInstance getProcessInstance();
+
+ void trigger(RuleFlowNodeInstance from);
+
+ void triggerCompleted();
+
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/RuleFlowProcessInstance.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/IRuleFlowProcessInstance.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/RuleFlowProcessInstance.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/RuleFlowProcessInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,58 @@
+package org.drools.ruleflow.instance;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.Collection;
+
+import org.drools.Agenda;
+import org.drools.WorkingMemory;
+import org.drools.ruleflow.common.instance.ProcessInstance;
+import org.drools.ruleflow.core.Node;
+import org.drools.ruleflow.core.RuleFlowProcess;
+
+/**
+ * A process instance for a RuleFlow process.
+ * Contains a reference to all its node instances, and the agenda that
+ * is controlling the RuleFlow process.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface RuleFlowProcessInstance
+ extends
+ ProcessInstance {
+
+ RuleFlowProcess getRuleFlowProcess();
+
+ void addNodeInstance(RuleFlowNodeInstance nodeInstance);
+
+ void removeNodeInstance(RuleFlowNodeInstance nodeInstance);
+
+ Collection getNodeInstances();
+
+ RuleFlowNodeInstance getFirstNodeInstance(long nodeId);
+
+ void setWorkingMemory(WorkingMemory workingMemory);
+
+ WorkingMemory getWorkingMemory();
+
+ Agenda getAgenda();
+
+ RuleFlowNodeInstance getNodeInstance(Node node);
+
+ void start();
+
+}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/EndNodeInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/EndNodeInstance.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/EndNodeInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,37 +0,0 @@
-package org.drools.ruleflow.instance.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import org.drools.ruleflow.common.instance.IProcessInstance;
-import org.drools.ruleflow.instance.IRuleFlowNodeInstance;
-
-/**
- * Runtime counterpart of an end node.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class EndNodeInstance extends RuleFlowNodeInstance {
-
- public void trigger(final IRuleFlowNodeInstance from) {
- getProcessInstance().setState( IProcessInstance.STATE_COMPLETED );
- }
-
- public void triggerCompleted() {
- // this should never occur
- throw new IllegalArgumentException( "End nodes cannot be completed." );
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/EndNodeInstanceImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/EndNodeInstance.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/EndNodeInstanceImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/EndNodeInstanceImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,37 @@
+package org.drools.ruleflow.instance.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import org.drools.ruleflow.common.instance.ProcessInstance;
+import org.drools.ruleflow.instance.RuleFlowNodeInstance;
+
+/**
+ * Runtime counterpart of an end node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class EndNodeInstanceImpl extends RuleFlowNodeInstanceImpl {
+
+ public void trigger(final RuleFlowNodeInstance from) {
+ getProcessInstance().setState( ProcessInstance.STATE_COMPLETED );
+ }
+
+ public void triggerCompleted() {
+ // this should never occur
+ throw new IllegalArgumentException( "End nodes cannot be completed." );
+ }
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowJoinInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowJoinInstance.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowJoinInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,92 +0,0 @@
-package org.drools.ruleflow.instance.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.drools.ruleflow.core.IConnection;
-import org.drools.ruleflow.core.IJoin;
-import org.drools.ruleflow.core.INode;
-import org.drools.ruleflow.instance.IRuleFlowNodeInstance;
-
-/**
- * Runtime counterpart of a join node.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class RuleFlowJoinInstance extends RuleFlowNodeInstance
- implements
- IRuleFlowNodeInstance {
-
- private final Map triggers = new HashMap();
-
- protected IJoin getJoinNode() {
- return (IJoin) getNode();
- }
-
- public void trigger(final IRuleFlowNodeInstance from) {
- final IJoin join = getJoinNode();
- switch ( join.getType() ) {
- case IJoin.TYPE_XOR :
- triggerCompleted();
- break;
- case IJoin.TYPE_AND :
- final INode node = getProcessInstance().getRuleFlowProcess().getNode( from.getNodeId() );
- final Integer count = (Integer) this.triggers.get( node );
- if ( count == null ) {
- this.triggers.put( node,
- new Integer( 1 ) );
- } else {
- this.triggers.put( node,
- new Integer( count.intValue() + 1 ) );
- }
- checkActivation();
- break;
- default :
- throw new IllegalArgumentException( "Illegal join type " + join.getType() );
- }
- }
-
- private void checkActivation() {
- // check whether all parent nodes have been triggered
- for ( final Iterator it = getJoinNode().getIncomingConnections().iterator(); it.hasNext(); ) {
- final IConnection connection = (IConnection) it.next();
- if ( this.triggers.get( connection.getFrom() ) == null ) {
- return;
- }
- }
- // if true, decrease trigger count for all parents and trigger children
- for ( final Iterator it = getJoinNode().getIncomingConnections().iterator(); it.hasNext(); ) {
- final IConnection connection = (IConnection) it.next();
- final Integer count = (Integer) this.triggers.get( connection.getFrom() );
- if ( count.intValue() == 1 ) {
- this.triggers.remove( connection.getFrom() );
- } else {
- this.triggers.put( connection.getFrom(),
- new Integer( count.intValue() - 1 ) );
- }
- }
- triggerCompleted();
- }
-
- public void triggerCompleted() {
- getProcessInstance().getNodeInstance( getJoinNode().getTo().getTo() ).trigger( this );
- }
-
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowJoinInstanceImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowJoinInstance.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowJoinInstanceImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowJoinInstanceImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,92 @@
+package org.drools.ruleflow.instance.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.drools.ruleflow.core.Connection;
+import org.drools.ruleflow.core.Join;
+import org.drools.ruleflow.core.Node;
+import org.drools.ruleflow.instance.RuleFlowNodeInstance;
+
+/**
+ * Runtime counterpart of a join node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowJoinInstanceImpl extends RuleFlowNodeInstanceImpl
+ implements
+ RuleFlowNodeInstance {
+
+ private final Map triggers = new HashMap();
+
+ protected Join getJoinNode() {
+ return (Join) getNode();
+ }
+
+ public void trigger(final RuleFlowNodeInstance from) {
+ final Join join = getJoinNode();
+ switch ( join.getType() ) {
+ case Join.TYPE_XOR :
+ triggerCompleted();
+ break;
+ case Join.TYPE_AND :
+ final Node node = getProcessInstance().getRuleFlowProcess().getNode( from.getNodeId() );
+ final Integer count = (Integer) this.triggers.get( node );
+ if ( count == null ) {
+ this.triggers.put( node,
+ new Integer( 1 ) );
+ } else {
+ this.triggers.put( node,
+ new Integer( count.intValue() + 1 ) );
+ }
+ checkActivation();
+ break;
+ default :
+ throw new IllegalArgumentException( "Illegal join type " + join.getType() );
+ }
+ }
+
+ private void checkActivation() {
+ // check whether all parent nodes have been triggered
+ for ( final Iterator it = getJoinNode().getIncomingConnections().iterator(); it.hasNext(); ) {
+ final Connection connection = (Connection) it.next();
+ if ( this.triggers.get( connection.getFrom() ) == null ) {
+ return;
+ }
+ }
+ // if true, decrease trigger count for all parents and trigger children
+ for ( final Iterator it = getJoinNode().getIncomingConnections().iterator(); it.hasNext(); ) {
+ final Connection connection = (Connection) it.next();
+ final Integer count = (Integer) this.triggers.get( connection.getFrom() );
+ if ( count.intValue() == 1 ) {
+ this.triggers.remove( connection.getFrom() );
+ } else {
+ this.triggers.put( connection.getFrom(),
+ new Integer( count.intValue() - 1 ) );
+ }
+ }
+ triggerCompleted();
+ }
+
+ public void triggerCompleted() {
+ getProcessInstance().getNodeInstance( getJoinNode().getTo().getTo() ).trigger( this );
+ }
+
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowNodeInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowNodeInstance.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowNodeInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,63 +0,0 @@
-package org.drools.ruleflow.instance.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import org.drools.ruleflow.core.INode;
-import org.drools.ruleflow.instance.IRuleFlowNodeInstance;
-import org.drools.ruleflow.instance.IRuleFlowProcessInstance;
-
-/**
- * Default implementation of a RuleFlow node instance.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public abstract class RuleFlowNodeInstance
- implements
- IRuleFlowNodeInstance {
-
- private long id;
- private long nodeId;
- private IRuleFlowProcessInstance processInstance;
-
- public void setId(final long id) {
- this.id = id;
- }
-
- public long getId() {
- return this.id;
- }
-
- public void setNodeId(final long nodeId) {
- this.nodeId = nodeId;
- }
-
- public long getNodeId() {
- return this.nodeId;
- }
-
- public void setProcessInstance(final IRuleFlowProcessInstance processInstance) {
- this.processInstance = processInstance;
- }
-
- public IRuleFlowProcessInstance getProcessInstance() {
- return this.processInstance;
- }
-
- protected INode getNode() {
- return this.processInstance.getRuleFlowProcess().getNode( this.nodeId );
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowNodeInstanceImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowNodeInstance.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowNodeInstanceImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowNodeInstanceImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,63 @@
+package org.drools.ruleflow.instance.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import org.drools.ruleflow.core.Node;
+import org.drools.ruleflow.instance.RuleFlowNodeInstance;
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+
+/**
+ * Default implementation of a RuleFlow node instance.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class RuleFlowNodeInstanceImpl
+ implements
+ RuleFlowNodeInstance {
+
+ private long id;
+ private long nodeId;
+ private RuleFlowProcessInstance processInstance;
+
+ public void setId(final long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+ public void setNodeId(final long nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public long getNodeId() {
+ return this.nodeId;
+ }
+
+ public void setProcessInstance(final RuleFlowProcessInstance processInstance) {
+ this.processInstance = processInstance;
+ }
+
+ public RuleFlowProcessInstance getProcessInstance() {
+ return this.processInstance;
+ }
+
+ protected Node getNode() {
+ return this.processInstance.getRuleFlowProcess().getNode( this.nodeId );
+ }
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowProcessInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowProcessInstance.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowProcessInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,141 +0,0 @@
-package org.drools.ruleflow.instance.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.drools.Agenda;
-import org.drools.ruleflow.common.instance.IProcessInstance;
-import org.drools.ruleflow.common.instance.impl.ProcessInstance;
-import org.drools.ruleflow.core.IEndNode;
-import org.drools.ruleflow.core.IJoin;
-import org.drools.ruleflow.core.INode;
-import org.drools.ruleflow.core.IRuleFlowProcess;
-import org.drools.ruleflow.core.IRuleSetNode;
-import org.drools.ruleflow.core.ISplit;
-import org.drools.ruleflow.core.IStartNode;
-import org.drools.ruleflow.instance.IRuleFlowNodeInstance;
-import org.drools.ruleflow.instance.IRuleFlowProcessInstance;
-
-/**
- * Default implementation of a RuleFlow process instance.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class RuleFlowProcessInstance extends ProcessInstance
- implements
- IRuleFlowProcessInstance {
-
- private static final long serialVersionUID = -6760756665603399413L;
-
- private Agenda agenda;
- private final List nodeInstances = new ArrayList();
-
- public IRuleFlowProcess getRuleFlowProcess() {
- return (IRuleFlowProcess) getProcess();
- }
-
- public void addNodeInstance(final IRuleFlowNodeInstance nodeInstance) {
- this.nodeInstances.add( nodeInstance );
- nodeInstance.setProcessInstance( this );
- }
-
- public void removeNodeInstance(final IRuleFlowNodeInstance nodeInstance) {
- this.nodeInstances.remove( nodeInstance );
- }
-
- public Collection getNodeInstances() {
- return Collections.unmodifiableCollection( this.nodeInstances );
- }
-
- public IRuleFlowNodeInstance getFirstNodeInstance(final long nodeId) {
- for ( final Iterator iterator = this.nodeInstances.iterator(); iterator.hasNext(); ) {
- final IRuleFlowNodeInstance nodeInstance = (IRuleFlowNodeInstance) iterator.next();
- if ( nodeInstance.getNodeId() == nodeId ) {
- return nodeInstance;
- }
- }
- return null;
- }
-
- public Agenda getAgenda() {
- return this.agenda;
- }
-
- public void setAgenda(final Agenda agenda) {
- this.agenda = agenda;
- }
-
- public IRuleFlowNodeInstance getNodeInstance(final INode node) {
- if ( node instanceof IRuleSetNode ) {
- final IRuleFlowNodeInstance result = (IRuleFlowNodeInstance) this.agenda.getRuleFlowGroup( ((IRuleSetNode) node).getRuleFlowGroup() );
- result.setNodeId( node.getId() );
- addNodeInstance( result );
- return result;
- } else if ( node instanceof ISplit ) {
- IRuleFlowNodeInstance result = getFirstNodeInstance( node.getId() );
- if ( result == null ) {
- result = new RuleFlowSplitInstance();
- result.setNodeId( node.getId() );
- addNodeInstance( result );
- return result;
- }
- } else if ( node instanceof IJoin ) {
- IRuleFlowNodeInstance result = getFirstNodeInstance( node.getId() );
- if ( result == null ) {
- result = new RuleFlowJoinInstance();
- result.setNodeId( node.getId() );
- addNodeInstance( result );
- }
- return result;
- } else if ( node instanceof IStartNode ) {
- final IRuleFlowNodeInstance result = new StartNodeInstance();
- result.setNodeId( node.getId() );
- addNodeInstance( result );
- return result;
- } else if ( node instanceof IEndNode ) {
- final IRuleFlowNodeInstance result = new EndNodeInstance();
- result.setNodeId( node.getId() );
- addNodeInstance( result );
- return result;
- }
- throw new IllegalArgumentException( "Illegal node type: " + node.getClass() );
- }
-
- public void start() {
- if ( getState() != IProcessInstance.STATE_PENDING ) {
- throw new IllegalArgumentException( "A process instance can only be started once" );
- }
- setState( IProcessInstance.STATE_ACTIVE );
- getNodeInstance( getRuleFlowProcess().getStart() ).trigger( null );
- }
-
- public String toString() {
- final StringBuffer sb = new StringBuffer( "RuleFlowProcessInstance" );
- sb.append( getId() );
- sb.append( " [processId=" );
- sb.append( getProcess().getId() );
- sb.append( ",state=" );
- sb.append( getState() );
- sb.append( "]" );
- return sb.toString();
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowProcessInstanceImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowProcessInstance.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowProcessInstanceImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowProcessInstanceImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,160 @@
+package org.drools.ruleflow.instance.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.Agenda;
+import org.drools.WorkingMemory;
+import org.drools.common.EventSupport;
+import org.drools.ruleflow.common.instance.impl.ProcessInstanceImpl;
+import org.drools.ruleflow.core.EndNode;
+import org.drools.ruleflow.core.Join;
+import org.drools.ruleflow.core.Node;
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.ruleflow.core.RuleSetNode;
+import org.drools.ruleflow.core.Split;
+import org.drools.ruleflow.core.StartNode;
+import org.drools.ruleflow.instance.RuleFlowNodeInstance;
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+
+/**
+ * Default implementation of a RuleFlow process instance.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowProcessInstanceImpl extends ProcessInstanceImpl
+ implements
+ RuleFlowProcessInstance {
+
+ private static final long serialVersionUID = -6760756665603399413L;
+
+ private WorkingMemory workingMemory;
+ private final List nodeInstances = new ArrayList();
+
+ public RuleFlowProcess getRuleFlowProcess() {
+ return (RuleFlowProcess) getProcess();
+ }
+
+ public void addNodeInstance(final RuleFlowNodeInstance nodeInstance) {
+ this.nodeInstances.add( nodeInstance );
+ nodeInstance.setProcessInstance( this );
+ }
+
+ public void removeNodeInstance(final RuleFlowNodeInstance nodeInstance) {
+ this.nodeInstances.remove( nodeInstance );
+ }
+
+ public Collection getNodeInstances() {
+ return Collections.unmodifiableCollection( this.nodeInstances );
+ }
+
+ public RuleFlowNodeInstance getFirstNodeInstance(final long nodeId) {
+ for ( final Iterator iterator = this.nodeInstances.iterator(); iterator.hasNext(); ) {
+ final RuleFlowNodeInstance nodeInstance = (RuleFlowNodeInstance) iterator.next();
+ if ( nodeInstance.getNodeId() == nodeId ) {
+ return nodeInstance;
+ }
+ }
+ return null;
+ }
+
+ public Agenda getAgenda() {
+ if (this.workingMemory == null) {
+ return null;
+ }
+ return this.workingMemory.getAgenda();
+ }
+
+ public void setWorkingMemory(final WorkingMemory workingMemory) {
+ if (this.workingMemory != null) {
+ throw new IllegalArgumentException("A working memory can only be set once.");
+ }
+ this.workingMemory = workingMemory;
+ }
+
+ public WorkingMemory getWorkingMemory() {
+ return this.workingMemory;
+ }
+
+ public RuleFlowNodeInstance getNodeInstance(final Node node) {
+ if ( node instanceof RuleSetNode ) {
+ final RuleFlowNodeInstance result = (RuleFlowNodeInstance) getAgenda().getRuleFlowGroup( ((RuleSetNode) node).getRuleFlowGroup() );
+ result.setNodeId( node.getId() );
+ addNodeInstance( result );
+ return result;
+ } else if ( node instanceof Split ) {
+ RuleFlowNodeInstance result = getFirstNodeInstance( node.getId() );
+ if ( result == null ) {
+ result = new RuleFlowSplitInstanceImpl();
+ result.setNodeId( node.getId() );
+ addNodeInstance( result );
+ }
+ return result;
+ } else if ( node instanceof Join ) {
+ RuleFlowNodeInstance result = getFirstNodeInstance( node.getId() );
+ if ( result == null ) {
+ result = new RuleFlowJoinInstanceImpl();
+ result.setNodeId( node.getId() );
+ addNodeInstance( result );
+ }
+ return result;
+ } else if ( node instanceof StartNode ) {
+ final RuleFlowNodeInstance result = new StartNodeInstanceImpl();
+ result.setNodeId( node.getId() );
+ addNodeInstance( result );
+ return result;
+ } else if ( node instanceof EndNode ) {
+ final RuleFlowNodeInstance result = new EndNodeInstanceImpl();
+ result.setNodeId( node.getId() );
+ addNodeInstance( result );
+ return result;
+ }
+ throw new IllegalArgumentException( "Illegal node type: " + node.getClass() );
+ }
+
+ public void start() {
+ if ( getState() != ProcessInstanceImpl.STATE_PENDING ) {
+ throw new IllegalArgumentException( "A process instance can only be started once" );
+ }
+ setState( ProcessInstanceImpl.STATE_ACTIVE );
+ getNodeInstance( getRuleFlowProcess().getStart() ).trigger( null );
+ }
+
+ public void setState(final int state) {
+ super.setState(state);
+ if (state == ProcessInstanceImpl.STATE_COMPLETED) {
+ ((EventSupport) this.workingMemory).getRuleFlowEventSupport()
+ .fireRuleFlowProcessCompleted(this);
+ }
+ }
+
+ public String toString() {
+ final StringBuffer sb = new StringBuffer( "RuleFlowProcessInstance" );
+ sb.append( getId() );
+ sb.append( " [processId=" );
+ sb.append( getProcess().getId() );
+ sb.append( ",state=" );
+ sb.append( getState() );
+ sb.append( "]" );
+ return sb.toString();
+ }
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSequenceNodeInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSequenceNodeInstance.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSequenceNodeInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,41 +0,0 @@
-package org.drools.ruleflow.instance.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import org.drools.ruleflow.core.IRuleSetNode;
-import org.drools.ruleflow.instance.IRuleFlowNodeInstance;
-
-/**
- * Runtime counterpart of a ruleset node.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class RuleFlowSequenceNodeInstance extends RuleFlowNodeInstance {
-
- protected IRuleSetNode getRuleSetNode() {
- return (IRuleSetNode) getNode();
- }
-
- public void trigger(final IRuleFlowNodeInstance from) {
- getProcessInstance().getAgenda().activateRuleFlowGroup( getRuleSetNode().getRuleFlowGroup() );
- }
-
- public void triggerCompleted() {
- getProcessInstance().getNodeInstance( getRuleSetNode().getTo().getTo() ).trigger( this );
- }
-
-}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSequenceNodeInstanceImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSequenceNodeInstance.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSequenceNodeInstanceImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSequenceNodeInstanceImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,41 @@
+package org.drools.ruleflow.instance.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import org.drools.ruleflow.core.RuleSetNode;
+import org.drools.ruleflow.instance.RuleFlowNodeInstance;
+
+/**
+ * Runtime counterpart of a ruleset node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowSequenceNodeInstanceImpl extends RuleFlowNodeInstanceImpl {
+
+ protected RuleSetNode getRuleSetNode() {
+ return (RuleSetNode) getNode();
+ }
+
+ public void trigger(final RuleFlowNodeInstance from) {
+ getProcessInstance().getAgenda().activateRuleFlowGroup( getRuleSetNode().getRuleFlowGroup() );
+ }
+
+ public void triggerCompleted() {
+ getProcessInstance().getNodeInstance( getRuleSetNode().getTo().getTo() ).trigger( this );
+ }
+
+}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSplitInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSplitInstance.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSplitInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,113 +0,0 @@
-package org.drools.ruleflow.instance.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.drools.common.RuleFlowGroupNode;
-import org.drools.ruleflow.core.IConnection;
-import org.drools.ruleflow.core.IConstraint;
-import org.drools.ruleflow.core.ISplit;
-import org.drools.ruleflow.instance.IRuleFlowNodeInstance;
-import org.drools.spi.Activation;
-import org.drools.spi.RuleFlowGroup;
-
-/**
- * Runtime counterpart of a split node.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class RuleFlowSplitInstance extends RuleFlowNodeInstance
- implements
- IRuleFlowNodeInstance {
-
- protected ISplit getSplitNode() {
- return (ISplit) getNode();
- }
-
- public void trigger(final IRuleFlowNodeInstance from) {
- final ISplit split = getSplitNode();
- switch ( split.getType() ) {
- case ISplit.TYPE_AND :
- List outgoing = split.getOutgoingConnections();
- for ( final Iterator iterator = outgoing.iterator(); iterator.hasNext(); ) {
- final IConnection connection = (IConnection) iterator.next();
- getProcessInstance().getNodeInstance( connection.getTo() ).trigger( this );
- }
- break;
- case ISplit.TYPE_XOR :
- outgoing = split.getOutgoingConnections();
- int priority = Integer.MAX_VALUE;
- IConnection selected = null;
- RuleFlowGroup systemRuleFlowGroup = getProcessInstance().getAgenda().getRuleFlowGroup("DROOLS_SYSTEM");
- for ( final Iterator iterator = outgoing.iterator(); iterator.hasNext(); ) {
- final IConnection connection = (IConnection) iterator.next();
- IConstraint constraint = split.getConstraint(connection);
- if (constraint != null && constraint.getPriority() < priority) {
- String rule = "RuleFlow-" + getProcessInstance().getProcess().getId() + "-" +
- getNode().getId() + "-" + connection.getTo().getId();
- for (Iterator activations = systemRuleFlowGroup.iterator(); activations.hasNext(); ) {
- Activation activation = ((RuleFlowGroupNode) activations.next()).getActivation();
- if (rule.equals(activation.getRule().getName())) {
- selected = connection;
- priority = constraint.getPriority();
- break;
- }
- }
- }
- }
- if (selected == null) {
- throw new IllegalArgumentException("XOR split could not find at least one valid outgoing connection for split " + getSplitNode().getName());
- }
- getProcessInstance().getNodeInstance( selected.getTo() ).trigger( this );
- break;
- case ISplit.TYPE_OR :
- outgoing = split.getOutgoingConnections();
- boolean found = false;
- systemRuleFlowGroup = getProcessInstance().getAgenda().getRuleFlowGroup("DROOLS_SYSTEM");
- for ( final Iterator iterator = outgoing.iterator(); iterator.hasNext(); ) {
- final IConnection connection = (IConnection) iterator.next();
- IConstraint constraint = split.getConstraint(connection);
- if (constraint != null) {
- String rule = "RuleFlow-" + getProcessInstance().getProcess().getId() + "-" +
- getNode().getId() + "-" + connection.getTo().getId();
- for (Iterator activations = systemRuleFlowGroup.iterator(); activations.hasNext(); ) {
- Activation activation = (Activation) activations.next();
- if (rule.equals(activation.getRule().getName())) {
- getProcessInstance().getNodeInstance( connection.getTo() ).trigger( this );
- found = true;
- break;
- }
- }
- }
- if (!found) {
- throw new IllegalArgumentException("OR split could not find at least one valid outgoing connection for split " + getSplitNode().getName());
- }
- }
- break;
- default :
- throw new IllegalArgumentException( "Illegal split type " + split.getType() );
- }
- }
-
- public void triggerCompleted() {
- // TODO Auto-generated method stub
-
- }
-
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSplitInstanceImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSplitInstance.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSplitInstanceImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/RuleFlowSplitInstanceImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,113 @@
+package org.drools.ruleflow.instance.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.common.RuleFlowGroupNode;
+import org.drools.ruleflow.core.Connection;
+import org.drools.ruleflow.core.Constraint;
+import org.drools.ruleflow.core.Split;
+import org.drools.ruleflow.instance.RuleFlowNodeInstance;
+import org.drools.spi.Activation;
+import org.drools.spi.RuleFlowGroup;
+
+/**
+ * Runtime counterpart of a split node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowSplitInstanceImpl extends RuleFlowNodeInstanceImpl
+ implements
+ RuleFlowNodeInstance {
+
+ protected Split getSplitNode() {
+ return (Split) getNode();
+ }
+
+ public void trigger(final RuleFlowNodeInstance from) {
+ final Split split = getSplitNode();
+ switch ( split.getType() ) {
+ case Split.TYPE_AND :
+ List outgoing = split.getOutgoingConnections();
+ for ( final Iterator iterator = outgoing.iterator(); iterator.hasNext(); ) {
+ final Connection connection = (Connection) iterator.next();
+ getProcessInstance().getNodeInstance( connection.getTo() ).trigger( this );
+ }
+ break;
+ case Split.TYPE_XOR :
+ outgoing = split.getOutgoingConnections();
+ int priority = Integer.MAX_VALUE;
+ Connection selected = null;
+ RuleFlowGroup systemRuleFlowGroup = getProcessInstance().getAgenda().getRuleFlowGroup("DROOLS_SYSTEM");
+ for ( final Iterator iterator = outgoing.iterator(); iterator.hasNext(); ) {
+ final Connection connection = (Connection) iterator.next();
+ Constraint constraint = split.getConstraint(connection);
+ if (constraint != null && constraint.getPriority() < priority) {
+ String rule = "RuleFlow-" + getProcessInstance().getProcess().getId() + "-" +
+ getNode().getId() + "-" + connection.getTo().getId();
+ for (Iterator activations = systemRuleFlowGroup.iterator(); activations.hasNext(); ) {
+ Activation activation = ((RuleFlowGroupNode) activations.next()).getActivation();
+ if (rule.equals(activation.getRule().getName())) {
+ selected = connection;
+ priority = constraint.getPriority();
+ break;
+ }
+ }
+ }
+ }
+ if (selected == null) {
+ throw new IllegalArgumentException("XOR split could not find at least one valid outgoing connection for split " + getSplitNode().getName());
+ }
+ getProcessInstance().getNodeInstance( selected.getTo() ).trigger( this );
+ break;
+ case Split.TYPE_OR :
+ outgoing = split.getOutgoingConnections();
+ boolean found = false;
+ systemRuleFlowGroup = getProcessInstance().getAgenda().getRuleFlowGroup("DROOLS_SYSTEM");
+ for ( final Iterator iterator = outgoing.iterator(); iterator.hasNext(); ) {
+ final Connection connection = (Connection) iterator.next();
+ Constraint constraint = split.getConstraint(connection);
+ if (constraint != null) {
+ String rule = "RuleFlow-" + getProcessInstance().getProcess().getId() + "-" +
+ getNode().getId() + "-" + connection.getTo().getId();
+ for (Iterator activations = systemRuleFlowGroup.iterator(); activations.hasNext(); ) {
+ Activation activation = (Activation) activations.next();
+ if (rule.equals(activation.getRule().getName())) {
+ getProcessInstance().getNodeInstance( connection.getTo() ).trigger( this );
+ found = true;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ throw new IllegalArgumentException("OR split could not find at least one valid outgoing connection for split " + getSplitNode().getName());
+ }
+ }
+ break;
+ default :
+ throw new IllegalArgumentException( "Illegal split type " + split.getType() );
+ }
+ }
+
+ public void triggerCompleted() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/StartNodeInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/StartNodeInstance.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/StartNodeInstance.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1,40 +0,0 @@
-package org.drools.ruleflow.instance.impl;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed 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.
- */
-
-import org.drools.ruleflow.core.IStartNode;
-import org.drools.ruleflow.instance.IRuleFlowNodeInstance;
-
-/**
- * Runtime counterpart of a start node.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class StartNodeInstance extends RuleFlowNodeInstance {
-
- public void trigger(final IRuleFlowNodeInstance from) {
- triggerCompleted();
- }
-
- public IStartNode getStartNode() {
- return (IStartNode) getNode();
- }
-
- public void triggerCompleted() {
- getProcessInstance().getNodeInstance( getStartNode().getTo().getTo() ).trigger( this );
- }
-}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/StartNodeInstanceImpl.java (from rev 12245, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/StartNodeInstance.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/StartNodeInstanceImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ruleflow/instance/impl/StartNodeInstanceImpl.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -0,0 +1,40 @@
+package org.drools.ruleflow.instance.impl;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed 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.
+ */
+
+import org.drools.ruleflow.core.StartNode;
+import org.drools.ruleflow.instance.RuleFlowNodeInstance;
+
+/**
+ * Runtime counterpart of a start node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class StartNodeInstanceImpl extends RuleFlowNodeInstanceImpl {
+
+ public void trigger(final RuleFlowNodeInstance from) {
+ triggerCompleted();
+ }
+
+ public StartNode getStartNode() {
+ return (StartNode) getNode();
+ }
+
+ public void triggerCompleted() {
+ getProcessInstance().getNodeInstance( getStartNode().getTo().getTo() ).trigger( this );
+ }
+}
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -1276,7 +1276,52 @@
assertEquals( 0,
agenda.agendaSize() );
}
+
+ /**
+ * Test auto-deactivation of empty ruleflow group.
+ */
+ public void testRuleFlowGroup5() {
+ final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+ final ReteooWorkingMemory workingMemory = (ReteooWorkingMemory) ruleBase.newStatefulSession();
+
+ final InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();
+
+ // create rule0
+ final Consequence consequence0 = new Consequence() {
+ private static final long serialVersionUID = -2596133893109870505L;
+
+ public void evaluate(KnowledgeHelper knowledgeHelper,
+ WorkingMemory w) {
+ // do nothing
+ }
+ };
+
+ final Rule rule0 = new Rule( "test-rule0" );
+ rule0.setRuleFlowGroup( "rule-flow-group-0" );
+ rule0.setConsequence( consequence0 );
+
+ final RuleFlowGroup ruleFlowGroup0 = agenda.getRuleFlowGroup( "rule-flow-group-0" );
+ assertTrue( ruleFlowGroup0.isAutoDeactivate() );
+
+ // RuleFlowGroup should be empty, as well as the agenda
+ assertEquals( 0,
+ ruleFlowGroup0.size() );
+ assertEquals( 0,
+ agenda.agendaSize() );
+
+ // Activate the RuleFlowGroup, the activations stay in the group, but
+ // should now also be in the Agenda
+ agenda.activateRuleFlowGroup( "rule-flow-group-0" );
+ assertEquals( 0,
+ ruleFlowGroup0.size() );
+ assertEquals( 0,
+ agenda.agendaSize() );
+ workingMemory.executeQueuedActions();
+
+ assertFalse( ruleFlowGroup0.isActive() );
+ }
+
public void testRuleFlowGroupLockOnActive() {
final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
@@ -1307,6 +1352,7 @@
// When both the rule is lock-on-active and the agenda group is active, activations should be ignored
rule.setLockOnActive( true );
+ ruleFlowGroup.setAutoDeactivate( false );
ruleFlowGroup.setActive( true );
node.assertTuple( tuple,
context,
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java 2007-05-31 00:20:43 UTC (rev 12248)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java 2007-05-31 00:21:38 UTC (rev 12249)
@@ -29,25 +29,24 @@
import org.drools.common.PropagationContextImpl;
import org.drools.common.RuleFlowGroupImpl;
import org.drools.rule.Rule;
-import org.drools.ruleflow.common.instance.IProcessInstance;
-import org.drools.ruleflow.core.IConnection;
-import org.drools.ruleflow.core.IConstraint;
-import org.drools.ruleflow.core.IEndNode;
-import org.drools.ruleflow.core.IJoin;
-import org.drools.ruleflow.core.IRuleFlowProcess;
-import org.drools.ruleflow.core.IRuleSetNode;
-import org.drools.ruleflow.core.ISplit;
-import org.drools.ruleflow.core.IStartNode;
-import org.drools.ruleflow.core.impl.Connection;
-import org.drools.ruleflow.core.impl.Constraint;
-import org.drools.ruleflow.core.impl.EndNode;
-import org.drools.ruleflow.core.impl.Join;
-import org.drools.ruleflow.core.impl.RuleFlowProcess;
-import org.drools.ruleflow.core.impl.RuleSetNode;
-import org.drools.ruleflow.core.impl.Split;
-import org.drools.ruleflow.core.impl.StartNode;
-import org.drools.ruleflow.instance.IRuleFlowProcessInstance;
-import org.drools.ruleflow.instance.impl.RuleFlowProcessInstance;
+import org.drools.ruleflow.common.instance.ProcessInstance;
+import org.drools.ruleflow.core.Connection;
+import org.drools.ruleflow.core.Constraint;
+import org.drools.ruleflow.core.EndNode;
+import org.drools.ruleflow.core.Join;
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.ruleflow.core.RuleSetNode;
+import org.drools.ruleflow.core.Split;
+import org.drools.ruleflow.core.StartNode;
+import org.drools.ruleflow.core.impl.ConnectionImpl;
+import org.drools.ruleflow.core.impl.EndNodeImpl;
+import org.drools.ruleflow.core.impl.JoinImpl;
+import org.drools.ruleflow.core.impl.RuleFlowProcessImpl;
+import org.drools.ruleflow.core.impl.RuleSetNodeImpl;
+import org.drools.ruleflow.core.impl.SplitImpl;
+import org.drools.ruleflow.core.impl.StartNodeImpl;
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+import org.drools.ruleflow.instance.impl.RuleFlowProcessInstanceImpl;
import org.drools.spi.Consequence;
import org.drools.spi.KnowledgeHelper;
import org.drools.spi.PropagationContext;
@@ -124,48 +123,48 @@
null );
// nodes
- final IStartNode start = new StartNode();
- final IRuleSetNode ruleSet0 = new RuleSetNode();
+ final StartNode start = new StartNodeImpl();
+ final RuleSetNode ruleSet0 = new RuleSetNodeImpl();
ruleSet0.setRuleFlowGroup( "rule-flow-group-0" );
- final IRuleSetNode ruleSet1 = new RuleSetNode();
+ final RuleSetNode ruleSet1 = new RuleSetNodeImpl();
ruleSet1.setRuleFlowGroup( "rule-flow-group-1" );
- final IRuleSetNode ruleSet2 = new RuleSetNode();
+ final RuleSetNode ruleSet2 = new RuleSetNodeImpl();
ruleSet2.setRuleFlowGroup( "rule-flow-group-2" );
- final IRuleSetNode ruleSet3 = new RuleSetNode();
+ final RuleSetNode ruleSet3 = new RuleSetNodeImpl();
ruleSet3.setRuleFlowGroup( "rule-flow-group-3" );
- final ISplit split = new Split();
- split.setType( ISplit.TYPE_AND );
- final IJoin join = new Join();
- join.setType( IJoin.TYPE_AND );
- final IEndNode end = new EndNode();
+ final Split split = new SplitImpl();
+ split.setType( Split.TYPE_AND );
+ final Join join = new JoinImpl();
+ join.setType( Join.TYPE_AND );
+ final EndNode end = new EndNodeImpl();
// connections
- new Connection( start,
+ new ConnectionImpl( start,
ruleSet0,
- IConnection.TYPE_NORMAL );
- new Connection( ruleSet0,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( ruleSet0,
split,
- IConnection.TYPE_NORMAL );
- new Connection( split,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( split,
ruleSet1,
- IConnection.TYPE_NORMAL );
- new Connection( split,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( split,
ruleSet2,
- IConnection.TYPE_NORMAL );
- new Connection( ruleSet1,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( ruleSet1,
join,
- IConnection.TYPE_NORMAL );
- new Connection( ruleSet2,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( ruleSet2,
join,
- IConnection.TYPE_NORMAL );
- new Connection( join,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( join,
ruleSet3,
- IConnection.TYPE_NORMAL );
- new Connection( ruleSet3,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( ruleSet3,
end,
- IConnection.TYPE_NORMAL );
+ Connection.TYPE_NORMAL );
// process
- final IRuleFlowProcess process = new RuleFlowProcess();
+ final RuleFlowProcess process = new RuleFlowProcessImpl();
process.addNode( start );
process.addNode( ruleSet0 );
process.addNode( ruleSet1 );
@@ -176,10 +175,10 @@
process.addNode( end );
// proces instance
- final IRuleFlowProcessInstance processInstance = new RuleFlowProcessInstance();
- processInstance.setAgenda( agenda );
+ final RuleFlowProcessInstance processInstance = new RuleFlowProcessInstanceImpl();
+ processInstance.setWorkingMemory( workingMemory );
processInstance.setProcess( process );
- assertEquals( IProcessInstance.STATE_PENDING,
+ assertEquals( ProcessInstance.STATE_PENDING,
processInstance.getState() );
final RuleFlowGroupImpl ruleFlowGroup0 = (RuleFlowGroupImpl) agenda.getRuleFlowGroup( "rule-flow-group-0" );
@@ -232,7 +231,7 @@
// Activate process instance, the activations stay in the group,
// but should now also be in the Agenda
processInstance.start();
- assertEquals( IProcessInstance.STATE_ACTIVE,
+ assertEquals( ProcessInstance.STATE_ACTIVE,
processInstance.getState() );
assertEquals( 2,
ruleFlowGroup0.size() );
@@ -295,7 +294,7 @@
ruleFlowGroup3.size() );
assertEquals( 0,
agenda.agendaSize() );
- assertEquals( IProcessInstance.STATE_COMPLETED,
+ assertEquals( ProcessInstance.STATE_COMPLETED,
processInstance.getState() );
}
@@ -366,54 +365,54 @@
null );
// nodes
- final IStartNode start = new StartNode();
- final IRuleSetNode ruleSet0 = new RuleSetNode();
+ final StartNode start = new StartNodeImpl();
+ final RuleSetNode ruleSet0 = new RuleSetNodeImpl();
ruleSet0.setRuleFlowGroup( "rule-flow-group-0" );
- final IRuleSetNode ruleSet1 = new RuleSetNode();
+ final RuleSetNode ruleSet1 = new RuleSetNodeImpl();
ruleSet1.setRuleFlowGroup( "rule-flow-group-1" );
- final IRuleSetNode ruleSet2 = new RuleSetNode();
+ final RuleSetNode ruleSet2 = new RuleSetNodeImpl();
ruleSet2.setRuleFlowGroup( "rule-flow-group-2" );
- final IRuleSetNode ruleSet3 = new RuleSetNode();
+ final RuleSetNode ruleSet3 = new RuleSetNodeImpl();
ruleSet3.setRuleFlowGroup( "rule-flow-group-3" );
- final ISplit split = new Split();
- split.setType( ISplit.TYPE_XOR );
- final IJoin join = new Join();
- join.setType( IJoin.TYPE_XOR );
- final IEndNode end = new EndNode();
+ final Split split = new SplitImpl();
+ split.setType( Split.TYPE_XOR );
+ final Join join = new JoinImpl();
+ join.setType( Join.TYPE_XOR );
+ final EndNode end = new EndNodeImpl();
// connections
- new Connection( start,
+ new ConnectionImpl( start,
ruleSet0,
- IConnection.TYPE_NORMAL );
- new Connection( ruleSet0,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( ruleSet0,
split,
- IConnection.TYPE_NORMAL );
- Connection out1 = new Connection( split,
+ Connection.TYPE_NORMAL );
+ Connection out1 = new ConnectionImpl( split,
ruleSet1,
- IConnection.TYPE_NORMAL );
- Connection out2 = new Connection( split,
+ Connection.TYPE_NORMAL );
+ Connection out2 = new ConnectionImpl( split,
ruleSet2,
- IConnection.TYPE_NORMAL );
- new Connection( ruleSet1,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( ruleSet1,
join,
- IConnection.TYPE_NORMAL );
- new Connection( ruleSet2,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( ruleSet2,
join,
- IConnection.TYPE_NORMAL );
- new Connection( join,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( join,
ruleSet3,
- IConnection.TYPE_NORMAL );
- new Connection( ruleSet3,
+ Connection.TYPE_NORMAL );
+ new ConnectionImpl( ruleSet3,
end,
- IConnection.TYPE_NORMAL );
- IConstraint constraint1 = new Constraint();
+ Connection.TYPE_NORMAL );
+ Constraint constraint1 = new org.drools.ruleflow.core.impl.ConstraintImpl();
constraint1.setPriority(1);
split.setConstraint(out1, constraint1);
- IConstraint constraint2 = new Constraint();
+ Constraint constraint2 = new org.drools.ruleflow.core.impl.ConstraintImpl();
constraint2.setPriority(2);
split.setConstraint(out2, constraint2);
// process
- final IRuleFlowProcess process = new RuleFlowProcess();
+ final RuleFlowProcess process = new RuleFlowProcessImpl();
process.setId( "1" );
process.addNode( start );
process.addNode( ruleSet0 );
@@ -444,10 +443,10 @@
splitRule2.getLhs() );
// proces instance
- final IRuleFlowProcessInstance processInstance = new RuleFlowProcessInstance();
- processInstance.setAgenda( agenda );
+ final RuleFlowProcessInstance processInstance = new RuleFlowProcessInstanceImpl();
+ processInstance.setWorkingMemory( workingMemory );
processInstance.setProcess( process );
- assertEquals( IProcessInstance.STATE_PENDING,
+ assertEquals( ProcessInstance.STATE_PENDING,
processInstance.getState() );
final RuleFlowGroupImpl ruleFlowGroup0 = (RuleFlowGroupImpl) agenda.getRuleFlowGroup( "rule-flow-group-0" );
@@ -493,7 +492,7 @@
final ReteTuple splitTuple2 = new ReteTuple( new DefaultFactHandle( 1,
"cheese" ) );
- splitNode1.assertTuple( splitTuple2,
+ splitNode2.assertTuple( splitTuple2,
context0,
workingMemory );
@@ -518,7 +517,7 @@
// Activate process instance, the activations stay in the group,
// but should now also be in the Agenda
processInstance.start();
- assertEquals( IProcessInstance.STATE_ACTIVE,
+ assertEquals( ProcessInstance.STATE_ACTIVE,
processInstance.getState() );
assertEquals( 2,
ruleFlowGroup0.size() );
@@ -569,7 +568,7 @@
ruleFlowGroup3.size() );
assertEquals( 0,
agenda.agendaSize() );
- assertEquals( IProcessInstance.STATE_COMPLETED,
+ assertEquals( ProcessInstance.STATE_COMPLETED,
processInstance.getState() );
}
}
More information about the jboss-svn-commits
mailing list