org.fourthline.cling.support.lastchange

## Class LastChangeParser

- java.lang.Object
- - org.seamless.xml.SAXParser
  - - org.fourthline.cling.support.lastchange.LastChangeParser

- Direct Known Subclasses:
    AVTransportLastChangeParser, RenderingControlLastChangeParser

      public abstract class LastChangeParser
      extends org.seamless.xml.SAXParser

  Reads and writes the "LastChange" XML content.

  Validates against a schema if the `SAXParser.getSchemaSources()` method doesn't return `null`.

  Note: This is broken on most devices and with most services out in the wild. In fact, you might want to use polling the service with actions, to get its status, instead of GENA. Polling can be expensive on low-power control points, however.

  Author:
    Christian Bauer

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `LastChangeParser.CONSTANTS`

    - ### Nested classes/interfaces inherited from class org.seamless.xml.SAXParser

      `org.seamless.xml.SAXParser.Handler<I>, org.seamless.xml.SAXParser.SimpleErrorHandler`

  - ### Field Summary

    - ### Fields inherited from class org.seamless.xml.SAXParser

      `XML_SCHEMA_NAMESPACE, XML_SCHEMA_RESOURCE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LastChangeParser()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Document` | `buildDOM(Event event)`
    `protected EventedValue` | `createValue(String name, Map.Entry<String,String>[] attributes)`
    `String` | `generate(Event event)`
    `protected void` | `generateEventedValue(EventedValue eventedValue, Document descriptor, Element parentElement)`
    `protected void` | `generateInstanceIDs(Event event, Document descriptor, Element rootElement)`
    `protected void` | `generateRoot(Event event, Document descriptor)`
    `protected Set<Class<? extends EventedValue>>` | `getEventedVariables()`
    `protected abstract String` | `getNamespace()`
    `Event` | `parse(String xml)`
    `Event` | `parseResource(String resource)` Uses the current thread's context classloader to read and unmarshall the given resource.

    - ### Methods inherited from class org.seamless.xml.SAXParser

      `create, createSchema, getErrorHandler, getSchemaSources, parse, setContentHandler`

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

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

- - ### Constructor Detail

    - #### LastChangeParser

          public LastChangeParser()

  - ### Method Detail

    - #### getNamespace

          protected abstract String getNamespace()

    - #### getEventedVariables

          protected Set<Class<? extends EventedValue>> getEventedVariables()

    - #### createValue

          protected EventedValue createValue(String name,
                                 Map.Entry<String,String>[] attributes)
                                      throws Exception

      Throws:
        `Exception`

    - #### parseResource

          public Event parseResource(String resource)
                              throws Exception

      Uses the current thread's context classloader to read and unmarshall the given resource.
      Parameters:
        `resource` - The resource on the classpath.
      Returns:
        The unmarshalled Event model.
      Throws:
        `Exception`

    - #### parse

          public Event parse(String xml)
                      throws Exception

      Throws:
        `Exception`

    - #### generate

          public String generate(Event event)
                          throws Exception

      Throws:
        `Exception`

    - #### buildDOM

          protected Document buildDOM(Event event)
                               throws Exception

      Throws:
        `Exception`

    - #### generateRoot

          protected void generateRoot(Event event,
                          Document descriptor)

    - #### generateInstanceIDs

          protected void generateInstanceIDs(Event event,
                                 Document descriptor,
                                 Element rootElement)

    - #### generateEventedValue

          protected void generateEventedValue(EventedValue eventedValue,
                                  Document descriptor,
                                  Element parentElement)

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