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

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

All Implemented Interfaces:
  Iterable<NodeTypeDefinition>

Deprecated. Use `NodeTypeManager.registerNodeTypes(java.io.InputStream, boolean)` instead

    @Deprecated
    public class JackrabbitXmlNodeTypeReader

extends Object

A class that reads node types from Jackrabbit XML files.

Typically, the class will be used like this:

     Session session = ...
     // Instantiate the reader and load one or more files ...
     JackrabbitXmlNodeTypeReader reader = new JackrabbitXmlNodeTypeReader(session);
     reader.read(file); // or stream or resource file

     if (!reader.getProblems().isEmpty()) {
         // Report problems
     } else {
         // Use the standard JCR API to register the loaded node types ...
         boolean allowUpdate = false;
         session.getWorkspace().getNodeTypeManager().registerNodeTypes(reader.getNodeTypeDefinitions(), allowUpdate);
     }

The format of the XML is defined by this DTD:

     <!ELEMENT nodeTypes (nodeType)*>
         <!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)>

         <!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)>

         <!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)>

Nested Class Summary
`protected static class` | `JackrabbitXmlNodeTypeReader.XmlImporter` Deprecated.

Field Summary
`protected ValueFactory<Boolean>` | `booleanFactory`
`protected ExecutionContext` | `context`
`protected List<NodeTypeDefinition>` | `immutableTypes`
`protected NameFactory` | `nameFactory`
`protected PathFactory` | `pathFactory`
`protected Problems` | `problems`
`protected Path` | `root`
`protected ValueFactory<String>` | `stringFactory`
`protected List<NodeTypeDefinition>` | `types`
`protected ValueFactories` | `valueFactories`

Constructor Summary
`JackrabbitXmlNodeTypeReader(ExecutionContext context)` Deprecated. Create a new node type factory that reads the node types from Jackrabbit XML files.
`JackrabbitXmlNodeTypeReader(Session session)` Deprecated. Create a new node type factory that reads the node types from Jackrabbit XML files.

Method Summary
`protected NodeDefinitionTemplate` | `childNodeDefinitionFrom(Subgraph nodeTypeGraph, Location childNodeLocation)`
`ExecutionContext` | `getExecutionContext()` Get the execution context used by this reader.
`NamespaceRegistry` | `getNamespaceRegistry()` Get the namespace registry used by this reader.
`Set<NamespaceRegistry.Namespace>` | `getNamespaces()` Get the namespaces that were created when reading in node types.
`NodeTypeDefinition[]` | `getNodeTypeDefinitions()` Deprecated. Returns the node type definitions created by this factory.
`Problems` | `getProblems()` Deprecated. Get the problems where warnings and error messages were recorded by this factory.
`protected void` | `importFrom(Destination destination, Path path, String content, String resourceName)` Deprecated. Method that loads into the graph destination the content containing the node type definitions.
`Iterator<NodeTypeDefinition>` | `iterator()` Deprecated.
`protected Name` | `name(String name)`
`protected Name` | `nameFrom(SubgraphNode node)`
`protected NodeTypeTemplate` | `nodeTypeFrom(SubgraphNode nodeTypeNode, Subgraph subgraph)`
`protected PropertyDefinitionTemplate` | `propertyDefinitionFrom(Subgraph nodeTypeGraph, Location propertyLocation)`
`void` | `read(File file)` Deprecated. Import the node types from the supplied file and add all of the node type definitions to this factory's list.
`void` | `read(Graph graph, Path parentOfTypes, Collection<Name> nodeTypesToRead, String resourceName)` Import the node types from the supplied location in the specified graph.
`void` | `read(Graph graph, Path parentOfTypes, String resourceName)` Deprecated. Import the node types from the supplied location in the specified graph.
`void` | `read(InputStream stream, String resourceName)` Deprecated. Import the node types from the supplied stream and add all of the node type definitions to this factory's list.
`void` | `read(String resourceFile)` Deprecated. Import the node types from the file at the supplied path, and add all of the node type definitions to this factory's list.
`void` | `read(String content, String resourceName)` Deprecated. Import the node types from the supplied string and add all of the node type definitions to this factory's list.
`void` | `read(Subgraph subgraph, Location locationOfParent, String resourceName)` Deprecated. Import the node types from the supplied location in the specified graph.
`void` | `read(URL url)` Deprecated. Import the node types from the file at the supplied URL and add all of the node type definitions to this factory's list.
`protected boolean` | `readBoolean(SubgraphNode node, Name propertyName, boolean defaultValue)`
`protected boolean` | `readBoolean(SubgraphNode node, String propertyName, boolean defaultValue)`
`protected Name` | `readName(SubgraphNode node, Name propertyName, Name defaultValue)`
`protected Name` | `readName(SubgraphNode node, String propertyName, Name defaultValue)`
`protected List<Name>` | `readNames(SubgraphNode node, Name propertyName, Name defaultIfNone)`
`protected List<Name>` | `readNames(SubgraphNode node, String propertyName, Name defaultIfNone)`
`protected String` | `readString(SubgraphNode node, Name propertyName, String defaultValue)`
`protected String` | `readString(SubgraphNode node, String propertyName, String defaultValue)`
`protected List<String>` | `readStrings(SubgraphNode node, Name propertyName)`
`protected List<String>` | `readStrings(SubgraphNode node, String propertyName)`
`protected List<NodeTypeDefinition>` | `readTypesFrom(Graph graph, Path parentOfTypes, Collection<Name> nodeTypesToRead)`
`protected List<NodeTypeDefinition>` | `readTypesFrom(Subgraph nodeTypeSubgraph, Location locationOfParentOfNodeTypes, Collection<Name> nodeTypesToRead)`
`protected List<Value>` | `readValues(SubgraphNode node, Name propertyName, int requiredType)`
`protected String` | `string(Object value)`

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

