Class ObserveManager
java.lang.Object
org.eclipse.californium.core.observe.ObserveManager
Manager for server-side observe relations.
Note: since 3.6 the data model for server-side observe relations has changed.
The manager keeps a map of all observe relations by their remote endpoint and
the used token. Additional it keeps a map of all remote endpoint with their
list of the observe relations from that endpoint.
With a success response, a observe relation is established and added to the
ObservableResource
and from that on, changes will be reported by
notifications. Error responses will terminate the observe relation, as well
as a observe-cancel request or if a notification is rejected. If a CON
notification times out without being ACKed, all established observe relations
from that remote endpoint are canceled.-
Constructor Summary
ConstructorDescriptionDeprecated.ObserveManager
(org.eclipse.californium.elements.config.Configuration config) Constructs a new ObserveManager for this server. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addObserveRelation
(Exchange exchange, ObservableResource resource) Add observer relation.void
cancelObserveRelation
(Exchange exchange) Cancel observe relation.findObservingEndpoint
(InetSocketAddress address) Deprecated.obsoleteorg.eclipse.californium.elements.config.Configuration
Get configuration.int
Get number of observing endpoints.int
Get number of observe relations.getObservingEndpoint
(InetSocketAddress address) Deprecated.obsoletegetRelation
(InetSocketAddress address, Token token) Deprecated.obsoleteboolean
isFull()
Checks, whether the maximum number of observe relation is reached.void
onRejectedNotification
(ObserveRelation relation) Report rejected notification.void
removeObserveRelation
(ObserveRelation relation) Remove observe relation.void
setObserveHealth
(ObserveHealth observeHealth) Set observe health status.
-
Constructor Details
-
ObserveManager
Deprecated.useObserveManager(Configuration)
insteadConstructs a new ObserveManager for this server. -
ObserveManager
public ObserveManager(org.eclipse.californium.elements.config.Configuration config) Constructs a new ObserveManager for this server.- Parameters:
config
- configuration. May benull
.- Since:
- 3.6
-
-
Method Details
-
setObserveHealth
Set observe health status.- Parameters:
observeHealth
- health status for observe.- Since:
- 3.6
-
findObservingEndpoint
Deprecated.obsoleteFind the ObservingEndpoint for the specified endpoint address or create a new one if none exists yet. Does not returnnull
.- Parameters:
address
- the address- Returns:
- the ObservingEndpoint for the address
-
addObserveRelation
Add observer relation.- Parameters:
exchange
- The initial exchange.resource
- The resource- Since:
- 3.6
-
cancelObserveRelation
Cancel observe relation.- Parameters:
exchange
- The exchange to cancel a observe relation- Since:
- 3.6
-
onRejectedNotification
Report rejected notification.- Parameters:
relation
- observe relation of rejected notification- Since:
- 3.6
-
removeObserveRelation
Remove observe relation.- Parameters:
relation
- observe relation to remove- Since:
- 3.6
-
getNumberOfEndpoints
public int getNumberOfEndpoints()Get number of observing endpoints.- Returns:
- number of observing endpoints
- Since:
- 3.6
-
getNumberOfObserverRelations
public int getNumberOfObserverRelations()Get number of observe relations.- Returns:
- number of observe relations
- Since:
- 3.6
-
getConfiguration
public org.eclipse.californium.elements.config.Configuration getConfiguration()Get configuration.- Returns:
- configuration, may be
null
. - Since:
- 3.7
-
isFull
public boolean isFull()Checks, whether the maximum number of observe relation is reached.- Returns:
true
, if the maximum number of observe relation is reached,false
, otherwise- Since:
- 3.6
-
getObservingEndpoint
Deprecated.obsoleteReturn the ObservingEndpoint for the specified endpoint address ornull
, if none exists.- Parameters:
address
- the address- Returns:
- the ObservingEndpoint or
null
-
getRelation
Deprecated.obsoleteGet observe relation.- Parameters:
address
- the addresstoken
- token of relation- Returns:
- the observe relation, or
null
, if not available
-
ObserveManager(Configuration)
instead