public class DefaultDevice extends DeviceCommons implements LocalDevice
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. To receive discovery messages a discovery binding DiscoveryBinding must be added
to the device. To receive device metadata messages, a communication binding CommunicationBinding must be
added to the device. For example in DPWS, the discovery binding must be a
org.ws4d.java.communication.IPDiscoveryBinding, for metadat messages this binding must be a
org.ws4d.java.communication.HTTPBinding, so that the device can receive get messages.
If you not add any binding auto bindings for all interfaces will be generated!
A DefaultDevice has to be started before becoming fully functional. Starting the device will establish the
binding, i. e. a socket for discovery and metadata messages will be opened and the http server will listen to the
address of the binding. For example 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:
public class ExampleDefaultDevice {
private static IPAddress ip = IPNetworkDetection.getInstance().getIPAddressOfAnyLocalInterface("your ip
address", true);
private static int port = 0;
public static void main(String[] args) {
CoreFramework.start(args);
DefaultDevice device = new DefaultDevice();
HTTPBinding deviceBinding = new HTTPBinding(ip, port, "SimpleExampleDevice",
DPWSCommunicationManager.COMMUNICATION_MANAGER_ID);
HTTPBinding serviceBinding = new HTTPBinding(ip, port, "SimpleExampleService",
DPWSCommunicationManager.COMMUNICATION_MANAGER_ID);
DefaultService service = new DefaultService();
service.addBinding(serviceBinding);
device.addBinding(deviceBinding);
device.addService(service);
device.addFriendlyName("en-US", "JMEDS Simple Device");
try {
device.start();
} catch (IOException e) {
Log.printStackTrace(e);
}
}
}
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 with the appropriate response message types:
ProbeMatchesMessage ResolveMatchesMessage GetResponseMessage Additionally the device initiates the sending of the following message types:
HelloMessage ByeMessage The DefaultDevice class implements the functionality of a Target Service described in the WSDD-Discovery specification.
customMData, deviceMetadata, modelMetadata| Constructor and Description |
|---|
DefaultDevice()
Deprecated.
|
DefaultDevice(int configurationId)
Deprecated.
|
DefaultDevice(int configurationId,
java.lang.String comManId)
Constructor of local device.
|
DefaultDevice(java.lang.String comManId)
Constructor of local device.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBinding(CommunicationAutoBinding binding)
Adds the given autoBinding to this
Bindable. |
DiscoveryAutoBinding |
addBinding(CommunicationAutoBinding autoBinding,
boolean addDiscoveryBinding,
boolean addOutgoingDiscoveryInfo)
Adds the given autoBinding to this
Bindable. |
void |
addBinding(CommunicationBinding binding)
Adds the given binding to this
Bindable. |
BindingContainer |
addBinding(CommunicationBinding binding,
boolean addDiscoveryBinding,
boolean addOutgoingDiscoveryInfo)
Adds the given binding to this
Bindable. |
void |
addBinding(DiscoveryAutoBinding autoBinding) |
void |
addBinding(DiscoveryBinding binding) |
void |
addCustomMData(java.lang.String communicationManagerId,
UnknownDataContainer container) |
void |
addFriendlyName(java.lang.String lang,
java.lang.String friendlyName)
Adds a friendly name to the device.
|
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 |
addMatchingServiceReferencesToDataStructure(DataStructure to,
QNameSet servicePortTypes,
SecurityKey securityKey)
Adds service references associated to this device to the data structure
to, if
they match the service port types given within serviceTypes. |
void |
addModelName(java.lang.String lang,
java.lang.String modelName)
Adds a model name to the device.
|
void |
addOutgoingDiscoveryInfo(DiscoveryAutoBinding autoBinding) |
void |
addOutgoingDiscoveryInfo(OutgoingDiscoveryInfo info)
Adds the specified outgoing discovery info to this device.
|
void |
addService(LocalService service)
Adds service to device.
|
void |
addService(LocalService service,
boolean startIfRunning)
Adds a service to the device.
|
void |
addSupportedProtocolInfo(ProtocolInfo pinfo) |
void |
checkAndSet(LocalService service)
Check if there is already a service with the serviceId or if serviceId is null a serviceId will be generated with
className and a counter.
|
void |
clearBindings()
Removes all bindings from this
Bindable instance. |
protected void |
deviceIsStarting()
This method must be overwrite if the device should do something while starting.
|
protected void |
deviceIsStopping()
This method must be overwrite if the device should do something while stopping.
|
boolean |
deviceMatches(QNameSet deviceSearchTypes,
QNameSet serviceSearchTypes,
ProbeScopeSet searchScopes,
java.lang.String comManId)
Checks if this device matches the searched device port types and scopes.
|
boolean |
deviceMatches(SearchParameter search)
Checks if the outer device matches the SearchParameter.
|
void |
disconnectAllServiceReferences(boolean resetServiceRefs)
Disconnects all ServiceReferences from device.
|
void |
exclusiveLock()
Acquires an exclusive lock.
|
protected AppSequenceManager |
getAppSequencer()
Returns the
AappSequenceManager of this device. |
AuthorizationManager |
getAuthorizationManager()
Returns the authorization manager of this Device.
|
AutoBindingAndOutgoingDiscoveryInfoListener |
getAutoBindingAndOutgoingDiscoveryInfoListener() |
java.lang.String |
getComManId() |
Iterator |
getCommunicationAutoBindings()
Returns an iterator over all
autoBindings assigned to this Bindable instance. |
Iterator |
getCommunicationBindings()
Returns an iterator over all
bindings assigned to this Bindable
instance. |
int |
getConfigurationID()
Gets the configuration id.
|
UnknownDataContainer[] |
getCustomMData(java.lang.String communicationManagerId)
The method returns all custom metadata
|
CredentialInfo |
getDefaultLocalCredentialInfo()
Returns the default credential info of this device.
|
java.lang.String |
getDefaultNamespace()
return the default namespace.
|
ThisDeviceMData |
getDeviceMetadata() |
DeviceProperties |
getDeviceProperties()
Gets device configuration properties.
|
DeviceReference |
getDeviceReference(SecurityKey securityKey)
Gets the
DeviceReference of this device. |
Iterator |
getDiscoveryAutoBindings() |
Iterator |
getDiscoveryBindings() |
DiscoveryData |
getDiscoveryData()
This will return the discovery data of the local device.
|
Iterator |
getDiscoveryXAddressInfos()
Returns a iterator over the discovery addresses of this 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.
|
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.
|
NetworkChangeListener |
getNetworkChangeListener() |
Set |
getOutgoingDiscoveryInfos() |
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.
|
Service |
getService(URI serviceId)
Get a service.
|
ServiceReference |
getServiceReference(EndpointReference serviceEpr,
SecurityKey securityKey)
Get service reference by endpoint reference of referenced service.
|
ServiceReference |
getServiceReference(URI serviceId,
SecurityKey securityKey)
Gets service reference by service id of referenced service.
|
Iterator |
getServiceReferences(QNameSet servicePortTypes,
SecurityKey securityKey)
Gets iterator over the service reference of the services, which implements all port types
specified.
|
Iterator |
getServiceReferences(SecurityKey securityKey)
Gets iterator over the service references of all services.
|
Iterator |
getServices()
Get iterator over all services.
|
HashSet |
getSupportedProtocolInfos() |
Iterator |
getTransportAndDiscoveryXAddressInfos()
Returns a iterator over the combination of transport and discovery addresses of this device.
|
Iterator |
getTransportXAddressInfos()
Returns a iterator over the transport addresses of this device.
|
boolean |
hasAutoOutgoingDiscoveryInfos() |
boolean |
hasCommunicationAutoBindings()
Returns
true only if this instance has at least one binding assigned. |
boolean |
hasCommunicationBindings()
|
boolean |
hasDiscoveryAutoBindings()
Returns
true |
boolean |
hasDiscoveryBindings()
Returns
true |
boolean |
hasOutgoingDiscoveryInfos()
Returns
true |
void |
invalidate()
set the device on invalid.
|
boolean |
isRemote()
Is device remote (proxy) or local?
|
boolean |
isRunning()
Returns if the device was started and is running now.
|
boolean |
isValid()
return true if device is valid and false if it is invalid.
|
boolean |
releaseExclusiveLock()
Releases an exclusive lock of the current thread.
|
void |
releaseSharedLock()
Releases a shared lock of the current thread.
|
boolean |
removeBinding(BindingContainer container) |
boolean |
removeBinding(CommunicationAutoBinding autoBinding) |
boolean |
removeBinding(CommunicationAutoBinding communicationBinding,
DiscoveryAutoBinding discoveryBinding) |
boolean |
removeBinding(CommunicationBinding binding)
Removes the specified binding from this
Bindable instance. |
boolean |
removeBinding(DiscoveryAutoBinding autoBinding) |
boolean |
removeBinding(DiscoveryBinding binding) |
boolean |
removeOutgoingDiscoveryInfo(DiscoveryAutoBinding autoBinding) |
boolean |
removeOutgoingDiscoveryInfo(OutgoingDiscoveryInfo info)
Removes a previously
added outgoing discovery info from
this device. |
void |
removeService(LocalService service)
Removes service from device.
|
void |
removeService(LocalService service,
boolean stopIfRunning)
Removes a service from the device.
|
void |
removeSupportedProtocolInfo(ProtocolInfo pinfo) |
void |
sendBye()
Sends multicast Bye Message.
|
void |
sendBye(XAddressInfo targetXAddressInfo)
Sends hello message to an explicit endpoint.
|
void |
sendHello()
Sends multicast hello message.
|
void |
sendHello(XAddressInfo targetXAddrInfo)
Sends hello message to an explicit endpoint.
|
void |
setAuthorizationManager(AuthorizationManager authorizationManager)
Set the authorization manager for this device.
|
void |
setCustomMData(java.lang.String communicationManagerId,
ArrayList customMData)
Set the custom metadata
|
void |
setDefaultLocalCredentialInfo(CredentialInfo defaultLocalCredentialInfo)
Set the default credential info for this device.
|
void |
setDefaultNamespace(java.lang.String ns) |
void |
setDeviceMetadata(ThisDeviceMData deviceMetadata)
Sets the device metadata of the device.
|
void |
setEndpointReference(EndpointReference endpoint)
Sets the
EndpointReference of this device. |
void |
setFirmwareVersion(java.lang.String firmwareVersion)
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 |
setServiceChanged() |
void |
sharedLock()
Acquires a shared lock.
|
void |
start()
Starts the device.
|
void |
stop()
Stops the device.
|
void |
stop(boolean stopServices)
Stops the device.
|
boolean |
tryExclusiveLock()
Try to get an exclusive lock immediately.
|
boolean |
trySharedLock()
Tries to get a shared lock immediately.
|
void |
validateDeviceMetadata() |
void |
validateModelMetadata() |
equals, hashCode, toStringpublic static final int MAX_QNAME_SERIALIZATION
protected final int configurationId
protected final HashMap services
protected final AppSequenceManager appSequencer
protected final HashMap incomingListeners
protected final HashMap communicationAutoBindings
protected final HashMap communicationBindingsUp
protected final HashMap communicationBindingsDown
protected final HashMap discoveryBindingsUp
protected final HashMap discoveryBindingsDown
protected final HashMap discoveryAutoBindings
protected final HashMap activeDiscoveryDomains
protected final HashMap outgoingDiscoveryInfosUp
protected final HashMap outgoingDiscoveryInfosDown
protected final DeviceProperties deviceProp
protected DiscoveryData discoveryData
protected HashSet serviceIdStrings
protected boolean running
protected boolean changed
protected boolean discoveryDataChanged
protected boolean isMetadataVersionSet
protected java.lang.String defaultLanugaugeString
protected LocalizedString defaultFriendlyName
protected LocalizedString defaultModelName
protected LocalizedString defaultManufacturer
public DefaultDevice()
public DefaultDevice(int configurationId)
public DefaultDevice(java.lang.String comManId)
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,
java.lang.String comManId)
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.public boolean isRemote()
Devicepublic boolean isRunning()
LocalDeviceisRunning in interface LocalDevicetrue, if this device is runningpublic boolean hasCommunicationBindings()
Bindabletrue only if this Bindable instance has at least one binding assigned. Returns false, if it doesn't have any
bindings.hasCommunicationBindings in interface Bindablepublic boolean hasCommunicationAutoBindings()
Bindabletrue only if this instance has at least one binding assigned. Returns false, if it doesn't have any
autoBindings.hasCommunicationAutoBindings in interface Bindablepublic boolean hasDiscoveryBindings()
LocalDevicetrue if discovery bindings are available.hasDiscoveryBindings in interface LocalDevicetrue if discovery bindings are available.public boolean hasDiscoveryAutoBindings()
LocalDevicetrue if discovery auto bindings are available.hasDiscoveryAutoBindings in interface LocalDevicetrue if discovery auto bindings are available.public Iterator getCommunicationAutoBindings()
BindableautoBindings assigned to this Bindable instance. This
iterator will have no next elements (rather than being
), if the Bindable doesn't have any
bindings.getCommunicationAutoBindings in interface Bindablebindingspublic Iterator getCommunicationBindings()
Bindablebindings assigned to this Bindable
instance. This iterator will have no next elements (rather than being ), if the
Bindable doesn't have any bindings.getCommunicationBindings in interface Bindablebindingspublic Iterator getDiscoveryBindings()
getDiscoveryBindings in interface LocalDevicepublic Iterator getDiscoveryAutoBindings()
getDiscoveryAutoBindings in interface LocalDevicepublic HashSet getSupportedProtocolInfos()
getSupportedProtocolInfos in interface LocalDevicepublic Set getOutgoingDiscoveryInfos()
getOutgoingDiscoveryInfos in interface LocalDevicepublic BindingContainer addBinding(CommunicationBinding binding, boolean addDiscoveryBinding, boolean addOutgoingDiscoveryInfo) throws WS4DIllegalStateException
LocalDeviceBindable. Does nothing if the Bindable
already contains the binding.addBinding in interface LocalDevicebinding - The binding to add.addDiscoveryBinding - If true, also all corresponding DiscoveryBinding is add to the device.addOutgoingDiscoveryInfo - If true, also all corresponding OutgoingDiscoverInfos are add to the device.WS4DIllegalStateException - in case this Bindable doesn't currently support modifications (see #supportsBindingChanges())public void addSupportedProtocolInfo(ProtocolInfo pinfo)
addSupportedProtocolInfo in interface LocalDevicepublic void removeSupportedProtocolInfo(ProtocolInfo pinfo)
removeSupportedProtocolInfo in interface LocalDevicepublic DiscoveryAutoBinding addBinding(CommunicationAutoBinding autoBinding, boolean addDiscoveryBinding, boolean addOutgoingDiscoveryInfo)
LocalDeviceBindable. Does nothing if the Bindable
already contains the binding.addBinding in interface LocalDevicepublic void addBinding(DiscoveryBinding binding) throws WS4DIllegalStateException
addBinding in interface LocalDeviceWS4DIllegalStateExceptionpublic void addBinding(DiscoveryAutoBinding autoBinding)
addBinding in interface LocalDevicepublic boolean removeBinding(CommunicationBinding binding)
BindableBindable 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 Bindablebinding - the binding to removetrue if this Bindable instance had the given binding assigned and it was
removed successfully, false otherwisepublic boolean removeBinding(DiscoveryBinding binding) throws WS4DIllegalStateException
removeBinding in interface LocalDeviceWS4DIllegalStateExceptionpublic boolean removeBinding(CommunicationAutoBinding autoBinding) throws WS4DIllegalStateException
removeBinding in interface BindableWS4DIllegalStateExceptionpublic boolean removeBinding(DiscoveryAutoBinding autoBinding) throws WS4DIllegalStateException
removeBinding in interface LocalDeviceWS4DIllegalStateExceptionpublic void clearBindings()
throws WS4DIllegalStateException
BindableBindable instance. Does nothing if there are no
bindings assigned.clearBindings in interface BindableWS4DIllegalStateException - in case this Bindable doesn't support modifications at the current time (see #supportsBindingChanges())public void addOutgoingDiscoveryInfo(OutgoingDiscoveryInfo info)
addOutgoingDiscoveryInfo in interface LocalDeviceinfo - the new protocol domain to add to this devicepublic void addOutgoingDiscoveryInfo(DiscoveryAutoBinding autoBinding)
public boolean removeOutgoingDiscoveryInfo(DiscoveryAutoBinding autoBinding)
public boolean removeOutgoingDiscoveryInfo(OutgoingDiscoveryInfo info)
added outgoing discovery info from
this device.removeOutgoingDiscoveryInfo in interface LocalDeviceinfo - the output domain to removepublic boolean hasOutgoingDiscoveryInfos()
LocalDevicetrue if outgoing discovery infos are available.hasOutgoingDiscoveryInfos in interface LocalDevicetrue if outgoing discovery infos are available.public boolean hasAutoOutgoingDiscoveryInfos()
public DeviceReference getDeviceReference(SecurityKey securityKey)
DeviceDeviceReference of this device.getDeviceReference in interface DeviceDeviceReference 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 LocalDevicejava.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 LocalDevicejava.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.protected void deviceIsStarting()
start() method is running.protected void deviceIsStopping()
stop() method is running.public void sendHello()
Important: This method won't start the device. But starting this device will automatically send a hello message.
sendHello in interface LocalDevicepublic void sendHello(XAddressInfo targetXAddrInfo)
Important: This method won't start the device. But starting this device will automatically send a hello message.
public void sendBye()
Important: This method won't stop the device. But stopping this device will automatically send a bye message.
sendBye in interface LocalDevicepublic void sendBye(XAddressInfo targetXAddressInfo)
Important: This method won't start the device. But starting this device will automatically send a hello message.
public void setServiceChanged()
setServiceChanged in interface LocalDevicepublic void sharedLock()
LockablesharedLock in interface Lockablepublic void exclusiveLock()
LockableexclusiveLock in interface Lockablepublic void releaseSharedLock()
LockablereleaseSharedLock in interface Lockablepublic boolean releaseExclusiveLock()
LockablereleaseExclusiveLock in interface Lockablepublic boolean tryExclusiveLock()
LockabletryExclusiveLock in interface Lockabletrue if the lock has been allocated, false otherwisepublic boolean trySharedLock()
LockabletrySharedLock in interface Lockabletrue if the lock has been allocated, false otherwisepublic EndpointReference getEndpointReference()
DevicegetEndpointReference in interface Devicepublic 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 LocalDeviceendpoint - The endpoint reference to set.public Iterator getPortTypes()
DeviceQName.getPortTypes in interface DeviceQName.public void setPortTypes(QNameSet qnsPortTypes) throws java.lang.IllegalArgumentException
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 LocalDeviceqnsPortTypes - Device port types to set.java.lang.IllegalArgumentExceptionpublic Iterator getScopes()
DeviceURI.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 LocalDevicescopes - List of scopes to set.public java.lang.String getManufacturer(java.lang.String lang)
DeviceLocalizedString.getManufacturer in interface DevicegetManufacturer in class DeviceCommonslang - The language of the manufacturer's name to be obtained. The language consts are specified in LocalizedString.LocalizedString.public Iterator getManufacturers()
DeviceLocalizedString.getManufacturers in interface DevicegetManufacturers in class DeviceCommonsLocalizedString.public java.lang.String getManufacturerUrl()
DevicegetManufacturerUrl in interface DevicegetManufacturerUrl in class DeviceCommonspublic 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 LocalDevicemanufacturerUrl - The url of the manufacturer to set.public java.lang.String getModelName(java.lang.String lang)
DeviceLocalizedString.getModelName in interface DevicegetModelName in class DeviceCommonslang - Language of the model name to get. The language consts are specified in LocalizedString.LocalizedString.public Iterator getModelNames()
DeviceLocalizedString.getModelNames in interface DevicegetModelNames in class DeviceCommonsLocalizedString.public java.lang.String getModelNumber()
DevicegetModelNumber in interface DevicegetModelNumber in class DeviceCommonspublic 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 LocalDevicemodelNumber - The model number of the device to set.public java.lang.String getModelUrl()
DevicegetModelUrl in interface DevicegetModelUrl in class DeviceCommonspublic 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 LocalDevicemodelUrl - The model url of the device to set.public java.lang.String getPresentationUrl()
DevicegetPresentationUrl in interface DevicegetPresentationUrl in class DeviceCommonspublic 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 LocalDevicepresentationUrl - The presentation url to set.public java.lang.String getFriendlyName(java.lang.String lang)
DevicegetFriendlyName in interface DevicegetFriendlyName in class DeviceCommonslang - language of friendly nameLocalizedString in specified languagepublic Iterator getFriendlyNames()
DeviceLocalizedString.getFriendlyNames in interface DevicegetFriendlyNames in class DeviceCommonsLocalizedString.public java.lang.String getFirmwareVersion()
DevicegetFirmwareVersion in interface DevicegetFirmwareVersion in class DeviceCommonspublic void setFirmwareVersion(java.lang.String firmwareVersion)
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 LocalDevicefirmwareVersion - The firmware version of the device to set.public java.lang.String getSerialNumber()
DevicegetSerialNumber in interface DevicegetSerialNumber in class DeviceCommonspublic 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 LocalDeviceserialNumber - The serial number of the device 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 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 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 LocalDevicelang - 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 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 LocalDeviceservice - 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 LocalDeviceservice - 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.IOExceptionpublic void checkAndSet(LocalService service)
service - which should be checked.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 LocalDeviceservice - 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.
removeService in interface LocalDeviceservice - The service to remove from the device.stopIfRunning - true the service is stopped if the service is running, false just remove.java.io.IOExceptionpublic ThisDeviceMData getDeviceMetadata()
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 LocalDevicedeviceMetadata - public void validateDeviceMetadata()
public long getMetadataVersion()
DevicegetMetadataVersion in interface Devicepublic 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 LocalDevicemetadataVersion - The metadata version to set is of type unsigned int.public ThisModelMData getModelMetadata()
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 LocalDevicemodelMetadata - The model metadata of the device to set.public void validateModelMetadata()
public Iterator getServices()
LocalDeviceService.getServices in interface LocalDeviceService.public Service getService(URI serviceId)
LocalDeviceService.getService in interface LocalDeviceService.public Iterator getServiceReferences(SecurityKey securityKey)
DeviceServiceReference.getServiceReferences in interface Devicepublic Iterator getServiceReferences(QNameSet servicePortTypes, SecurityKey securityKey)
DeviceServiceReference.getServiceReferences in interface DeviceservicePortTypes - The service port types the services must implement, to be returned by its reference.public void addMatchingServiceReferencesToDataStructure(DataStructure to, QNameSet servicePortTypes, SecurityKey securityKey)
Deviceto, if
they match the service port types given within serviceTypes.addMatchingServiceReferencesToDataStructure in interface Deviceto - collection to add matching service references toservicePortTypes - service port types to look forpublic ServiceReference getServiceReference(URI serviceId, SecurityKey securityKey)
DevicegetServiceReference in interface Devicenull if no service matches the service id.public ServiceReference getServiceReference(EndpointReference serviceEpr, SecurityKey securityKey)
DevicegetServiceReference in interface Devicenull, if no service matches the service id.public Iterator getTransportXAddressInfos()
DeviceURI.getTransportXAddressInfos in interface DeviceURI.public Iterator getDiscoveryXAddressInfos()
DeviceURI.getDiscoveryXAddressInfos in interface DeviceURI.public Iterator getTransportAndDiscoveryXAddressInfos()
DeviceURI.getTransportAndDiscoveryXAddressInfos in interface DeviceURI.public DiscoveryData getDiscoveryData()
LocalDevicegetDiscoveryData in interface LocalDeviceprotected AppSequenceManager getAppSequencer()
AappSequenceManager of this device.AppSequenceManager of this device.public CredentialInfo getDefaultLocalCredentialInfo()
public void setDefaultLocalCredentialInfo(CredentialInfo defaultLocalCredentialInfo)
defaultLocalCredentialInfo - public AuthorizationManager getAuthorizationManager()
LocalDevicegetAuthorizationManager in interface LocalDevicepublic void setAuthorizationManager(AuthorizationManager authorizationManager)
LocalDevicesetAuthorizationManager in interface LocalDevicepublic void disconnectAllServiceReferences(boolean resetServiceRefs)
DeviceCommons resetServiceRefs
is true serviceReferences will be reseted too.disconnectAllServiceReferences in class DeviceCommonspublic 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 deviceSearchTypes, QNameSet serviceSearchTypes, ProbeScopeSet searchScopes, java.lang.String comManId)
deviceSearchTypes - 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 boolean deviceMatches(SearchParameter search)
LocalDevicedeviceMatches in interface LocalDevicesearch - SearchParameter to match.true - if the outer device matches search.public java.lang.String getDefaultNamespace()
DevicegetDefaultNamespace in interface Devicepublic void setDefaultNamespace(java.lang.String ns)
public boolean isValid()
Devicepublic void invalidate()
Deviceinvalidate in interface Devicepublic UnknownDataContainer[] getCustomMData(java.lang.String communicationManagerId)
DevicegetCustomMData in interface DevicegetCustomMData in class DeviceCommonspublic void setCustomMData(java.lang.String communicationManagerId,
ArrayList customMData)
LocalDevicesetCustomMData in interface LocalDevicecustomMData - String which contains the new custom metadata.public void addCustomMData(java.lang.String communicationManagerId,
UnknownDataContainer container)
addCustomMData in interface LocalDeviceorg.ws4d.java.service.LocalDevice#addCustomMData(UnknownDataContainer)public AutoBindingAndOutgoingDiscoveryInfoListener getAutoBindingAndOutgoingDiscoveryInfoListener()
getAutoBindingAndOutgoingDiscoveryInfoListener in interface LocalDevicepublic NetworkChangeListener getNetworkChangeListener()
getNetworkChangeListener in interface LocalDevicepublic java.lang.String getComManId()
getComManId in interface Devicepublic void addBinding(CommunicationAutoBinding binding)
BindableBindable. Does nothing if the Bindable
already contains the binding.addBinding in interface Bindablepublic void addBinding(CommunicationBinding binding)
BindableBindable. Does nothing if the Bindable
already contains the binding.addBinding in interface Bindablebinding - the binding to addpublic boolean removeBinding(BindingContainer container)
removeBinding in interface LocalDevicepublic boolean removeBinding(CommunicationAutoBinding communicationBinding, DiscoveryAutoBinding discoveryBinding)
removeBinding in interface LocalDevice