[jboss-svn-commits] JBL Code SVN: r7105 - in labs/jbossrules/trunk/drools-core/src/main/java/org/drools: audit common event reteoo
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Oct 25 10:13:18 EDT 2006
Author: mark.proctor at jboss.com
Date: 2006-10-25 10:13:13 -0400 (Wed, 25 Oct 2006)
New Revision: 7105
Modified:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/WorkingMemoryLogger.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/DefaultBetaConstraints.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/AgendaEventListener.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/AgendaEventSupport.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/DebugAgendaEventListener.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/DefaultAgendaEventListener.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java
Log:
-AgendaListener now passes the WorkingMemory
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 2006-10-25 13:54:03 UTC (rev 7104)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/WorkingMemoryLogger.java 2006-10-25 14:13:13 UTC (rev 7105)
@@ -164,7 +164,7 @@
/**
* @see org.drools.event.AgendaEventListener
*/
- public void activationCreated(final ActivationCreatedEvent event) {
+ public void activationCreated(final ActivationCreatedEvent event, WorkingMemory workingMemory) {
filterLogEvent( new ActivationLogEvent( LogEvent.ACTIVATION_CREATED,
getActivationId( event.getActivation() ),
event.getActivation().getRule().getName(),
@@ -174,7 +174,7 @@
/**
* @see org.drools.event.AgendaEventListener
*/
- public void activationCancelled(final ActivationCancelledEvent event) {
+ public void activationCancelled(final ActivationCancelledEvent event, WorkingMemory workingMemory) {
filterLogEvent( new ActivationLogEvent( LogEvent.ACTIVATION_CANCELLED,
getActivationId( event.getActivation() ),
event.getActivation().getRule().getName(),
@@ -184,7 +184,7 @@
/**
* @see org.drools.event.AgendaEventListener
*/
- public void beforeActivationFired(final BeforeActivationFiredEvent event) {
+ public void beforeActivationFired(final BeforeActivationFiredEvent event, WorkingMemory workingMemory) {
filterLogEvent( new ActivationLogEvent( LogEvent.BEFORE_ACTIVATION_FIRE,
getActivationId( event.getActivation() ),
event.getActivation().getRule().getName(),
@@ -194,7 +194,7 @@
/**
* @see org.drools.event.AgendaEventListener
*/
- public void afterActivationFired(final AfterActivationFiredEvent event) {
+ public void afterActivationFired(final AfterActivationFiredEvent event, WorkingMemory workingMemory) {
filterLogEvent( new ActivationLogEvent( LogEvent.AFTER_ACTIVATION_FIRE,
getActivationId( event.getActivation() ),
event.getActivation().getRule().getName(),
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 2006-10-25 13:54:03 UTC (rev 7104)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultAgenda.java 2006-10-25 14:13:13 UTC (rev 7105)
@@ -318,7 +318,7 @@
if ( this.scheduledActivations != null && !this.scheduledActivations.isEmpty() ) {
for ( ScheduledAgendaItem item = (ScheduledAgendaItem) this.scheduledActivations.removeFirst(); item != null; item = (ScheduledAgendaItem) this.scheduledActivations.removeFirst() ) {
item.remove();
- eventsupport.getAgendaEventSupport().fireActivationCancelled( item );
+ eventsupport.getAgendaEventSupport().fireActivationCancelled( item, this.workingMemory );
}
}
}
@@ -353,7 +353,7 @@
item.getActivationGroupNode().getActivationGroup().removeActivation( item );
}
- eventsupport.getAgendaEventSupport().fireActivationCancelled( item );
+ eventsupport.getAgendaEventSupport().fireActivationCancelled( item, this.workingMemory );
}
((AgendaGroupImpl) agendaGroup).clear();
}
@@ -382,7 +382,7 @@
if ( activation.isActivated() ) {
activation.setActivated( false );
activation.remove();
- eventsupport.getAgendaEventSupport().fireActivationCancelled( activation );
+ eventsupport.getAgendaEventSupport().fireActivationCancelled( activation, this.workingMemory );
}
}
activationGroup.clear();
@@ -426,7 +426,7 @@
public synchronized void fireActivation(final Activation activation) throws ConsequenceException {
final EventSupport eventsupport = (EventSupport) this.workingMemory;
- eventsupport.getAgendaEventSupport().fireBeforeActivationFired( activation );
+ eventsupport.getAgendaEventSupport().fireBeforeActivationFired( activation, this.workingMemory );
if ( activation.getActivationGroupNode() != null ) {
final ActivationGroup activationGroup = activation.getActivationGroupNode().getActivationGroup();
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultBetaConstraints.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultBetaConstraints.java 2006-10-25 13:54:03 UTC (rev 7104)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultBetaConstraints.java 2006-10-25 14:13:13 UTC (rev 7105)
@@ -52,10 +52,10 @@
public DefaultBetaConstraints(final BetaNodeFieldConstraint[] constraints) {
this( constraints, true );
- this.indexed = -1;
}
public DefaultBetaConstraints(final BetaNodeFieldConstraint[] constraints, boolean index ) {
+ this.indexed = -1;
this.constraints = new LinkedList();
ContextEntry current = null;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/AgendaEventListener.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/AgendaEventListener.java 2006-10-25 13:54:03 UTC (rev 7104)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/AgendaEventListener.java 2006-10-25 14:13:13 UTC (rev 7105)
@@ -18,14 +18,16 @@
import java.util.EventListener;
+import org.drools.WorkingMemory;
+
public interface AgendaEventListener
extends
EventListener {
- void activationCreated(ActivationCreatedEvent event);
+ void activationCreated(ActivationCreatedEvent event, WorkingMemory workingMemory);
- void activationCancelled(ActivationCancelledEvent event);
+ void activationCancelled(ActivationCancelledEvent event, WorkingMemory workingMemory);
- void beforeActivationFired(BeforeActivationFiredEvent event);
+ void beforeActivationFired(BeforeActivationFiredEvent event, WorkingMemory workingMemory);
- void afterActivationFired(AfterActivationFiredEvent event);
+ void afterActivationFired(AfterActivationFiredEvent event, WorkingMemory workingMemory);
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/AgendaEventSupport.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/AgendaEventSupport.java 2006-10-25 13:54:03 UTC (rev 7104)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/AgendaEventSupport.java 2006-10-25 14:13:13 UTC (rev 7105)
@@ -33,7 +33,7 @@
/**
*
*/
- private static final long serialVersionUID = 9072017367081307109L;
+ private static final long serialVersionUID = 320L;
private final List listeners = Collections.synchronizedList( new ArrayList() );
private final WorkingMemory workingMemory;
@@ -63,7 +63,7 @@
return this.listeners.isEmpty();
}
- public void fireActivationCreated(final Activation activation) {
+ public void fireActivationCreated(final Activation activation, WorkingMemory workingMemory) {
if ( this.listeners.isEmpty() ) {
return;
}
@@ -71,11 +71,11 @@
final ActivationCreatedEvent event = new ActivationCreatedEvent( activation );
for ( int i = 0, size = this.listeners.size(); i < size; i++ ) {
- ((AgendaEventListener) this.listeners.get( i )).activationCreated( event );
+ ((AgendaEventListener) this.listeners.get( i )).activationCreated( event, workingMemory );
}
}
- public void fireActivationCancelled(final Activation activation) {
+ public void fireActivationCancelled(final Activation activation, WorkingMemory workingMemory) {
if ( this.listeners.isEmpty() ) {
return;
}
@@ -83,11 +83,11 @@
final ActivationCancelledEvent event = new ActivationCancelledEvent( activation );
for ( int i = 0, size = this.listeners.size(); i < size; i++ ) {
- ((AgendaEventListener) this.listeners.get( i )).activationCancelled( event );
+ ((AgendaEventListener) this.listeners.get( i )).activationCancelled( event, workingMemory );
}
}
- public void fireBeforeActivationFired(final Activation activation) {
+ public void fireBeforeActivationFired(final Activation activation, WorkingMemory workingMemory) {
if ( this.listeners.isEmpty() ) {
return;
}
@@ -95,7 +95,7 @@
final BeforeActivationFiredEvent event = new BeforeActivationFiredEvent( activation );
for ( int i = 0, size = this.listeners.size(); i < size; i++ ) {
- ((AgendaEventListener) this.listeners.get( i )).beforeActivationFired( event );
+ ((AgendaEventListener) this.listeners.get( i )).beforeActivationFired( event, workingMemory );
}
}
@@ -107,7 +107,7 @@
final AfterActivationFiredEvent event = new AfterActivationFiredEvent( activation );
for ( int i = 0, size = this.listeners.size(); i < size; i++ ) {
- ((AgendaEventListener) this.listeners.get( i )).afterActivationFired( event );
+ ((AgendaEventListener) this.listeners.get( i )).afterActivationFired( event, workingMemory );
}
}
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/DebugAgendaEventListener.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/DebugAgendaEventListener.java 2006-10-25 13:54:03 UTC (rev 7104)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/DebugAgendaEventListener.java 2006-10-25 14:13:13 UTC (rev 7105)
@@ -1,5 +1,7 @@
package org.drools.event;
+import org.drools.WorkingMemory;
+
/*
* Copyright 2005 JBoss Inc
*
@@ -23,19 +25,19 @@
// intentionally left blank
}
- public void activationCreated(final ActivationCreatedEvent event) {
+ public void activationCreated(final ActivationCreatedEvent event, WorkingMemory workingMemory) {
System.err.println( event );
}
- public void activationCancelled(final ActivationCancelledEvent event) {
+ public void activationCancelled(final ActivationCancelledEvent event, WorkingMemory workingMemory) {
System.err.println( event );
}
- public void beforeActivationFired(final BeforeActivationFiredEvent event) {
+ public void beforeActivationFired(final BeforeActivationFiredEvent event, WorkingMemory workingMemory) {
System.err.println( event );
}
- public void afterActivationFired(final AfterActivationFiredEvent event) {
+ public void afterActivationFired(final AfterActivationFiredEvent event, WorkingMemory workingMemory) {
System.err.println( event );
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/DefaultAgendaEventListener.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/DefaultAgendaEventListener.java 2006-10-25 13:54:03 UTC (rev 7104)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/event/DefaultAgendaEventListener.java 2006-10-25 14:13:13 UTC (rev 7105)
@@ -1,5 +1,7 @@
package org.drools.event;
+import org.drools.WorkingMemory;
+
/*
* Copyright 2005 JBoss Inc
*
@@ -23,19 +25,19 @@
// intentionally left blank
}
- public void activationCreated(final ActivationCreatedEvent event) {
+ public void activationCreated(final ActivationCreatedEvent event, WorkingMemory workingMemory) {
// intentionally left blank
}
- public void activationCancelled(final ActivationCancelledEvent event) {
+ public void activationCancelled(final ActivationCancelledEvent event, WorkingMemory workingMemory) {
// intentionally left blank
}
- public void beforeActivationFired(final BeforeActivationFiredEvent event) {
+ public void beforeActivationFired(final BeforeActivationFiredEvent event, WorkingMemory workingMemory) {
// intentionally left blank
}
- public void afterActivationFired(final AfterActivationFiredEvent event) {
+ public void afterActivationFired(final AfterActivationFiredEvent event, WorkingMemory workingMemory) {
// intentionally left blank
}
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java 2006-10-25 13:54:03 UTC (rev 7104)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java 2006-10-25 14:13:13 UTC (rev 7105)
@@ -106,6 +106,8 @@
private Map objectType;
private int currentOffsetAdjustment;
+
+ private final boolean removeIdentities;
// ------------------------------------------------------------
// Constructors
@@ -123,6 +125,7 @@
//Set to 1 as Rete node is set to 0
this.id = 1;
+ this.removeIdentities = false;
}
/**
@@ -263,7 +266,7 @@
binder = attachColumn( (Column) object,
and,
- true );
+ this.removeIdentities );
// If a tupleSource does not exist then we need to adapt this
// into
@@ -370,7 +373,7 @@
private BetaConstraints attachColumn(final Column column,
final GroupElement parent,
- final boolean removeIdentities) throws InvalidPatternException {
+ boolean removeIdentities) throws InvalidPatternException {
// Adjusting offset in case a previous Initial-Fact was added to the network
column.adjustOffset( this.currentOffsetAdjustment );
More information about the jboss-svn-commits
mailing list