GigaSpaces XAP 7.0 API

com.j_spaces.core.client
Class TokenQuery

java.lang.Object
  extended by com.j_spaces.core.client.TokenQuery
All Implemented Interfaces:
Serializable, net.jini.core.entry.Entry

public class TokenQuery
extends Object
implements net.jini.core.entry.Entry

TokenQuery provides a simple mechanism which allows notifications of several different notify templates, each with a different token field, to be triggered for a single space operation. The tokenized field holds separated token values. These tokens are separated by a space-char delimiter (by default). The separator char can be configured via space-config file.


 Message msg = new Message();
 msg.tokenField = "10";
 TokenQuery template = new TokenQuery(msg, "tokenField");
 
 // Register for notification
 m_NotifyDelegator notifyDelegator = new NotifyDelegator(space, template,
        null, this, Lease.FOREVER, null , false , NotifyModifiers.WRITE);
 
 // trigger notification corresponding to the different tokenized field values
 Message entryMsg = new Message();
 entryMsg.tokenField = "10 12 7 10";

 // write operation will trigger 2 notification for value 10 
 space.write(entryMsg, null,5000);
 

See Also:
Serialized Form

Constructor Summary
TokenQuery(net.jini.core.entry.Entry entry, String tokenizedFieldName)
          A TokenQuery object is constructed with the user's Entry and the chosen tokenized field.
 
Method Summary
 net.jini.core.entry.Entry extractEntry()
           
 String getTokenizedFieldName()
           
 String toString()
          Returns a string representation of the Entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TokenQuery

public TokenQuery(net.jini.core.entry.Entry entry,
                  String tokenizedFieldName)
A TokenQuery object is constructed with the user's Entry and the chosen tokenized field. The TokenQuery object is used as the template object of the NotifyDelegator constructor.

Parameters:
entry - - entry to perform space operations upon
tokenizedFieldName - - Name of the tokenized field. The field must be a String type field, and only one such field is allowed per class.
Method Detail

getTokenizedFieldName

public String getTokenizedFieldName()
Returns:
tokenized field name

extractEntry

public net.jini.core.entry.Entry extractEntry()
Returns:
internal constructed Entry

toString

public String toString()
Returns a string representation of the Entry. The string "textually represents" this object in conjunction with the internal Entry. The string consists of the name of the class of which the object is an instance, the breaker character '[', the value of the tokenized field and the toString of the internal Entry, followed by a closing bracket '].

Overrides:
toString in class Object
Returns:
a string representation of the Entry.

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.