Class DeviceImpl
- java.lang.Object
-
- com.google.common.util.concurrent.AbstractIdleService
-
- org.somda.sdc.dpws.device.DeviceImpl
-
- All Implemented Interfaces:
com.google.common.util.concurrent.Service,Device,DiscoveryAccess,HostingServiceAccess
public class DeviceImpl extends com.google.common.util.concurrent.AbstractIdleService implements Device, com.google.common.util.concurrent.Service, DiscoveryAccess, HostingServiceAccess
Default implementation of Device, DiscoveryAccess and HostingServiceAccess.todo DGr no support for hosting and hosted services being updated during runtime.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHostedService(HostedService hostedService)Adds a hosted service definition.Map<String,SubscriptionManager>getActiveSubscriptions()DiscoveryAccessgetDiscoveryAccess()Gets access to WS-Discovery in order to configure types and scopes.StringgetEprAddress()HostingServiceAccessgetHostingServiceAccess()Gets access to Hosting Service metadata and Hosted Services.voidsendHello()Sends a Hello message to the network.voidsetScopes(Collection<String> scopes)Sets the scopes in accordance with WS-Discovery.voidsetThisDevice(ThisDeviceType thisDevice)Adds the ThisModel definition.voidsetThisModel(ThisModelType thisModel)Updates the ThisModel definition.voidsetTypes(Collection<QName> types)Sets the types in accordance with WS-Discovery.protected voidshutDown()protected voidstartUp()-
Methods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toString
-
-
-
-
Method Detail
-
startUp
protected void startUp() throws Exception- Specified by:
startUpin classcom.google.common.util.concurrent.AbstractIdleService- Throws:
Exception
-
shutDown
protected void shutDown() throws Exception- Specified by:
shutDownin classcom.google.common.util.concurrent.AbstractIdleService- Throws:
Exception
-
getActiveSubscriptions
public Map<String,SubscriptionManager> getActiveSubscriptions()
- Specified by:
getActiveSubscriptionsin interfaceDevice
-
getDiscoveryAccess
public DiscoveryAccess getDiscoveryAccess()
Description copied from interface:DeviceGets access to WS-Discovery in order to configure types and scopes.- Specified by:
getDiscoveryAccessin interfaceDevice- Returns:
- discovery access.
-
getHostingServiceAccess
public HostingServiceAccess getHostingServiceAccess()
Description copied from interface:DeviceGets access to Hosting Service metadata and Hosted Services.- Specified by:
getHostingServiceAccessin interfaceDevice- Returns:
- hosting service access.
-
getEprAddress
public String getEprAddress()
- Specified by:
getEprAddressin interfaceDevice
-
setTypes
public void setTypes(Collection<QName> types)
Description copied from interface:DiscoveryAccessSets the types in accordance with WS-Discovery.- Specified by:
setTypesin interfaceDiscoveryAccess- Parameters:
types- the types to set.- See Also:
- Matching Types and Scopes
-
setScopes
public void setScopes(Collection<String> scopes)
Description copied from interface:DiscoveryAccessSets the scopes in accordance with WS-Discovery.- Specified by:
setScopesin interfaceDiscoveryAccess- Parameters:
scopes- the scopes to set.- See Also:
- Matching Types and Scopes
-
sendHello
public void sendHello()
Description copied from interface:DiscoveryAccessSends a Hello message to the network.The Hello message will be sent only if
DiscoveryAccess.setScopes(Collection)orDiscoveryAccess.setTypes(Collection)has been called prior to this function. This needs to be repeated for every Hello to be sent.- Specified by:
sendHelloin interfaceDiscoveryAccess
-
setThisDevice
public void setThisDevice(ThisDeviceType thisDevice)
Description copied from interface:HostingServiceAccessAdds the ThisModel definition.According to the DPWS specification, certain information is limited in the number of characters:
ThisDeviceType.getFriendlyName()shall have fewer thanDpwsConstants.MAX_FIELD_SIZEoctetsThisDeviceType.getFirmwareVersion()shall have fewer thanDpwsConstants.MAX_FIELD_SIZEoctetsThisDeviceType.getSerialNumber()()} shall have fewer thanDpwsConstants.MAX_FIELD_SIZEoctets
Attention: If those limits are exceeded, the underlying implementation may cut off overflowing characters.
- Specified by:
setThisDevicein interfaceHostingServiceAccess- Parameters:
thisDevice- the ThisModel information to set.- See Also:
- 4.1 Characteristics
-
setThisModel
public void setThisModel(ThisModelType thisModel)
Description copied from interface:HostingServiceAccessUpdates the ThisModel definition.According to the DPWS specification, certain information is limited in the number of characters:
ThisModelType.getManufacturer()()} shall have fewer thanDpwsConstants.MAX_FIELD_SIZEoctetsThisModelType.getModelName()()} shall have fewer thanDpwsConstants.MAX_FIELD_SIZEoctetsThisModelType.getModelNumber()()} ()} shall have fewer thanDpwsConstants.MAX_FIELD_SIZEoctetsThisModelType.getManufacturerUrl()shall have fewer thanDpwsConstants.MAX_URI_SIZEoctetsThisModelType.getModelUrl()()} shall have fewer thanDpwsConstants.MAX_URI_SIZEoctets
Attention: If those limits are exceeded, the underlying implementation may cut off overflowing characters.
- Specified by:
setThisModelin interfaceHostingServiceAccess- Parameters:
thisModel- the ThisModel information to set.- See Also:
- 4.1 Characteristics
-
addHostedService
public void addHostedService(HostedService hostedService)
Description copied from interface:HostingServiceAccessAdds a hosted service definition.Attention: there is currently no mechanism that verifies if the hosted service was added before!
- Specified by:
addHostedServicein interfaceHostingServiceAccess- Parameters:
hostedService- the hosted service definition to add.
-
-