org.apache.jackrabbit.commons.cnd
Class CompactNodeTypeDefReader<T,N>

java.lang.Object
  extended by org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader<T,N>
Type Parameters:
T -
N -

public class CompactNodeTypeDefReader<T,N>
extends Object

CompactNodeTypeDefReader. Parses node type definitions written in the compact node type definition format and provides a list of type definition objects that can then be used to register node types.

The CompactNodeTypeDefReader is parameterizable in the type of the node type definition T and the type of the namespace mapping N which the parser should build. For types T and N the parser's constructor takes a DefinitionBuilderFactory for T and N.

The EBNF grammar of the compact node type definition:

 Cnd ::= {NamespaceMapping | NodeTypeDef}
 NamespaceMapping ::= '<' Prefix '=' Uri '>'
 Prefix ::= String
 Uri ::= String
 NodeTypeDef ::= NodeTypeName [Supertypes]
                 [NodeTypeAttribute {NodeTypeAttribute}]
                 {PropertyDef | ChildNodeDef}
 NodeTypeName ::= '[' String ']'
 Supertypes ::= '>' (StringList | '?')
 NodeTypeAttribute ::= Orderable | Mixin | Abstract | Query |
                       PrimaryItem
 Orderable ::= ('orderable' | 'ord' | 'o') ['?']
 Mixin ::= ('mixin' | 'mix' | 'm') ['?']
 Abstract ::= ('abstract' | 'abs' | 'a') ['?']
 Query ::= ('noquery' | 'nq') | ('query' | 'q' )
 PrimaryItem ::= ('primaryitem'| '!')(String | '?')
 PropertyDef ::= PropertyName [PropertyType] [DefaultValues]
                 [PropertyAttribute {PropertyAttribute}]
                 [ValueConstraints]
 PropertyName ::= '-' String
 PropertyType ::= '(' ('STRING' | 'BINARY' | 'LONG' | 'DOUBLE' |
                       'BOOLEAN' | 'DATE' | 'NAME' | 'PATH' |
                       'REFERENCE' | 'WEAKREFERENCE' |
                       'DECIMAL' | 'URI' | 'UNDEFINED' | '*' |
                       '?') ')'
 DefaultValues ::= '=' (StringList | '?')
 ValueConstraints ::= '<' (StringList | '?')
 ChildNodeDef ::= NodeName [RequiredTypes] [DefaultType]
                  [NodeAttribute {NodeAttribute}]
 NodeName ::= '+' String
 RequiredTypes ::= '(' (StringList | '?') ')'
 DefaultType ::= '=' (String | '?')
 PropertyAttribute ::= Autocreated | Mandatory | Protected |
                       Opv | Multiple | QueryOps | NoFullText |
                       NoQueryOrder
 NodeAttribute ::= Autocreated | Mandatory | Protected |
                   Opv | Sns
 Autocreated ::= ('autocreated' | 'aut' | 'a' )['?']
 Mandatory ::= ('mandatory' | 'man' | 'm') ['?']
 Protected ::= ('protected' | 'pro' | 'p') ['?']
 Opv ::= 'COPY' | 'VERSION' | 'INITIALIZE' | 'COMPUTE' |
         'IGNORE' | 'ABORT' | ('OPV' '?')
 Multiple ::= ('multiple' | 'mul' | '*') ['?']
 QueryOps ::= ('queryops' | 'qop')
              (('''Operator {','Operator}''') | '?')
 Operator ::= '=' | '<>' | '<' | '<=' | '>' | '>=' | 'LIKE'
 NoFullText ::= ('nofulltext' | 'nof') ['?']
 NoQueryOrder ::= ('noqueryorder' | 'nqord') ['?']
 Sns ::= ('sns' | '*') ['?']
 StringList ::= String {',' String}
 String ::= QuotedString | UnquotedString
 QuotedString ::= SingleQuotedString | DoubleQuotedString
 SingleQuotedString ::= ''' UnquotedString '''
 DoubleQuotedString ::= '"' UnquotedString '"'
 UnquotedString ::= XmlChar {XmlChar}
 XmlChar ::= see 3.2.2 Local Names
 


Constructor Summary
CompactNodeTypeDefReader(Reader r, String systemId, DefinitionBuilderFactory<T,N> factory)
          Creates a new CND reader and parses the given stream.
CompactNodeTypeDefReader(Reader r, String systemId, N nsMapping, DefinitionBuilderFactory<T,N> factory)
          Creates a new CND reader and parses the given stream.
 
Method Summary
 N getNamespaceMapping()
          Returns the namespace mapping.
 List<T> getNodeTypeDefinitions()
          Returns the list of parsed node type definitions definitions.
 String getSystemId()
          Returns the previously assigned system id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompactNodeTypeDefReader

public CompactNodeTypeDefReader(Reader r,
                                String systemId,
                                DefinitionBuilderFactory<T,N> factory)
                         throws ParseException
Creates a new CND reader and parses the given stream.

Parameters:
r - a reader to the CND
systemId - a informative id of the given stream
factory - builder for creating new definitions and handling namespaces
Throws:
ParseException - if an error occurs

CompactNodeTypeDefReader

public CompactNodeTypeDefReader(Reader r,
                                String systemId,
                                N nsMapping,
                                DefinitionBuilderFactory<T,N> factory)
                         throws ParseException
Creates a new CND reader and parses the given stream.

Parameters:
r - a reader to the CND
systemId - a informative id of the given stream
nsMapping - default namespace mapping to use
factory - builder for creating new definitions and handling namespaces
Throws:
ParseException - if an error occurs
Method Detail

getSystemId

public String getSystemId()
Returns the previously assigned system id

Returns:
the system id

getNodeTypeDefinitions

public List<T> getNodeTypeDefinitions()
Returns the list of parsed node type definitions definitions.

Returns:
a collection of node type definition objects

getNamespaceMapping

public N getNamespaceMapping()
Returns the namespace mapping.

Returns:


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.