jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Reschke <julian.resc...@gmx.de>
Subject reading CND using regexps
Date Thu, 03 May 2012 16:48:33 GMT
Jukka,

how attached are you to that code?

It appears that the failures left in PredefinedNodeTypeTests may not be 
trivial to fix; maybe it would be better to re-use code from the jcr 
commons CompactNodeTypeDefReader?

Best regards, Julian

On 2012-05-03 18:43, reschke@apache.org wrote:
> Author: reschke
> Date: Thu May  3 16:43:57 2012
> New Revision: 1333544
>
> URL: http://svn.apache.org/viewvc?rev=1333544&view=rev
> Log:
> OAK-66: fix minor CND parsing problems
>
> Modified:
>      jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
>
> Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
> URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java?rev=1333544&r1=1333543&r2=1333544&view=diff
> ==============================================================================
> --- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
(original)
> +++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
Thu May  3 16:43:57 2012
> @@ -48,7 +48,7 @@ class NodeTypeImpl implements NodeType {
>
>       private static final Pattern DEF_PATTERN = Pattern.compile(
>               "  ([\\+\\-]) (\\S+) \\((\\S+?)\\)( = (\\S+))?"
> -            + "(( (mandatory|autocreated|protected|multiple))*)"
> +            + "(( (mandatory|autocreated|protected|multiple|sns))*)"
>               + "( ([A-Z]+))?(.*)");
>
>       private final NodeTypeManager manager;
> @@ -85,8 +85,8 @@ class NodeTypeImpl implements NodeType {
>
>           this.isAbstract = matcher.group(5) != null;
>           this.mixin = matcher.group(4) != null;
> -        this.hasOrderableChildNodes = matcher.group(7) != null;
> -        this.primaryItemName = matcher.group(8);
> +        this.hasOrderableChildNodes = matcher.group(6) != null;
> +        this.primaryItemName = matcher.group(7);
>
>           String supertypes = matcher.group(2);
>           if (supertypes != null)  {
> @@ -112,6 +112,7 @@ class NodeTypeImpl implements NodeType {
>                   boolean autoCreated = matcher.group(6).contains(" autocreated");
>                   boolean isProtected = matcher.group(6).contains(" protected");
>                   boolean multiple = matcher.group(6).contains(" multiple");
> +                boolean allowSNS = matcher.group(6).contains(" sns");
>
>                   int onParentVersionAction = OnParentVersionAction.COPY;
>                   if (matcher.group(10) != null) {
> @@ -123,7 +124,7 @@ class NodeTypeImpl implements NodeType {
>                       declaredChildNodeDefinitions.add(new NodeDefinitionImpl(
>                               this, mapper, defName, autoCreated, mandatory,
>                               onParentVersionAction, isProtected, manager,
> -                            defType.split(", "), matcher.group(5), false));
> +                            defType.split(", "), matcher.group(5), allowSNS));
>                   } else if ("-".equals(matcher.group(1))) {
>                       declaredPropertyDefinitions.add(new PropertyDefinitionImpl(
>                               this, mapper, defName, autoCreated, mandatory,
>
>
>


Mime
View raw message