jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r773032 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/ ...
Date Fri, 08 May 2009 15:32:37 GMT
Author: angela
Date: Fri May  8 15:32:35 2009
New Revision: 773032

URL: http://svn.apache.org/viewvc?rev=773032&view=rev
Log:
JCR-1483: Move common node type functionality to jackrabbit-spi-commons

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/Lexer.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/ParseException.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/Lexer.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java?rev=773032&r1=773031&r2=773032&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
Fri May  8 15:32:35 2009
@@ -24,10 +24,10 @@
 import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
 import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefReader;
 import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefWriter;
-import org.apache.jackrabbit.core.nodetype.compact.ParseException;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
+import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.uuid.Constants;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java?rev=773032&r1=773031&r2=773032&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
Fri May  8 15:32:35 2009
@@ -19,7 +19,7 @@
 import org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader;
 import org.apache.jackrabbit.core.nodetype.xml.NodeTypeWriter;
 import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefReader;
-import org.apache.jackrabbit.core.nodetype.compact.ParseException;
+import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
 import org.apache.jackrabbit.spi.Name;
 
 import javax.jcr.NamespaceRegistry;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java?rev=773032&r1=773031&r2=773032&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
Fri May  8 15:32:35 2009
@@ -22,10 +22,10 @@
 import org.apache.jackrabbit.commons.NamespaceHelper;
 import org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
+import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.data.DataStore;
 import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefReader;
-import org.apache.jackrabbit.core.nodetype.compact.ParseException;
 
 import javax.jcr.nodetype.NodeTypeDefinition;
 import javax.jcr.nodetype.NodeTypeExistsException;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java?rev=773032&r1=773031&r2=773032&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
Fri May  8 15:32:35 2009
@@ -33,6 +33,8 @@
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
+import org.apache.jackrabbit.spi.commons.nodetype.compact.Lexer;
+import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
 import org.apache.jackrabbit.util.ISO9075;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.apache.jackrabbit.value.ValueFactoryImpl;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/Lexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/Lexer.java?rev=773032&r1=773031&r2=773032&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/Lexer.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/Lexer.java
Fri May  8 15:32:35 2009
@@ -16,146 +16,21 @@
  */
 package org.apache.jackrabbit.core.nodetype.compact;
 
-import java.io.StreamTokenizer;
 import java.io.Reader;
-import java.io.IOException;
 
 /**
  * Lexer
+ *
+ * @deprecated Use {@link org.apache.jackrabbit.spi.commons.nodetype.compact.Lexer} instead.
  */
-public class Lexer {
-    public static final char SINGLE_QUOTE = '\'';
-    public static final char DOUBLE_QUOTE = '\"';
-    public static final char BEGIN_NODE_TYPE_NAME = '[';
-    public static final char END_NODE_TYPE_NAME = ']';
-    public static final char EXTENDS = '>';
-    public static final char LIST_DELIMITER = ',';
-    public static final char PROPERTY_DEFINITION = '-';
-    public static final char CHILD_NODE_DEFINITION = '+';
-    public static final char BEGIN_TYPE = '(';
-    public static final char END_TYPE = ')';
-    public static final char DEFAULT = '=';
-    public static final char CONSTRAINT = '<';
-
-    public static final String[] ORDERABLE = new String[] {"orderable", "ord", "o"};
-    public static final String[] MIXIN = new String[]{"mixin", "mix", "m"};
-    public static final String[] ABSTRACT = new String[]{"abstract", "abs", "a"};
-    public static final String[] NOQUERY = new String[]{"noquery", "nq"};
-    public static final String[] PRIMARYITEM = new String[]{"primaryitem", "!"};
-
-    public static final String[] PRIMARY = new String[]{"primary", "pri", "!"};
-    public static final String[] AUTOCREATED = new String[]{"autocreated", "aut", "a"};
-    public static final String[] MANDATORY = new String[]{"mandatory", "man", "m"};
-    public static final String[] PROTECTED = new String[]{"protected", "pro", "p"};
-    public static final String[] MULTIPLE = new String[]{"multiple", "mul", "*"};
-
-    public static final String[] COPY = new String[]{"copy", "Copy", "COPY"};
-    public static final String[] VERSION = new String[]{"version", "Version", "VERSION"};
-    public static final String[] INITIALIZE = new String[]{"initialize", "Initialize", "INITIALIZE"};
-    public static final String[] COMPUTE = new String[]{"compute", "Compute", "COMPUTE"};
-    public static final String[] IGNORE = new String[]{"ignore", "Ignore", "IGNORE"};
-    public static final String[] ABORT = new String[]{"abort", "Abort", "ABORT"};
-
-    public static final String[] ATTRIBUTE = new String[]{"primary", "pri", "!",
-                                                          "autocreated", "aut", "a",
-                                                          "mandatory", "man", "m",
-                                                          "protected", "pro", "p",
-                                                          "multiple", "mul", "*",
-                                                          "copy", "Copy", "COPY",
-                                                          "version", "Version", "VERSION",
-                                                          "initialize", "Initialize", "INITIALIZE",
-                                                          "compute", "Compute", "COMPUTE",
-                                                          "ignore", "Ignore", "IGNORE",
-                                                          "abort", "Abort", "ABORT"};
-
-    public static final String[] STRING = {"string", "String", "STRING"};
-    public static final String[] BINARY = {"binary", "Binary", "BINARY"};
-    public static final String[] LONG = {"long", "Long", "LONG"};
-    public static final String[] DOUBLE = {"double", "Double", "DOUBLE"};
-    public static final String[] BOOLEAN = {"boolean", "Boolean", "BOOLEAN"};
-    public static final String[] DATE = {"date", "Date", "DATE"};
-    public static final String[] NAME = {"name", "Name", "NAME"};
-    public static final String[] PATH = {"path", "Path", "PATH"};
-    public static final String[] REFERENCE = {"reference", "Reference", "REFERENCE"};
-
-    public static final String[] UNDEFINED = new String[]{"undefined", "Undefined", "UNDEFINED",
"*"};
-
-    public static final String EOF = "eof";
-
-    private final StreamTokenizer st;
-
-    private final String systemId;
+public class Lexer extends org.apache.jackrabbit.spi.commons.nodetype.compact.Lexer {
 
     /**
      * Constructor
+     *
      * @param r
      */
     public Lexer(Reader r, String systemId) {
-        this.systemId = systemId;
-        st = new StreamTokenizer(r);
-
-        st.eolIsSignificant(false);
-
-        st.lowerCaseMode(false);
-
-        st.slashSlashComments(true);
-        st.slashStarComments(true);
-
-        st.wordChars('a', 'z');
-        st.wordChars('A', 'Z');
-        st.wordChars(':', ':');
-        st.wordChars('_', '_');
-
-        st.quoteChar(SINGLE_QUOTE);
-        st.quoteChar(DOUBLE_QUOTE);
-
-        st.ordinaryChar(BEGIN_NODE_TYPE_NAME);
-        st.ordinaryChar(END_NODE_TYPE_NAME);
-        st.ordinaryChar(EXTENDS);
-        st.ordinaryChar(LIST_DELIMITER);
-        st.ordinaryChar(PROPERTY_DEFINITION);
-        st.ordinaryChar(CHILD_NODE_DEFINITION);
-        st.ordinaryChar(BEGIN_TYPE);
-        st.ordinaryChar(END_TYPE);
-        st.ordinaryChar(DEFAULT);
-        st.ordinaryChar(CONSTRAINT);
-    }
-
-    /**
-     * getNextToken
-     *
-     * @return
-     * @throws ParseException
-     */
-    public String getNextToken() throws ParseException {
-        try {
-            int tokenType = st.nextToken();
-            if (tokenType == StreamTokenizer.TT_EOF) {
-                return EOF;
-            } else if (tokenType == StreamTokenizer.TT_WORD
-                    || tokenType == SINGLE_QUOTE
-                    || tokenType == DOUBLE_QUOTE) {
-                return st.sval;
-            } else if (tokenType == StreamTokenizer.TT_NUMBER) {
-                return String.valueOf(st.nval);
-            } else {
-                return new String(new char[] {(char) tokenType});
-            }
-        } catch (IOException e) {
-            fail("IOException while attempting to read input stream", e);
-            return null;
-        }
-    }
-
-    public void fail(String message) throws ParseException {
-        throw new ParseException(message, st.lineno(), -1, systemId);
-    }
-
-    public void fail(String message, Throwable e) throws ParseException {
-        throw new ParseException(message, e, st.lineno(), -1, systemId);
-    }
-
-    public void fail(Throwable e) throws ParseException {
-        throw new ParseException(e, st.lineno(), -1, systemId);
+        super(r, systemId);
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/ParseException.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/ParseException.java?rev=773032&r1=773031&r2=773032&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/ParseException.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/ParseException.java
Fri May  8 15:32:35 2009
@@ -18,111 +18,24 @@
 
 /**
  * ParseException
+ *
+ * @deprecated Use {@link org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException}
instead.
  */
-public class ParseException extends Exception {
+public class ParseException extends org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException
{
 
-    /**
-     * the line number where the error occurred
-     */
-    private final int lineNumber;
-
-    /**
-     * the column number where the error occurred
-     */
-    private final int colNumber;
-
-    /**
-     * the systemid of the source that produced the error
-     */
-    private final String systemId;
-
-
-    /**
-     * Constructs a new instance of this class with <code>null</code> as its
-     * detail message.
-     */
     public ParseException(int lineNumber, int colNumber, String systemId) {
-        super();
-        this.lineNumber = lineNumber;
-        this.colNumber = colNumber;
-        this.systemId = systemId;
+        super(lineNumber, colNumber, systemId);
     }
 
-    /**
-     * Constructs a new instance of this class with the specified detail
-     * message.
-     *
-     * @param message the detail message. The detail message is saved for
-     *                later retrieval by the {@link #getMessage()} method.
-     */
     public ParseException(String message, int lineNumber, int colNumber, String systemId)
{
-        super(message);
-        this.lineNumber = lineNumber;
-        this.colNumber = colNumber;
-        this.systemId = systemId;
+        super(message, lineNumber, colNumber, systemId);
     }
 
-    /**
-     * Constructs a new instance of this class with the specified detail
-     * message and root cause.
-     *
-     * @param message   the detail message. The detail message is saved for
-     *                  later retrieval by the {@link #getMessage()} method.
-     * @param rootCause root failure cause
-     */
     public ParseException(String message, Throwable rootCause, int lineNumber, int colNumber,
String systemId) {
-        super(message, rootCause);
-        this.lineNumber = lineNumber;
-        this.colNumber = colNumber;
-        this.systemId = systemId;
+        super(message, rootCause, lineNumber, colNumber, systemId);
     }
 
-    /**
-     * Constructs a new instance of this class with the specified root cause.
-     *
-     * @param rootCause root failure cause
-     */
     public ParseException(Throwable rootCause, int lineNumber, int colNumber, String systemId)
{
-        super(rootCause);
-        this.lineNumber = lineNumber;
-        this.colNumber = colNumber;
-        this.systemId = systemId;
+        super(rootCause, lineNumber, colNumber, systemId);
     }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getMessage() {
-        StringBuffer b = new StringBuffer(super.getMessage());
-        String delim = " (";
-        if (systemId != null && !systemId.equals("")) {
-            b.append(delim);
-            b.append(systemId);
-            delim = ", ";
-        }
-        if (lineNumber >= 0) {
-            b.append(delim);
-            b.append("line ");
-            b.append(lineNumber);
-            delim = ", ";
-        }
-        if (colNumber >= 0) {
-            b.append(delim);
-            b.append("col ");
-            b.append(colNumber);
-            delim = ", ";
-        }
-        if (delim.equals(", ")) {
-            b.append(")");
-        }
-        return b.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String toString() {
-        return super.toString(); // + " (" + systemId + ", line " + lineNumber +", col "
+ colNumber +")";
-    }
-
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/Lexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/Lexer.java?rev=773032&r1=773031&r2=773032&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/Lexer.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/Lexer.java
Fri May  8 15:32:35 2009
@@ -39,6 +39,9 @@
 
     public static final String[] ORDERABLE = new String[] {"orderable", "ord", "o"};
     public static final String[] MIXIN = new String[]{"mixin", "mix", "m"};
+    public static final String[] ABSTRACT = new String[]{"abstract", "abs", "a"};
+    public static final String[] NOQUERY = new String[]{"noquery", "nq"};
+    public static final String[] PRIMARYITEM = new String[]{"primaryitem", "!"};
 
     public static final String[] PRIMARY = new String[]{"primary", "pri", "!"};
     public static final String[] AUTOCREATED = new String[]{"autocreated", "aut", "a"};



Mime
View raw message