Package org.iirds.dita.ot.plugin

# Class CompositeMetadataHandler

java.lang.Object
org.iirds.dita.ot.plugin.CompositeMetadataHandler

All Implemented Interfaces:
  `IirdsMetadataHandler`

public class CompositeMetadataHandler extends Object implements IirdsMetadataHandler
A composite metadata handler. It consists of other metadata handlers added by `addMetadataHandler(IirdsMetadataHandler)`. The methods delegate to all member handler.

Author:
  Martin Kreutzer, Empolis Information Management GmbH

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CompositeMetadataHandler()`
  `CompositeMetadataHandler(String name, IirdsMetadataHandler... handlers)`
  Create a composite metadata handler and provide the handlers

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addMetadataHandler(IirdsMetadataHandler handler)`
  Add an metadata handler
  `void`
  `addMetadataHandlers(Collection<IirdsMetadataHandler> handlers)`
  Adds metadata handlers
  `void`
  `addToModel(ToCNode node, org.apache.jena.rdf.model.Model model)`
  Adds extracted metadata of a topic or map to the iiRDS RDF model.
  `void`
  `completeModel(ToCNode root, org.apache.jena.rdf.model.Model model)`
  Perform any post-processes on the iiRDS RDF model, after all metadata handlers have done their extraction and model update jobs.
  `void`
  `extractMetadata(ToCNode node, Document document)`
  Extract metadata from an XML DOM of a topic or map.
  `List<IirdsMetadataHandler>`
  `getMetadataHandlers()`
  `String`
  `getName()`
  The name this metadata handler can be activated by from the `dita` command via parameters
  `void`
  `setName(String name)`
  `String`
  `toString()`

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

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

- ## Constructor Details

  - ### CompositeMetadataHandler

    public CompositeMetadataHandler()

  - ### CompositeMetadataHandler

    public CompositeMetadataHandler(String name, IirdsMetadataHandler... handlers)
    Create a composite metadata handler and provide the handlers
    Parameters:
      `name` - the name of this handler
      `handlers` - the handlers making up this composite metadata handler

- ## Method Details

  - ### getName

    public String getName()
    Description copied from interface: `IirdsMetadataHandler`
    The name this metadata handler can be activated by from the `dita` command via parameters
    Specified by:
      `getName` in interface `IirdsMetadataHandler`
    Returns:
      the unique name, should be short and comprehensible to users of the DITA OT.

  - ### setName

    public void setName(String name)

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### getMetadataHandlers

    public List<IirdsMetadataHandler> getMetadataHandlers()
    Returns:
      unmodifiable list of metadata handlers composing this metadata handler

  - ### addMetadataHandlers

    public void addMetadataHandlers(Collection<IirdsMetadataHandler> handlers)
    Adds metadata handlers
    Parameters:
      `handlers` - the metadata handlers to add

  - ### addMetadataHandler

    public void addMetadataHandler(IirdsMetadataHandler handler)
    Add an metadata handler
    Parameters:
      `handler` - the metadata handler to add

  - ### extractMetadata

    public void extractMetadata(ToCNode node, Document document)
    Description copied from interface: `IirdsMetadataHandler`
    Extract metadata from an XML DOM of a topic or map. Implementations should store the extracted metadata via `ToCNode.setProperty(String, Object)`. The key of the property should reflect the element / attribute where the metadata come form in order to achieve unique keys for the properties.
    Specified by:
      `extractMetadata` in interface `IirdsMetadataHandler`
    Parameters:
      `node` - the ToC node context
      `document` - the DOM to extract from

  - ### addToModel

    public void addToModel(ToCNode node, org.apache.jena.rdf.model.Model model)
    Description copied from interface: `IirdsMetadataHandler`
    Adds extracted metadata of a topic or map to the iiRDS RDF model. Implementations shall access the extracted metadata via `ToCNode.getProperty(String)`. The iiRDS `InformationUnit` has already been created when this method gets called and is accessible via `ToCNode.getInformationUnit()`
    Specified by:
      `addToModel` in interface `IirdsMetadataHandler`
    Parameters:
      `node` - the ToC node context
      `model` - the RDF model (graph) to work with and update

  - ### completeModel

    public void completeModel(ToCNode root, org.apache.jena.rdf.model.Model model)
    Description copied from interface: `IirdsMetadataHandler`
    Perform any post-processes on the iiRDS RDF model, after all metadata handlers have done their extraction and model update jobs. It should be used to complete the model, e.g. in the case mandatory metadata are missing. The default implementation does nothing. This method gets called only for the root node (usually the document). The implementation is free to `access` and manipulate any child nodes.
    Specified by:
      `completeModel` in interface `IirdsMetadataHandler`
    Parameters:
      `root` - the ToC node context
      `model` - the RDF model (graph) to work with