You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by md...@apache.org on 2011/09/07 14:00:20 UTC
svn commit: r1166138 [3/12] - in /jackrabbit/sandbox/jackrabbit-mk:
jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/
jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/
jackrabbit-spi-commons/src/main/ja...
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java Wed Sep 7 12:00:14 2011
@@ -42,18 +42,11 @@ public class ConsolidatingChangeLog exte
private static final PathFactory PATH_FACTORY = PathFactoryImpl.getInstance();
/**
- * Create a new instance of a consolidating change log.
- */
- public ConsolidatingChangeLog() {
- super();
- }
-
- /**
* Create a {@link Path} from the {@link NodeId} of a parent and the {@link Name} of a
* child.
* @param parentId node id of the parent
* @param name name of the child
- * @return the path of the item <code>name</code> or <code>null</code> if <code>parentId</code>'s
+ * @return the path of the item {@code name} or {@code null} if {@code parentId}'s
* path is not absolute
* @throws RepositoryException
*/
@@ -69,7 +62,7 @@ public class ConsolidatingChangeLog exte
/**
* Determine the {@link Path} from an {@link ItemId}.
* @param itemId
- * @return path of the item <code>itemId</code> or <code>null</code> if <code>itemId</code>'s
+ * @return path of the item {@code itemId} or {@code null} if {@code itemId}'s
* path is not absolute
*/
protected static Path getPath(ItemId itemId) {
@@ -82,51 +75,59 @@ public class ConsolidatingChangeLog exte
// -----------------------------------------------------< ChangeLog >---
- public void addNode(NodeId parentId, Name nodeName, Name nodetypeName, String uuid)
- throws RepositoryException {
-
+ @Override
+ public void addNode(NodeId parentId, Name nodeName, Name nodetypeName, String uuid) throws RepositoryException {
addOperation(CancelableOperations.addNode(parentId, nodeName, nodetypeName, uuid));
}
+ @Override
public void addProperty(NodeId parentId, Name propertyName, QValue value) throws RepositoryException {
addOperation(CancelableOperations.addProperty(parentId, propertyName, value));
}
+ @Override
public void addProperty(NodeId parentId, Name propertyName, QValue[] values) throws RepositoryException {
addOperation(CancelableOperations.addProperty(parentId, propertyName, values));
}
+ @Override
public void move(NodeId srcNodeId, NodeId destParentNodeId, Name destName) throws RepositoryException {
addOperation(CancelableOperations.move(srcNodeId, destParentNodeId, destName));
}
+ @Override
public void remove(ItemId itemId) throws RepositoryException {
addOperation(CancelableOperations.remove(itemId));
}
+ @Override
public void reorderNodes(NodeId parentId, NodeId srcNodeId, NodeId beforeNodeId) throws RepositoryException {
addOperation(CancelableOperations.reorderNodes(parentId, srcNodeId, beforeNodeId));
}
+ @Override
public void setMixins(NodeId nodeId, Name[] mixinNodeTypeNames) throws RepositoryException {
addOperation(CancelableOperations.setMixins(nodeId, mixinNodeTypeNames));
}
+ @Override
public void setPrimaryType(NodeId nodeId, Name primaryNodeTypeName) throws RepositoryException {
addOperation(CancelableOperations.setPrimaryType(nodeId, primaryNodeTypeName));
}
+ @Override
public void setValue(PropertyId propertyId, QValue value) throws RepositoryException {
addOperation(CancelableOperations.setValue(propertyId, value));
}
+ @Override
public void setValue(PropertyId propertyId, QValue[] values) throws RepositoryException {
addOperation(CancelableOperations.setValue(propertyId, values));
}
/**
* Determines the cancellation behavior from the list of {@link ChangeLogImpl#operations operations}
- * and the current operation <code>op</code>:
+ * and the current operation {@code op}:
* <ul>
* <li>When the current operation is cancelled by the last operation, the list of operations
* is not modified.</li>
@@ -167,10 +168,12 @@ public class ConsolidatingChangeLog exte
private boolean last = !it.hasPrevious();
private boolean done;
+ @Override
public boolean hasNext() {
return it.hasPrevious() || last;
}
+ @Override
public CancelableOperation next() {
if (last) {
done = true;
@@ -183,6 +186,7 @@ public class ConsolidatingChangeLog exte
}
}
+ @Override
public void remove() {
if (done) {
throw new IllegalStateException("Cannot remove last element");
@@ -204,49 +208,48 @@ public class ConsolidatingChangeLog exte
/**
* The other operation cancels this operations
*/
- public static final int CANCEL_THIS = 0;
+ int CANCEL_THIS = 0;
/**
* This operation cancels the other operation
*/
- public static final int CANCEL_OTHER = 1;
+ int CANCEL_OTHER = 1;
/**
* This operation and the other operation cancel each other mutually
*/
- public static final int CANCEL_BOTH = 2;
+ int CANCEL_BOTH = 2;
/**
* No cancellation
*/
- public static final int CANCEL_NONE = 3;
+ int CANCEL_NONE = 3;
/**
- * Determines the cancellation behavior of the <code>other</code> operation
+ * Determines the cancellation behavior of the {@code other} operation
* on this operation.
* @param other
- * @return Either {@link #CANCEL_THIS}, {@link #CANCEL_OTHER}, {@link #CANCEL_OTHER}
+ * @return Either {@link #CANCEL_THIS}, {@link #CANCEL_OTHER}, {@link #CANCEL_OTHER}
* or {@link #CANCEL_NONE}
* @throws RepositoryException
*/
- public int cancel(CancelableOperation other) throws RepositoryException;
+ int cancel(CancelableOperation other) throws RepositoryException;
}
/**
* Factory for creating {@link ConsolidatingChangeLog.CancelableOperation CancelableOperation}s.
- * The inner classes of this class all implement the <code>CancelableOperation</code> interface.
+ * The inner classes of this class all implement the {@code CancelableOperation} interface.
*
* @see Operation
*/
protected static final class CancelableOperations {
private CancelableOperations() {
- super();
}
// -----------------------------------------------------< Empty >---
/**
- * An <code>Empty</code> operation never cancels another operation and is never
+ * An {@code Empty} operation never cancels another operation and is never
* cancelled by any other operation.
*/
public static class Empty extends Operations.Empty implements CancelableOperation {
@@ -254,6 +257,7 @@ public class ConsolidatingChangeLog exte
/**
* @return {@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE}
*/
+ @Override
public int cancel(CancelableOperation other) throws RepositoryException {
return CANCEL_NONE;
}
@@ -270,7 +274,7 @@ public class ConsolidatingChangeLog exte
// -----------------------------------------------------< AddNode >---
/**
- * An <code>AddNode</code> operation is is cancelled by a
+ * An {@code AddNode} operation is is cancelled by a
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} operation higher up the tree.
* The remove operation is also cancelled if it is targeted at the same node than this add
* operation.
@@ -285,16 +289,17 @@ public class ConsolidatingChangeLog exte
* @return
* <ul>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_BOTH CANCEL_BOTH} if
- * <code>other</code> is an instance of
+ * {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and has this node
* as target.</li>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_THIS CANCEL_THIS} if
- * <code>other</code> is an instance of
+ * {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and has an node higher up
* the hierarchy as target.</li>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE} otherwise.</li>
* </ul>
*/
+ @Override
public int cancel(CancelableOperation other) throws RepositoryException {
if (other instanceof Remove) {
Path thisPath = ConsolidatingChangeLog.getPath(parentId, nodeName);
@@ -305,7 +310,7 @@ public class ConsolidatingChangeLog exte
if (thisPath.equals(otherPath)) {
return CANCEL_BOTH;
}
- return (thisPath.isDescendantOf(otherPath))
+ return thisPath.isDescendantOf(otherPath)
? CANCEL_THIS
: CANCEL_NONE;
}
@@ -329,7 +334,7 @@ public class ConsolidatingChangeLog exte
// ---------------------------------------------------< AddProperty >---
/**
- * <code>AddProperty</code> operations might cancel with
+ * {@code AddProperty} operations might cancel with
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and
* {@link ConsolidatingChangeLog.CancelableOperations.SetValue SetValue} operations.
*/
@@ -347,22 +352,23 @@ public class ConsolidatingChangeLog exte
* @return
* <ul>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_BOTH CANCEL_BOTH} if
- * <code>other</code> is an instance of
+ * {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and has this property as
- * target or if <code>other</code> is an instance of
+ * target or if {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.SetValue SetValue} for a value of
- * <code>null</code> and has this property as target.</li>
+ * {@code null} and has this property as target.</li>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_THIS CANCEL_THIS} if
- * <code>other</code> is an instance of
+ * {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and has a node higher up
* the hierarchy as target.</li>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_OTHER CANCEL_OTHER} if
- * <code>other</code> is an instance of
+ * {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.SetValue SetValue} and has this
* property as target.</li>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE} otherwise.</li>
* <ul>
*/
+ @Override
public int cancel(CancelableOperation other) throws RepositoryException {
if (other instanceof Remove) {
Path thisPath = ConsolidatingChangeLog.getPath(parentId, propertyName);
@@ -373,7 +379,7 @@ public class ConsolidatingChangeLog exte
if (thisPath.equals(otherPath)) {
return CANCEL_BOTH;
}
- return (thisPath.isDescendantOf(otherPath))
+ return thisPath.isDescendantOf(otherPath)
? CANCEL_THIS
: CANCEL_NONE;
}
@@ -430,7 +436,7 @@ public class ConsolidatingChangeLog exte
// ----------------------------------------------------------< Move >---
/**
- * An <code>Move</code> operation never cancels another operation and is never
+ * An {@code Move} operation never cancels another operation and is never
* cancelled by any other operation.
*/
public static class Move extends Operations.Move implements CancelableOperation {
@@ -442,6 +448,7 @@ public class ConsolidatingChangeLog exte
/**
* @return {@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE}
*/
+ @Override
public int cancel(CancelableOperation other) {
return CANCEL_NONE;
}
@@ -462,7 +469,7 @@ public class ConsolidatingChangeLog exte
// --------------------------------------------------------< Remove >---
/**
- * An <code>Remove</code> operation never cancels another operation and is never
+ * An {@code Remove} operation never cancels another operation and is never
* cancelled by any other operation.
*/
public static class Remove extends Operations.Remove implements CancelableOperation {
@@ -474,6 +481,7 @@ public class ConsolidatingChangeLog exte
/**
* @return {@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE}
*/
+ @Override
public int cancel(CancelableOperation other) {
return CANCEL_NONE;
}
@@ -492,7 +500,7 @@ public class ConsolidatingChangeLog exte
// -------------------------------------------------< Reorder Nodes >---
/**
- * A <code>ReorderNodes</code> operation might cancel with
+ * A {@code ReorderNodes} operation might cancel with
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and
* {@link ConsolidatingChangeLog.CancelableOperations.ReorderNodes ReorderNodes} operations.
*/
@@ -506,15 +514,16 @@ public class ConsolidatingChangeLog exte
* @return
* <ul>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_THIS CANCEL_THIS} if
- * <code>other</code> is an instance of
+ * {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and has an node higher up
- * the hierarchy or this node as target. Or if <code>other</code> is an instance of
+ * the hierarchy or this node as target. Or if {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.ReorderNodes ReorderNodes} which
- * has this node as target and neither <code>srcNodeId</code> nor <code>beforeNodeId</code>
+ * has this node as target and neither {@code srcNodeId} nor {@code beforeNodeId}
* has same name siblings.</li>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE} otherwise.</li>
* </ul>
*/
+ @Override
public int cancel(CancelableOperation other) throws RepositoryException {
if (other instanceof Remove) {
Path thisPath = ConsolidatingChangeLog.getPath(srcNodeId);
@@ -539,7 +548,7 @@ public class ConsolidatingChangeLog exte
return CANCEL_NONE;
}
- private boolean hasSNS(NodeId nodeId) {
+ private static boolean hasSNS(NodeId nodeId) {
if (nodeId != null) {
Path path = ConsolidatingChangeLog.getPath(nodeId);
return path != null && path.getIndex() > 1;
@@ -564,7 +573,7 @@ public class ConsolidatingChangeLog exte
// -----------------------------------------------------< SetMixins >---
/**
- * A <code>SetMixins</code> operation might cancel with
+ * A {@code SetMixins} operation might cancel with
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and
* {@link ConsolidatingChangeLog.CancelableOperations.SetMixins SetMixins} operations.
*/
@@ -578,14 +587,15 @@ public class ConsolidatingChangeLog exte
* @return
* <ul>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_THIS CANCEL_THIS} if
- * <code>other</code> is an instance of
+ * {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and has an node higher up
- * the hierarchy or this node as target. Or if <code>other</code> is an instance of
+ * the hierarchy or this node as target. Or if {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.SetMixins SetMixins} which has this node
- * as target and has the same <code>mixinNodeTypeNames</code>.</li>
+ * as target and has the same {@code mixinNodeTypeNames}.</li>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE} otherwise.</li>
* </ul>
*/
+ @Override
public int cancel(CancelableOperation other) throws RepositoryException {
if (other instanceof Remove) {
Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
@@ -633,7 +643,7 @@ public class ConsolidatingChangeLog exte
// -----------------------------------------------------< SetMixins >---
/**
- * A <code>SetPrimaryType</code> operation might cancel with
+ * A {@code SetPrimaryType} operation might cancel with
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and
* {@link ConsolidatingChangeLog.CancelableOperations.SetPrimaryType SetPrimaryType} operations.
*/
@@ -647,14 +657,15 @@ public class ConsolidatingChangeLog exte
* @return
* <ul>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_THIS CANCEL_THIS} if
- * <code>other</code> is an instance of
+ * {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and has an node higher up
- * the hierarchy or this node as target. Or if <code>other</code> is an instance of
+ * the hierarchy or this node as target. Or if {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.SetMixins SetMixins} which has this node
- * as target and has the same <code>mixinNodeTypeNames</code>.</li>
+ * as target and has the same {@code mixinNodeTypeNames}.</li>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE} otherwise.</li>
* </ul>
*/
+ @Override
public int cancel(CancelableOperation other) throws RepositoryException {
if (other instanceof Remove) {
Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
@@ -697,7 +708,7 @@ public class ConsolidatingChangeLog exte
// ------------------------------------------------------< SetValue >---
/**
- * A <code>SetValue</code> operation might cancel with
+ * A {@code SetValue} operation might cancel with
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and
* {@link ConsolidatingChangeLog.CancelableOperations.SetValue SetValue} operations.
*/
@@ -714,14 +725,15 @@ public class ConsolidatingChangeLog exte
* @return
* <ul>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_THIS CANCEL_THIS} if
- * <code>other</code> is an instance of
+ * {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and has an node higher up
- * the hierarchy or this node as target. Or if <code>other</code> is an instance of
+ * the hierarchy or this node as target. Or if {@code other} is an instance of
* {@link ConsolidatingChangeLog.CancelableOperations.SetValue SetValue} which has this
* property as target</li>
* <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE} otherwise.</li>
* </ul>
*/
+ @Override
public int cancel(CancelableOperation other) throws RepositoryException {
if (other instanceof Remove) {
Path thisPath = ConsolidatingChangeLog.getPath(propertyId);
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operation.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operation.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operation.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operation.java Wed Sep 7 12:00:14 2011
@@ -16,10 +16,10 @@
*/
package org.apache.jackrabbit.spi.commons.batch;
-import javax.jcr.RepositoryException;
-
import org.apache.jackrabbit.spi.Batch;
+import javax.jcr.RepositoryException;
+
/**
* An <code>Operation</code> represents a method call on a {@link Batch}.
*/
@@ -30,5 +30,5 @@ public interface Operation {
* @param batch
* @throws RepositoryException
*/
- public void apply(Batch batch) throws RepositoryException;
+ void apply(Batch batch) throws RepositoryException;
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java Wed Sep 7 12:00:14 2011
@@ -16,10 +16,6 @@
*/
package org.apache.jackrabbit.spi.commons.batch;
-import java.util.Arrays;
-
-import javax.jcr.RepositoryException;
-
import org.apache.jackrabbit.spi.Batch;
import org.apache.jackrabbit.spi.ItemId;
import org.apache.jackrabbit.spi.Name;
@@ -27,18 +23,21 @@ import org.apache.jackrabbit.spi.NodeId;
import org.apache.jackrabbit.spi.PropertyId;
import org.apache.jackrabbit.spi.QValue;
+import javax.jcr.RepositoryException;
+import java.util.Arrays;
+
/**
* Factory for creating {@link Operation}s. The inner classes of this class
- * all implement the <code>Operation</code> interface. They are representatives
+ * all implement the {@code Operation} interface. They are representatives
* for the method calls on a {@link Batch}. In addition {@link Empty} represents
* the empty operation which does nothing.
*/
public final class Operations {
private Operations() {
- super();
}
// -------------------------------------------------------------< Empty >---
+
/**
* Representative of the empty {@link Operation} which does nothing when
* applied to a {@link Batch}.
@@ -47,13 +46,13 @@ public final class Operations {
private static final Empty INSTANCE = new Empty();
protected Empty() {
- super();
}
/**
* This method has no effect.
* {@inheritDoc}
*/
+ @Override
public void apply(Batch batch) throws RepositoryException { /* nothing to do */ }
@Override
@@ -63,10 +62,7 @@ public final class Operations {
@Override
public boolean equals(Object other) {
- if (null == other) {
- return false;
- }
- return other instanceof Empty;
+ return null != other && other instanceof Empty;
}
@Override
@@ -84,6 +80,7 @@ public final class Operations {
}
// -----------------------------------------------------------< AddNode >---
+
/**
* Representative of an add-node {@link Operation} which calls
* {@link Batch#addNode(NodeId, Name, Name, String)} when applied to a {@link Batch}.
@@ -104,23 +101,20 @@ public final class Operations {
* @param uuid
*/
public AddNode(NodeId parentId, Name nodeName, Name nodetypeName, String uuid) {
- super();
this.parentId = parentId;
this.nodeName = nodeName;
this.nodetypeName = nodetypeName;
this.uuid = uuid;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void apply(Batch batch) throws RepositoryException {
batch.addNode(parentId, nodeName, nodetypeName, uuid);
}
@Override
public String toString() {
- return "AddNode[" + parentId + ", " + nodeName + ", " + nodetypeName + ", " + uuid + "]";
+ return "AddNode[" + parentId + ", " + nodeName + ", " + nodetypeName + ", " + uuid + ']';
}
@Override
@@ -172,6 +166,7 @@ public final class Operations {
}
// -------------------------------------------------------< AddProperty >---
+
/**
* Representative of an add-property {@link Operation} which calls
* {@link Batch#addProperty(NodeId, Name, QValue)} or {@link Batch#addProperty(NodeId, Name, QValue[])}
@@ -184,7 +179,6 @@ public final class Operations {
protected final boolean isMultivalued;
private AddProperty(NodeId parentId, Name propertyName, QValue[] values, boolean isMultivalued) {
- super();
this.parentId = parentId;
this.propertyName = propertyName;
this.values = values;
@@ -215,9 +209,7 @@ public final class Operations {
this(parentId, propertyName, values, true);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void apply(Batch batch) throws RepositoryException {
if (isMultivalued) {
batch.addProperty(parentId, propertyName, values);
@@ -229,7 +221,7 @@ public final class Operations {
@Override
public String toString() {
- return "AddProperty[" + parentId + ", " + propertyName + ", " + values + "]";
+ return "AddProperty[" + parentId + ", " + propertyName + ", " + values + ']';
}
@Override
@@ -290,6 +282,7 @@ public final class Operations {
}
// --------------------------------------------------------------< Move >---
+
/**
* Representative of a move {@link Operation} which calls
* {@link Batch#move(NodeId, NodeId, Name)} when applied to a {@link Batch}.
@@ -308,22 +301,19 @@ public final class Operations {
* @param destName
*/
public Move(NodeId srcNodeId, NodeId destParentNodeId, Name destName) {
- super();
this.srcNodeId = srcNodeId;
this.destParentNodeId = destParentNodeId;
this.destName = destName;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void apply(Batch batch) throws RepositoryException {
batch.move(srcNodeId, destParentNodeId, destName);
}
@Override
public String toString() {
- return "Move[" + srcNodeId + ", " + destParentNodeId + ", " + destName + "]";
+ return "Move[" + srcNodeId + ", " + destParentNodeId + ", " + destName + ']';
}
@Override
@@ -370,6 +360,7 @@ public final class Operations {
}
// ------------------------------------------------------------< Remove >---
+
/**
* Representative of a remove {@link Operation} which calls {@link Batch#remove(ItemId)} when
* applied to a {@link Batch}.
@@ -384,20 +375,17 @@ public final class Operations {
* @param itemId
*/
public Remove(ItemId itemId) {
- super();
this.itemId = itemId;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void apply(Batch batch) throws RepositoryException {
batch.remove(itemId);
}
@Override
public String toString() {
- return "Remove[" + itemId + "]";
+ return "Remove[" + itemId + ']';
}
@Override
@@ -436,6 +424,7 @@ public final class Operations {
}
// ------------------------------------------------------< ReorderNodes >---
+
/**
* Representative of a reorder-nodes {@link Operation} which calls
* {@link Batch#reorderNodes(NodeId, NodeId, NodeId)} when applied to a {@link Batch}.
@@ -454,22 +443,19 @@ public final class Operations {
* @param beforeNodeId
*/
public ReorderNodes(NodeId parentId, NodeId srcNodeId, NodeId beforeNodeId) {
- super();
this.parentId = parentId;
this.srcNodeId = srcNodeId;
this.beforeNodeId = beforeNodeId;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void apply(Batch batch) throws RepositoryException {
batch.reorderNodes(parentId, srcNodeId, beforeNodeId);
}
@Override
public String toString() {
- return "ReorderNodes[" + parentId + ", " + srcNodeId + ", " + beforeNodeId + "]";
+ return "ReorderNodes[" + parentId + ", " + srcNodeId + ", " + beforeNodeId + ']';
}
@Override
@@ -516,6 +502,7 @@ public final class Operations {
}
// ---------------------------------------------------------< SetMixins >---
+
/**
* Representative of a set-mixin {@link Operation} which calls
* {@link Batch#setMixins(NodeId, Name[])} when applied to a {@link Batch}.
@@ -532,21 +519,18 @@ public final class Operations {
* @param mixinNodeTypeNames
*/
public SetMixins(NodeId nodeId, Name[] mixinNodeTypeNames) {
- super();
this.nodeId = nodeId;
this.mixinNodeTypeNames = mixinNodeTypeNames;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void apply(Batch batch) throws RepositoryException {
batch.setMixins(nodeId, mixinNodeTypeNames);
}
@Override
public String toString() {
- return "SetMixins[" + nodeId + ", " + mixinNodeTypeNames + "]";
+ return "SetMixins[" + nodeId + ", " + mixinNodeTypeNames + ']';
}
@Override
@@ -589,6 +573,7 @@ public final class Operations {
}
// ----------------------------------------------------< SetPrimaryType >---
+
/**
* Representative of a set-mixin {@link Operation} which calls
* {@link Batch#setMixins(NodeId, Name[])} when applied to a {@link Batch}.
@@ -605,21 +590,18 @@ public final class Operations {
* @param primaryTypeName
*/
public SetPrimaryType(NodeId nodeId, Name primaryTypeName) {
- super();
this.nodeId = nodeId;
this.primaryTypeName = primaryTypeName;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void apply(Batch batch) throws RepositoryException {
batch.setPrimaryType(nodeId, primaryTypeName);
}
@Override
public String toString() {
- return "SetPrimaryType[" + nodeId + ", " + primaryTypeName + "]";
+ return "SetPrimaryType[" + nodeId + ", " + primaryTypeName + ']';
}
@Override
@@ -662,6 +644,7 @@ public final class Operations {
}
// ----------------------------------------------------------< SetValue >---
+
/**
* Representative of a set-value {@link Operation} which calls
* {@link Batch#setValue(PropertyId, QValue)} or {@link Batch#setValue(PropertyId, QValue[])}
@@ -673,7 +656,6 @@ public final class Operations {
protected final boolean isMultivalued;
private SetValue(PropertyId propertyId, QValue[] values, boolean isMultivalued) {
- super();
this.propertyId = propertyId;
this.values = values;
this.isMultivalued = isMultivalued;
@@ -701,9 +683,7 @@ public final class Operations {
this(propertyId, values, true);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void apply(Batch batch) throws RepositoryException {
if (isMultivalued) {
batch.setValue(propertyId, values);
@@ -715,7 +695,7 @@ public final class Operations {
@Override
public String toString() {
- return "SetValue[" + propertyId + ", " + values + "]";
+ return "SetValue[" + propertyId + ", " + values + ']';
}
@Override
@@ -766,7 +746,7 @@ public final class Operations {
* @param values
* @return
*/
- public static Operation setValue(final PropertyId propertyId, final QValue[] values) {
+ public static Operation setValue(PropertyId propertyId, QValue[] values) {
return new SetValue(propertyId, values);
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingNameResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingNameResolver.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingNameResolver.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingNameResolver.java Wed Sep 7 12:00:14 2011
@@ -60,15 +60,16 @@ public class CachingNameResolver impleme
//-------------------------------------------------------< NameResolver >---
/**
- * Returns a <code>Name</code> for the given prefixed JCR name. The name
+ * Returns a {@code Name} for the given prefixed JCR name. The name
* is first looked up form the generational cache and the call gets
* delegated to the decorated name resolver only if the cache misses.
*
* @param jcrName A JCR name String.
- * @return A <code>Name</code> object.
+ * @return A {@code Name} object.
* @throws IllegalNameException if the JCR name format is invalid
* @throws NamespaceException if the namespace prefix can not be resolved
*/
+ @Override
public Name getQName(String jcrName)
throws IllegalNameException, NamespaceException {
Name name = (Name) cache.get(jcrName);
@@ -81,14 +82,15 @@ public class CachingNameResolver impleme
/**
- * Returns the prefixed JCR name for the given <code>Name</code>. The name
+ * Returns the prefixed JCR name for the given {@code Name}. The name
* is first looked up form the generational cache and the call gets
* delegated to the decorated name resolver only if the cache misses.
*
* @param name The name object.
- * @return qualified JCR name in the form <code>prefix:localName</code>.
+ * @return qualified JCR name in the form {@code prefix:localName}.
* @throws NamespaceException if the namespace URI can not be resolved
*/
+ @Override
public String getJCRName(Name name) throws NamespaceException {
String jcrName = (String) cache.get(name);
if (jcrName == null) {
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingPathResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingPathResolver.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingPathResolver.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingPathResolver.java Wed Sep 7 12:00:14 2011
@@ -61,18 +61,19 @@ public class CachingPathResolver impleme
//--------------------------------------------------------< PathResolver >
/**
- * Returns the <code>Path</code> object for the given JCR path String.
+ * Returns the {@code Path} object for the given JCR path String.
* The path is first looked up form the generational cache and the call gets
* delegated to the decorated path resolver only if the cache misses.
*
* @param path A JCR path String.
- * @return A <code>Path</code> object.
+ * @return A {@code Path} object.
* @throws MalformedPathException if the JCR path format is invalid
* @throws IllegalNameException if any of the JCR names contained in the
* path are invalid.
* @throws NamespaceException if a namespace prefix can not be resolved.
- * @see PathResolver#getQPath(String)
+ * @see PathResolver#getQPath(String)
*/
+ @Override
public Path getQPath(String path) throws MalformedPathException, IllegalNameException, NamespaceException {
return getQPath(path, true);
}
@@ -80,8 +81,11 @@ public class CachingPathResolver impleme
/**
* @see PathResolver#getQPath(String, boolean)
*/
- public Path getQPath(String path, boolean normalizeIdentifier) throws MalformedPathException, IllegalNameException, NamespaceException {
- Path qpath;
+ @Override
+ public Path getQPath(String path, boolean normalizeIdentifier) throws MalformedPathException, IllegalNameException,
+ NamespaceException {
+
+ Path qPath;
/*
* Jcr paths consisting of an identifier segment have 2 different
* path object representations depending on the given resolution flag:
@@ -91,29 +95,30 @@ public class CachingPathResolver impleme
* when calling getQPath with the same identifier-jcr-path.
*/
if (path.startsWith("[") && !normalizeIdentifier) {
- qpath = resolver.getQPath(path, normalizeIdentifier);
+ qPath = resolver.getQPath(path, normalizeIdentifier);
} else {
- qpath = (Path) cache.get(path);
- if (qpath == null) {
- qpath = resolver.getQPath(path, normalizeIdentifier);
- cache.put(path, qpath);
+ qPath = (Path) cache.get(path);
+ if (qPath == null) {
+ qPath = resolver.getQPath(path, normalizeIdentifier);
+ cache.put(path, qPath);
}
}
- return qpath;
+ return qPath;
}
/**
- * Returns the JCR path String for the given <code>Path</code>. The path
+ * Returns the JCR path String for the given {@code Path}. The path
* is first looked up form the generational cache and the call gets
* delegated to the decorated path resolver only if the cache misses.
*
- * @param path A <code>Path</code> object.
+ * @param path A {@code Path} object.
* @return A JCR path String in the standard form.
* @throws NamespaceException if a namespace URI can not be resolved.
* @see PathResolver#getJCRPath(org.apache.jackrabbit.spi.Path)
*/
+ @Override
public String getJCRPath(Path path) throws NamespaceException {
String jcrPath = (String) cache.get(path);
if (jcrPath == null) {
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/DefaultNamePathResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/DefaultNamePathResolver.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/DefaultNamePathResolver.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/DefaultNamePathResolver.java Wed Sep 7 12:00:14 2011
@@ -16,10 +16,6 @@
*/
package org.apache.jackrabbit.spi.commons.conversion;
-import javax.jcr.NamespaceException;
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.Session;
-
import org.apache.jackrabbit.spi.Name;
import org.apache.jackrabbit.spi.Path;
import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
@@ -28,8 +24,12 @@ import org.apache.jackrabbit.spi.commons
import org.apache.jackrabbit.spi.commons.namespace.RegistryNamespaceResolver;
import org.apache.jackrabbit.spi.commons.namespace.SessionNamespaceResolver;
+import javax.jcr.NamespaceException;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.Session;
+
/**
- * <code>DefaultNamePathResolver</code>...
+ * {@code DefaultNamePathResolver}...
*/
public class DefaultNamePathResolver implements NamePathResolver {
@@ -42,7 +42,8 @@ public class DefaultNamePathResolver imp
}
public DefaultNamePathResolver(Session session) {
- this(new SessionNamespaceResolver(session), ((session instanceof IdentifierResolver)? (IdentifierResolver) session : null), false);
+ this(new SessionNamespaceResolver(session),
+ session instanceof IdentifierResolver ? (IdentifierResolver) session : null, false);
}
public DefaultNamePathResolver(NamespaceRegistry registry) {
@@ -57,11 +58,11 @@ public class DefaultNamePathResolver imp
NameResolver nr = new ParsingNameResolver(NameFactoryImpl.getInstance(), nsResolver);
PathResolver pr = new ParsingPathResolver(PathFactoryImpl.getInstance(), nr, idResolver);
if (enableCaching) {
- this.nResolver = new CachingNameResolver(nr);
- this.pResolver = new CachingPathResolver(pr);
+ nResolver = new CachingNameResolver(nr);
+ pResolver = new CachingPathResolver(pr);
} else {
- this.nResolver = nr;
- this.pResolver = pr;
+ nResolver = nr;
+ pResolver = pr;
}
}
@@ -70,22 +71,27 @@ public class DefaultNamePathResolver imp
this.pResolver = pResolver;
}
+ @Override
public Name getQName(String name) throws IllegalNameException, NamespaceException {
return nResolver.getQName(name);
}
+ @Override
public String getJCRName(Name name) throws NamespaceException {
return nResolver.getJCRName(name);
}
+ @Override
public Path getQPath(String path) throws MalformedPathException, IllegalNameException, NamespaceException {
return pResolver.getQPath(path);
}
+ @Override
public Path getQPath(String path, boolean normalizeIdentifier) throws MalformedPathException, IllegalNameException, NamespaceException {
return pResolver.getQPath(path, normalizeIdentifier);
}
+ @Override
public String getJCRPath(Path path) throws NamespaceException {
return pResolver.getJCRPath(path);
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/GenerationalCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/GenerationalCache.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/GenerationalCache.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/GenerationalCache.java Wed Sep 7 12:00:14 2011
@@ -69,7 +69,7 @@ class GenerationalCache {
/**
* Age of the young cache generation.
*/
- private int age = 0;
+ private int age;
/**
* Creates a caching resolver.
@@ -106,7 +106,7 @@ class GenerationalCache {
* to the young generation via a call to {@link #put(Object, Object)}.
*
* @param key key of the cache entry
- * @return value of the cache entry, or <code>null</code>
+ * @return value of the cache entry, or {@code null}
*/
public Object get(Object key) {
Object value = cache.get(key);
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/IdentifierResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/IdentifierResolver.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/IdentifierResolver.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/IdentifierResolver.java Wed Sep 7 12:00:14 2011
@@ -19,11 +19,11 @@ package org.apache.jackrabbit.spi.common
import org.apache.jackrabbit.spi.Path;
/**
- * <code>IdentifierResolver</code> ....
+ * {@code IdentifierResolver} ....
*/
public interface IdentifierResolver {
- public Path getPath(String identifier) throws MalformedPathException;
+ Path getPath(String identifier) throws MalformedPathException;
- public void checkFormat(String identifier) throws MalformedPathException;
+ void checkFormat(String identifier) throws MalformedPathException;
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java Wed Sep 7 12:00:14 2011
@@ -24,10 +24,10 @@ import org.apache.jackrabbit.util.XMLCha
import javax.jcr.NamespaceException;
/**
- * <code>NameParser</code> parses a {@link String jcrName} using a
+ * {@code NameParser} parses a {@link String jcrName} using a
* {@link NamespaceResolver} and a {@link NameFactory}.
*/
-public class NameParser {
+public final class NameParser {
// constants for parser
private static final int STATE_PREFIX_START = 0;
@@ -37,16 +37,19 @@ public class NameParser {
private static final int STATE_URI_START = 4;
private static final int STATE_URI = 5;
+ private NameParser() {
+ }
+
/**
- * Parses the <code>jcrName</code> (either qualified or expanded) and
- * returns a new <code>Name</code>.
+ * Parses the {@code jcrName} (either qualified or expanded) and
+ * returns a new {@code Name}.
*
* @param jcrName the name to be parsed. The jcrName may either be in the
* qualified or in the expanded form.
- * @param resolver <code>NamespaceResolver</code> use to retrieve the
+ * @param resolver {@code NamespaceResolver} use to retrieve the
* namespace URI from the prefix contained in the given JCR name.
- * @return qName the new <code>Name</code>
- * @throws IllegalNameException If <code>jcrName</code> is not a valid
+ * @return qName the new {@code Name}
+ * @throws IllegalNameException If {@code jcrName} is not a valid
* JCR-style name.
* @throws NamespaceException If the jcr name contains an unknown prefix.
*/
@@ -67,7 +70,7 @@ public class NameParser {
int nameStart = 0;
int state = STATE_PREFIX_START;
boolean trailingSpaces = false;
- boolean checkFormat = (resolver == null);
+ boolean checkFormat = resolver == null;
for (int i = 0; i < len; i++) {
char c = jcrName.charAt(i);
@@ -187,24 +190,24 @@ public class NameParser {
uri = resolver.getURI(prefix);
}
- String localName = (nameStart == 0 ? jcrName : jcrName.substring(nameStart, len));
+ String localName = nameStart == 0 ? jcrName : jcrName.substring(nameStart, len);
return factory.create(uri, localName);
}
/**
- * Parses an array of <code>jcrName</code> and returns the respective
- * array of <code>Name</code>.
+ * Parses an array of {@code jcrName} and returns the respective
+ * array of {@code Name}.
*
* @param jcrNames the array of names to be parsed
- * @param resolver <code>NamespaceResolver</code> use to retrieve the
+ * @param resolver {@code NamespaceResolver} use to retrieve the
* namespace URI from the prefix contained in the given JCR name.
* @param factory
- * @return the new array of <code>Name</code>
- * @throws IllegalNameException If <code>jcrName</code> is not a valid
+ * @return the new array of {@code Name}
+ * @throws IllegalNameException If {@code jcrName} is not a valid
* JCR-style name.
* @throws NamespaceException If the jcr name contains an unknown prefix.
*/
- public static Name[] parse(String jcrNames[], NamespaceResolver resolver, NameFactory factory)
+ public static Name[] parse(String[] jcrNames, NamespaceResolver resolver, NameFactory factory)
throws NameException, NamespaceException {
Name[] ret = new Name[jcrNames.length];
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameResolver.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameResolver.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameResolver.java Wed Sep 7 12:00:14 2011
@@ -26,22 +26,22 @@ import javax.jcr.NamespaceException;
public interface NameResolver {
/**
- * Returns the <code>Name</code> for the given JCR name String.
+ * Returns the {@code Name} for the given JCR name String.
*
* @param name A JCR name String.
- * @return A <code>Name</code> object.
+ * @return A {@code Name} object.
* @throws IllegalNameException if the JCR name format is invalid
* @throws NamespaceException if the namespace prefix can not be resolved
*/
Name getQName(String name) throws IllegalNameException, NamespaceException;
/**
- * Returns the qualified JCR name String for the given <code>Name</code> object.
+ * Returns the qualified JCR name String for the given {@code Name} object.
*
- * @param name A <code>Name</code> object.
+ * @param name A {@code Name} object.
* @return The qualified JCR name String consisting of
- * <code>prefix:localName</code> or
- * <code>localName</code> in case of the empty namespace.
+ * {@code prefix:localName} or
+ * {@code localName} in case of the empty namespace.
* @throws NamespaceException if the namespace URI can not be resolved
*/
String getJCRName(Name name) throws NamespaceException;
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingNameResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingNameResolver.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingNameResolver.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingNameResolver.java Wed Sep 7 12:00:14 2011
@@ -52,35 +52,37 @@ public class ParsingNameResolver impleme
//--------------------------------------------------------< NameResolver >
/**
- * Parses the given JCR name and returns the resolved <code>Name</code> object.
+ * Parses the given JCR name and returns the resolved {@code Name} object.
*
* @param jcrName A JCR name String
- * @return A <code>Name</code> object.
+ * @return A {@code Name} object.
* @throws IllegalNameException if the JCR name format is invalid
* @throws NamespaceException if the namespace prefix can not be resolved.
* @see NameResolver#getQName(String)
*/
+ @Override
public Name getQName(String jcrName) throws IllegalNameException, NamespaceException {
return NameParser.parse(jcrName, resolver, nameFactory);
}
/**
- * Returns the qualified JCR name for the given <code>Name</code> object.
+ * Returns the qualified JCR name for the given {@code Name} object.
* If the name is in the default namespace, then the local name
* is returned without a prefix. Otherwise the prefix for the
* namespace is resolved and used to construct the JCR name.
*
- * @param name A <code>Name</code> object.
+ * @param name A {@code Name} object.
* @return A qualified JCR name string.
* @throws NamespaceException if the namespace URI can not be resolved.
* @see NameResolver#getJCRName(org.apache.jackrabbit.spi.Name)
*/
+ @Override
public String getJCRName(Name name) throws NamespaceException {
String uri = name.getNamespaceURI();
if (uri.length() == 0) {
return name.getLocalName();
} else {
- return resolver.getPrefix(uri) + ":" + name.getLocalName();
+ return resolver.getPrefix(uri) + ':' + name.getLocalName();
}
}
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingPathResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingPathResolver.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingPathResolver.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingPathResolver.java Wed Sep 7 12:00:14 2011
@@ -68,39 +68,42 @@ public class ParsingPathResolver impleme
}
/**
- * Parses the given JCR path into a <code>Path</code> object.
+ * Parses the given JCR path into a {@code Path} object.
*
* @param jcrPath A JCR path String.
- * @return A <code>Path</code> object.
+ * @return A {@code Path} object.
* @throws MalformedPathException if the JCR path format is invalid.
* @throws IllegalNameException if any of the JCR names contained in the path are invalid.
* @throws NamespaceException if a namespace prefix can not be resolved
*/
+ @Override
public Path getQPath(String jcrPath) throws MalformedPathException, IllegalNameException, NamespaceException {
return PathParser.parse(jcrPath, nameResolver, idResolver, pathFactory);
}
/**
* Calls {@link PathParser#parse(String, NameResolver, IdentifierResolver, org.apache.jackrabbit.spi.PathFactory)}
- * from the given <code>jcrPath</code>.
- *
+ * from the given {@code jcrPath}.
+ *
* @see PathResolver#getQPath(String, boolean)
*/
+ @Override
public Path getQPath(String jcrPath, boolean normalizeIdentifier) throws MalformedPathException, IllegalNameException, NamespaceException {
return PathParser.parse(jcrPath, nameResolver, idResolver, pathFactory, normalizeIdentifier);
}
/**
- * Returns the JCR path representation for the given <code>Path</code> object.
+ * Returns the JCR path representation for the given {@code Path} object.
*
- * @param path A <code>Path</code> object.
+ * @param path A {@code Path} object.
* @return A JCR path String in the standard form.
* @throws NamespaceException if a namespace URI can not be resolved.
- * @see PathResolver#getJCRPath(org.apache.jackrabbit.spi.Path)
+ * @see PathResolver#getJCRPath(org.apache.jackrabbit.spi.Path)
*/
+ @Override
public String getJCRPath(Path path) throws NamespaceException {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
Path.Element[] elements = path.getElements();
for (int i = 0; i < elements.length; i++) {
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java Wed Sep 7 12:00:14 2011
@@ -25,10 +25,10 @@ import org.apache.jackrabbit.spi.commons
import javax.jcr.NamespaceException;
/**
- * <code>PathParser</code> formats a {@link Path} using a
+ * {@code PathParser} formats a {@link Path} using a
* {@link NameResolver} and a {@link PathFactory}.
*/
-public class PathParser {
+public final class PathParser {
// constants for parser
private static final int STATE_PREFIX_START = 0;
@@ -38,22 +38,28 @@ public class PathParser {
private static final int STATE_INDEX = 4;
private static final int STATE_INDEX_END = 5;
private static final int STATE_DOT = 6;
- private static final int STATE_DOTDOT = 7;
+ private static final int STATE_DOT_DOT = 7;
private static final int STATE_IDENTIFIER = 8;
private static final int STATE_URI = 9;
private static final int STATE_URI_END = 10;
+ private static final char EOF = (char) -1;
+
+ private PathParser() {
+ }
+
+
/**
- * Parses <code>jcrPath</code> into a <code>Path</code> object using
- * <code>resolver</code> to convert prefixes into namespace URI's. If
- * resolver is <code>null</code> this method only checks the format of the
- * passed String and returns <code>null</code>.
+ * Parses {@code jcrPath} into a {@code Path} object using
+ * {@code resolver} to convert prefixes into namespace URI's. If
+ * resolver is {@code null} this method only checks the format of the
+ * passed String and returns {@code null}.
*
* @param jcrPath the jcr path.
* @param resolver the namespace resolver.
- * @param factory <code>PathFactory</code> to be used.
+ * @param factory {@code PathFactory} to be used.
* @return A path object.
- * @throws MalformedPathException If the <code>jcrPath</code> is malformed.
+ * @throws MalformedPathException If the {@code jcrPath} is malformed.
* @throws IllegalNameException if any of the jcrNames is malformed.
* @throws NamespaceException If an unresolvable prefix is encountered.
*/
@@ -63,15 +69,15 @@ public class PathParser {
}
/**
- * Parses <code>jcrPath</code> into a <code>Path</code> object using
- * <code>resolver</code> to convert prefixes into namespace URI's. If the
- * specified <code>jcrPath</code> is an identifier based absolute path
+ * Parses {@code jcrPath} into a {@code Path} object using
+ * {@code resolver} to convert prefixes into namespace URI's. If the
+ * specified {@code jcrPath} is an identifier based absolute path
* beginning with an identifier segment the specified
- * <code>IdentifierResolver</code> will be used to resolve it to an
+ * {@code IdentifierResolver} will be used to resolve it to an
* absolute path.<p/>
- * If <code>namResolver</code> is <code>null</code> or if <code>identifierResolver</code>
- * is <code>null</code> and the path starts with an identifier segment, this
- * method only checks the format of the string and returns <code>null</code>.
+ * If {@code namResolver} is {@code null} or if {@code identifierResolver}
+ * is {@code null} and the path starts with an identifier segment, this
+ * method only checks the format of the string and returns {@code null}.
*
* @param jcrPath the jcr path.
* @param nameResolver the namespace resolver.
@@ -79,7 +85,7 @@ public class PathParser {
* segment and resolve to an absolute path.
* @param factory
* @return A path object.
- * @throws MalformedPathException If the <code>jcrPath</code> is malformed.
+ * @throws MalformedPathException If the {@code jcrPath} is malformed.
* @throws IllegalNameException if any of the jcrNames is malformed.
* @throws NamespaceException If an unresolvable prefix is encountered.
* @since JCR 2.0
@@ -91,15 +97,15 @@ public class PathParser {
}
/**
- * Parses <code>jcrPath</code> into a <code>Path</code> object using
- * <code>resolver</code> to convert prefixes into namespace URI's. If the
- * specified <code>jcrPath</code> is an identifier based absolute path
+ * Parses {@code jcrPath} into a {@code Path} object using
+ * {@code resolver} to convert prefixes into namespace URI's. If the
+ * specified {@code jcrPath} is an identifier based absolute path
* beginning with an identifier segment the specified
- * <code>IdentifierResolver</code> will be used to resolve it to an
+ * {@code IdentifierResolver} will be used to resolve it to an
* absolute path.<p/>
- * If <code>namResolver</code> is <code>null</code> or if <code>identifierResolver</code>
- * is <code>null</code> and the path starts with an identifier segment, this
- * method only checks the format of the string and returns <code>null</code>.
+ * If {@code namResolver} is {@code null} or if {@code identifierResolver}
+ * is {@code null} and the path starts with an identifier segment, this
+ * method only checks the format of the string and returns {@code null}.
*
* @param jcrPath the jcr path.
* @param nameResolver the namespace resolver.
@@ -108,7 +114,7 @@ public class PathParser {
* @param factory
* @param normalizeIdentifier
* @return A path object.
- * @throws MalformedPathException If the <code>jcrPath</code> is malformed.
+ * @throws MalformedPathException If the {@code jcrPath} is malformed.
* @throws IllegalNameException if any of the jcrNames is malformed.
* @throws NamespaceException If an unresolvable prefix is encountered.
* @since JCR 2.0
@@ -121,19 +127,19 @@ public class PathParser {
}
/**
- * Parses the given <code>jcrPath</code> and returns a <code>Path</code>. If
- * <code>parent</code> is not <code>null</code>, it is prepended to the
- * built path before it is returned. If <code>resolver</code> is
- * <code>null</code>, this method only checks the format of the string and
- * returns <code>null</code>.
+ * Parses the given {@code jcrPath} and returns a {@code Path}. If
+ * {@code parent} is not {@code null}, it is prepended to the
+ * built path before it is returned. If {@code resolver} is
+ * {@code null}, this method only checks the format of the string and
+ * returns {@code null}.
*
* @param parent the parent path
* @param jcrPath the JCR path
* @param resolver the namespace resolver to get prefixes for namespace
* URI's.
* @param factory
- * @return the <code>Path</code> object.
- * @throws MalformedPathException If the <code>jcrPath</code> is malformed.
+ * @return the {@code Path} object.
+ * @throws MalformedPathException If the {@code jcrPath} is malformed.
* @throws IllegalNameException if any of the jcrNames is malformed.
* @throws NamespaceException If an unresolvable prefix is encountered.
*/
@@ -144,15 +150,15 @@ public class PathParser {
}
/**
- * Parses the given <code>jcrPath</code> and returns a <code>Path</code>. If
- * <code>parent</code> is not <code>null</code>, it is prepended to the
- * built path before it is returned. If the specifed <code>jcrPath</code>
+ * Parses the given {@code jcrPath} and returns a {@code Path}. If
+ * {@code parent} is not {@code null}, it is prepended to the
+ * built path before it is returned. If the specified {@code jcrPath}
* is an identifier based absolute path beginning with an identifier segment
- * the given <code>identifierResolver</code> will be used to resolve it to an
+ * the given {@code identifierResolver} will be used to resolve it to an
* absolute path.<p/>
- * If <code>nameResolver</code> is <code>null</code> or if <code>identifierResolver</code>
- * is <code>null</code> and the path starts with an identifier segment, this
- * method only checks the format of the string and returns <code>null</code>.
+ * If {@code nameResolver} is {@code null} or if {@code identifierResolver}
+ * is {@code null} and the path starts with an identifier segment, this
+ * method only checks the format of the string and returns {@code null}.
*
* @param parent the parent path.
* @param jcrPath the jcr path.
@@ -160,7 +166,7 @@ public class PathParser {
* @param identifierResolver the resolver to validate any trailing identifier
* segment and resolve it to an absolute path.
* @param factory The path factory.
- * @return the <code>Path</code> object.
+ * @return the {@code Path} object.
* @throws MalformedPathException
* @throws IllegalNameException
* @throws NamespaceException
@@ -172,15 +178,15 @@ public class PathParser {
}
/**
- * Parses the given <code>jcrPath</code> and returns a <code>Path</code>. If
- * <code>parent</code> is not <code>null</code>, it is prepended to the
- * built path before it is returned. If the specified <code>jcrPath</code>
+ * Parses the given {@code jcrPath} and returns a {@code Path}. If
+ * {@code parent} is not {@code null}, it is prepended to the
+ * built path before it is returned. If the specified {@code jcrPath}
* is an identifier based absolute path beginning with an identifier segment
- * the given <code>identifierResolver</code> will be used to resolve it to an
+ * the given {@code identifierResolver} will be used to resolve it to an
* absolute path.<p/>
- * If <code>nameResolver</code> is <code>null</code> or if <code>identifierResolver</code>
- * is <code>null</code> and the path starts with an identifier segment, this
- * method only checks the format of the string and returns <code>null</code>.
+ * If {@code nameResolver} is {@code null} or if {@code identifierResolver}
+ * is {@code null} and the path starts with an identifier segment, this
+ * method only checks the format of the string and returns {@code null}.
*
* @param parent the parent path.
* @param jcrPath the jcr path.
@@ -189,7 +195,7 @@ public class PathParser {
* segment and resolve it to an absolute path.
* @param factory The path factory.
* @param normalizeIdentifier
- * @return the <code>Path</code> object.
+ * @return the {@code Path} object.
* @throws MalformedPathException
* @throws IllegalNameException
* @throws NamespaceException
@@ -198,8 +204,6 @@ public class PathParser {
IdentifierResolver identifierResolver, PathFactory factory,
boolean normalizeIdentifier)
throws MalformedPathException, IllegalNameException, NamespaceException {
-
- final char EOF = (char) -1;
// check for length
int len = jcrPath == null ? 0 : jcrPath.length();
@@ -218,7 +222,7 @@ public class PathParser {
int pos = 0;
if (jcrPath.charAt(0) == '/') {
if (parent != null) {
- throw new MalformedPathException("'" + jcrPath + "' is not a relative path.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a relative path.");
}
builder.addRoot();
pos++;
@@ -233,7 +237,7 @@ public class PathParser {
int state;
if (jcrPath.charAt(0) == '[') {
if (parent != null) {
- throw new MalformedPathException("'" + jcrPath + "' is not a relative path.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a relative path.");
}
state = STATE_IDENTIFIER;
pos++;
@@ -248,7 +252,7 @@ public class PathParser {
int index = Path.INDEX_UNDEFINED;
boolean wasSlash = false;
- boolean checkFormat = (nameResolver == null);
+ boolean checkFormat = nameResolver == null;
while (pos <= len) {
char c = pos == len ? EOF : jcrPath.charAt(pos);
@@ -261,17 +265,17 @@ public class PathParser {
case '/':
case EOF:
if (state == STATE_PREFIX_START && c != EOF) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. double slash '//' not allowed.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. double slash '//' not allowed.");
}
if (state == STATE_PREFIX
|| state == STATE_NAME
|| state == STATE_INDEX_END
|| state == STATE_URI_END) {
- // eof pathelement
+ // eof path element
if (name == null) {
if (wasSlash) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path: Trailing slashes not allowed in prefixes and names.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path: Trailing slashes not allowed in prefixes and names.");
}
name = jcrPath.substring(lastPos, pos - 1);
}
@@ -292,7 +296,7 @@ public class PathParser {
if (c == EOF) {
// eof identifier reached
if (jcrPath.charAt(pos - 2) != ']') {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path: Unterminated identifier segment.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path: Unterminated identifier segment.");
}
String identifier = jcrPath.substring(lastPos, pos - 2);
if (checkFormat) {
@@ -300,7 +304,7 @@ public class PathParser {
identifierResolver.checkFormat(identifier);
} // else ignore. TODO: rather throw?
} else if (identifierResolver == null) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path: Identifier segments are not supported.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path: Identifier segments are not supported.");
} else if (normalizeIdentifier) {
builder.addAll(identifierResolver.getPath(identifier).getElements());
} else {
@@ -314,14 +318,14 @@ public class PathParser {
builder.addLast(factory.getCurrentElement());
lastPos = pos;
state = STATE_PREFIX_START;
- } else if (state == STATE_DOTDOT) {
+ } else if (state == STATE_DOT_DOT) {
builder.addLast(factory.getParentElement());
lastPos = pos;
state = STATE_PREFIX_START;
} else if (state == STATE_PREFIX_START && c == EOF) {
// ignore trailing slash
} else if (state != STATE_URI) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. '" + c + "' not a valid name character.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. '" + c + "' not a valid name character.");
}
break;
@@ -329,34 +333,34 @@ public class PathParser {
if (state == STATE_PREFIX_START) {
state = STATE_DOT;
} else if (state == STATE_DOT) {
- state = STATE_DOTDOT;
- } else if (state == STATE_DOTDOT) {
+ state = STATE_DOT_DOT;
+ } else if (state == STATE_DOT_DOT) {
state = STATE_PREFIX;
} else if (state == STATE_INDEX_END) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. '" + c + "' not valid after index. '/' expected.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. '" + c + "' not valid after index. '/' expected.");
}
break;
case ':':
if (state == STATE_PREFIX_START) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. Prefix must not be empty");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. Prefix must not be empty");
} else if (state == STATE_PREFIX) {
if (wasSlash) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path: Trailing slashes not allowed in prefixes and names.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path: Trailing slashes not allowed in prefixes and names.");
}
state = STATE_NAME_START;
// don't reset the lastPos/pos since prefix+name are passed together to the NameResolver
} else if (state == STATE_IDENTIFIER || state == STATE_URI) {
// nothing do
} else {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. '" + c + "' not valid name character");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. '" + c + "' not valid name character");
}
break;
case '[':
if (state == STATE_PREFIX || state == STATE_NAME) {
if (wasSlash) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path: Trailing slashes not allowed in prefixes and names.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path: Trailing slashes not allowed in prefixes and names.");
}
state = STATE_INDEX;
name = jcrPath.substring(lastPos, pos - 1);
@@ -364,7 +368,7 @@ public class PathParser {
} else if (state == STATE_IDENTIFIER) {
// nothing do
} else {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. '" + c + "' not a valid name character.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. '" + c + "' not a valid name character.");
}
break;
@@ -373,45 +377,47 @@ public class PathParser {
try {
index = Integer.parseInt(jcrPath.substring(lastPos, pos - 1));
} catch (NumberFormatException e) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. NumberFormatException in index: " + jcrPath.substring(lastPos, pos - 1));
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. NumberFormatException in index: " + jcrPath.substring(lastPos, pos - 1));
}
if (index < Path.INDEX_DEFAULT) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. Index number invalid: " + index);
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. Index number invalid: " + index);
}
state = STATE_INDEX_END;
} else if (state == STATE_IDENTIFIER) {
// nothing do
} else {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. '" + c + "' not a valid name character.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. '" + c + "' not a valid name character.");
}
break;
case ' ':
if (state == STATE_PREFIX_START || state == STATE_NAME_START) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. '" + c + "' not valid name start");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. '" + c + "' not valid name start");
} else if (state == STATE_INDEX_END) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. '" + c + "' not valid after index. '/' expected.");
- } else if (state == STATE_DOT || state == STATE_DOTDOT) {
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. '" + c + "' not valid after index. '/' expected.");
+ } else if (state == STATE_DOT || state == STATE_DOT_DOT) {
state = STATE_PREFIX;
}
break;
case '\t':
if (state != STATE_IDENTIFIER) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. Whitespace not a allowed in name.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. Whitespace not a allowed in name.");
}
+ break;
case '*':
case '|':
if (state != STATE_IDENTIFIER) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. '" + c + "' not a valid name character.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. '" + c + "' not a valid name character.");
}
+ break;
case '{':
if (state == STATE_PREFIX_START && lastPos == pos-1) {
// '{' marks the start of a uri enclosed in an expanded name
// instead of the usual namespace prefix, if it is
// located at the beginning of a new segment.
state = STATE_URI;
- } else if (state == STATE_NAME_START || state == STATE_DOT || state == STATE_DOTDOT) {
+ } else if (state == STATE_NAME_START || state == STATE_DOT || state == STATE_DOT_DOT) {
// otherwise it's part of the local name
state = STATE_NAME;
}
@@ -424,12 +430,12 @@ public class PathParser {
break;
default:
- if (state == STATE_PREFIX_START || state == STATE_DOT || state == STATE_DOTDOT) {
+ if (state == STATE_PREFIX_START || state == STATE_DOT || state == STATE_DOT_DOT) {
state = STATE_PREFIX;
} else if (state == STATE_NAME_START) {
state = STATE_NAME;
} else if (state == STATE_INDEX_END) {
- throw new MalformedPathException("'" + jcrPath + "' is not a valid path. '" + c + "' not valid after index. '/' expected.");
+ throw new MalformedPathException('\'' + jcrPath + "' is not a valid path. '" + c + "' not valid after index. '/' expected.");
}
}
wasSlash = c == ' ';
@@ -449,7 +455,7 @@ public class PathParser {
* therefore will not be detected.
*
* @param jcrPath
- * @throws MalformedPathException If the <code>jcrPath</code> is malformed.
+ * @throws MalformedPathException If the {@code jcrPath} is malformed.
*/
public static void checkFormat(String jcrPath) throws MalformedPathException {
try {