org.fourthline.cling.protocol.sync

## Class ReceivingSubscribe

- java.lang.Object
- - org.fourthline.cling.protocol.ReceivingAsync<IN>
  - - org.fourthline.cling.protocol.ReceivingSync<StreamRequestMessage,OutgoingSubscribeResponseMessage>
    - - org.fourthline.cling.protocol.sync.ReceivingSubscribe

- All Implemented Interfaces:
    Runnable

      public class ReceivingSubscribe
      extends ReceivingSync<StreamRequestMessage,OutgoingSubscribeResponseMessage>

  Handles reception of GENA event subscription (initial and renewal) messages.

  This protocol tries to find a local event subscription URI matching the requested URI, then creates a new `LocalGENASubscription` if no subscription identifer was supplied.

  The subscription is however only registered with the local service, and monitoring of state changes is established, if the response of this protocol was successfully delivered to the client which requested the subscription.

  Once registration and monitoring is active, an initial event with the current state of the service is send to the subscriber. This will only happen after the subscription response message was successfully delivered to the subscriber.

  Author:
    Christian Bauer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected LocalGENASubscription` | `subscription`

    - ### Fields inherited from class org.fourthline.cling.protocol.ReceivingSync

      `outputMessage, remoteClientInfo`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReceivingSubscribe(UpnpService upnpService, StreamRequestMessage inputMessage)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected OutgoingSubscribeResponseMessage` | `executeSync()`
    `protected OutgoingSubscribeResponseMessage` | `processNewSubscription(LocalService service, IncomingSubscribeRequestMessage requestMessage)`
    `protected OutgoingSubscribeResponseMessage` | `processRenewal(LocalService service, IncomingSubscribeRequestMessage requestMessage)`
    `void` | `responseException(Throwable t)` Called by the client of this protocol if the returned response was not delivered.
    `void` | `responseSent(StreamResponseMessage responseMessage)` Called by the client of this protocol after the returned response has been successfully delivered.

    - ### Methods inherited from class org.fourthline.cling.protocol.ReceivingSync

      `execute, getOutputMessage, getRemoteClientInfo, toString`

    - ### Methods inherited from class org.fourthline.cling.protocol.ReceivingAsync

      `getFirstHeader, getInputMessage, getUpnpService, run, waitBeforeExecution`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### subscription

          protected LocalGENASubscription subscription

  - ### Constructor Detail

    - #### ReceivingSubscribe

          public ReceivingSubscribe(UpnpService upnpService,
                            StreamRequestMessage inputMessage)

  - ### Method Detail

    - #### executeSync

          protected OutgoingSubscribeResponseMessage executeSync()
                                                          throws RouterException

      Specified by:
        `executeSync` in class `ReceivingSync<StreamRequestMessage,OutgoingSubscribeResponseMessage>`
      Throws:
        `RouterException`

    - #### processRenewal

          protected OutgoingSubscribeResponseMessage processRenewal(LocalService service,
                                                        IncomingSubscribeRequestMessage requestMessage)

    - #### processNewSubscription

          protected OutgoingSubscribeResponseMessage processNewSubscription(LocalService service,
                                                                IncomingSubscribeRequestMessage requestMessage)

    - #### responseSent

          public void responseSent(StreamResponseMessage responseMessage)

      Description copied from class: `ReceivingSync`
      Called by the client of this protocol after the returned response has been successfully delivered.

      NOOP by default.

      Overrides:
        `responseSent` in class `ReceivingSync<StreamRequestMessage,OutgoingSubscribeResponseMessage>`

    - #### responseException

          public void responseException(Throwable t)

      Description copied from class: `ReceivingSync`
      Called by the client of this protocol if the returned response was not delivered.

      NOOP by default.

      Overrides:
        `responseException` in class `ReceivingSync<StreamRequestMessage,OutgoingSubscribeResponseMessage>`
      Parameters:
        `t` - The reason why the response wasn't delivered.

Copyright © 2014 4th Line GmbH, Switzerland. All Rights Reserved.