Field Detail

### problems

    protected final Problems problems

### types

    protected final List<NodeTypeDefinition> types

### immutableTypes

    protected final List<NodeTypeDefinition> immutableTypes

### context

    protected final ExecutionContext context

### valueFactories

    protected final ValueFactories valueFactories

### pathFactory

    protected final PathFactory pathFactory

### nameFactory

    protected final NameFactory nameFactory

### booleanFactory

    protected final ValueFactory<Boolean> booleanFactory

### stringFactory

    protected final ValueFactory<String> stringFactory

### root

    protected final Path root

Constructor Detail

### JackrabbitXmlNodeTypeReader

    public JackrabbitXmlNodeTypeReader(Session session)

  Deprecated.
  Create a new node type factory that reads the node types from Jackrabbit XML files.

  Parameters:
    `session` - the session that will be used to register the node types; may not be null

### JackrabbitXmlNodeTypeReader

    public JackrabbitXmlNodeTypeReader(ExecutionContext context)

  Deprecated.
  Create a new node type factory that reads the node types from Jackrabbit XML files.

  Parameters:
    `context` - the context that will be used to load the node types; may not be null

Method Detail

### read

    public void read(InputStream stream,
                     String resourceName)
              throws IOException

  Deprecated.
  Import the node types from the supplied stream and add all of the node type definitions to this factory's list. This method will close the stream.

  Parameters:
    `stream` - the stream containing the CND content
    `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

### read

    public void read(File file)
              throws IOException

  Deprecated.
  Import the node types from the supplied file and add all of the node type definitions to this factory's list.

  Parameters:
    `file` - the file containing the node types
  Throws:
    `IllegalArgumentException` - if the supplied file reference is null, or if the file does not exist or is not readable
    `IOException` - if there is a problem reading from the supplied stream

### read

    public void read(URL url)
              throws IOException

  Deprecated.
  Import the node types from the file at the supplied URL and add all of the node type definitions to this factory's list.

  Parameters:
    `url` - the URL to the file containing the node types
  Throws:
    `IllegalArgumentException` - if the supplied URL is null
    `IOException` - if there is a problem opening or reading the stream to the supplied URL

### read

    public void read(String resourceFile)
              throws IOException

  Deprecated.
  Import the node types from the file at the supplied path, and add all of the node type definitions to this factory's list. This method first attempts to resolve the supplied path to a resource on the classpath. If such a resource could not be found, this method considers the supplied argument as the path to an existing and readable file. If that does not succeed, this method treats the supplied argument as a valid and resolvable URL.

  Parameters:
    `resourceFile` - the name of the resource file on the classpath containing the node types
  Throws:
    `IllegalArgumentException` - if the supplied string is null or empty
    `IOException` - if there is a problem reading from the supplied resource, or if the resource could not be found

### read

    public void read(String content,
                     String resourceName)

  Deprecated.
  Import the node types from the supplied string and add all of the node type definitions to this factory's list.

  Parameters:
    `content` - the string containing the CND content
    `resourceName` - a logical name for the resource name to be used when reporting problems; may be null if there is no useful name

### read

    public void read(Graph graph,
                     Path parentOfTypes,
                     String resourceName)

  Deprecated.
  Import the node types from the supplied location in the specified graph.

  Parameters:
    `graph` - the graph containing the standard ModeShape CND content
    `parentOfTypes` - the path to the parent of the node type definition nodes
    `resourceName` - a logical name for the resource name to be used when reporting problems; may be null if there is no useful name

### read

    public void read(Subgraph subgraph,
                     Location locationOfParent,
                     String resourceName)

  Deprecated.
  Import the node types from the supplied location in the specified graph.

  Parameters:
    `subgraph` - the subgraph containing the standard ModeShape CND content
    `locationOfParent` - the location to the parent of the node type definition nodes
    `resourceName` - a logical name for the resource name to be used when reporting problems; may be null if there is no useful name

### getProblems

    public Problems getProblems()

  Deprecated.
  Get the problems where warnings and error messages were recorded by this factory.

  Returns:
    the problems; never null

### getNodeTypeDefinitions

    public NodeTypeDefinition[] getNodeTypeDefinitions()

  Deprecated.
  Returns the node type definitions created by this factory.

  Returns:
    the `NodeTypeDefinition`s

### iterator

    public Iterator<NodeTypeDefinition> iterator()

  Deprecated.

  Specified by:
    `iterator` in interface `Iterable<NodeTypeDefinition>`
  See Also:
    `Iterable.iterator()`

### importFrom

    protected void importFrom(Destination destination,
                              Path path,
                              String content,
                              String resourceName)
                       throws Exception

  Deprecated.
  Method that loads into the graph destination the content containing the node type definitions.

  Parameters:
    `destination` - the destination to which the node type content should be written; never null
    `path` - the path within the destination at which the node type content should be rooted; never null
    `content` - the content containing some string representation of the node types to be imported; never null
    `resourceName` - a descriptive name for this import (used only for error messages); may be null
  Throws:
    `Exception` - if there is a problem importing from the content; this will be automatically recorded in the problems
  See Also:
    `GraphNodeTypeReader.importFrom(org.modeshape.graph.io.Destination, org.modeshape.graph.property.Path, java.lang.String, java.lang.String)`

### read

    public void read(Graph graph,
                     Path parentOfTypes,
                     Collection<Name> nodeTypesToRead,
                     String resourceName)

  Import the node types from the supplied location in the specified graph.

  Parameters:
    `graph` - the graph containing the standard ModeShape CND content
    `parentOfTypes` - the path to the parent of the node type definition nodes
    `nodeTypesToRead` - the names of the node types that should be read; null means that all node types should be read
    `resourceName` - a logical name for the resource name to be used when reporting problems; may be null if there is no useful name

### getExecutionContext

    public ExecutionContext getExecutionContext()

  Get the execution context used by this reader. This context is different than what was supplied in the constructor, and will have a local `NamespaceRegistry`. This prevents the reader from modifying the registry in the supplied context.

  Returns:
    the execution context; never null

### getNamespaceRegistry

    public NamespaceRegistry getNamespaceRegistry()

  Get the namespace registry used by this reader.

  Returns:
    the namespace registry; never null

### getNamespaces

    public Set<NamespaceRegistry.Namespace> getNamespaces()

  Get the namespaces that were created when reading in node types.

  Returns:
    the namespaces; never null

### readTypesFrom

    protected List<NodeTypeDefinition> readTypesFrom(Graph graph,
                                                     Path parentOfTypes,
                                                     Collection<Name> nodeTypesToRead)

### readTypesFrom

    protected List<NodeTypeDefinition> readTypesFrom(Subgraph nodeTypeSubgraph,
                                                     Location locationOfParentOfNodeTypes,
                                                     Collection<Name> nodeTypesToRead)

### nodeTypeFrom

    protected NodeTypeTemplate nodeTypeFrom(SubgraphNode nodeTypeNode,
                                            Subgraph subgraph)
                                     throws ConstraintViolationException

  Throws:
    `ConstraintViolationException`

### propertyDefinitionFrom

    protected PropertyDefinitionTemplate propertyDefinitionFrom(Subgraph nodeTypeGraph,
                                                                Location propertyLocation)
                                                         throws ConstraintViolationException

  Throws:
    `ConstraintViolationException`

### childNodeDefinitionFrom

    protected NodeDefinitionTemplate childNodeDefinitionFrom(Subgraph nodeTypeGraph,
                                                             Location childNodeLocation)
                                                      throws ConstraintViolationException

  Throws:
    `ConstraintViolationException`

### nameFrom

    protected Name nameFrom(SubgraphNode node)

### name

    protected Name name(String name)

### string

    protected String string(Object value)

### readBoolean

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

### readBoolean

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

### readString

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

### readString

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

### readStrings

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

### readStrings

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

### readValues

    protected List<Value> readValues(SubgraphNode node,
                                     Name propertyName,
                                     int requiredType)

### readName

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

### readName

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

### readNames

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

### readNames

    protected List<Name> readNames(SubgraphNode node,
                                   Name 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-2011 JBoss, a division of Red Hat. All Rights Reserved.