[jboss-svn-commits] JBL Code SVN: r24674 - in labs/jbossrules/branches/mfossati: drools-osworkflow/src/test/java/org/drools/osworkflow/test/persistence and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jan 13 10:28:53 EST 2009
Author: mfossati
Date: 2009-01-13 10:28:53 -0500 (Tue, 13 Jan 2009)
New Revision: 24674
Modified:
labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/AbstractProcessInstanceMarshaller.java
labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java
labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java
labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshallerRegistry.java
labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/test/persistence/AbstractJPAPersistenceTestCase.java
Log:
Changes in ProcessMArshallerRegistry, so it now stores ProcessType insted of ProcessInstance clazz
Modified: labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/AbstractProcessInstanceMarshaller.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/AbstractProcessInstanceMarshaller.java 2009-01-13 13:41:35 UTC (rev 24673)
+++ labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/AbstractProcessInstanceMarshaller.java 2009-01-13 15:28:53 UTC (rev 24674)
@@ -14,6 +14,7 @@
import org.drools.process.core.context.variable.VariableScope;
import org.drools.process.instance.context.swimlane.SwimlaneContextInstance;
import org.drools.process.instance.context.variable.VariableScopeInstance;
+import org.drools.process.instance.impl.ProcessInstanceImpl;
import org.drools.runtime.process.NodeInstance;
import org.drools.runtime.process.NodeInstanceContainer;
import org.drools.runtime.process.ProcessInstance;
@@ -41,8 +42,8 @@
WorkflowProcessInstanceImpl workFlow = (WorkflowProcessInstanceImpl) processInstance;
ObjectOutputStream stream = context.stream;
- // saves the processInstance class first
- stream.writeObject(processInstance.getClass());
+ // saves the processInstance type first
+ stream.writeUTF(((ProcessInstanceImpl)processInstance).getProcess().getType());
stream.writeLong(workFlow.getId());
stream.writeUTF(workFlow.getProcessId());
stream.writeInt(workFlow.getState());
Modified: labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java 2009-01-13 13:41:35 UTC (rev 24673)
+++ labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java 2009-01-13 15:28:53 UTC (rev 24674)
@@ -3,10 +3,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Queue;
@@ -29,13 +26,9 @@
import org.drools.common.RuleFlowGroupImpl;
import org.drools.common.TruthMaintenanceSystem;
import org.drools.concurrent.ExecutorService;
-import org.drools.process.core.context.swimlane.SwimlaneContext;
-import org.drools.process.core.context.variable.VariableScope;
-import org.drools.process.instance.ProcessInstance;
import org.drools.process.instance.WorkItem;
import org.drools.process.instance.WorkItemManager;
-import org.drools.process.instance.context.swimlane.SwimlaneContextInstance;
-import org.drools.process.instance.context.variable.VariableScopeInstance;
+import org.drools.process.instance.impl.ProcessInstanceImpl;
import org.drools.process.instance.impl.WorkItemImpl;
import org.drools.process.instance.timer.TimerInstance;
import org.drools.process.instance.timer.TimerManager;
@@ -64,9 +57,6 @@
import org.drools.rule.GroupElement;
import org.drools.rule.Package;
import org.drools.rule.Rule;
-import org.drools.ruleflow.instance.RuleFlowProcessInstance;
-import org.drools.runtime.process.NodeInstance;
-import org.drools.runtime.process.NodeInstanceContainer;
import org.drools.spi.Activation;
import org.drools.spi.AgendaGroup;
import org.drools.spi.FactHandleFactory;
@@ -75,16 +65,6 @@
import org.drools.spi.RuleFlowGroup;
import org.drools.util.ObjectHashMap;
import org.drools.util.ObjectHashSet;
-import org.drools.workflow.instance.impl.NodeInstanceImpl;
-import org.drools.workflow.instance.node.CompositeContextNodeInstance;
-import org.drools.workflow.instance.node.ForEachNodeInstance;
-import org.drools.workflow.instance.node.HumanTaskNodeInstance;
-import org.drools.workflow.instance.node.JoinInstance;
-import org.drools.workflow.instance.node.MilestoneNodeInstance;
-import org.drools.workflow.instance.node.RuleSetNodeInstance;
-import org.drools.workflow.instance.node.SubProcessNodeInstance;
-import org.drools.workflow.instance.node.TimerNodeInstance;
-import org.drools.workflow.instance.node.WorkItemNodeInstance;
public class InputMarshaller {
/**
@@ -779,14 +759,9 @@
public static ProcessMarshaller getMarshaller (MarshallerReaderContext context) throws IOException {
ObjectInputStream stream = context.stream;
- Class clazz = null;
- try {
- clazz = (Class)stream.readObject();
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return ProcessMarshallerRegistry.INSTANCE.getMarshaller(clazz);
+ String processInstanceType= null;
+ processInstanceType = stream.readUTF();
+ return ProcessMarshallerRegistry.INSTANCE.getMarshaller(processInstanceType);
}
// public static ProcessInstance readProcessInstance(MarshallerReaderContext context) throws IOException {
Modified: labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java 2009-01-13 13:41:35 UTC (rev 24673)
+++ labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java 2009-01-13 15:28:53 UTC (rev 24674)
@@ -28,6 +28,7 @@
import org.drools.common.RuleFlowGroupImpl;
import org.drools.common.WorkingMemoryAction;
import org.drools.process.instance.WorkItemManager;
+import org.drools.process.instance.impl.ProcessInstanceImpl;
import org.drools.process.instance.timer.TimerInstance;
import org.drools.process.instance.timer.TimerManager;
import org.drools.reteoo.BetaNode;
@@ -726,7 +727,7 @@
for ( org.drools.runtime.process.ProcessInstance processInstance : processInstances ) {
stream.writeShort( PersisterEnums.PROCESS_INSTANCE );
writeProcessInstance( context,
- (RuleFlowProcessInstance) processInstance );
+ (ProcessInstanceImpl)processInstance );
}
stream.writeShort( PersisterEnums.END );
}
@@ -735,7 +736,7 @@
ProcessInstance processInstance) throws IOException {
ProcessMarshaller marshaller = ProcessMarshallerRegistry.INSTANCE
- .getMarshaller(processInstance.getClass());
+ .getMarshaller(((ProcessInstanceImpl)processInstance).getProcess().getType());
marshaller.writeProcessInstance(context, processInstance);
}
Modified: labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshallerRegistry.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshallerRegistry.java 2009-01-13 13:41:35 UTC (rev 24673)
+++ labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshallerRegistry.java 2009-01-13 15:28:53 UTC (rev 24674)
@@ -4,33 +4,34 @@
import java.util.Map;
import org.drools.process.instance.impl.ProcessInstanceImpl;
+import org.drools.ruleflow.core.RuleFlowProcess;
import org.drools.ruleflow.instance.RuleFlowProcessInstance;
/**
-* Registry for ProcessInstance/ProcessMarshaller
+* Registry for Process/ProcessMarshaller
*/
public class ProcessMarshallerRegistry {
public static ProcessMarshallerRegistry INSTANCE = new ProcessMarshallerRegistry();
- private Map<Class<? extends ProcessInstanceImpl> , ProcessMarshaller> registry;
+ private Map<String , ProcessMarshaller> registry;
private ProcessMarshallerRegistry() {
- this.registry = new HashMap<Class< ? extends ProcessInstanceImpl>, ProcessMarshaller >();
+ this.registry = new HashMap<String, ProcessMarshaller >();
// default logic that used to be in OutPutMarshaller:
- register( RuleFlowProcessInstance.class,
+ register( RuleFlowProcess.RULEFLOW_TYPE,
RuleFlowProcessInstanceMarshaller.INSTANCE );
}
- public void register(Class<? extends ProcessInstanceImpl> cls,
+ public void register(String cls,
ProcessMarshaller marchaller) {
this.registry.put(cls, marchaller);
}
@SuppressWarnings("unchecked")
- public ProcessMarshaller getMarshaller(Class clazz) {
- return this.registry.get(clazz);
+ public ProcessMarshaller getMarshaller(String type) {
+ return this.registry.get(type);
}
Modified: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/test/persistence/AbstractJPAPersistenceTestCase.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/test/persistence/AbstractJPAPersistenceTestCase.java 2009-01-13 13:41:35 UTC (rev 24673)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/test/persistence/AbstractJPAPersistenceTestCase.java 2009-01-13 15:28:53 UTC (rev 24674)
@@ -14,6 +14,7 @@
import org.drools.RuleBaseFactory;
import org.drools.compiler.PackageBuilder;
import org.drools.marshalling.ProcessMarshallerRegistry;
+import org.drools.osworkflow.core.OSWorkflowProcess;
import org.drools.osworkflow.instance.OSWorkflowProcessInstance;
import org.drools.osworkflow.persistence.marshaller.OSWorkflowMarshaller;
import org.drools.rule.Package;
@@ -46,7 +47,7 @@
properties.put("workItemManagerFactory", "org.drools.persistence.processinstance.JPAWorkItemManagerFactory");
properties.put("processSignalManagerFactory", "org.drools.persistence.processinstance.JPASignalManagerFactory");
//TODO configure this with IOC
- ProcessMarshallerRegistry.INSTANCE.register(OSWorkflowProcessInstance.class, OSWorkflowMarshaller.INSTANCE);
+ ProcessMarshallerRegistry.INSTANCE.register(OSWorkflowProcess.OSWORKFLOW_TYPE, OSWorkflowMarshaller.INSTANCE);
return properties;
}
More information about the jboss-svn-commits
mailing list