org.modeshape.sequencer.msoffice

## Class MSOfficeMetadataSequencer

- java.lang.Object
- - org.modeshape.jcr.api.sequencer.Sequencer
  - - org.modeshape.sequencer.msoffice.MSOfficeMetadataSequencer

-     public class MSOfficeMetadataSequencer
      extends Sequencer

  A sequencer that processes the content of an MS Office document, extracts the metadata for the file, and then writes that metadata to the repository.

  This sequencer produces data that corresponds to the following structure:

  - msoffice:metadata node of type `msoffice:metadata`
    - msoffice:title optional string property for the title of the documnt
    - msoffice:subject optional string property for the subject of the document
    - msoffice:author optional string property for the author of the document
    - msoffice:keywords optional string property for the document keywords
    - msoffice:comment optional string property for the document comment
    - msoffice:template optional string property for the template from which this document originates
    - msoffice:last_saved_by optional string property for the person that last saved this document
    - msoffice:revision optional string property for this document revision
    - msoffice:total_editing_time optional long property for the length this document has been edited
    - msoffice:last_printed optional date property for the date of last printing this document
    - msoffice:created date property for the date of creation of the document
    - msoffice:saved date property for the date of last save of this document
    - msoffice:pages long property for the number of pages of this document
    - msoffice:words long property for the number of words in this document
    - msoffice:characters long property for the number of characters in this document
    - msoffice:creating_application string property for the application used to create this document
    - msoffice:thumbnail optional binary property for the thumbanail of this document
    - msoffice:full_contents optional String property holding the text contents of an excel file
    - msoffice:sheet_name optional String property for the name of a sheet in excel (multiple)
  - msoffice:slide node of type `msoffice:pptslide`
    - msoffice:title optional String property for the title of a slide
    - msoffice:notes optional String property for the notes of a slide
    - msoffice:text optional String property for the text of a slide
    - msoffice:thumbnail optional binary property for the thumbnail of a slide (PNG image)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `MSOfficeMetadataSequencer.MimeTypeConstants`

    - ### Nested classes/interfaces inherited from class org.modeshape.jcr.api.sequencer.Sequencer

      `Sequencer.Context`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MSOfficeMetadataSequencer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `execute(Property inputProperty, Node outputNode, Sequencer.Context context)` Execute the sequencing operation on the specified property, which has recently been created or changed.
    `void` | `initialize(NamespaceRegistry registry, NodeTypeManager nodeTypeManager)` Initialize the sequencer.

    - ### Methods inherited from class org.modeshape.jcr.api.sequencer.Sequencer

      `getAcceptedMimeTypes, getLogger, getName, getPathExpressions, getRepositoryName, getUniqueId, hasAcceptedMimeTypes, isAccepted, registerDefaultMimeTypes, registerNamespace, registerNodeTypes, registerNodeTypes, toString`

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

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

- - ### Constructor Detail

    - #### MSOfficeMetadataSequencer

          public MSOfficeMetadataSequencer()

  - ### Method Detail

    - #### initialize

          public void initialize(NamespaceRegistry registry,
                        NodeTypeManager nodeTypeManager)
                          throws RepositoryException,
                                 IOException

      Description copied from class: `Sequencer`
      Initialize the sequencer. This is called automatically by ModeShape once for each Sequencer instance, and should not be called by the sequencer.

      By default this method does nothing, so it should be overridden by implementations to do a one-time initialization of any internal components. For example, sequencers can use the supplied `registry` and `nodeTypeManager` objects to register custom namesapces and node types required by the generated content.

      Overrides:
        `initialize` in class `Sequencer`
      Parameters:
        `registry` - the namespace registry that can be used to register custom namespaces; never null
        `nodeTypeManager` - the node type manager that can be used to register custom node types; never null
      Throws:
        `RepositoryException` - if operations on the `NamespaceRegistry` or `NodeTypeManager` fail
        `IOException` - if any stream based operations fail (like importing cnd files)

    - #### execute

          public boolean execute(Property inputProperty,
                        Node outputNode,
                        Sequencer.Context context)
                          throws Exception

      Description copied from class: `Sequencer`
      Execute the sequencing operation on the specified property, which has recently been created or changed.

      Each sequencer is expected to process the value of the property, extract information from the value, and write a structured representation (in the form of a node or a subgraph of nodes) using the supplied output node. Note that the output node will either be:

      1. the selected node, in which case the sequencer was configured to generate the output information directly under the selected input node; or
      2. a newly created node in a different location than node being sequenced (in this case, the primary type of the new node will be 'nt:unstructured', but the sequencer can easily change that using `Node.setPrimaryType(String)`)

      The implementation is expected to always clean up all resources that it acquired, even in the case of exceptions.

      Note: This method must be threadsafe: ModeShape will likely invoke this method concurrently in separate threads, and the method should never modify the state or fields of the Sequencer implementation class. All initialization should be performed in `Sequencer.initialize(NamespaceRegistry, NodeTypeManager)`.

      Specified by:
        `execute` in class `Sequencer`
      Parameters:
        `inputProperty` - the property that was changed and that should be used as the input; never null
        `outputNode` - the node that represents the output for the derived information; never null, and will either be `new` if the output is being placed outside of the selected node, or will not be new when the output is to be placed on the selected input node
        `context` - the context in which this sequencer is executing, and which may contain additional parameters useful when generating the output structure; never null
      Returns:
        true if the sequencer's output should be saved, or false otherwise
      Throws:
        `Exception` - if there was a problem with the sequencer that could not be handled. All exceptions will be logged automatically as errors by ModeShape.

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.