J-Sim v1.2.1-p7 API

drcl.inet.contract
Class IDLookup

java.lang.Object
  extended bydrcl.comp.Contract
      extended bydrcl.inet.contract.IDLookup

public class IDLookup
extends Contract

The IdentityLookup contract. This contract defines three services at the reactor:

DefaultIdentityRetrieval
The initiator sends a drcl.data.IntObj of value 0 and the reactor returns the default identity (drcl.data.LongObj) stored at the reactor.
AllIdentitiesRetrieval
The initiator sends a drcl.data.IntObj of value 1 and the reactor returns all the identities (long[]) stored at the reactor.
IdentitiesQuery
The initiator sends identities in question (long[]) and the reactor sends back the corresponding answers in the boolean[] array of the same size. The value true indicates the corresponding identity exists in the reactor.
This class also provides a set of static methods to facilitate conducting the above services (getDefaultID(Port), getAllIDs(Port) and query(..., Port)) from the specified port. These methods are particularly useful in implementing a protocol that needs to be aware of the identities of the node.


Field Summary
static int GET_ALL
           
static int GET_DEFAULT
           
 
Fields inherited from class drcl.comp.Contract
Role_INITIATOR, Role_PEER, Role_REACTOR
 
Constructor Summary
IDLookup()
           
IDLookup(int role_)
           
 
Method Summary
static java.lang.Object createGetAllRequest()
           
static java.lang.Object createGetDefaultRequest()
           
static java.lang.Object createQueryRequest(long id_)
           
static java.lang.Object createQueryRequest(long[] id_)
           
static long[] getAllIDs(Port out_)
           
 java.lang.Object getContractContent()
          Returns the content of this contract (format?).
static long getDefaultID(Port out_)
           
 java.lang.String getName()
           
static boolean[] query(long[] ids_, Port out_)
           
static boolean query(long id_, Port out_)
           
 
Methods inherited from class drcl.comp.Contract
getRole, match, setRole
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GET_DEFAULT

public static final int GET_DEFAULT
See Also:
Constant Field Values

GET_ALL

public static final int GET_ALL
See Also:
Constant Field Values
Constructor Detail

IDLookup

public IDLookup()

IDLookup

public IDLookup(int role_)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in class Contract

getContractContent

public java.lang.Object getContractContent()
Description copied from class: Contract
Returns the content of this contract (format?).

Specified by:
getContractContent in class Contract

getDefaultID

public static long getDefaultID(Port out_)

getAllIDs

public static long[] getAllIDs(Port out_)

query

public static boolean query(long id_,
                            Port out_)

query

public static boolean[] query(long[] ids_,
                              Port out_)

createGetDefaultRequest

public static java.lang.Object createGetDefaultRequest()

createGetAllRequest

public static java.lang.Object createGetAllRequest()

createQueryRequest

public static java.lang.Object createQueryRequest(long id_)

createQueryRequest

public static java.lang.Object createQueryRequest(long[] id_)

J-Sim v1.2.1-p7 API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~