JBoss Community Archive (Read Only)

ModeShape 2.8

ZIP File Sequencer

The ZIP file sequencer is included in ModeShape and extracts the files and folders contained in the ZIP archive file, extracting the files and folders into the repository using JCR's nt:file and nt:folder built-in node types. The structure of the output thus matches the logical structure of the contents of the ZIP file.

ExampleThis sequencer generates a graph structure that maps to the files and folders in the ZIP file. An example (listed in the JCR document view) from sequencing a ZIP file written into /a/foo and containing one file, /x/y/z.txt is provided below:

<foo jcr:primaryType="zip:file"
     mode:derivedFrom="/files/docForReferenceGuide.xml" >
  <x jcr:primaryType="nt:folder"
    <y jcr:primaryType="nt:folder"
      <z.txt jcr:primaryType="nt:file">
        <jcr:content jcr:primaryType="nt:resource"
                     jcr:data="This is the file content"
                     jcr:mimeType="text/plain" />

The CND for the zip:file node type is listed below.

[zip:file] > nt:folder, mix:mimeType

To use this sequencer, simply include the modeshape-sequencer-zip JAR in your application and configure the JcrConfiguration to use this sequencer using something similar to:

JcrConfiguration config = ...

config.sequencer("ZIP Sequencer")
      .setDescription("Sequences compressed files to extract the internal file and folder structure")
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:04:46 UTC, last content change 2011-12-06 22:23:03 UTC.