You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by Julian Reschke <ju...@gmx.de> on 2012/05/03 18:48:33 UTC
reading CND using regexps
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,
>
>
>
Re: reading CND using regexps
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On Thu, May 3, 2012 at 6:48 PM, Julian Reschke <ju...@gmx.de> wrote:
> how attached are you to that code?
Not at all attached. It was the simplest thing I could come up quickly
in order to allow us get past the TCK dependency on the presence of
node types. Consider it throw-away code.
BR,
Jukka Zitting