equip.data
Class EventPattern

java.lang.Object
  extended byequip.runtime.Object
      extended byequip.runtime.ValueBase
          extended byequip.data.ItemData
              extended byequip.data.EventPattern
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
EventPatternImpl

public abstract class EventPattern
extends ItemData

An ItemData subclass which represents a process's interest in a certain kind of event(s). An instance of the event type itself is the pattern, using match(). This coniders null strings and valuetype references to be wildcards, and requires that the pattern be the same class or a subclass of the matched object.

The different kinds of patterns define different ways in which they are satisfied and/or removed from the system.

An AddEvent with kind ItemEventKind.EQDATA_KIND_PRESENT (or wildcard) will match items already in existance (as if the Pattern has been in place before they were created).

Similarly, a DeleteEvent with that kind will cause callbacks when the pattern is deleted for any matching items still present in the database.

Inherited from ItemData:


Field Summary
 boolean deleteItemOnMatch
          Whether to delete the matched item (for Add/Delete pseudo-events) after any/each successful match.
 boolean deleteOnCheck
          flag to remove pattern as soon as first full check complete.
 boolean deleteOnMatch
          flag to delete pattern if a successful match occurs.
 Event[] eventTemplates
          Template to be matched by a dataspace event.
 ItemData[] itemTemplates
          Template to be matched by the item to which an item-linked event relates (add, delete, update, mutate).
 boolean local
          Is the event pattern for the local database only?
 boolean matched
          internal flag indicating pattern has been successfully matched.
 
Fields inherited from class equip.data.ItemData
id, name
 
Constructor Summary
EventPattern()
          Default no-arg constructor
 
Method Summary
 boolean _equals_helper(EventPattern c)
          Internal IDL-generated equality test helper
 boolean _matches_helper(EventPattern c)
          Internal IDL-generated match test helper
 boolean equals(java.lang.Object c)
          Standard IDL-generated equality test.
 java.lang.String getModuleName()
          IDL-generated helper routine to get module name (currently unimplemented).
abstract  void initAsCompoundEventMonitor(Event[] eventTemplates, boolean local)
          convenience initialisation: version of initAsSimpleEventMonitor(equip.data.Event, boolean) for multiple event templates.
abstract  void initAsCompoundItemMonitor(ItemData[] itemTemplates, boolean local)
          convenience initialisation: version of initAsSimpleItemMonitor(equip.data.ItemData, boolean) for multiple item templates.
abstract  void initAsSimpleCollect(ItemData itemTemplate, boolean local)
          convenience initialisation: tuplespace collect - all matching items are returned and deleted (out) (NBonly works on local dataspace at present).
abstract  void initAsSimpleCopyCollect(ItemData itemTemplate, boolean local)
          convenience initialisation: tuplespace copy-collect - all matching items are returned (read) (NBonly works on local dataspace at present).
abstract  void initAsSimpleEventMonitor(Event eventTemplate, boolean local)
          convenience initialisation: ongoing monitor for simple events, rather than data items.
abstract  void initAsSimpleItemMonitor(ItemData itemTemplate, boolean local)
          convenience initialisation: like an ongoing copy-collect: makes an event pattern for Add, update and delete events on the matching itemTemplate (works globally but asynchrnously).
abstract  void initAsSimpleOut(ItemData itemTemplate, boolean local)
          convenience initialisation: tuplespace out - single matching item, which is atomically removed from the data space (NBonly works on local dataspace at present).
abstract  void initAsSimpleRead(ItemData itemTemplate, boolean local)
          convenience initialisation: tuplespace read - single matching item (NBonly works on local dataspace at present).
abstract  void initAsSimpleReadp(ItemData itemTemplate, boolean local)
          convenience initialisation: tuplespace readp (predicate) - single matching item, or null if no item is present at the moment (read waits for an item) (NBonly works on local dataspace at present).
 boolean matches(java.lang.Object c)
          Standard IDL-generated template match test.
 void readObject(ObjectInputStream in)
          Internal IDL-generated serialisation helper.
 void writeObject(ObjectOutputStream out)
          Internal IDL-generated serialisation helper.
 
Methods inherited from class equip.data.ItemData
_equals_helper, _matches_helper
 
Methods inherited from class equip.runtime.ValueBase
_equals_helper, _matches_helper, clone
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

itemTemplates

public ItemData[] itemTemplates
Template to be matched by the item to which an item-linked event relates (add, delete, update, mutate). I.e. the itemTemplates AND the eventTemplates must match. (no itemTemplates -> any item, no eventTemplates -> any event).


eventTemplates

public Event[] eventTemplates
Template to be matched by a dataspace event. Note, for item-related events (add, delete, update, mutate), itemTemplates must also match.


deleteOnCheck

public boolean deleteOnCheck
flag to remove pattern as soon as first full check complete. i.e. probe momentary current state. Only useful with Add/Delete (PRESENT) pseudo-events


deleteOnMatch

public boolean deleteOnMatch
flag to delete pattern if a successful match occurs. c.f. tuplespace 'read' of a single item


matched

public boolean matched
internal flag indicating pattern has been successfully matched. used internally in DataSession; must be set to false when the EventPattern is first added to a dataspace.


deleteItemOnMatch

public boolean deleteItemOnMatch
Whether to delete the matched item (for Add/Delete pseudo-events) after any/each successful match. Match is only deemed to succeed if the delete has/will succeed. c.f. tuplespace 'out' (single if also deleteOnMatch, else multiple)


local

public boolean local
Is the event pattern for the local database only?

Constructor Detail

EventPattern

public EventPattern()
Default no-arg constructor

Method Detail

initAsSimpleRead

public abstract void initAsSimpleRead(ItemData itemTemplate,
                                      boolean local)
convenience initialisation: tuplespace read - single matching item (NBonly works on local dataspace at present). (deleteOnMatch)


initAsSimpleReadp

public abstract void initAsSimpleReadp(ItemData itemTemplate,
                                       boolean local)
convenience initialisation: tuplespace readp (predicate) - single matching item, or null if no item is present at the moment (read waits for an item) (NBonly works on local dataspace at present). (deleteOnMatch, deleteOnCheck)


initAsSimpleOut

public abstract void initAsSimpleOut(ItemData itemTemplate,
                                     boolean local)
convenience initialisation: tuplespace out - single matching item, which is atomically removed from the data space (NBonly works on local dataspace at present). (deleteOnMatch, deleteItemOnMatch)


initAsSimpleCopyCollect

public abstract void initAsSimpleCopyCollect(ItemData itemTemplate,
                                             boolean local)
convenience initialisation: tuplespace copy-collect - all matching items are returned (read) (NBonly works on local dataspace at present). (deleteOnCheck)


initAsSimpleCollect

public abstract void initAsSimpleCollect(ItemData itemTemplate,
                                         boolean local)
convenience initialisation: tuplespace collect - all matching items are returned and deleted (out) (NBonly works on local dataspace at present). (deleteOnCheck, deleteItemOnMatch)


initAsSimpleItemMonitor

public abstract void initAsSimpleItemMonitor(ItemData itemTemplate,
                                             boolean local)
convenience initialisation: like an ongoing copy-collect: makes an event pattern for Add, update and delete events on the matching itemTemplate (works globally but asynchrnously).

Using the ItemEventKind.EQDATA_KIND_PRESENT kind (or wildcard) this also returns items existing when the patterns is first added to a session. It will then return add/update/delete events matching until the pattern is removed.

This is the main method used for inter-dataspace replication, since a non-local item monitor will be copied to other connected dataspace replicas and cause matching items to be copied to and kept up to date in the originating dataspace.


initAsCompoundItemMonitor

public abstract void initAsCompoundItemMonitor(ItemData[] itemTemplates,
                                               boolean local)
convenience initialisation: version of initAsSimpleItemMonitor(equip.data.ItemData, boolean) for multiple item templates.


initAsSimpleEventMonitor

public abstract void initAsSimpleEventMonitor(Event eventTemplate,
                                              boolean local)
convenience initialisation: ongoing monitor for simple events, rather than data items.

Used for stateless event distribution, e.g. comparable to Elvin.


initAsCompoundEventMonitor

public abstract void initAsCompoundEventMonitor(Event[] eventTemplates,
                                                boolean local)
convenience initialisation: version of initAsSimpleEventMonitor(equip.data.Event, boolean) for multiple event templates.


getModuleName

public java.lang.String getModuleName()
IDL-generated helper routine to get module name (currently unimplemented).

Overrides:
getModuleName in class ItemData
Returns:
name of this class's module

equals

public boolean equals(java.lang.Object c)
Standard IDL-generated equality test.

Overrides:
equals in class ItemData
Parameters:
c - The object to be compared against this.
Returns:
true if this is equal to c

_equals_helper

public boolean _equals_helper(EventPattern c)
Internal IDL-generated equality test helper


matches

public boolean matches(java.lang.Object c)
Standard IDL-generated template match test.

Overrides:
matches in class ItemData
Parameters:
c - The object to be checked against this template.
Returns:
true if this (as a template) matches the argument

_matches_helper

public boolean _matches_helper(EventPattern c)
Internal IDL-generated match test helper


writeObject

public void writeObject(ObjectOutputStream out)
                 throws java.io.IOException
Internal IDL-generated serialisation helper. Used by ObjectInputStream and ObjectOutputStream only.

Overrides:
writeObject in class ItemData
Throws:
java.io.IOException

readObject

public void readObject(ObjectInputStream in)
                throws java.io.IOException,
                       java.lang.ClassNotFoundException,
                       java.lang.InstantiationException
Internal IDL-generated serialisation helper. Used by ObjectInputStream and ObjectOutputStream only.

Overrides:
readObject in class ItemData
Throws:
java.io.IOException
java.lang.ClassNotFoundException
java.lang.InstantiationException