Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr
Class JackrabbitXmlNodeTypeReader.XmlImporter

    java.lang.Object
      org.modeshape.jcr.JackrabbitXmlNodeTypeReader.XmlImporter

Enclosing class:
  JackrabbitXmlNodeTypeReader

    protected static class JackrabbitXmlNodeTypeReader.XmlImporter

extends Object

Field Summary
`protected Destination` | `destination`
`protected NameFactory` | `nameFactory`
`protected Path` | `outputPath`
`protected PathFactory` | `pathFactory`
`protected PropertyFactory` | `propertyFactory`
`protected List<String>` | `VALID_ON_PARENT_VERSION`
`protected ValueFactories` | `valueFactories`

Constructor Summary
`JackrabbitXmlNodeTypeReader.XmlImporter(Destination destination, Path parentPath)` Create a new importer that will place the content in the supplied destination under the supplied path.
`JackrabbitXmlNodeTypeReader.XmlImporter(Destination destination, Path parentPath, boolean compatibleWithPreJcr2)` Create a new importer that will place the content in the supplied destination under the supplied path.

Method Summary
`void` | `importFrom(File file, Problems problems)` Import the CND content from the supplied stream, placing the content into the importer's destination.
`void` | `importFrom(InputStream stream, Problems problems, String resourceName)` Import the CND content from the supplied stream, placing the content into the importer's destination.
`void` | `importFrom(String content, Problems problems, String resourceName)` Import the CND content from the supplied stream, placing the content into the importer's destination.
`protected Name` | `name(String name)`
`protected Name` | `nameFrom(SubgraphNode node)`
`protected void` | `parse(InputStream content, Problems problems, String resourceName)` Parse the XML content.
`protected void` | `parseChildNodeDefinition(Subgraph subgraph, SubgraphNode childDefn, Path parentPath)` Read the property definition from the graph and create the corresponding CND content in the destination.
`protected void` | `parseNodeType(Subgraph subgraph, SubgraphNode nodeType, Path parentPath)` Parse the node type element.
`protected void` | `parsePropertyDefinition(Subgraph subgraph, SubgraphNode propertyDefn, Path parentPath)` Read the property definition from the graph and create the corresponding CND content in the destination.
`protected boolean` | `readBoolean(SubgraphNode node, String propertyName, boolean defaultValue)`
`protected Name` | `readName(SubgraphNode node, String propertyName, Name defaultValue)`
`protected List<Name>` | `readNames(SubgraphNode node, String propertyName, Name defaultIfNone)`
`protected String` | `readString(SubgraphNode node, String propertyName, String defaultValue)`
`protected List<String>` | `readStrings(SubgraphNode node, String propertyName)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### VALID_ON_PARENT_VERSION

    protected final List<String> VALID_ON_PARENT_VERSION

### destination

    protected final Destination destination

### outputPath

    protected final Path outputPath

### propertyFactory

    protected final PropertyFactory propertyFactory

### pathFactory

    protected final PathFactory pathFactory

### nameFactory

    protected final NameFactory nameFactory

### valueFactories

    protected final ValueFactories valueFactories

Constructor Detail

### JackrabbitXmlNodeTypeReader.XmlImporter

    public JackrabbitXmlNodeTypeReader.XmlImporter(Destination destination,
                                                   Path parentPath,
                                                   boolean compatibleWithPreJcr2)

  Create a new importer that will place the content in the supplied destination under the supplied path.

  Parameters:
    `destination` - the destination where content is to be written
    `parentPath` - the path in the destination below which the generated content is to appear
    `compatibleWithPreJcr2` - true if this parser should accept the CND format that was used in the reference implementation prior to JCR 2.0.
  Throws:
    `IllegalArgumentException` - if either parameter is null

### JackrabbitXmlNodeTypeReader.XmlImporter

    public JackrabbitXmlNodeTypeReader.XmlImporter(Destination destination,
                                                   Path parentPath)

  Create a new importer that will place the content in the supplied destination under the supplied path. This parser will accept the Jackrabbit XML format.

  Parameters:
    `destination` - the destination where content is to be written
    `parentPath` - the path in the destination below which the generated content is to appear
  Throws:
    `IllegalArgumentException` - if either parameter is null

Method Detail

### importFrom

    public void importFrom(InputStream stream,
                           Problems problems,
                           String resourceName)
                    throws SAXException,
                           IOException

  Import the CND content from the supplied stream, placing the content into the importer's destination.

  Parameters:
    `stream` - the stream containing the CND content
    `problems` - where any problems encountered during import should be reported
    `resourceName` - a logical name for the resource name to be used when reporting problems; may be null if there is no useful name
  Throws:
    `IOException` - if there is a problem reading from the supplied stream
    `SAXException` - if there is an error in the XML

### importFrom

    public void importFrom(File file,
                           Problems problems)
                    throws SAXException,
                           IOException

  Import the CND content from the supplied stream, placing the content into the importer's destination.

  Parameters:
    `file` - the file containing the CND content
    `problems` - where any problems encountered during import should be reported
  Throws:
    `IOException` - if there is a problem reading from the supplied file
    `SAXException` - if there is an error in the XML

### importFrom

    public void importFrom(String content,
                           Problems problems,
                           String resourceName)
                    throws SAXException,
                           IOException

  Import the CND content from the supplied stream, placing the content into the importer's destination.

  Parameters:
    `content` - the string containing the CND content
    `problems` - where any problems encountered during import should be reported
    `resourceName` - a logical name for the resource name to be used when reporting problems; may be null if there is no useful name
  Throws:
    `IOException` - if there is a problem reading from the supplied string
    `SAXException` - if there is an error in the XML

### parse

    protected void parse(InputStream content,
                         Problems problems,
                         String resourceName)
                  throws SAXException,
                         IOException

  Parse the XML content.

  Parameters:
    `content` - the content
    `problems` - where any problems encountered during import should be reported
    `resourceName` - a logical name for the resource name to be used when reporting problems; may be null if there is no useful name
  Throws:
    `IOException` - if there is a problem reading from the supplied stream
    `SAXException` - if there is an error in the XML

### parseNodeType

    protected void parseNodeType(Subgraph subgraph,
                                 SubgraphNode nodeType,
                                 Path parentPath)

  Parse the node type element.

           <!ELEMENT nodeType (supertypes?|propertyDefinition*|childNodeDefinition*)>
           <!ATTLIST nodeType
                   name CDATA #REQUIRED
                   isMixin (true|false) #REQUIRED
                    hasOrderableChildNodes (true|false) #REQUIRED
                   primaryItemName CDATA #REQUIRED
               >
           <!ELEMENT supertypes (supertype+)>
           <!ELEMENT supertype (CDATA)>

  Parameters:
    `subgraph` -
    `nodeType` -
    `parentPath` -

### parsePropertyDefinition

    protected void parsePropertyDefinition(Subgraph subgraph,
                                           SubgraphNode propertyDefn,
                                           Path parentPath)

  Read the property definition from the graph and create the corresponding CND content in the destination.

        <!ELEMENT propertyDefinition (valueConstraints?|defaultValues?)>
           <!ATTLIST propertyDefinition
                   name CDATA #REQUIRED
                   requiredType (String|Date|Path|Name|Reference|Binary|Double|Long|Boolean|undefined) #REQUIRED
                   autoCreated (true|false) #REQUIRED
                   mandatory (true|false) #REQUIRED
                   onParentVersion (COPY|VERSION|INITIALIZE|COMPUTE|IGNORE|ABORT) #REQUIRED
                   protected (true|false) #REQUIRED
                   multiple  (true|false) #REQUIRED
               >
           <!ELEMENT valueConstraints (valueConstraint+)>
           <!ELEMENT valueConstraint (CDATA)>
           <!ELEMENT defaultValues (defaultValue+)>
           <!ELEMENT defaultValue (CDATA)>

  Parameters:
    `subgraph` -
    `propertyDefn` -
    `parentPath` -

### parseChildNodeDefinition

    protected void parseChildNodeDefinition(Subgraph subgraph,
                                            SubgraphNode childDefn,
                                            Path parentPath)

  Read the property definition from the graph and create the corresponding CND content in the destination.

           <!ELEMENT childNodeDefinition (requiredPrimaryTypes)>
           <!ATTLIST childNodeDefinition
                   name CDATA #REQUIRED
                   defaultPrimaryType  CDATA #REQUIRED
                   autoCreated (true|false) #REQUIRED
                   mandatory (true|false) #REQUIRED
                   onParentVersion (COPY|VERSION|INITIALIZE|COMPUTE|IGNORE|ABORT) #REQUIRED
                   protected (true|false) #REQUIRED
                   sameNameSiblings (true|false) #REQUIRED
               >
           <!ELEMENT requiredPrimaryTypes (requiredPrimaryType+)>
           <!ELEMENT requiredPrimaryType (CDATA)>

  Parameters:
    `subgraph` -
    `childDefn` -
    `parentPath` -

### nameFrom

    protected Name nameFrom(SubgraphNode node)

### name

    protected Name name(String name)

### readBoolean

    protected boolean readBoolean(SubgraphNode node,
                                  String propertyName,
                                  boolean defaultValue)

### readString

    protected String readString(SubgraphNode node,
                                String propertyName,
                                String defaultValue)

### readStrings

    protected List<String> readStrings(SubgraphNode node,
                                       String propertyName)

### readName

    protected Name readName(SubgraphNode node,
                            String propertyName,
                            Name defaultValue)

### readNames

    protected List<Name> readNames(SubgraphNode node,
                                   String propertyName,
                                   Name defaultIfNone)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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