|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectequip.runtime.Object
equip.runtime.ValueBase
equip.net.ServiceProxy
equip.data.DataProxy
equip.data.Server
The normal implementation of the IDL'd dataspace API, DataProxy as a dataspace server, delegating most of the
work to an instance of class DataDelegate.
Note 1: you should
NOT normally create these directly; use the singleton DataManager to allow sharing of dataspace replicas within a single
application.
Note 2: you will probably find the IDataspace API easier to use and more familar in
terms of Java idiom (see DataspaceBean).
Note 3: see the package documentation for notes on security between dataspace server and clients.
| Field Summary |
| Fields inherited from class equip.data.DataProxy |
initialItems |
| Fields inherited from class equip.net.ServiceProxy |
serviceMoniker |
| Constructor Summary | |
Server(short port)
|
|
Server(SimpleMoniker moniker)
|
|
| Method Summary | |
boolean |
activate(DeactivateCallback callback,
ValueBase closure)
Request activation of the service proxy, i.e. connect to server. |
void |
activateAsync()
Create a thread to repeatedly attempt to activate this dataspace (assuming that it is a client) whenever its activation fails. |
void |
addEvent(Event event)
Add a new event into the dataspace. |
void |
addItem(ItemData item,
int locked,
boolean local,
boolean processBound,
Lease itemLease)
add item event helper - create and publish an AddEvent. |
void |
beginBusy()
this dangerous internal API lets you suspend the enactment of events; also make a matching call to endBusy().
|
DataSession |
createSession(DataCallback callback,
ValueBase closure)
Create a new data session in which to express interest in events and data items and to get callbacks/notifications. |
void |
deactivate()
Request deactivation of an (active) service proxy, i.e. |
void |
deleteItem(GUID id,
boolean local)
delete item event helper - create and publish an DeleteEvent. |
void |
deleteSession(DataSession session)
Delete a DataSession previously created with
createSession(equip.data.DataCallback, equip.runtime.ValueBase); effectively any remaining
EventPatterns will be removed. |
void |
endBusy()
this dangerous internal API lets you resume the enactment of events; only call to match a previous call to beginBusy().
|
ItemData |
getItem(GUID id)
Get an ItemData from the local dataspace by item
GUID. |
ItemBinding |
getItemBinding(GUID id)
Get an ItemBinding from the local dataspace by item
GUID. |
SimpleMoniker |
getMoniker()
|
short |
getPort()
|
GUID |
getResponsible()
get responsible (replica) ID |
static void |
main(java.lang.String[] args)
|
void |
queueEvent(Event event)
(always) Queued add of a new event into the dataspace. |
void |
run()
|
void |
setDefaultAgent(GUID defaultAgentId)
Set a default GUID to be used as the default owner and/or requestor for locally generated events and data items. |
void |
setPersist(boolean persistFlag)
Whether this dataspace replica should try to associate persistently with its server/peer. |
void |
terminate()
Destroy this dataspace, terminating any communication and threads and (hopefully) allowing all resources to be released/GCed. |
void |
updateItem(ItemData item,
boolean local,
boolean reliable)
update item event helper - create and publish an UpdateEvent with default priority (0).
|
void |
updateItem2(ItemData item,
boolean local,
boolean reliable,
int priority)
update item event helper - create and publish an UpdateEvent.
|
void |
waitForEvents(boolean local)
Block and wait for all pending events to be enacted. |
| Methods inherited from class equip.data.DataProxy |
_equals_helper, _matches_helper, equals, getModuleName, matches, readObject, writeObject |
| Methods inherited from class equip.net.ServiceProxy |
_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 |
| Constructor Detail |
public Server(short port)
public Server(SimpleMoniker moniker)
| Method Detail |
public static void main(java.lang.String[] args)
public void addEvent(Event event)
DataProxy
addEvent in class DataProxyevent - The event to published.public void queueEvent(Event event)
queueEvent in class DataProxyevent - The event to published.public ItemBinding getItemBinding(GUID id)
DataProxyItemBinding from the local dataspace by item
GUID.
getItemBinding in class DataProxyid - The item's GUID.
public ItemData getItem(GUID id)
DataProxyItemData from the local dataspace by item
GUID.
getItem in class DataProxyid - The item's GUID.
public void setDefaultAgent(GUID defaultAgentId)
DataProxy
setDefaultAgent in class DataProxydefaultAgentId - GUID to use as default
owner/requestor
public void addItem(ItemData item,
int locked,
boolean local,
boolean processBound,
Lease itemLease)
DataProxyAddEvent.
addItem in class DataProxyitem - The value of the new item (including id).locked - See ItemBindingInfo.locked.local - See ItemBindingInfo.processBound.processBound - See ItemBindingInfo.local.itemLease - See ItemBindingInfo.itemLease.
public void updateItem2(ItemData item,
boolean local,
boolean reliable,
int priority)
DataProxyUpdateEvent.
NOTE: if this is an item with a lease and you want the lease
to be renewed then use an addItem repeatedly instead (with
the new Lease value in the ItemBinding).
updateItem2 in class DataProxyitem - The new value of the item (including original id).local - See EventMetadata.local.reliable - See EventMetadata.reliable.priority - See EventMetadata.priority.
public void updateItem(ItemData item,
boolean local,
boolean reliable)
DataProxyUpdateEvent with default priority (0).
NOTE: if this is an item with a lease and you want the lease
to be renewed then use an addItem repeatedly instead (with
the new Lease value in the ItemBinding).
updateItem in class DataProxyitem - The new value of the item (including original id).local - See EventMetadata.local.reliable - See EventMetadata.reliable.
public void deleteItem(GUID id,
boolean local)
DataProxyDeleteEvent.
deleteItem in class DataProxyid - The GUID of the item to be deleted.local - See EventMetadata.local.
public DataSession createSession(DataCallback callback,
ValueBase closure)
DataProxyDataCallback and
(usually easier to use) DataCallbackPost.
createSession in class DataProxycallback - Event-handling subclass of DataCallback or DataCallbackPost, notified
about events matching any EventPatterns that
are added to new session.closure - Optional application parameter provided to the
callback notification (can be null).
DataSession to which EventPatterns can be added to cause replication and/or
notifications of events and items.public void deleteSession(DataSession session)
DataProxyDataSession previously created with
DataProxy.createSession(equip.data.DataCallback, equip.runtime.ValueBase); effectively any remaining
EventPatterns will be removed. In C++ the caller will still hold the last reference to the data session object, which must be released in order for the session object to actually be deleted.
deleteSession in class DataProxysession - The DataSession object returned
from DataProxy.createSession(equip.data.DataCallback, equip.runtime.ValueBase) to be deleted from the dataspace.
public boolean activate(DeactivateCallback callback,
ValueBase closure)
ServiceProxy
activate in class ServiceProxypublic void deactivate()
ServiceProxy
deactivate in class ServiceProxypublic short getPort()
public SimpleMoniker getMoniker()
public void run()
run in interface java.lang.Runnablepublic void waitForEvents(boolean local)
DataProxy
waitForEvents in class DataProxylocal - Wait only for local events (if false, then
also send a message to the server dataspace and wait for
it to come back as well).public void beginBusy()
DataProxyDataProxy.endBusy().
Easy to deadlock with unmatched calls!
beginBusy in class DataProxypublic void endBusy()
DataProxyDataProxy.beginBusy().
Easy to deadlock - or break synchronization - with unmatched calls!
endBusy in class DataProxypublic void setPersist(boolean persistFlag)
DataProxyLease mechanism to
handle garbage collection: use with care.
Note that replicas are identified to each other by the
responsible GUID of each.
setPersist in class DataProxypersistFlag - Whether to connect persistently.public void activateAsync()
DataProxyServiceProxy.activate(equip.net.DeactivateCallback, equip.runtime.ValueBase) and ServiceProxy.deactivate() which are also implemented
for direct control over activation.
activateAsync in class DataProxypublic GUID getResponsible()
getResponsible in class DataProxypublic void terminate()
terminate in class DataProxy
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||