org.fourthline.cling.support.lastchange

## Class LastChangeAwareServiceManager<T extends LastChangeDelegator>

- java.lang.Object
- - org.fourthline.cling.model.DefaultServiceManager<T>
  - - org.fourthline.cling.support.lastchange.LastChangeAwareServiceManager<T>

- All Implemented Interfaces:
    ServiceManager<T>

      public class LastChangeAwareServiceManager<T extends LastChangeDelegator>
      extends DefaultServiceManager<T>

  Handles the "initial" event state for GENA subscriptions to services using LastChange.

  When a GENA subscription is made on your AVTransport/RenderingControl service, you have to read the initial state of the service. Ususally Cling would do this for you and simply access all the state variables of your service behind the scenes. But the AVTransport/RenderingControl service doesn't use regular UPnP state variable eventing internally, they rely on the awful "LastChange" mechanism for their "logical" instances.

  Use this `ServiceManager` instead of the default one for these services.

  Author:
    Christian Bauer

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.fourthline.cling.model.DefaultServiceManager

      `DefaultServiceManager.DefaultPropertyChangeListener`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected LastChangeParser` | `lastChangeParser`

    - ### Fields inherited from class org.fourthline.cling.model.DefaultServiceManager

      `lock, propertyChangeSupport, service, serviceClass, serviceImpl`

    - ### Fields inherited from interface org.fourthline.cling.model.ServiceManager

      `EVENTED_STATE_VARIABLES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LastChangeAwareServiceManager(LocalService<T> localService, Class<T> serviceClass, LastChangeParser lastChangeParser)`
    `LastChangeAwareServiceManager(LocalService<T> localService, LastChangeParser lastChangeParser)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `fireLastChange()` Call this method to propagate all accumulated "LastChange" values to GENA subscribers.
    `protected LastChangeParser` | `getLastChangeParser()`
    `protected Collection<StateVariableValue>` | `readInitialEventedStateVariableValues()`

    - ### Methods inherited from class org.fourthline.cling.model.DefaultServiceManager

      `createPropertyChangeListener, createPropertyChangeSupport, createServiceInstance, execute, getCurrentState, getCurrentState, getImplementation, getLockTimeoutMillis, getPropertyChangeSupport, getService, init, lock, toString, unlock`

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

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

- - ### Field Detail

    - #### lastChangeParser

          protected final LastChangeParser lastChangeParser

  - ### Constructor Detail

    - #### LastChangeAwareServiceManager

          public LastChangeAwareServiceManager(LocalService<T> localService,
                                       LastChangeParser lastChangeParser)

    - #### LastChangeAwareServiceManager

          public LastChangeAwareServiceManager(LocalService<T> localService,
                                       Class<T> serviceClass,
                                       LastChangeParser lastChangeParser)

  - ### Method Detail

    - #### getLastChangeParser

          protected LastChangeParser getLastChangeParser()

    - #### fireLastChange

          public void fireLastChange()

      Call this method to propagate all accumulated "LastChange" values to GENA subscribers.

    - #### readInitialEventedStateVariableValues

          protected Collection<StateVariableValue> readInitialEventedStateVariableValues()
                                                                                  throws Exception

      Overrides:
        `readInitialEventedStateVariableValues` in class `DefaultServiceManager<T extends LastChangeDelegator>`
      Throws:
        `Exception`

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