|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ws4d.java.util.TimedEntry org.ws4d.java.dispatch.DefaultDeviceReference
public class DefaultDeviceReference
Class holds listeners of device reference. Also manages creating and disposing of devices.
Field Summary | |
---|---|
static AppSequence |
APP_SEQUENCE_ZERO
This sequence number should only be used to compare the first incoming message to proxy devices |
static int |
EVENT_DEVICE_BYE
|
static int |
EVENT_DEVICE_CHANGED
|
static int |
EVENT_DEVICE_COMPLETELY_DISCOVERED
|
static int |
EVENT_DEVICE_FAULT_RESET
|
static int |
EVENT_DEVICE_GET_RSP
|
static int |
EVENT_DEVICE_SEEN
|
Fields inherited from interface org.ws4d.java.service.reference.DeviceReference |
---|
STATE_BUILD_UP, STATE_RUNNING, STATE_STOPPED, STATE_UNKNOWN |
Fields inherited from interface org.ws4d.java.service.reference.Reference |
---|
LOCATION_LOCAL, LOCATION_REMOTE, LOCATION_UNKNOWN |
Method Summary | |
---|---|
void |
addListener(DeviceListener listener)
Register listener (callback) for device reference changes. |
void |
announceDeviceBye()
Informs listeners on this device reference in separate thread about stop. |
void |
announceDeviceChangedAndBuildUp()
Clones device listeners and informs everyone in separate thread about change. |
void |
announceDeviceRunningAndBuildUp()
Clones device listeners and informs everyone in separate thread about change. |
void |
buildUpDevice()
Instructs this device reference to asynchronously send a Get message to the device and create a new proxy, if required. |
void |
fetchCompleteDiscoveryDataAsync()
Fetches all discovery data of device reference by sending a directed probe to the remote device. |
void |
fetchCompleteDiscoveryDataSync()
Uses directed Probe to refresh discovery data. |
java.lang.String |
getCustomMData()
Give the customize metadata |
Device |
getDevice()
Get device. |
Iterator |
getDevicePortTypes(boolean doDiscovery)
Gets port types implemented by device. |
QName[] |
getDevicePortTypesAsArray(boolean doDiscovery)
Gets port types implemented by device. |
EndpointReference |
getEndpointReference()
Gets endpoint reference of device. |
int |
getLocation()
Returns the location of the device or service, which may be - LOCATION_UNKNOWN, - LOCATION_REMOTE, - LOCATION_LOCAL. |
long |
getMetadataVersion(boolean doDiscovery)
Returns the metadata version of the device. |
java.lang.String |
getPreferredCommunicationManagerID()
Returns the ID of the communication protocol to use when communicating with this reference's target over the current preferred transport address . |
URI |
getPreferredXAddress()
Returns the preferred transport address for communication with this reference. |
XAddressInfo |
getPreferredXAddressInfo()
|
Iterator |
getScopes(boolean doDiscovery)
Gets scopes the device resides in. |
URI[] |
getScopesAsArray(boolean doDiscovery)
Gets scopes the device resides in. |
int |
getState()
Gets state of device / device reference. |
Iterator |
getXAddressInfos(boolean doDiscovery)
Get the transport addresses of the device. |
boolean |
isAutoUpdateDevice()
|
boolean |
isCompleteDiscovered()
Case remote: Did we receive the answer to a directed probe for the current version of the device? |
boolean |
isDeviceObjectExisting()
Case remote: Did a proxy device object exist for the current version of the remote device? |
boolean |
isDiscovered()
Case remote: Did we receive a resolve message for the current version of the device. |
boolean |
isSecureDevice()
|
Device |
rebuildDevice()
Rebuilds device. |
void |
removeListener(DeviceListener listener)
Unregisters listener for this device reference. |
void |
reset()
Resets all state information of the device reference except the endpoint reference. |
void |
reset(boolean recurse)
Resets all state information of the device reference except the endpoint reference. |
XAddressInfo |
resolveRemoteDevice()
Sends Resolve message to remote device. |
void |
setAutoUpdateDevice(boolean autoUpdateDevice)
When set to true , the device reference will attempt to
rebuild the device proxy automatically each time a a change in the
device's metadata version is detected. |
void |
setCustomMData(java.lang.String customMData)
Set the customize metadata |
void |
setDiscoveryData(DiscoveryData newDiscoveryData)
|
Device |
setLocalDevice(LocalDevice device)
Sets device, replaces present device. |
void |
setSecureDevice(boolean sec)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final AppSequence APP_SEQUENCE_ZERO
public static final int EVENT_DEVICE_SEEN
public static final int EVENT_DEVICE_BYE
public static final int EVENT_DEVICE_GET_RSP
public static final int EVENT_DEVICE_CHANGED
public static final int EVENT_DEVICE_COMPLETELY_DISCOVERED
public static final int EVENT_DEVICE_FAULT_RESET
Method Detail |
---|
public java.lang.String toString()
toString
in class TimedEntry
public int getState()
DeviceReference
DeviceReference.STATE_UNKNOWN
, DeviceReference.STATE_RUNNING
,
DeviceReference.STATE_BUILD_UP
and DeviceReference.STATE_STOPPED
.
getState
in interface DeviceReference
DeviceReference.STATE_UNKNOWN
,
DeviceReference.STATE_RUNNING
,
DeviceReference.STATE_BUILD_UP
,
DeviceReference.STATE_STOPPED
public Device getDevice() throws TimeoutException
DeviceReference
A Proxy to a remote device is built up by sending resolve and get messages.
getDevice
in interface DeviceReference
TimeoutException
- This exception is thrown, if the remote device
doesn't answer to the messages, which tries to receive the
necessary data. The possible messages to be sent are resolve,
and get messages. The timeout value can be configured in the
DispatchingProperties
via the methods
DispatchingProperties.setMatchWaitTime(long)
and
DispatchingProperties.setResponseWaitTime(int)
.public Device rebuildDevice() throws TimeoutException
TimeoutException
public void buildUpDevice()
DeviceListener#deviceBuildUp(DeviceReference, Device)
method.
Note that in oder to reduce network traffic a Get message will actually be sent only if it is detected that the device within this device reference instance is not up to date anymore.
public Device setLocalDevice(LocalDevice device)
device
- Replacement device (local).
public void setDiscoveryData(DiscoveryData newDiscoveryData)
public void reset()
reset(boolean)
with an
argument of false
.
public void reset(boolean recurse)
recurse
is set to true
, than all
service references currently associated with this device reference will
be reset prior to removing them, too.
recurse
- if service references associated with this device
reference shell be reset, toopublic void fetchCompleteDiscoveryDataSync() throws TimeoutException
fetchCompleteDiscoveryDataSync
in interface DeviceReference
TimeoutException
public void fetchCompleteDiscoveryDataAsync()
DeviceReference
fetchCompleteDiscoveryDataAsync
in interface DeviceReference
public XAddressInfo resolveRemoteDevice() throws TimeoutException
TimeoutException
public int getLocation()
Reference
getLocation
in interface Reference
public Iterator getDevicePortTypes(boolean doDiscovery) throws TimeoutException
DeviceReference
getDevicePortTypes
in interface DeviceReference
doDiscovery
- if true
and no port types are known and
device is remote located, a resolve message will be sent to
remote device to discover them.
QName
.
TimeoutException
public QName[] getDevicePortTypesAsArray(boolean doDiscovery) throws TimeoutException
DeviceReference
getDevicePortTypesAsArray
in interface DeviceReference
doDiscovery
- if true
and no port types are known and
device is remote located, a resolve message will be sent to
remote device to discover them.
QName
.
TimeoutException
public Iterator getScopes(boolean doDiscovery) throws TimeoutException
DeviceReference
getScopes
in interface DeviceReference
doDiscovery
- if true
and no port types are known and
device is remote located, a resolve message will be sent to
remote device to discover them.
URI
.
TimeoutException
public URI[] getScopesAsArray(boolean doDiscovery) throws TimeoutException
DeviceReference
getScopesAsArray
in interface DeviceReference
doDiscovery
- if true
and no port types are known and
device is remote located, a resolve message will be sent to
remote device to discover them.
URI
.
TimeoutException
public long getMetadataVersion(boolean doDiscovery) throws TimeoutException
DeviceReference
getMetadataVersion
in interface DeviceReference
doDiscovery
- if true
and no port types are known and
device is remote located, a resolve message will be sent to
remote device to discover them.
TimeoutException
public Iterator getXAddressInfos(boolean doDiscovery) throws TimeoutException
DeviceReference
getXAddressInfos
in interface DeviceReference
doDiscovery
- if true
and no port types are known and
device is remote located, a resolve message will be sent to
remote device to discover them.
URI
.
TimeoutException
public URI getPreferredXAddress()
Reference
getPreferredXAddress
in interface Reference
public java.lang.String getPreferredCommunicationManagerID()
Reference
preferred transport address
. Will return
the framework-wide
default communication ID
, if no preferred transport address has been
explicitly set.
getPreferredCommunicationManagerID
in interface Reference
public EndpointReference getEndpointReference()
DeviceReference
getEndpointReference
in interface DeviceReference
public java.lang.String getCustomMData()
getCustomMData
in interface DeviceReference
public void setCustomMData(java.lang.String customMData)
customMData
- String which contains the new customize metadata.public void addListener(DeviceListener listener)
DeviceReference
addListener
in interface DeviceReference
listener
- listener (callback) to register.public void removeListener(DeviceListener listener)
DeviceReference
removeListener
in interface DeviceReference
listener
- listener to remove.public boolean isDeviceObjectExisting()
DeviceReference
true
.
isDeviceObjectExisting
in interface DeviceReference
true
.public boolean isDiscovered()
DeviceReference
isDiscovered
in interface DeviceReference
true
.public boolean isCompleteDiscovered()
DeviceReference
isCompleteDiscovered
in interface DeviceReference
true
.public void setAutoUpdateDevice(boolean autoUpdateDevice)
DeviceReference
true
, the device reference will attempt to
rebuild the device proxy automatically each time a a change in the
device's metadata version is detected.
setAutoUpdateDevice
in interface DeviceReference
public boolean isAutoUpdateDevice()
isAutoUpdateDevice
in interface DeviceReference
public void announceDeviceBye()
public void announceDeviceChangedAndBuildUp()
public void announceDeviceRunningAndBuildUp()
public boolean isSecureDevice()
isSecureDevice
in interface DeviceReference
public void setSecureDevice(boolean sec)
setSecureDevice
in interface DeviceReference
public XAddressInfo getPreferredXAddressInfo()
getPreferredXAddressInfo
in interface DeviceReference
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |