You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by fi...@apache.org on 2005/11/26 06:41:17 UTC
svn commit: r349083 [2/2] - in
/incubator/jackrabbit/trunk/contrib/compact-nt: ./
src/java/org/apache/jackrabbit/core/nodetype/compact/
Modified: incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/Lexer.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/Lexer.java?rev=349083&r1=349082&r2=349083&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/Lexer.java (original)
+++ incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/Lexer.java Fri Nov 25 21:41:13 2005
@@ -1,151 +1,151 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.nodetype.compact;
-
-import java.io.StreamTokenizer;
-import java.io.Reader;
-import java.io.IOException;
-
-/**
- * Lexer
- */
-public class Lexer {
- public final static char QUOTE = '\'';
- public final static char BEGIN_NODE_TYPE_NAME = '[';
- public final static char END_NODE_TYPE_NAME = ']';
- public final static char EXTENDS = '>';
- public final static char LIST_DELIMITER = ',';
- public final static char PROPERTY_DEFINITION = '-';
- public final static char CHILD_NODE_DEFINITION = '+';
- public final static char BEGIN_TYPE = '(';
- public final static char END_TYPE = ')';
- public final static char DEFAULT = '=';
- public final static char CONSTRAINT = '<';
-
- public final static String[] ORDERABLE = new String[] {"orderable", "ord", "o"};
- public final static String[] MIXIN = new String[]{"mixin", "mix", "m"};
-
- public final static String[] PRIMARY = new String[]{"primary", "pri", "!"};
- public final static String[] AUTOCREATED = new String[]{"autocreated", "aut", "a"};
- public final static String[] MANDATORY = new String[]{"mandatory", "man", "m"};
- public final static String[] PROTECTED = new String[]{"protected", "pro", "p"};
- public final static String[] MULTIPLE = new String[]{"multiple", "mul", "*"};
-
- public final static String[] COPY = new String[]{"copy", "Copy", "COPY"};
- public final static String[] VERSION = new String[]{"version", "Version", "VERSION"};
- public final static String[] INITIALIZE = new String[]{"initialize", "Initialize", "INITIALIZE"};
- public final static String[] COMPUTE = new String[]{"compute", "Compute", "COMPUTE"};
- public final static String[] IGNORE = new String[]{"ignore", "Ignore", "IGNORE"};
- public final static String[] ABORT = new String[]{"abort", "Abort", "ABORT"};
-
- public final static 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 final static String[] STRING = {"string", "String", "STRING"};
- public final static String[] BINARY = {"binary", "Binary", "BINARY"};
- public final static String[] LONG = {"long", "Long", "LONG"};
- public final static String[] DOUBLE = {"double", "Double", "DOUBLE"};
- public final static String[] BOOLEAN = {"boolean", "Boolean", "BOOLEAN"};
- public final static String[] DATE = {"date", "Date", "DATE"};
- public final static String[] NAME = {"name", "Name", "NAME"};
- public final static String[] PATH = {"path", "Path", "PATH"};
- public final static String[] REFERENCE = {"reference", "Reference", "REFERENCE"};
-
- public final static String[] UNDEFINED = new String[]{"undefined", "Undefined", "UNDEFINED", "*"};
-
- public final static String EOF = "eof";
-
- private final StreamTokenizer st;
-
- private final String systemId;
-
- /**
- * 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.quoteChar(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 == QUOTE){
- return st.sval;
- } 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);
- }
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.nodetype.compact;
+
+import java.io.StreamTokenizer;
+import java.io.Reader;
+import java.io.IOException;
+
+/**
+ * Lexer
+ */
+public class Lexer {
+ public final static char QUOTE = '\'';
+ public final static char BEGIN_NODE_TYPE_NAME = '[';
+ public final static char END_NODE_TYPE_NAME = ']';
+ public final static char EXTENDS = '>';
+ public final static char LIST_DELIMITER = ',';
+ public final static char PROPERTY_DEFINITION = '-';
+ public final static char CHILD_NODE_DEFINITION = '+';
+ public final static char BEGIN_TYPE = '(';
+ public final static char END_TYPE = ')';
+ public final static char DEFAULT = '=';
+ public final static char CONSTRAINT = '<';
+
+ public final static String[] ORDERABLE = new String[] {"orderable", "ord", "o"};
+ public final static String[] MIXIN = new String[]{"mixin", "mix", "m"};
+
+ public final static String[] PRIMARY = new String[]{"primary", "pri", "!"};
+ public final static String[] AUTOCREATED = new String[]{"autocreated", "aut", "a"};
+ public final static String[] MANDATORY = new String[]{"mandatory", "man", "m"};
+ public final static String[] PROTECTED = new String[]{"protected", "pro", "p"};
+ public final static String[] MULTIPLE = new String[]{"multiple", "mul", "*"};
+
+ public final static String[] COPY = new String[]{"copy", "Copy", "COPY"};
+ public final static String[] VERSION = new String[]{"version", "Version", "VERSION"};
+ public final static String[] INITIALIZE = new String[]{"initialize", "Initialize", "INITIALIZE"};
+ public final static String[] COMPUTE = new String[]{"compute", "Compute", "COMPUTE"};
+ public final static String[] IGNORE = new String[]{"ignore", "Ignore", "IGNORE"};
+ public final static String[] ABORT = new String[]{"abort", "Abort", "ABORT"};
+
+ public final static 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 final static String[] STRING = {"string", "String", "STRING"};
+ public final static String[] BINARY = {"binary", "Binary", "BINARY"};
+ public final static String[] LONG = {"long", "Long", "LONG"};
+ public final static String[] DOUBLE = {"double", "Double", "DOUBLE"};
+ public final static String[] BOOLEAN = {"boolean", "Boolean", "BOOLEAN"};
+ public final static String[] DATE = {"date", "Date", "DATE"};
+ public final static String[] NAME = {"name", "Name", "NAME"};
+ public final static String[] PATH = {"path", "Path", "PATH"};
+ public final static String[] REFERENCE = {"reference", "Reference", "REFERENCE"};
+
+ public final static String[] UNDEFINED = new String[]{"undefined", "Undefined", "UNDEFINED", "*"};
+
+ public final static String EOF = "eof";
+
+ private final StreamTokenizer st;
+
+ private final String systemId;
+
+ /**
+ * 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.quoteChar(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 == QUOTE){
+ return st.sval;
+ } 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);
+ }
}
Propchange: incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/Lexer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/NamespaceMapping.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/NamespaceMapping.java?rev=349083&r1=349082&r2=349083&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/NamespaceMapping.java (original)
+++ incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/NamespaceMapping.java Fri Nov 25 21:41:13 2005
@@ -1,160 +1,160 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.nodetype.compact;
-
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.AbstractNamespaceResolver;
-
-import javax.jcr.NamespaceException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * A Simple Namespace Mapping table. Mappings can be added
- * and then the object can be used as a NamespaceResolver. Additionally, it can
- * be based on a underlying NamespaceResolver
- */
-public class NamespaceMapping extends AbstractNamespaceResolver {
-
- /** local uris */
- private final Properties prefixToURI = new Properties();
-
- /** local prefix */
- private final Properties URIToPrefix = new Properties();
-
- /** base */
- private final NamespaceResolver base;
-
- public NamespaceMapping() {
- this.base = null;
- }
-
- /**
- * Constructor
- */
- public NamespaceMapping(NamespaceResolver base) {
- this.base = base;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getPrefix(String uri) throws NamespaceException {
- if (URIToPrefix.containsKey(uri)) {
- return URIToPrefix.getProperty(uri);
- } else if (base == null) {
- throw new NamespaceException("No prefix for URI '" + uri + "' declared.");
- } else {
- return base.getPrefix(uri);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public String getURI(String prefix) throws NamespaceException {
- if (prefixToURI.containsKey(prefix)) {
- return prefixToURI.getProperty(prefix);
- } else if (base == null) {
- throw new NamespaceException("No URI for pefix '" + prefix + "' declared.");
- } else {
- return base.getURI(prefix);
- }
- }
-
- /**
- * Set a prefix == URI one-to-one mapping
- *
- * @param prefix
- * @param uri
- * @throws NamespaceException
- */
- public void setMapping(String prefix, String uri) throws NamespaceException{
- if (prefix == null) {
- throw new NamespaceException("Prefix must not be null");
- }
- if (uri == null) {
- throw new NamespaceException("URI must not be null");
- }
- if (URIToPrefix.containsKey(uri)) {
- // remove mapping
- prefixToURI.remove(URIToPrefix.remove(uri));
- }
- if (prefixToURI.containsKey(prefix)) {
- // remove mapping
- URIToPrefix.remove(prefixToURI.remove(prefix));
- }
- prefixToURI.put(prefix, uri);
- URIToPrefix.put(uri, prefix);
- }
-
- /**
- * Return a Map of prefix to URI mappings currently registered.
- * The returned Map is a copy of the internal Map.
- * @return Map
- */
- public Map getPrefixToURIMapping(){
- return new HashMap(prefixToURI);
- }
-
- /**
- * Return a Map of URI to prefix mappings currently registered.
- * The returned Map is a copy of the internal Map.
- * @return Map
- */
- public Map getURIToPrefixMapping(){
- return new HashMap(URIToPrefix);
- }
-
- /**
- * Override equals()
- *
- * @param obj
- * @return boolean
- */
- public boolean equals(Object obj){
- if (this == obj) {
- return true;
- }
- if (obj instanceof NamespaceMapping) {
- NamespaceMapping other = (NamespaceMapping) obj;
- return this.getPrefixToURIMapping().equals(other.getPrefixToURIMapping())
- && this.getURIToPrefixMapping().equals(other.getURIToPrefixMapping());
- }
- return false;
- }
-
- /**
- * Override toString()
- *
- * @return String
- */
- public String toString(){
- String s= "";
- Set mapping = prefixToURI.entrySet();
- for(Iterator i = mapping.iterator(); i.hasNext();){
- Map.Entry entry = (Map.Entry)i.next();
- String prefix = (String)entry.getKey();
- String uri = (String)entry.getValue();
- s += "'" + prefix + "' == '" + uri + "'\n";
- }
- return s;
- }
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.nodetype.compact;
+
+import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.name.AbstractNamespaceResolver;
+
+import javax.jcr.NamespaceException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * A Simple Namespace Mapping table. Mappings can be added
+ * and then the object can be used as a NamespaceResolver. Additionally, it can
+ * be based on a underlying NamespaceResolver
+ */
+public class NamespaceMapping extends AbstractNamespaceResolver {
+
+ /** local uris */
+ private final Properties prefixToURI = new Properties();
+
+ /** local prefix */
+ private final Properties URIToPrefix = new Properties();
+
+ /** base */
+ private final NamespaceResolver base;
+
+ public NamespaceMapping() {
+ this.base = null;
+ }
+
+ /**
+ * Constructor
+ */
+ public NamespaceMapping(NamespaceResolver base) {
+ this.base = base;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPrefix(String uri) throws NamespaceException {
+ if (URIToPrefix.containsKey(uri)) {
+ return URIToPrefix.getProperty(uri);
+ } else if (base == null) {
+ throw new NamespaceException("No prefix for URI '" + uri + "' declared.");
+ } else {
+ return base.getPrefix(uri);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getURI(String prefix) throws NamespaceException {
+ if (prefixToURI.containsKey(prefix)) {
+ return prefixToURI.getProperty(prefix);
+ } else if (base == null) {
+ throw new NamespaceException("No URI for pefix '" + prefix + "' declared.");
+ } else {
+ return base.getURI(prefix);
+ }
+ }
+
+ /**
+ * Set a prefix == URI one-to-one mapping
+ *
+ * @param prefix
+ * @param uri
+ * @throws NamespaceException
+ */
+ public void setMapping(String prefix, String uri) throws NamespaceException{
+ if (prefix == null) {
+ throw new NamespaceException("Prefix must not be null");
+ }
+ if (uri == null) {
+ throw new NamespaceException("URI must not be null");
+ }
+ if (URIToPrefix.containsKey(uri)) {
+ // remove mapping
+ prefixToURI.remove(URIToPrefix.remove(uri));
+ }
+ if (prefixToURI.containsKey(prefix)) {
+ // remove mapping
+ URIToPrefix.remove(prefixToURI.remove(prefix));
+ }
+ prefixToURI.put(prefix, uri);
+ URIToPrefix.put(uri, prefix);
+ }
+
+ /**
+ * Return a Map of prefix to URI mappings currently registered.
+ * The returned Map is a copy of the internal Map.
+ * @return Map
+ */
+ public Map getPrefixToURIMapping(){
+ return new HashMap(prefixToURI);
+ }
+
+ /**
+ * Return a Map of URI to prefix mappings currently registered.
+ * The returned Map is a copy of the internal Map.
+ * @return Map
+ */
+ public Map getURIToPrefixMapping(){
+ return new HashMap(URIToPrefix);
+ }
+
+ /**
+ * Override equals()
+ *
+ * @param obj
+ * @return boolean
+ */
+ public boolean equals(Object obj){
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof NamespaceMapping) {
+ NamespaceMapping other = (NamespaceMapping) obj;
+ return this.getPrefixToURIMapping().equals(other.getPrefixToURIMapping())
+ && this.getURIToPrefixMapping().equals(other.getURIToPrefixMapping());
+ }
+ return false;
+ }
+
+ /**
+ * Override toString()
+ *
+ * @return String
+ */
+ public String toString(){
+ String s= "";
+ Set mapping = prefixToURI.entrySet();
+ for(Iterator i = mapping.iterator(); i.hasNext();){
+ Map.Entry entry = (Map.Entry)i.next();
+ String prefix = (String)entry.getKey();
+ String uri = (String)entry.getValue();
+ s += "'" + prefix + "' == '" + uri + "'\n";
+ }
+ return s;
+ }
}
Propchange: incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/NamespaceMapping.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/ParseException.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/ParseException.java?rev=349083&r1=349082&r2=349083&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/ParseException.java (original)
+++ incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/ParseException.java Fri Nov 25 21:41:13 2005
@@ -1,128 +1,128 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.nodetype.compact;
-
-/**
- * ParseException
- */
-public class ParseException extends Exception {
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * {@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 +")";
- }
-
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.nodetype.compact;
+
+/**
+ * ParseException
+ */
+public class ParseException extends Exception {
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * {@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 +")";
+ }
+
}
Propchange: incubator/jackrabbit/trunk/contrib/compact-nt/src/java/org/apache/jackrabbit/core/nodetype/compact/ParseException.java
------------------------------------------------------------------------------
svn:eol-style = native