Class ObserveManager

java.lang.Object
org.eclipse.californium.core.observe.ObserveManager

public class ObserveManager extends Object
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 Details

    • ObserveManager

      @Deprecated public ObserveManager()
      Deprecated.
      Constructs 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 be null.
      Since:
      3.6
  • Method Details

    • setObserveHealth

      public void setObserveHealth(ObserveHealth observeHealth)
      Set observe health status.
      Parameters:
      observeHealth - health status for observe.
      Since:
      3.6
    • findObservingEndpoint

      @Deprecated public ObservingEndpoint findObservingEndpoint(InetSocketAddress address)
      Deprecated.
      obsolete
      Find the ObservingEndpoint for the specified endpoint address or create a new one if none exists yet. Does not return null.
      Parameters:
      address - the address
      Returns:
      the ObservingEndpoint for the address
    • addObserveRelation

      public void addObserveRelation(Exchange exchange, ObservableResource resource)
      Add observer relation.
      Parameters:
      exchange - The initial exchange.
      resource - The resource
      Since:
      3.6
    • cancelObserveRelation

      public void cancelObserveRelation(Exchange exchange)
      Cancel observe relation.
      Parameters:
      exchange - The exchange to cancel a observe relation
      Since:
      3.6
    • onRejectedNotification

      public void onRejectedNotification(ObserveRelation relation)
      Report rejected notification.
      Parameters:
      relation - observe relation of rejected notification
      Since:
      3.6
    • removeObserveRelation

      public void removeObserveRelation(ObserveRelation relation)
      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 public ObservingEndpoint getObservingEndpoint(InetSocketAddress address)
      Deprecated.
      obsolete
      Return the ObservingEndpoint for the specified endpoint address or null, if none exists.
      Parameters:
      address - the address
      Returns:
      the ObservingEndpoint or null
    • getRelation

      @Deprecated public ObserveRelation getRelation(InetSocketAddress address, Token token)
      Deprecated.
      obsolete
      Get observe relation.
      Parameters:
      address - the address
      token - token of relation
      Returns:
      the observe relation, or null, if not available