|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ws4d.java.service.DeviceCommons org.ws4d.java.service.DefaultDevice
public class DefaultDevice
Implementation of a local DPWS device. A device in DPWS is a web service with specific functions. It can be discovered via probing by clients and it supports resolving of its endpoint. A device bears metadata information and services.
This class implements a local device within the framework. Its metadata can
be configured and services can be added. The configuration can be done by use
of a configuration file/stream via the Properties
class. In this
case, the constructor DefaultDevice(int configurationId)
must be
used with the configuration id of the matching device properties.
CommunicationBinding
must be added to the device. In DPWS, this binding must be a
org.ws4d.java.communication.HTTPBinding
, so that the device can
receive get messages.
A DefaultDevice has to be started before becoming fully functional. Starting the device will establish the binding, i. e. a socket will be opened and the http server will listen to the address of the binding. In DPWS, a multicast listener will also be bound to the device. A hello message will then be sent to all connected networks. Residing services will also be started. Stopping the device will initiate the sending of a bye message, its services will be stopped and the binding will be removed.
Example code:
DPWSFramework.start(args);
...
DefaultDevice device = new DefaultDevice();
HTTPBinding binding = new HTTPBinding( ip, port, "SimpleExampleDevice" );
device.addBinding( binding );
device.addService( service );
device.addFriendlyName( "en-US", "JMEDS Simple Device" );
device.start();
Important: Setting/Adding device data includes getting the
exclusive lock ((Lockable
) for the device.
If the device is running, each change will cause a hello message to be sent
with an incremented metadata version. To combine multiple device data changes
with sending only one hello message, the exclusive lock has to be first be
obtained by exclusiveLock()
. After the last device data change,
releasing the exclusive lock through releaseExclusiveLock()
will
send a single hello with an incremented metadata version.
A DefaultDevice will respond to the following request message types:
ProbeMessage
ResolveMessage
GetMessage
ProbeMatchesMessage
ResolveMatchesMessage
GetResponseMessage
HelloMessage
ByeMessage
Nested Class Summary | |
---|---|
class |
DefaultDevice.AppSequenceManager
Manages the application sequence of device. |
Field Summary | |
---|---|
CustomizeMData |
custom
|
static boolean |
hasCustomizeMData
|
static int |
MAX_QNAME_SERIALIZATION
|
Constructor Summary | |
---|---|
DefaultDevice()
Constructor local DPWS device. |
|
DefaultDevice(int configurationId)
Constructor of local DPWS device. |
Method Summary | |
---|---|
void |
addBinding(CommunicationBinding binding)
Adds the given binding to this Bindable . |
void |
addBinding(DiscoveryBinding binding)
|
void |
addFriendlyName(java.lang.String lang,
java.lang.String friendlyName)
Adds a friendly name to the device. |
void |
addGroup(HTTPGroup group)
|
void |
addManufacturer(java.lang.String lang,
java.lang.String manufacturer)
Adds manufacturer name to the device which is used as value of the "dpws:Manufacturer" element in the model metadata. |
void |
addModelName(java.lang.String lang,
java.lang.String modelName)
Adds a model name to the device. |
void |
addOutputDiscoveryDomain(ProtocolDomain domain)
Adds the specified protocol domain to this device. |
void |
addService(LocalService service)
Adds service to device. |
void |
addService(LocalService service,
boolean startIfRunning)
Adds a service to the device. |
void |
addServiceReferences(DataStructure to,
QNameSet servicePortTypes)
Adds service references associated to this device to the data structure to , if they match the service port types given within
serviceTypes . |
void |
addUser(HTTPUser user)
|
void |
clearBindings()
Removes all bindings from this Bindable instance. |
boolean |
deviceMatches(QNameSet searchTypes,
ProbeScopeSet searchScopes)
Checks if this device matches the searched device port types and scopes. |
void |
exclusiveLock()
Acquires an exclusive lock. |
Iterator |
getBindings()
Returns an iterator over all bindings
assigned to this Bindable instance. |
int |
getConfigurationID()
Gets the configuration id. |
java.lang.String |
getDefaultNamespace()
return the default namespace. |
ThisDeviceMData |
getDeviceMetadata()
|
DeviceProperties |
getDeviceProperties()
Gets device configuration properties. |
DeviceReference |
getDeviceReference()
Gets the DeviceReference of this device. |
Iterator |
getDiscoveryBindings()
|
DiscoveryData |
getDiscoveryData()
This will return the discovery data of the local device. |
EndpointReference |
getEndpointReference()
Returns the endpoint reference of this device. |
java.lang.String |
getFirmwareVersion()
Gets firmware version. |
java.lang.String |
getFriendlyName(java.lang.String lang)
Gets friendly name of device. |
Iterator |
getFriendlyNames()
Gets iterator over all friendly names of device. |
HTTPGroup |
getGroup()
|
java.lang.String |
getManufacturer(java.lang.String lang)
Gets manufacturer by language. |
Iterator |
getManufacturers()
Gets all manufacturers as iterator over manufacterer names. |
java.lang.String |
getManufacturerUrl()
Gets the url of the manufacturer. |
long |
getMetadataVersion()
Returns metadata version for this device. |
ThisModelMData |
getModelMetadata()
|
java.lang.String |
getModelName(java.lang.String lang)
Gets model name by language. |
Iterator |
getModelNames()
Gets all model names as iterator over model names. |
java.lang.String |
getModelNumber()
Gets model number of device. |
java.lang.String |
getModelUrl()
Gets model url of device. |
Iterator |
getPortTypes()
Gets the iterator over device port types of the device. |
java.lang.String |
getPresentationUrl()
Gets presentation url of device. |
Iterator |
getScopes()
Gets iterator over all scopes of the device. |
java.lang.String |
getSerialNumber()
Gets serial number. |
ServiceReference |
getServiceReference(EndpointReference serviceEpr)
Get service reference by endpoint reference of referenced service. |
ServiceReference |
getServiceReference(URI serviceId)
Gets service reference by service id of referenced service. |
Iterator |
getServiceReferences()
Gets iterator over the service references of all services. |
Iterator |
getServiceReferences(QNameSet servicePortTypes)
Gets iterator over the service reference of the services, which implements all port types specified. |
Iterator |
getServices()
Gets iterator over all services. |
Iterator |
getXAddressInfos()
Returns a iterator over the transport addresses of this device. |
boolean |
hasBindings()
Returns true only if this Bindable instance has
at least one binding assigned. |
boolean |
hasCustomizeMData()
Tagged if a Device has metadata which are added by a user |
boolean |
hasDiscoveryBindings()
|
void |
invalidate()
|
boolean |
isDiscoveryProxy()
|
boolean |
isRemote()
Is device remote (proxy) or local? |
boolean |
isRunning()
Returns if the device was started and is running now. |
boolean |
isUsingDefaultDiscoveryDomains()
Does the device use the default discovery domains for send multicast discovery messages. |
boolean |
isValid()
|
java.lang.String |
readCustomizeMData()
The method return the metadata that a user has added as String |
boolean |
releaseExclusiveLock()
Releases an exclusive lock of the current thread. |
void |
releaseSharedLock()
Releases a shared lock of the current thread. |
boolean |
removeBinding(CommunicationBinding binding)
Removes the specified binding from this Bindable instance. |
boolean |
removeBinding(DiscoveryBinding binding)
|
void |
removeOutputDiscoveryDomain(ProtocolDomain domain)
Removes a previously added output domain from this device. |
void |
removeService(LocalService service)
Removes service from device. |
void |
removeService(LocalService service,
boolean stopIfRunning)
Removes a service from the device. |
void |
sendBye()
Sends Bye Message. |
void |
sendHello()
Sends hello message. |
void |
setDefaultNamespace(java.lang.String ns)
|
void |
setDeviceMetadata(ThisDeviceMData deviceMetadata)
Sets the device metadata of the device. |
void |
setDiscoveryProxy(boolean isDiscoveryProxy)
|
void |
setEndpointReference(EndpointReference endpoint)
Sets the EndpointReference of this device. |
void |
setFirmwareVersion(java.lang.String firmware)
Sets the firmware version to the device. |
void |
setManufacturerUrl(java.lang.String manufacturerUrl)
Sets the url of the manufacturer. |
void |
setMetadataVersion(long metadataVersion)
Sets the metadata version of the device. |
void |
setModelMetadata(ThisModelMData modelMetadata)
Sets the model metadata of the device. |
void |
setModelNumber(java.lang.String modelNumber)
Sets the model number of the device. |
void |
setModelUrl(java.lang.String modelUrl)
Sets the model url of the device. |
void |
setPortTypes(QNameSet qnsPortTypes)
Sets the port types of the device. |
void |
setPresentationUrl(java.lang.String presentationUrl)
Sets the presentation url of the device. |
void |
setScopes(ScopeSet scopes)
Sets a list of scopes. |
void |
setSerialNumber(java.lang.String serialNumber)
Sets the serial number of the device. |
void |
sharedLock()
Acquires a shared lock. |
void |
start()
Starts the device. |
void |
stop()
Stops the device. |
void |
stop(boolean stopServices)
Stops the device. |
boolean |
supportsBindingChanges()
Returns true , if it is safe to call one of the mutator
methods ((Bindable.addBinding(CommunicationBinding) ,
Bindable.removeBinding(CommunicationBinding) , (Bindable.clearBindings() ,
etc.) at this time without getting an IllegalStateException . |
boolean |
tryExclusiveLock()
Try to get an exclusive lock immediately. |
boolean |
trySharedLock()
Tries to get a shared lock immediately. |
void |
writeCustomizeMData(HashMap metaData)
Add user metadata to a device |
Methods inherited from class org.ws4d.java.service.DeviceCommons |
---|
equals, getCertificate, getPrivateKey, hashCode, isSecure, setCertificate, setPrivateKey, setSecureDevice, setSecureDevice, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.ws4d.java.service.Device |
---|
getCertificate, getPrivateKey, isSecure, setCertificate, setPrivateKey, setSecureDevice |
Field Detail |
---|
public static final int MAX_QNAME_SERIALIZATION
public static boolean hasCustomizeMData
public CustomizeMData custom
Constructor Detail |
---|
public DefaultDevice()
Properties
are used to build up the device.
Important: It is necessary to
add a binding
to a
device before it can be started.
public DefaultDevice(int configurationId)
Properties
. The property entries of this device will be gathered
in a DeviceProperties
object and used to build up the device and
its metadata.
Important: It is necessary to
add a binding
to a
device before it can be started. The binding may be specified within the
configuration file/stream.
configurationId
- The configuration id that map to the device
properties within the configuration file/stream.Method Detail |
---|
public boolean isRemote()
Device
isRemote
in interface Device
public boolean isRunning()
LocalDevice
isRunning
in interface LocalDevice
true
, if this device is runningpublic boolean hasBindings()
Bindable
true
only if this Bindable
instance has
at least one binding
assigned. Returns
false
, if it doesn't have any bindings.
hasBindings
in interface Bindable
public boolean hasDiscoveryBindings()
public Iterator getBindings()
Bindable
bindings
assigned to this Bindable
instance. This iterator will have
no next elements (rather than being ), if the
Bindable
doesn't have any bindings.
- Specified by:
getBindings
in interface Bindable
- Returns:
- an iterator over all available
bindings
public Iterator getDiscoveryBindings()
public boolean supportsBindingChanges()
Bindable
true
, if it is safe to call one of the mutator
methods ((Bindable.addBinding(CommunicationBinding)
,
Bindable.removeBinding(CommunicationBinding)
, (Bindable.clearBindings()
,
etc.) at this time without getting an IllegalStateException
.
Returns false
otherwise.
Some implementations of this interface may not allow for bindings to be
added or removed all the time, but rather only when the actual
implementation is in a certain set of states (note that this set could be
empty or contain solely a single set). By calling this method and
observing its return value it is possible for a client to determine
whether this Bindable
supports changes within its current
state.
supportsBindingChanges
in interface Bindable
true
if this Bindable
instance may be
modified at the moment without throwing
IllegalStateException
s, false
otherwiseBindable.addBinding(CommunicationBinding)
,
Bindable.removeBinding(CommunicationBinding)
,
Bindable.clearBindings()
public void addBinding(CommunicationBinding binding) throws WS4DIllegalStateException
Bindable
Bindable
. Does nothing if the
Bindable
already contains the binding.
addBinding
in interface Bindable
binding
- the binding to add
WS4DIllegalStateException
- in case this Bindable
doesn't currently support modifications (see
Bindable.supportsBindingChanges()
)public void addBinding(DiscoveryBinding binding) throws WS4DIllegalStateException
WS4DIllegalStateException
public boolean removeBinding(CommunicationBinding binding) throws WS4DIllegalStateException
Bindable
Bindable
instance.
Does nothing, if the Bindable
doesn't contain the given
binding. Returns true
if the binding was removed and
false
if it didn't exist.
removeBinding
in interface Bindable
binding
- the binding to remove
true
if this Bindable
instance had the
given binding assigned and it was removed successfully,
false
otherwise
WS4DIllegalStateException
- in case this Bindable
doesn't currently support modifications (see
Bindable.supportsBindingChanges()
)public boolean removeBinding(DiscoveryBinding binding) throws WS4DIllegalStateException
WS4DIllegalStateException
public void clearBindings() throws WS4DIllegalStateException
Bindable
Bindable
instance. Does
nothing if there are no bindings assigned.
clearBindings
in interface Bindable
WS4DIllegalStateException
- in case this Bindable
doesn't support modifications at the current time (see
Bindable.supportsBindingChanges()
)public DeviceReference getDeviceReference()
Device
DeviceReference
of this device.
getDeviceReference
in interface Device
DeviceReference
of this device.public final void start() throws java.io.IOException
CommunicationBinding
to the matching
CommunicationManager
, i.e. start listening to incoming messages
for the specified address,
DeviceServiceRegistry
.
start
in interface LocalDevice
java.io.IOException
- is thrown, if a binding couldn't be bound to the
communication manager or if starting a service will throw the
exception.public final void stop() throws java.io.IOException
CommunicationBinding
to the matching
CommunicationManager
,
DeviceServiceRegistry
.
stop
in interface LocalDevice
java.io.IOException
- is thrown if a binding couldn't be unbound or if
stopping a service will throw the exception.public final void stop(boolean stopServices) throws java.io.IOException
CommunicationBinding
to the matching
CommunicationManager
,
DeviceServiceRegistry
.
stopServices
- If true, stops services too.
java.io.IOException
- is thrown if a binding couldn't be unbound or if
stopping a service will throw the exception.public void sendHello()
Important: This method won't start the device. But starting this device will automatically send a hello message.
sendHello
in interface LocalDevice
public void sendBye()
Important: This method won't stop the device. But stopping this device will automatically send a bye message.
sendBye
in interface LocalDevice
public void sharedLock()
Lockable
sharedLock
in interface Lockable
public void exclusiveLock()
Lockable
exclusiveLock
in interface Lockable
public void releaseSharedLock()
Lockable
releaseSharedLock
in interface Lockable
public boolean releaseExclusiveLock()
Lockable
releaseExclusiveLock
in interface Lockable
public boolean tryExclusiveLock()
Lockable
tryExclusiveLock
in interface Lockable
true
if the lock has been allocated,
false
otherwisepublic boolean trySharedLock()
Lockable
trySharedLock
in interface Lockable
true
if the lock has been allocated,
false
otherwisepublic EndpointReference getEndpointReference()
Device
getEndpointReference
in interface Device
public Iterator getPortTypes()
Device
QName
.
getPortTypes
in interface Device
QName
.public Iterator getScopes()
Device
URI
.
getScopes
in interface Device
URI
.public java.lang.String getManufacturer(java.lang.String lang)
Device
LocalizedString
.
getManufacturer
in interface Device
getManufacturer
in class DeviceCommons
lang
- The language of the manufacturer's name to be obtained. The
language consts are specified in LocalizedString
.
LocalizedString
.public Iterator getManufacturers()
Device
LocalizedString
.
getManufacturers
in interface Device
getManufacturers
in class DeviceCommons
LocalizedString
.public java.lang.String getManufacturerUrl()
Device
getManufacturerUrl
in interface Device
getManufacturerUrl
in class DeviceCommons
public java.lang.String getModelName(java.lang.String lang)
Device
LocalizedString
.
getModelName
in interface Device
getModelName
in class DeviceCommons
lang
- Language of the model name to get. The language consts are
specified in LocalizedString
.
LocalizedString
.public Iterator getModelNames()
Device
LocalizedString
.
getModelNames
in interface Device
getModelNames
in class DeviceCommons
LocalizedString
.public java.lang.String getModelNumber()
Device
getModelNumber
in interface Device
getModelNumber
in class DeviceCommons
public java.lang.String getModelUrl()
Device
getModelUrl
in interface Device
getModelUrl
in class DeviceCommons
public java.lang.String getPresentationUrl()
Device
getPresentationUrl
in interface Device
getPresentationUrl
in class DeviceCommons
public java.lang.String getFriendlyName(java.lang.String lang)
Device
getFriendlyName
in interface Device
getFriendlyName
in class DeviceCommons
lang
- language of friendly name
LocalizedString
in specified
languagepublic Iterator getFriendlyNames()
Device
LocalizedString
.
getFriendlyNames
in interface Device
getFriendlyNames
in class DeviceCommons
LocalizedString
.public java.lang.String getFirmwareVersion()
Device
getFirmwareVersion
in interface Device
getFirmwareVersion
in class DeviceCommons
public java.lang.String getSerialNumber()
Device
getSerialNumber
in interface Device
getSerialNumber
in class DeviceCommons
public void setEndpointReference(EndpointReference endpoint)
EndpointReference
of this device. The endpoint reference
bears a stable globally-unique identifier of the device. This address
part is typically not a physical address. Properties
.
setEndpointReference
in interface LocalDevice
endpoint
- The endpoint reference to set.public void setPortTypes(QNameSet qnsPortTypes)
DefaultClient
) can search for the specific device port types.
The port types are communicated via the hello, probe matches, resolve matches, get response and the get metadata response messages (the "wsdd:Types" elements and the be "dpws:Types" elements of host metadata).
The "dpws:Device" port type is added by default.
setPortTypes
in interface LocalDevice
qnsPortTypes
- Device port types to set.public void setScopes(ScopeSet scopes)
Setting the scopes includes getting the exclusive lock ((Lockable
) of the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change, releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
setScopes
in interface LocalDevice
scopes
- List of scopes to set.public void addManufacturer(java.lang.String lang, java.lang.String manufacturer)
Adding the manufacturer name includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change, releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
lang
- Language attribute, i. e. "en-US or "de-DE":
manufacturer
- The manufacturer name to set in the specified
language.public void setManufacturerUrl(java.lang.String manufacturerUrl)
Setting the manufacturer url includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change, releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
setManufacturerUrl
in interface LocalDevice
manufacturerUrl
- The url of the manufacturer to set.public void addModelName(java.lang.String lang, java.lang.String modelName)
Adding a model name includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
lang
- Language attribute, i. e. "en-US or "de-DE":
modelName
- The model name to set in the specified language.public void setModelNumber(java.lang.String modelNumber)
Setting the model number includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained throughexclusiveLock()
. After the last device
data change the release of the exclusive lock by
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
setModelNumber
in interface LocalDevice
modelNumber
- The model number of the device to set.public void setModelUrl(java.lang.String modelUrl)
Setting the model url includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be taken by exclusiveLock()
. After the last device data
change the release of the exclusive lock by
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
setModelUrl
in interface LocalDevice
modelUrl
- The model url of the device to set.public void setPresentationUrl(java.lang.String presentationUrl)
Setting the presentation url includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
setPresentationUrl
in interface LocalDevice
presentationUrl
- The presentation url to set.public void addFriendlyName(java.lang.String lang, java.lang.String friendlyName)
Adding a friendly name includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
addFriendlyName
in interface LocalDevice
lang
- Language attribute, i. e. "en-US or "de-DE":
friendlyName
- The friendly name of the device in the specified
language to be set.public void setFirmwareVersion(java.lang.String firmware)
Setting the firmware version includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
setFirmwareVersion
in interface LocalDevice
firmware
- The firmware version of the device to set.public void setSerialNumber(java.lang.String serialNumber)
Setting the serial number version includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
setSerialNumber
in interface LocalDevice
serialNumber
- The serial number of the device to set.public void addService(LocalService service)
NOTICE: If the device is already running, you must start the service with the start() method, or use the addService(LocalService, boolean) method.
Adding a service to the device includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
addService
in interface LocalDevice
service
- service to add to this device.LocalDevice.addService(org.ws4d.java.service.LocalService,
boolean)
public void addService(LocalService service, boolean startIfRunning) throws java.io.IOException
Adding a service to the device includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change, releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
addService
in interface LocalDevice
service
- service to add to this device.startIfRunning
- true
the service is started if the
device is already running, false
the service has
not been not started, we just add it.
java.io.IOException
public void removeService(LocalService service)
Removing a service from the device includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
removeService
in interface LocalDevice
service
- The service to remove from this device.public void removeService(LocalService service, boolean stopIfRunning) throws java.io.IOException
true the service to remove is stopped if running, else not.
Removing a service from the device includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained throughexclusiveLock()
. After the last device data
change releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
- Specified by:
removeService
in interface LocalDevice
- Parameters:
service
- The service to remove from the device.stopIfRunning
- true
the service is stopped if the
service is running, false
just remove.
- Throws:
java.io.IOException
public void setDeviceMetadata(ThisDeviceMData deviceMetadata)
Setting the device metadata includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to obtained through exclusiveLock()
. After the last device data
change, releasing the exclusive lock with releaseExclusiveLock()
will send a single hello with an incremented metadata version.
setDeviceMetadata
in interface LocalDevice
deviceMetadata
- public void setMetadataVersion(long metadataVersion)
Setting the metadata version includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change, releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with the new
metadata version.
setMetadataVersion
in interface LocalDevice
metadataVersion
- The metadata version to set is of type unsigned
int.public void setModelMetadata(ThisModelMData modelMetadata)
Setting the model metadata version includes getting the exclusive lock ((
Lockable
) for the device.
If the device is running, each change will initiate the sending of a
hello message with an incremented metadata version. To combine multiple
device data changes with sending only one hello, the exclusive lock has
to be obtained through exclusiveLock()
. After the last device
data change releasing the exclusive lock with
releaseExclusiveLock()
will send a single hello with an
incremented metadata version.
setModelMetadata
in interface LocalDevice
modelMetadata
- The model metadata of the device to set.public ThisDeviceMData getDeviceMetadata()
public long getMetadataVersion()
Device
getMetadataVersion
in interface Device
public ThisModelMData getModelMetadata()
public Iterator getServices()
Service
.
getServices
in interface LocalDevice
Service
.public Iterator getServiceReferences()
Device
ServiceReference
.
getServiceReferences
in interface Device
public Iterator getServiceReferences(QNameSet servicePortTypes)
Device
ServiceReference
.
getServiceReferences
in interface Device
servicePortTypes
- The service port types the services must
implement, to be returned by its reference.
public void addServiceReferences(DataStructure to, QNameSet servicePortTypes)
Device
to
, if they match the service port types given within
serviceTypes
.
addServiceReferences
in interface Device
to
- collection to add matching service references toservicePortTypes
- service port types to look forpublic ServiceReference getServiceReference(URI serviceId)
Device
getServiceReference
in interface Device
null
if no service matches the
service id.public ServiceReference getServiceReference(EndpointReference serviceEpr)
Device
getServiceReference
in interface Device
null
, if no service matches
the service id.public Iterator getXAddressInfos()
Device
URI
.
getXAddressInfos
in interface Device
URI
.public DiscoveryData getDiscoveryData()
LocalDevice
getDiscoveryData
in interface LocalDevice
public boolean isUsingDefaultDiscoveryDomains()
true
=> hello and bye messages will
be sent via the static output domains in Discovery
. If
false
=> hello and bye will be sent to this device's
explicitly configured
domains
.
true
=> hello and bye messages will be sent via
the static output domains in Discovery
. If
false
=> hello and bye will be sent to this device's
configured output domains.public void addOutputDiscoveryDomain(ProtocolDomain domain)
isUsingDefaultDiscoveryDomains()
returns false
.
domain
- the new protocol domain to add to this deviceisUsingDefaultDiscoveryDomains()
,
#setUsingDefaultDiscoveryDomains(boolean)
public void removeOutputDiscoveryDomain(ProtocolDomain domain)
added
output domain from this device.
domain
- the output domain to removeisUsingDefaultDiscoveryDomains()
,
#setUsingDefaultDiscoveryDomains(boolean)
public DeviceProperties getDeviceProperties()
Properties
class.
While constructing this device, the device properties were used to set the device data. Changes of the device data afterwards will not be transmitted to the properties.
public int getConfigurationID()
DefaultDevice(int)
which specifies the
configuration id. The default id is -1, which doesn't map to any
configuration.
public boolean deviceMatches(QNameSet searchTypes, ProbeScopeSet searchScopes)
deviceMatches
in interface LocalDevice
searchTypes
- Searched device port types to match the device.searchScopes
- Searched scopes to match the device.
true
- if both the given device port types and
scopes are part of the device.public void setDiscoveryProxy(boolean isDiscoveryProxy)
public boolean isDiscoveryProxy()
public void setDefaultNamespace(java.lang.String ns)
public java.lang.String getDefaultNamespace()
Device
getDefaultNamespace
in interface Device
public boolean isValid()
isValid
in interface Device
public void invalidate()
invalidate
in interface Device
public HTTPGroup getGroup()
getGroup
in interface LocalDevice
public void addUser(HTTPUser user)
public void addGroup(HTTPGroup group)
public java.lang.String readCustomizeMData()
Device
readCustomizeMData
in interface Device
Device.readCustomizeMData()
public void writeCustomizeMData(HashMap metaData)
LocalDevice
writeCustomizeMData
in interface LocalDevice
metaData
- HashMap which contains the metadata which the user wants to addLocalDevice.writeCustomizeMData(HashMap)
public boolean hasCustomizeMData()
Device
hasCustomizeMData
in interface Device
Device.hasCustomizeMData()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |