org.sandev.basics.structs
Class CacheActionStruct

java.lang.Object
  extended byorg.sandev.basics.structs.CacheActionStruct
Direct Known Subclasses:
CacheAction

public class CacheActionStruct
extends java.lang.Object

A CacheAction is used for notification registration, and notifications, of changes to persistent message instances. By tracking changes, an application can ensure that its cached information remains in synch with the information recorded in the DataManager. CacheActions are sourced from, and registered with, a CacheManager, which is configured to work directly with the DataManager (or another CacheManager). For overview information on cache management, see Persist.html in the top level documentation.

Security considerations:

CacheActions do not contain instance data, and in many cases innapropriate display of changed information is not a problem. For example if the cached information is public, then presumably change notifications for that information would also be public. Alternatively, if the cached information is used only between trusted nodes, then the changed notification is also trusted.

In all other cases, security for CacheActions is handled like any message using an AuthFilter from the application Authorizer. Details are application specific, but for example:

For assistance with filtering and security issues contact Structs And Nodes Development Services.

Wildcarding:

Wildcard specification is allowed only for UNREGISTER actions. See the struct fields for details.

This message can be transmitted directly outside of a verb form.

Field Summary
protected  int action
          The caching action being done.
protected  java.lang.String messageClass
          The fully qualified classname of the message being being tracked.
protected  long revisionNumber
          The current revision number of the instance.
protected  java.lang.String[] sources
          The instance names of the sources requesting tracking updates.
protected  long uniqueID
          The uniqueID of the message instance being tracked.
 
Constructor Summary
CacheActionStruct()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

action

protected int action
The caching action being done. Note that while REGISTER guarantees that a change notification will be sent, UNREGISTER does not guarantee notifications will not arrive. Notifications will stop being broadcast only after the last registered listener unregisters.

enumerated constant values:

  • _UNDEFINED = 0
  • _CHANGED = 1
  • _DELETED = 2
  • _DUMPED = 3
  • _REGISTER = 4
  • _UNREGISTER = 5

uniqueID

protected long uniqueID
The uniqueID of the message instance being tracked.

Wildcarding: For UNREGISTER actions only, this field may be set to -1, meaning that any registrations matching the messageClass and source will be removed.

Wildcard matching on REGISTER actions is not allowed because the CacheManager would need to iterate and match instead of using a direct lookup. It also tends to cause unnecessary messaging. If your application requires significant pre-fetch caching, we recommend creating an appropriate struct declaration to hold the working set, and then handle cache registration local to the CacheManagerNode so that the multiple registration calls are handled locally.


messageClass

protected java.lang.String messageClass
The fully qualified classname of the message being being tracked.

Wildcarding: For UNREGISTER actions only, this field may be set to null or "", meaning that any registrations matching the source will be removed.

Length in characters, normal: 50 max: 255

revisionNumber

protected long revisionNumber
The current revision number of the instance. This is filled in with the latest revisionNumber by the CacheManager when an instance is CHANGED. There are no cache notifications sent when a new instance is added (since without a uniqueID it can't have been cached yet), and when an instance is deleted it doesn't matter what the revision number is anymore. This field is ignored on registration.


sources

protected java.lang.String[] sources
The instance names of the sources requesting tracking updates. For a REGISTER or UNREGISTER action, this array must have exactly one element in it, which is the instance name of the requesting node. A node can retrieve its instance name by calling
      getNodeInstance().getNodeInstanceName();
 

Within the CacheManager, this field serves as a reference count for the number of subscribers for a given notification, while supporting wildcard deregistration.

Constructor Detail

CacheActionStruct

public CacheActionStruct()