Interface Event


public interface Event
  • Method Details

    • getCore

      @NonNull Core getCore()
      Returns back pointer to the Core that created this Event.

      Returns:
      the Core object associated.
    • getErrorInfo

      @NonNull ErrorInfo getErrorInfo()
      Get full details about an error occured.

      Returns:
      a ErrorInfo object.
    • getFrom

      @NonNull Address getFrom()
      Get the "from" address of the subscription.

      Returns:
      the from Address.
    • getName

      @NonNull String getName()
      Get the name of the event as specified in the event package RFC.

      Returns:
      the event name.
    • getPublishState

      PublishState getPublishState()
      Get publish state.

      If the event object was not created by a publish mechanism, PublishState.None
      is returned.
      Returns:
      the current PublishState
    • getReason

      Reason getReason()
      Return reason code (in case of error state reached).

      Returns:
      a Reason enum
    • getRemoteContact

      @NonNull Address getRemoteContact()
      Get the "contact" address of the subscription.

      Returns:
      The "contact" address of the subscription
    • getResource

      @NonNull Address getResource()
      Get the resource address of the subscription or publish.

      Returns:
      the resource Address.
    • getSubscriptionDir

      SubscriptionDir getSubscriptionDir()
      Get subscription direction.

      If the object wasn't created by a subscription mechanism, SubscriptionDir.InvalidDir
      is returned.
      Returns:
      the SubscriptionDir
    • getSubscriptionState

      SubscriptionState getSubscriptionState()
      Get subscription state.

      If the event object was not created by a subscription mechanism, SubscriptionState.None
      is returned.
      Returns:
      the current SubscriptionState
    • getTo

      @NonNull Address getTo()
      Get the "to" address of the subscription.

      Returns:
      the "to" Address.
    • acceptPublish

      int acceptPublish()
      Accept an incoming publish.

      Returns:
      0 if successful, error code otherwise
    • acceptSubscription

      int acceptSubscription()
      Accept an incoming subcription.

      Returns:
      0 if successful, error code otherwise
    • addCustomHeader

      void addCustomHeader(@NonNull String name, @Nullable String value)
      Add a custom header to an outgoing susbscription or publish.

      Parameters:
      name - header's name
      value - the header's value.
    • denyPublish

      int denyPublish(Reason reason)
      Deny an incoming publish with given reason.

      Returns:
      0 if successful, error code otherwise
    • denySubscription

      int denySubscription(Reason reason)
      Deny an incoming subscription with given reason.

      Returns:
      0 if successful, error code otherwise
    • getCustomHeader

      @Nullable String getCustomHeader(@NonNull String name)
      Obtain the value of a given header for an incoming subscription.

      Parameters:
      name - header's name
      Returns:
      the header's value or null if such header doesn't exist.
    • notify

      int notify(@Nullable Content body)
      Send a notification.

      Parameters:
      body - an optional body containing the actual notification data.
      Returns:
      0 if successful, -1 otherwise.
    • pausePublish

      void pausePublish()
      Prevent an event from refreshing its publish.

      This is useful to let registrations to expire naturally (or) when the
      application wants to keep control on when refreshes are sent. The refreshing
      operations can be resumed with ProxyConfig.refreshRegister().
    • refreshPublish

      int refreshPublish()
      Refresh an outgoing publish keeping the same body.

      Returns:
      0 if successful, -1 otherwise.
    • refreshSubscribe

      int refreshSubscribe()
      Refresh an outgoing subscription keeping the same body.

      Returns:
      0 if successful, -1 otherwise.
    • removeCustomHeader

      void removeCustomHeader(@NonNull String name)
      Remove custom header to an outgoing susbscription or publish.

      Parameters:
      name - header's name
    • sendPublish

      int sendPublish(@NonNull Content body)
      Parameters:
      body - the new data to be published
      Returns:
      0 if successful, -1 otherwise.
    • sendSubscribe

      int sendSubscribe(@Nullable Content body)
      Parameters:
      body - optional content to attach with the subscription.
      Returns:
      0 if successful, -1 otherwise.
    • terminate

      void terminate()
      Terminate an incoming or outgoing subscription that was previously acccepted,
      or a previous publication.

      The Event shall not be used anymore after this operation.
    • updatePublish

      int updatePublish(@NonNull Content body)
      Update (refresh) a publish.

      Parameters:
      body - the new data to be published
      Returns:
      0 if successful, error code otherwise
    • updateSubscribe

      @Nullable int updateSubscribe(@Nullable Content body)
      Update (refresh) an outgoing subscription, changing the body.

      Parameters:
      body - an optional body to include in the subscription update, may be
      null.
      Returns:
      0 if successful, error code otherwise
    • addListener

      void addListener(EventListener listener)
    • removeListener

      void removeListener(EventListener listener)
    • setUserData

      void setUserData(Object data)
      Sets the object to store in this object user's data
      Parameters:
      data - the object to store
    • getUserData

      Object getUserData()
      Gets the object stored in this object user's data
      Returns:
      the object store if any, null otherwise
    • getNativePointer

      long getNativePointer()
      Gets the native pointer used by this class to make native method calls.
      Returns:
      the nativer pointer, as long
    • toString

      String toString()
      Overrides:
      toString in class Object