See: Description
Interface | Description |
---|---|
Sequencer.Context |
The sequencer context represents the complete context of a sequencer invocation.
|
Class | Description |
---|---|
Sequencer |
A component that reads recently-changed content (often uploaded files) and extracts additional information from the content.
|
But ModeShape does more. ModeShape sequencers can automatically unlock the structured information buried within all of those files, and this useful content derived from your files is then stored back in the repository where your client applications can search, access, and analyze it using the JCR API.
A repository can be configured to have any number of sequencers, and each one is configured to apply to content in the repository matching specific patterns. When content in the repository changes, ModeShape automatically looks to see which (if any) sequencers might be able to run on the changed content. If any of the sequencers do match, ModeShape automatically calls them by supplying the changed content. At that point, the sequencer's job is to process the supplied input, extract meaningful information, and write that derived information back into the repository where it can be accessed, searched and used by your client applications.
Implementing a sequencer is pretty straightforward:
Sequencer
abstract base class.execute(...)
method by processing the supplied input property and creating a node (or subgraph) that represents the structured output of the
input property.initialize(...)
method to register any custom node types and namespaces. Be sure your method only registers them if they don't exist.The output structure can take almost any form, and it is almost always specific to each kind of file being sequenced. For example, ModeShape comes with an image sequencer that extracts the simple metadata from different kinds of image files (e.g., JPEG, GIF, PNG, etc.). Another example is the Compact Node Definition (CND) sequencer that processes the CND files to extract and produce a structured representation of the node type definitions, property definitions, and child node definitions contained within the file.
There may be multiple sequencers that all output the same type of information. For example, ModeShape's Java class file sequencer and Java source file sequencer both generate an output structure that represents the Java AST. In this case, both types of files contain semantically similar information.
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.