此内容没有您所选择的语言版本。
15.2. Custom Sequencers
15.2.1. The Sequencer Framework
复制链接链接已复制到粘贴板!
		A sequencer is actually a plain old Java object (POJO). To create a sequencer, create a Java class that extends a single abstract class, called 
Sequencer :
	
		The abstract class also contains fields and getters (not shown above) for the name, description, and path expressions that are automatically set by the hierarchical database during repository initialization. The 
initialize(...) method is run upon repository initialization and can be overridden by an implementation to register (if required) any custom namespaces and node types required by the sequencer's generated output.
	Note
			The 
outputNode might belong to a different javax.jcr.Session object than the inputProperty , if the input and output paths of the sequencer configuration specify different workspaces. Therefore, be careful that all changes are made using the output node and its session.
		
		The inputs to the sequencer depend on how it is configured, but often the 
inputProperty represents the jcr:data BINARY property on the jcr:content child of an nt:file node. The outputNode , however, will be one of two things:
	- If there is no output path in the path expression, then the sequenced output is to be placed directly under the selected node, so therefore theoutputNodewill be the existing node being sequenced. In this case, the sequencer should place all content under the output node. In this case, the sequencers are not allowed to change the primary type.
- Otherwise, the sequenced output is to be placed in a different location than the selected node. In this case, the hierarchical database uses the name of the selected node and creates a new node under the output path. This new node will have a primary type ofnt:unstructured, but sequencers are allowed to change the primary type.
		The final parameter to the 
execute(...) method is the SequencerContext object, which is an interface containing some extra information often useful when sequencing files: