|
||||||||||
| 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.DataProxyImpl
The normal implementation of the IDL'd dataspace API, DataProxy; implements a dataspace client, 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).
| Nested Class Summary | |
(package private) class |
DataProxyImpl.ActivateThread
|
(package private) class |
DataProxyImpl.MyDeactivateCallback
|
(package private) class |
DataProxyImpl.WaitCallback
|
| Field Summary | |
(package private) int |
ackSeq
|
(package private) boolean |
activateAsyncFlag
|
(package private) boolean |
activeFlag
|
(package private) DeactivateCallback |
callback
|
(package private) DeactivateCallback |
deactivateCallback
|
(package private) ValueBase |
deactivateClosure
|
(package private) GUID |
defaultAgentId
|
(package private) DataDelegatePeerTCP |
driver
|
(package private) int |
lastAckSeq
|
(package private) boolean |
persistFlag
|
(package private) DataDelegatePeer |
serverPeer
|
(package private) boolean |
waitInited
|
(package private) DataSession |
waitSession
|
| Fields inherited from class equip.data.DataProxy |
initialItems |
| Fields inherited from class equip.net.ServiceProxy |
serviceMoniker |
| Constructor Summary | |
DataProxyImpl()
|
|
DataProxyImpl(GUID responsible)
|
|
| 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. |
boolean |
activateInternal(DeactivateCallback callback,
ValueBase closure,
boolean startInputThread)
|
void |
addEvent(Event event)
Add a new event into the dataspace. |
void |
addItem(ItemData item,
int locked,
boolean processBound,
boolean local,
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().
|
double |
getConnectionStrength()
|
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. |
GUID |
getResponsible()
get responsible (replica) ID |
int |
getUnsentEvents()
return number of unsent events - connection and outboundEvents |
(package private) void |
init(GUID responsible)
|
(package private) void |
initWaitForEvents()
|
(package private) void |
jbInit()
|
void |
notifyDeactivate(ServiceProxy proxy,
ValueBase closure)
|
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 |
| Field Detail |
GUID defaultAgentId
DataDelegatePeer serverPeer
DataDelegatePeerTCP driver
boolean persistFlag
boolean activeFlag
boolean activateAsyncFlag
DeactivateCallback callback
DeactivateCallback deactivateCallback
ValueBase deactivateClosure
boolean waitInited
DataSession waitSession
int ackSeq
int lastAckSeq
| Constructor Detail |
public DataProxyImpl()
public DataProxyImpl(GUID responsible)
| Method Detail |
void init(GUID responsible)
public 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 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 processBound,
boolean local,
Lease itemLease)
DataProxyAddEvent.
addItem in class DataProxyitem - The value of the new item (including id).locked - See ItemBindingInfo.locked.processBound - See ItemBindingInfo.processBound.local - See ItemBindingInfo.local.itemLease - See ItemBindingInfo.itemLease.
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 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 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 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 DataProxy
public boolean activate(DeactivateCallback callback,
ValueBase closure)
ServiceProxy
activate in class ServiceProxy
public boolean activateInternal(DeactivateCallback callback,
ValueBase closure,
boolean startInputThread)
public void deactivate()
ServiceProxy
deactivate in class ServiceProxy
public void notifyDeactivate(ServiceProxy proxy,
ValueBase closure)
public void run()
run in interface java.lang.Runnablepublic double getConnectionStrength()
public int getUnsentEvents()
void initWaitForEvents()
public 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).void jbInit()
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 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 | |||||||||