|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.modeshape.cnd.CndImporter
@NotThreadSafe public class CndImporter

A class that imports the node types contained in a JCR Compact Node Definition (CND) file into graph content. The content is
written using the graph structured defined by JCR and the "nt:nodeType", "nt:propertyDefinition", and "nt:childNodeDefinition" node types.
Although instances of this class never change their behavior and all processing is done in local contexts, Destination
is not thread-safe and therefore this component may not be considered thread-safe.
| Field Summary | |
|---|---|
protected Destination |
destination
|
protected boolean |
jcr170
|
protected NameFactory |
nameFactory
|
protected Path |
outputPath
|
protected PathFactory |
pathFactory
|
protected PropertyFactory |
propertyFactory
|
protected List<String> |
VALID_ON_PARENT_VERSION
|
protected List<String> |
VALID_PROPERTY_TYPES
|
protected Set<String> |
VALID_QUERY_OPERATORS
|
protected ValueFactories |
valueFactories
|
| Constructor Summary | |
|---|---|
CndImporter(Destination destination,
Path parentPath)
Create a new importer that will place the content in the supplied destination under the supplied path. |
|
CndImporter(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 void |
parse(String content)
Parse the CND content. |
protected void |
parseChildNodeDefinition(TokenStream tokens,
Path nodeTypePath)
Parse a node type's child node definition from the next tokens on the stream. |
protected void |
parseDefaultType(TokenStream tokens,
List<Property> properties)
Parse the child node definition's default type, if they appear next on the token stream. |
protected void |
parseDefaultValues(TokenStream tokens,
List<Property> properties)
Parse the property definition's default value, if they appear next on the token stream. |
protected Name |
parseName(TokenStream tokens)
Parse the name that is expected to be next on the token stream. |
protected List<Name> |
parseNameList(TokenStream tokens)
Parse a list of names, separated by commas. |
protected void |
parseNamespaceMapping(TokenStream tokens)
Parse the namespace mapping statement that is next on the token stream. |
protected void |
parseNodeAttributes(TokenStream tokens,
List<Property> properties,
Name childNodeDefnName,
Path childNodeDefnPath)
Parse the child node definition's attributes, if they appear next on the token stream. |
protected void |
parseNodeTypeDefinition(TokenStream tokens,
Path path)
Parse the node type definition that is next on the token stream. |
protected Name |
parseNodeTypeName(TokenStream tokens)
Parse a node type name that appears next on the token stream. |
protected void |
parseNodeTypeOptions(TokenStream tokens,
List<Property> properties)
Parse the options for the node types, including whether the node type is orderable, a mixin, abstract, whether it supports querying, and which property/child node (if any) is the primary item for the node type. |
protected void |
parsePropertyAttributes(TokenStream tokens,
List<Property> properties,
Name propDefnName,
Path propDefnPath)
Parse the property definition's attributes, if they appear next on the token stream. |
protected void |
parsePropertyDefinition(TokenStream tokens,
Path nodeTypePath)
Parse a node type's property definition from the next tokens on the stream. |
protected void |
parsePropertyOrChildNodeDefinitions(TokenStream tokens,
Path nodeTypePath)
Parse a node type's property or child node definitions that appear next on the token stream. |
protected void |
parsePropertyType(TokenStream tokens,
List<Property> properties,
String defaultPropertyType)
Parse the property type, if a valid one appears next on the token stream. |
protected void |
parseQueryOperators(TokenStream tokens,
List<Property> properties)
Parse the property definition's query operators, if they appear next on the token stream. |
protected void |
parseRequiredPrimaryTypes(TokenStream tokens,
List<Property> properties)
Parse the child node definition's list of required primary types, if they appear next on the token stream. |
protected List<String> |
parseStringList(TokenStream tokens)
Parse a list of strings, separated by commas. |
protected List<Name> |
parseSupertypes(TokenStream tokens)
Parse an optional list of supertypes if they appear next on the token stream. |
protected void |
parseValueConstraints(TokenStream tokens,
List<Property> properties)
Parse the property definition's value constraints, if they appear next on the token stream. |
protected String |
removeQuotes(String text)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final List<String> VALID_PROPERTY_TYPES
protected final List<String> VALID_ON_PARENT_VERSION
protected final Set<String> VALID_QUERY_OPERATORS
protected final Destination destination
protected final Path outputPath
protected final PropertyFactory propertyFactory
protected final PathFactory pathFactory
protected final NameFactory nameFactory
protected final ValueFactories valueFactories
protected final boolean jcr170
| Constructor Detail |
|---|
public CndImporter(Destination destination,
Path parentPath,
boolean compatibleWithPreJcr2)
destination - the destination where content is to be writtenparentPath - the path in the destination below which the generated content is to appearcompatibleWithPreJcr2 - true if this parser should accept the CND format that was used in the reference implementation
prior to JCR 2.0.
IllegalArgumentException - if either parameter is null
public CndImporter(Destination destination,
Path parentPath)
destination - the destination where content is to be writtenparentPath - the path in the destination below which the generated content is to appear
IllegalArgumentException - if either parameter is null| Method Detail |
|---|
public void importFrom(InputStream stream,
Problems problems,
String resourceName)
throws IOException
stream - the stream containing the CND contentproblems - where any problems encountered during import should be reportedresourceName - a logical name for the resource name to be used when reporting problems; may be null if there is no
useful name
IOException - if there is a problem reading from the supplied stream
public void importFrom(File file,
Problems problems)
throws IOException
file - the file containing the CND contentproblems - where any problems encountered during import should be reported
IOException - if there is a problem reading from the supplied stream
public void importFrom(String content,
Problems problems,
String resourceName)
content - the string containing the CND contentproblems - where any problems encountered during import should be reportedresourceName - a logical name for the resource name to be used when reporting problems; may be null if there is no
useful nameprotected void parse(String content)
content - the content
ParsingException - if there is a problem parsing the contentprotected void parseNamespaceMapping(TokenStream tokens)
tokens - the tokens containing the namespace statement; never null
ParsingException - if there is a problem parsing the content
protected void parseNodeTypeDefinition(TokenStream tokens,
Path path)
tokens - the tokens containing the node type definition; never nullpath - the path in the destination under which the node type definition should be stored; never null
ParsingException - if there is a problem parsing the contentprotected Name parseNodeTypeName(TokenStream tokens)
tokens - the tokens containing the node type name; never null
ParsingException - if there is a problem parsing the contentprotected List<Name> parseSupertypes(TokenStream tokens)
tokens - the tokens containing the supertype names; never null
ParsingException - if there is a problem parsing the contentprotected List<String> parseStringList(TokenStream tokens)
tokens - the tokens containing the comma-separated strings; never null
ParsingException - if there is a problem parsing the contentprotected List<Name> parseNameList(TokenStream tokens)
tokens - the tokens containing the comma-separated strings; never null
ParsingException - if there is a problem parsing the content
protected void parseNodeTypeOptions(TokenStream tokens,
List<Property> properties)
tokens - the tokens containing the comma-separated strings; never nullproperties - the list into which the properties that represent the options should be placed
ParsingException - if there is a problem parsing the content
protected void parsePropertyOrChildNodeDefinitions(TokenStream tokens,
Path nodeTypePath)
tokens - the tokens containing the definitions; never nullnodeTypePath - the path in the destination where the node type has been created, and under which the property and
child node type definitions should be placed
ParsingException - if there is a problem parsing the content
protected void parsePropertyDefinition(TokenStream tokens,
Path nodeTypePath)
tokens - the tokens containing the definition; never nullnodeTypePath - the path in the destination where the node type has been created, and under which the property and
child node type definitions should be placed
ParsingException - if there is a problem parsing the content
protected void parsePropertyType(TokenStream tokens,
List<Property> properties,
String defaultPropertyType)
tokens - the tokens containing the definition; never nullproperties - the list into which the property that represents the property type should be placeddefaultPropertyType - the default property type if none is actually found
ParsingException - if there is a problem parsing the content
protected void parseDefaultValues(TokenStream tokens,
List<Property> properties)
tokens - the tokens containing the definition; never nullproperties - the list into which the property that represents the default values should be placed
ParsingException - if there is a problem parsing the content
protected void parseValueConstraints(TokenStream tokens,
List<Property> properties)
tokens - the tokens containing the definition; never nullproperties - the list into which the property that represents the value constraints should be placed
ParsingException - if there is a problem parsing the content
protected void parsePropertyAttributes(TokenStream tokens,
List<Property> properties,
Name propDefnName,
Path propDefnPath)
tokens - the tokens containing the attributes; never nullproperties - the list into which the properties that represents the attributes should be placedpropDefnName - the name of the property definition; never nullpropDefnPath - the path in the destination to the property definition node; never null
ParsingException - if there is a problem parsing the content
protected void parseQueryOperators(TokenStream tokens,
List<Property> properties)
tokens - the tokens containing the definition; never nullproperties - the list into which the property that represents the value constraints should be placed
ParsingException - if there is a problem parsing the content
protected void parseChildNodeDefinition(TokenStream tokens,
Path nodeTypePath)
tokens - the tokens containing the definition; never nullnodeTypePath - the path in the destination where the node type has been created, and under which the child node type
definitions should be placed
ParsingException - if there is a problem parsing the content
protected void parseRequiredPrimaryTypes(TokenStream tokens,
List<Property> properties)
tokens - the tokens containing the definition; never nullproperties - the list into which the property that represents the required types should be placed
ParsingException - if there is a problem parsing the content
protected void parseDefaultType(TokenStream tokens,
List<Property> properties)
tokens - the tokens containing the definition; never nullproperties - the list into which the property that represents the default primary type should be placed
ParsingException - if there is a problem parsing the content
protected void parseNodeAttributes(TokenStream tokens,
List<Property> properties,
Name childNodeDefnName,
Path childNodeDefnPath)
tokens - the tokens containing the attributes; never nullproperties - the list into which the properties that represents the attributes should be placedchildNodeDefnName - the name of the child node definition; never nullchildNodeDefnPath - the path in the destination to the child node definition node; never null
ParsingException - if there is a problem parsing the contentprotected Name parseName(TokenStream tokens)
tokens - the tokens containing the name; never null
ParsingException - if there is a problem parsing the contentprotected final String removeQuotes(String text)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||