You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2006/12/07 16:09:59 UTC
svn commit: r483477 - in /jackrabbit/trunk/contrib/spi:
jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/
jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/
jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/
jcr2spi/src/main/ja...
Author: angela
Date: Thu Dec 7 07:09:57 2006
New Revision: 483477
URL: http://svn.apache.org/viewvc?view=rev&rev=483477
Log:
work in progress
- replace usage of UUID by uniqueID unless refering to 'jcr:uuid'
- PropertyImpl.checkValidReference: don't rely on Node-value to be NodeImpl
- spi.Event: getUUID() not used -> remove
Added:
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/UniqueIDReference.java (with props)
Removed:
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/UUIDReference.java
Modified:
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/CachingItemStateManager.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntries.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCache.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateFactory.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateManager.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/ChildNodeEntry.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/ChildNodeReference.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/PathElementReference.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Batch.java
jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ChildInfo.java
jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Event.java
jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdFactory.java
jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemId.java
jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java
jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyInfo.java
jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ChildInfoImpl.java
jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventFilterImpl.java
jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdFactoryImpl.java
jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java
jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ValueFactoryImpl.java
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java Thu Dec 7 07:09:57 2006
@@ -431,7 +431,7 @@
if (value == null) {
v = null;
} else {
- PropertyImpl.checkValidReference(value, PropertyType.REFERENCE, this);
+ PropertyImpl.checkValidReference(value, PropertyType.REFERENCE, session.getNamespaceResolver());
v = session.getValueFactory().createValue(value);
}
return setProperty(name, v, PropertyType.REFERENCE);
@@ -544,7 +544,7 @@
*/
public String getUUID() throws UnsupportedRepositoryOperationException, RepositoryException {
checkStatus();
- String uuid = getNodeState().getUUID();
+ String uuid = getNodeState().getUniqueID();
if (uuid == null || !isNodeType(QName.MIX_REFERENCEABLE)) {
throw new UnsupportedRepositoryOperationException();
}
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java Thu Dec 7 07:09:57 2006
@@ -22,6 +22,7 @@
import org.apache.jackrabbit.name.NoPrefixDeclaredException;
import org.apache.jackrabbit.name.QName;
import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.name.NamespaceResolver;
import org.apache.jackrabbit.value.QValue;
import org.apache.jackrabbit.value.ValueFormat;
import org.apache.jackrabbit.value.ValueHelper;
@@ -262,8 +263,8 @@
if (value == null) {
setInternalValues(null, reqType);
} else {
- checkValidReference(value, reqType, this);
- QValue qValue = QValue.create(((NodeImpl)value).getUUID(), PropertyType.REFERENCE);
+ checkValidReference(value, reqType, session.getNamespaceResolver());
+ QValue qValue = QValue.create(value.getUUID(), PropertyType.REFERENCE);
setInternalValues(new QValue[]{qValue}, reqType);
}
}
@@ -545,24 +546,21 @@
*
* @param value
* @param propertyType
- * @param itemImpl
* @throws ValueFormatException
* @throws RepositoryException
*/
- static void checkValidReference(Node value, int propertyType, ItemImpl itemImpl) throws ValueFormatException, RepositoryException {
+ static void checkValidReference(Node value, int propertyType, NamespaceResolver nsResolver) throws ValueFormatException, RepositoryException {
if (propertyType == PropertyType.REFERENCE) {
- if (value instanceof NodeImpl) {
- NodeImpl targetNode = (NodeImpl)value;
- if (!targetNode.isNodeType(QName.MIX_REFERENCEABLE)) {
+ try {
+ String jcrName = NameFormat.format(QName.MIX_REFERENCEABLE, nsResolver);
+ if (!value.isNodeType(jcrName)) {
throw new ValueFormatException("Target node must be of node type mix:referenceable");
}
- } else {
- String msg = "Incompatible Node object: " + value + "(" + itemImpl.safeGetJCRPath() + ")";
- log.debug(msg);
- throw new RepositoryException(msg);
+ } catch (NoPrefixDeclaredException e) {
+ throw new RepositoryException(e);
}
} else {
- throw new ValueFormatException("Property must be of type REFERENCE (" + itemImpl.safeGetJCRPath() + ")");
+ throw new ValueFormatException("Property must be of type REFERENCE.");
}
}
}
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/CachingItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/CachingItemStateManager.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/CachingItemStateManager.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/CachingItemStateManager.java Thu Dec 7 07:09:57 2006
@@ -155,20 +155,20 @@
* @throws ItemStateException if any other error occurs.
*/
private ItemState resolve(ItemId id) throws NoSuchItemStateException, ItemStateException {
- String uuid = id.getUUID();
+ String uid = id.getUniqueID();
Path path = id.getPath();
NodeState nodeState;
- // resolve uuid part
- if (uuid != null) {
- nodeState = cache.getNodeState(uuid);
+ // resolve uniqueID part
+ if (uid != null) {
+ nodeState = cache.getNodeState(uid);
if (nodeState == null) {
- // state identified by the uuid is not yet cached -> get from ISF
- NodeId refId = (path == null) ? (NodeId) id : idFactory.createNodeId(uuid);
+ // state identified by the uniqueID is not yet cached -> get from ISF
+ NodeId refId = (path == null) ? (NodeId) id : idFactory.createNodeId(uid);
nodeState = isf.createNodeState(refId, this);
}
} else {
- // start with root node if no uuid part in id
+ // start with root node if no uniqueID part in id
nodeState = getRootState();
}
@@ -189,9 +189,9 @@
*/
protected ItemState lookup(ItemId id) {
NodeState start;
- // resolve UUID
- if (id.getUUID() != null) {
- start = cache.getNodeState(id.getUUID());
+ // resolve uniqueID
+ if (id.getUniqueID() != null) {
+ start = cache.getNodeState(id.getUniqueID());
if (start == null) {
// not cached
return null;
@@ -208,7 +208,7 @@
}
if (id.getPath() == null) {
- // path is null -> id points to a state identified by uuid
+ // path is null -> id points to a state identified by uniqueID
return start;
} else {
// resolve path part
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntries.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntries.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntries.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntries.java Thu Dec 7 07:09:57 2006
@@ -80,28 +80,28 @@
this.nodeState = nodeState;
for (Iterator it = base.iterator(); it.hasNext();) {
ChildNodeEntry baseCne = (ChildNodeEntry) it.next();
- ChildNodeEntry cne = ChildNodeReference.create(nodeState, baseCne.getName(), baseCne.getUUID(), nodeState.isf, nodeState.idFactory);
+ ChildNodeEntry cne = ChildNodeReference.create(nodeState, baseCne.getName(), baseCne.getUniqueID(), nodeState.isf, nodeState.idFactory);
add(cne);
}
}
/**
* Returns true, if this ChildNodeEntries contains a entry that matches
- * the given name and either index or uuid:<br>
- * If <code>uuid</code> is not <code>null</code> the given index is
+ * the given name and either index or uniqueID:<br>
+ * If <code>uniqueID</code> is not <code>null</code> the given index is
* ignored since it is not required to identify a child node entry.
* Otherwise the given index is used.
*
* @param name
* @param index
- * @param uuid
+ * @param uniqueID
* @return
*/
- boolean contains(QName name, int index, String uuid) {
- if (uuid == null) {
+ boolean contains(QName name, int index, String uniqueID) {
+ if (uniqueID == null) {
return contains(name, index);
} else {
- return contains(name, uuid);
+ return contains(name, uniqueID);
}
}
@@ -131,11 +131,11 @@
/**
*
* @param name
- * @param uuid
+ * @param uniqueID
* @return
*/
- private boolean contains(QName name, String uuid) {
- if (uuid == null) {
+ private boolean contains(QName name, String uniqueID) {
+ if (uniqueID == null) {
throw new IllegalArgumentException();
}
if (!nameMap.containsKey(name)) {
@@ -148,14 +148,14 @@
for (Iterator it = ((List) o).iterator(); it.hasNext(); ) {
LinkedEntries.LinkNode n = (LinkedEntries.LinkNode) it.next();
ChildNodeEntry cne = n.getChildNodeEntry();
- if (uuid.equals(cne.getUUID())) {
+ if (uniqueID.equals(cne.getUniqueID())) {
return true;
}
}
} else {
// single child node with this name
ChildNodeEntry cne = ((LinkedEntries.LinkNode) o).getChildNodeEntry();
- return uuid.equals(cne.getUUID());
+ return uniqueID.equals(cne.getUniqueID());
}
// no matching entry found
return false;
@@ -312,18 +312,18 @@
/**
*
* @param nodeName
- * @param uuid
+ * @param uniqueID
* @return
- * @throws IllegalArgumentException if the given uuid is null.
+ * @throws IllegalArgumentException if the given uniqueID is null.
*/
- ChildNodeEntry get(QName nodeName, String uuid) {
- if (uuid == null) {
+ ChildNodeEntry get(QName nodeName, String uniqueID) {
+ if (uniqueID == null) {
throw new IllegalArgumentException();
}
Iterator cneIter = (nodeName != null) ? get(nodeName).iterator() : entries.iterator();
while (cneIter.hasNext()) {
ChildNodeEntry cne = (ChildNodeEntry) cneIter.next();
- if (uuid.equals(cne.getUUID())) {
+ if (uniqueID.equals(cne.getUniqueID())) {
return cne;
}
}
@@ -334,12 +334,12 @@
* Insert a new childnode entry at the position indicated by index.
*
* @param nodeName
- * @param uuid
+ * @param uniqueID
* @param index
* @return
*/
- ChildNodeEntry add(QName nodeName, String uuid, int index) {
- ChildNodeEntry cne = ChildNodeReference.create(nodeState, nodeName, uuid, nodeState.isf, nodeState.idFactory);
+ ChildNodeEntry add(QName nodeName, String uniqueID, int index) {
+ ChildNodeEntry cne = ChildNodeReference.create(nodeState, nodeName, uniqueID, nodeState.isf, nodeState.idFactory);
add(cne, index);
return cne;
}
@@ -578,7 +578,7 @@
}
/**
- * If the given child state got a (new) uuid assigned or its removed,
+ * If the given child state got a (new) unique ID assigned or its removed,
* its childEntry must be adjusted.
*
* @param childState
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCache.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCache.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCache.java Thu Dec 7 07:09:57 2006
@@ -34,25 +34,25 @@
/**
* Maps a String uuid to a {@link NodeState}.
*/
- private final Map uuid2NodeState;
+ private final Map uniqueId2NodeState;
/**
* Creates a new <code>CachingItemStateManager</code>.
*
*/
public ItemStateCache() {
- this.uuid2NodeState = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK);
+ this.uniqueId2NodeState = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK);
}
- public NodeState getNodeState(String uuid) {
- return (NodeState) uuid2NodeState.get(uuid);
+ public NodeState getNodeState(String uniqueID) {
+ return (NodeState) uniqueId2NodeState.get(uniqueID);
}
public NodeState getNodeState(NodeId nodeId) {
- String uuid = nodeId.getUUID();
- if (uuid != null && nodeId.getPath() == null) {
- return getNodeState(uuid);
+ String uid = nodeId.getUniqueID();
+ if (uid != null && nodeId.getPath() == null) {
+ return getNodeState(uid);
} else {
// TODO: missing caching for NodeState that are not only identified by uuid.
return null;
@@ -77,9 +77,9 @@
if (Status.isTerminal(state.getStatus())) {
if (state.isNode()) {
NodeState nodeState = (NodeState) state;
- String uuid = nodeState.getUUID();
- if (uuid != null) {
- uuid2NodeState.remove(uuid);
+ String uniqueID = nodeState.getUniqueID();
+ if (uniqueID != null) {
+ uniqueId2NodeState.remove(uniqueID);
}
}
state.removeListener(this);
@@ -107,10 +107,10 @@
private void putToCache(ItemState state) {
if (state.isNode() && (state.getStatus() == Status.EXISTING || state.getStatus() == Status.MODIFIED)) {
NodeState nodeState = (NodeState) state;
- // NOTE: uuid is retrieved from the state and not from the NodeId.
- String uuid = nodeState.getUUID();
- if (uuid != null) {
- uuid2NodeState.put(uuid, nodeState);
+ // NOTE: uniqueID is retrieved from the state and not from the NodeId.
+ String uniqueID = nodeState.getUniqueID();
+ if (uniqueID != null) {
+ uniqueId2NodeState.put(uniqueID, nodeState);
}
}
// TODO: add caching for other items as well
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java Thu Dec 7 07:09:57 2006
@@ -58,10 +58,10 @@
private QName nodeTypeName;
/**
- * The UUID of this node state or <code>null</code> if this node state
- * cannot be identified with a uuid.
+ * The unique ID of this node state or <code>null</code> if this node state
+ * cannot be identified with a unique ID.
*/
- private String uuid;
+ private String uniqueID;
/**
* The name of this node state
@@ -104,7 +104,7 @@
* Constructs a new node state that is not connected.
*
* @param name the name of this NodeState
- * @param uuid the uuid of this NodeState or <code>null</code> if
+ * @param uuid the uniqueID of this NodeState or <code>null</code> if
* this node state cannot be identified with a UUID.
* @param parent the parent of this NodeState
* @param nodeTypeName node type of this node
@@ -114,13 +114,13 @@
* states.
* @param idFactory the <code>IdFactory</code> to create new id
*/
- protected NodeState(QName name, String uuid, NodeState parent,
+ protected NodeState(QName name, String uniqueID, NodeState parent,
QName nodeTypeName, QNodeDefinition definition,
int initialStatus, ItemStateFactory isf,
IdFactory idFactory, boolean isWorkspaceState) {
super(parent, initialStatus, isf, idFactory, isWorkspaceState);
this.name = name;
- this.uuid = uuid;
+ this.uniqueID = uniqueID;
this.nodeTypeName = nodeTypeName;
this.definition = definition;
}
@@ -143,7 +143,7 @@
synchronized (overlayedState) {
NodeState wspState = overlayedState;
name = wspState.name;
- uuid = wspState.uuid;
+ uniqueID = wspState.uniqueID;
nodeTypeName = wspState.nodeTypeName;
definition = wspState.definition;
@@ -270,7 +270,7 @@
synchronized (another) {
NodeState nState = (NodeState) another;
name = nState.name;
- setUUID(nState.uuid);
+ setUniqueID(nState.uniqueID);
nodeTypeName = nState.nodeTypeName;
definition = nState.definition;
@@ -294,9 +294,9 @@
if (ce.denotesNode()) {
ChildNodeEntry cne = (ChildNodeEntry) ce;
int index = cne.getIndex();
- if (!childNodeEntries().contains(childName, index, cne.getUUID())) {
+ if (!childNodeEntries().contains(childName, index, cne.getUniqueID())) {
modified = true;
- childNodeEntries().add(childName, cne.getUUID(), index);
+ childNodeEntries().add(childName, cne.getUniqueID(), index);
}
} else {
if (!hasPropertyName(childName)) {
@@ -316,7 +316,7 @@
if (ce.denotesNode()) {
ChildNodeEntry cne = (ChildNodeEntry) ce;
int index = cne.getIndex();
- toRemove = !nState.childNodeEntries().contains(childName, index, cne.getUUID());
+ toRemove = !nState.childNodeEntries().contains(childName, index, cne.getUniqueID());
} else {
toRemove = !nState.properties.containsKey(childName);
}
@@ -389,8 +389,8 @@
* @return the id of this node state.
*/
public NodeId getNodeId() {
- if (uuid != null) {
- return idFactory.createNodeId(uuid);
+ if (uniqueID != null) {
+ return idFactory.createNodeId(uniqueID);
}
NodeState parent = getParent();
@@ -416,26 +416,26 @@
}
/**
- * @return the UUID of this node state or <code>null</code> if this
- * node cannot be identified with a UUID.
+ * @return the unique ID of this node state or <code>null</code> if this
+ * node cannot be identified with a unique ID.
*/
- public String getUUID() {
- return uuid;
+ public String getUniqueID() {
+ return uniqueID;
}
/**
- * Modify the uuid of this state and make sure, that the parent state
- * contains a proper childNodeEntry for this state. If the given uuid is
- * not different from the uuid of this state, the method returns silently
+ * Modify the uniqueID of this state and make sure, that the parent state
+ * contains a proper childNodeEntry for this state. If the given uniqueID is
+ * not different from the uniqueID of this state, the method returns silently
* without changing neither the parent nor this state.
*
- * @param uuid
+ * @param uniqueID
*/
- private void setUUID(String uuid) {
- String oldUUID = this.uuid;
- boolean mod = (oldUUID == null) ? uuid != null : !oldUUID.equals(uuid);
+ private void setUniqueID(String uniqueID) {
+ String oldUniqueID = this.uniqueID;
+ boolean mod = (oldUniqueID == null) ? uniqueID != null : !oldUniqueID.equals(uniqueID);
if (mod) {
- this.uuid = uuid;
+ this.uniqueID = uniqueID;
if (getParent() != null) {
getParent().childNodeEntries().replaceEntry(this);
}
@@ -584,12 +584,12 @@
* <code>NodeId</code> or <code>null</code> if there's no matching entry.
*/
synchronized ChildNodeEntry getChildNodeEntry(NodeId nodeId) {
- String uuid = nodeId.getUUID();
+ String uid = nodeId.getUniqueID();
Path path = nodeId.getPath();
ChildNodeEntry cne;
- if (uuid != null && path == null) {
- // retrieve child-entry by uuid
- cne = childNodeEntries().get(null, uuid);
+ if (uid != null && path == null) {
+ // retrieve child-entry by uid
+ cne = childNodeEntries().get(null, uid);
} else {
// retrieve child-entry by name and index
Path.PathElement nameElement = path.getNameElement();
@@ -728,9 +728,9 @@
properties.put(propName, propEntry);
try {
if (isWorkspaceState() && isUuidOrMixin(propName)) {
- if (QName.JCR_UUID.equals(propName) && uuid == null) {
+ if (QName.JCR_UUID.equals(propName) && uniqueID == null) {
PropertyState ps = propEntry.getPropertyState();
- setUUID(ps.getValue().getString());
+ setUniqueID(ps.getValue().getString());
} else if (QName.JCR_MIXINTYPES.equals(propName) && (mixinTypeNames == null || mixinTypeNames.length == 0)) {
PropertyState ps = propEntry.getPropertyState();
mixinTypeNames = getMixinNames(ps);
@@ -752,7 +752,7 @@
if (cpe != null) {
if (isWorkspaceState()) {
if (QName.JCR_UUID.equals(propName)) {
- setUUID(null);
+ setUniqueID(null);
} else if (QName.JCR_MIXINTYPES.equals(propName)) {
mixinTypeNames = QName.EMPTY_ARRAY;
}
@@ -803,14 +803,14 @@
case Event.NODE_ADDED:
int index = event.getQPath().getNameElement().getNormalizedIndex();
NodeId evId = (NodeId) event.getItemId();
- String uuid = (evId.getPath() != null) ? null : evId.getUUID();
+ String uniqueID = (evId.getPath() != null) ? null : evId.getUniqueID();
// add new childNodeEntry if it has not been added by
// some earlier 'add' event
// TODO: TOBEFIXED for SNSs
- ChildNodeEntry cne = (uuid != null) ? childNodeEntries().get(name, uuid) : childNodeEntries().get(name, index);
+ ChildNodeEntry cne = (uniqueID != null) ? childNodeEntries().get(name, uniqueID) : childNodeEntries().get(name, index);
if (cne == null) {
- cne = childNodeEntries().add(name, uuid, index);
+ cne = childNodeEntries().add(name, uniqueID, index);
}
// and let the transiently modified session state now, that
// its workspace state has been touched.
@@ -873,7 +873,7 @@
throws IllegalStateException {
checkIsSessionState();
- // remember parent states that have need to adjust their uuid/mixintypes
+ // remember parent states that have need to adjust their uniqueID/mixintypes
// or that got a new child entry added or existing entries removed.
Map modParents = new HashMap();
@@ -917,7 +917,7 @@
cne = overlayedParent.childNodeEntries().add(addedState.getQName(), null, index);
}
NodeState overlayed = cne.getNodeState();
- if (overlayed.getUUID() != null) {
+ if (overlayed.getUniqueID() != null) {
overlayedParent.childNodeEntries().replaceEntry(overlayed);
}
addedState.connect(overlayed);
@@ -932,7 +932,7 @@
addedState.connect(pe.getPropertyState());
}
- // make sure the new state gets updated (e.g. uuid created by server)
+ // make sure the new state gets updated (e.g. uniqueID created by server)
addedState.merge(addedState.overlayedState, true);
// and mark the added-state existing
addedState.setStatus(Status.EXISTING);
@@ -987,7 +987,7 @@
}
/* process all parent states that are marked modified and eventually
- need their uuid or mixin-types being adjusted because that property
+ need their uniqueID or mixin-types being adjusted because that property
has been added, modified or removed */
for (Iterator it = modParents.keySet().iterator(); it.hasNext();) {
NodeState parent = (NodeState) it.next();
@@ -1408,9 +1408,9 @@
for (int i = 0; i < props.length; i++) {
try {
if (QName.JCR_UUID.equals(props[i].getQName())) {
- String uuid = (props[i].getStatus() == Status.REMOVED) ? null : props[i].getValue().getString();
- sState.setUUID(uuid);
- overlayed.setUUID(uuid);
+ String uniqueID = (props[i].getStatus() == Status.REMOVED) ? null : props[i].getValue().getString();
+ sState.setUniqueID(uniqueID);
+ overlayed.setUniqueID(uniqueID);
} else if (QName.JCR_MIXINTYPES.equals(props[i].getQName())) {
QName[] mixins = (props[i].getStatus() == Status.REMOVED) ? QName.EMPTY_ARRAY : getMixinNames(props[i]);
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java Thu Dec 7 07:09:57 2006
@@ -749,11 +749,11 @@
QName name = def.getQName();
if (QName.MIX_REFERENCEABLE.equals(declaringNT) && QName.JCR_UUID.equals(name)) {
// mix:referenceable node type defines jcr:uuid
- String uuid = parent.getUUID();
- if (uuid == null) {
- uuid = UUID.randomUUID().toString();
+ String uniqueID = parent.getUniqueID();
+ if (uniqueID == null) {
+ uniqueID = UUID.randomUUID().toString();
}
- genValues = new QValue[]{QValue.create(uuid)};
+ genValues = new QValue[]{QValue.create(uniqueID)};
} else if (QName.NT_BASE.equals(declaringNT)) {
// nt:base node type
if (QName.JCR_PRIMARYTYPE.equals(name)) {
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java Thu Dec 7 07:09:57 2006
@@ -49,10 +49,10 @@
* @inheritDoc
* @see TransientItemStateFactory#createNewNodeState(QName, String, NodeState, QName, QNodeDefinition)
*/
- public NodeState createNewNodeState(QName name, String uuid,
+ public NodeState createNewNodeState(QName name, String uniqueID,
NodeState parent, QName nodetypeName,
QNodeDefinition definition) {
- NodeState nodeState = new NodeState(name, uuid, parent, nodetypeName,
+ NodeState nodeState = new NodeState(name, uniqueID, parent, nodetypeName,
definition, Status.NEW, this, idFactory, false);
// notify listeners when this item state is saved or invalidated
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateFactory.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateFactory.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateFactory.java Thu Dec 7 07:09:57 2006
@@ -30,16 +30,16 @@
* Creates a transient child <code>NodeState</code> with the given
* <code>name</code>.
*
- * @param name the name of the <code>NodeState</code> to create.
- * @param uuid the uuid of the <code>NodeState</code> to create or
- * <code>null</code> if the created <code>NodeState</code>
- * cannot be identified by a UUID.
+ * @param name the name of the <code>NodeState</code> to create.
+ * @param uniqueID the unique ID of the <code>NodeState</code> to create or
+ * <code>null</code> if the created <code>NodeState</code> cannot be
+ * identified by a unique ID.
* @param parent the parent of the <code>NodeState</code> to create.
* @param nodeTypeName name of the primary nodetype
* @param definition the definition for this new NodeState
* @return the created <code>NodeState</code>.
*/
- public NodeState createNewNodeState(QName name, String uuid,
+ public NodeState createNewNodeState(QName name, String uniqueID,
NodeState parent, QName nodeTypeName,
QNodeDefinition definition);
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java Thu Dec 7 07:09:57 2006
@@ -108,17 +108,17 @@
* {@link NodeState}.
*
* @param nodeName the name of the <code>NodeState</code> to create.
- * @param uuid the uuid of the <code>NodeState</code> to create or
+ * @param uniqueID the uniqueID of the <code>NodeState</code> to create or
* <code>null</code> if the created <code>NodeState</code>
- * cannot be identified by a UUID.
+ * cannot be identified by a unique ID.
* @param nodeTypeName name of the node type of the new node state.
* @param definition The qualified definition for the new node state.
* @param parent the parent of the new node state.
* @return a new transient {@link NodeState}.
*/
- NodeState createNewNodeState(QName nodeName, String uuid, QName nodeTypeName,
+ NodeState createNewNodeState(QName nodeName, String uniqueID, QName nodeTypeName,
QNodeDefinition definition, NodeState parent) {
- NodeState nodeState = getTransientFactory().createNewNodeState(nodeName, uuid, parent, nodeTypeName, definition);
+ NodeState nodeState = getTransientFactory().createNewNodeState(nodeName, uniqueID, parent, nodeTypeName, definition);
parent.addChildNodeState(nodeState);
changeLog.added(nodeState);
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java Thu Dec 7 07:09:57 2006
@@ -39,7 +39,6 @@
import javax.jcr.ItemNotFoundException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.NoSuchNodeTypeException;
-import java.io.InputStream;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
@@ -147,11 +146,11 @@
}
// build the node state
- String uuid = null;
+ String uniqueID = null;
if (info.getId().getPath() == null) {
- uuid = info.getId().getUUID();
+ uniqueID = info.getId().getUniqueID();
}
- NodeState state = new NodeState(info.getQName(), uuid, parent, info.getNodetype(),
+ NodeState state = new NodeState(info.getQName(), uniqueID, parent, info.getNodetype(),
definition, Status.EXISTING, this, service.getIdFactory(), true);
// names of child property entries
@@ -215,7 +214,7 @@
Collection childInfos = service.getChildInfos(sessionInfo, nodeState.getNodeId());
for (Iterator it = childInfos.iterator(); it.hasNext();) {
ChildInfo ci = (ChildInfo) it.next();
- entries.add(ci.getName(), ci.getUUID(), ci.getIndex());
+ entries.add(ci.getName(), ci.getUniqueID(), ci.getIndex());
}
return entries;
} catch (PathNotFoundException e) {
@@ -249,17 +248,10 @@
QValue[] qValues;
if (info.getType() == PropertyType.BINARY) {
- InputStream[] ins = info.getValuesAsStream();
- qValues = new QValue[ins.length];
- for (int i = 0; i < ins.length; i++) {
- qValues[i] = QValue.create(ins[i]);
- }
+ qValues = QValue.create(info.getValuesAsStream(), PropertyType.BINARY);
} else {
String[] str = info.getValues();
- qValues = new QValue[str.length];
- for (int i = 0; i < str.length; i++) {
- qValues[i] = QValue.create(str[i], info.getType());
- }
+ qValues = QValue.create(str, info.getType());
}
state.init(info.getType(), qValues);
@@ -292,7 +284,7 @@
//-----------------------------------------------------< NodeReferences >---
/**
* <code>NodeReferences</code> represents the references (i.e. properties of
- * type <code>REFERENCE</code>) to a particular node (denoted by its uuid).
+ * type <code>REFERENCE</code>) to a particular node (denoted by its unique ID).
*/
private class NodeReferencesImpl implements NodeReferences {
@@ -319,10 +311,10 @@
*/
public boolean isEmpty() {
// shortcut
- if (nodeState.getUUID() == null) {
+ if (nodeState.getUniqueID() == null) {
return true;
}
- // nodestate has a uuid and is potentially mix:referenceable
+ // nodestate has a unique ID and is potentially mix:referenceable
// => try to retrieve references
try {
NodeInfo info = service.getNodeInfo(sessionInfo, nodeState.getNodeId());
@@ -338,10 +330,10 @@
*/
public Iterator iterator() {
// shortcut
- if (nodeState.getUUID() == null) {
+ if (nodeState.getUniqueID() == null) {
return Collections.EMPTY_SET.iterator();
}
- // nodestate has a uuid and is potentially mix:referenceable
+ // nodestate has a uniqueID and is potentially mix:referenceable
// => try to retrieve references
try {
NodeInfo info = service.getNodeInfo(sessionInfo, nodeState.getNodeId());
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateManager.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateManager.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateManager.java Thu Dec 7 07:09:57 2006
@@ -164,7 +164,8 @@
if (state != null) {
state.refresh(event);
}
- // parent must be notified in case mixintypes or uuid is changed.
+ // parent must be notified in case jcr:mixintypes or jcr:uuid
+ // was changed.
if (parent != null) {
parent.refresh(event);
}
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/ChildNodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/ChildNodeEntry.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/ChildNodeEntry.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/ChildNodeEntry.java Thu Dec 7 07:09:57 2006
@@ -23,7 +23,7 @@
/**
* <code>ChildNodeEntry</code> specifies the name, index (in the case of
- * same-name siblings) and the UUID of a child node entry.
+ * same-name siblings) and the unique ID of a child node entry.
*/
public interface ChildNodeEntry extends ChildItemEntry {
@@ -33,11 +33,11 @@
public NodeId getId();
/**
- * @return the UUID of the node state which is referenced by this child node
- * entry or <code>null</code> if the node state cannot be identified with a
- * UUID.
+ * @return the unique ID of the node state which is referenced by this
+ * child node entry or <code>null</code> if the node state cannot be
+ * identified with a unique ID.
*/
- public String getUUID();
+ public String getUniqueID();
/**
* @return the index of this child node entry to suppport same-name siblings.
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/ChildNodeReference.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/ChildNodeReference.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/ChildNodeReference.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/ChildNodeReference.java Thu Dec 7 07:09:57 2006
@@ -18,6 +18,7 @@
import org.apache.jackrabbit.name.QName;
import org.apache.jackrabbit.spi.IdFactory;
+import org.apache.jackrabbit.spi.NodeId;
import org.apache.jackrabbit.jcr2spi.state.NodeState;
import org.apache.jackrabbit.jcr2spi.state.ItemStateFactory;
import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
@@ -42,32 +43,33 @@
public static ChildNodeEntry create(NodeState child, ItemStateFactory isf,
IdFactory idFactory) {
ChildNodeEntry cne;
- if (child.getUUID() == null) {
+ if (child.getUniqueID() == null) {
cne = new PathElementReference(child, isf, idFactory);
} else {
- cne = new UUIDReference(child, isf);
+ cne = new UniqueIDReference(child, isf);
}
return cne;
}
/**
* Creates a <code>ChildNodeEntry</code> instance based on
- * <code>nodeName</code> and an optional <code>uuid</code>.
+ * <code>name</code> and an optional <code>uniqueID</code>.
*
* @param parent
- * @param childName
- * @param childUUID
+ * @param name
+ * @param uniqueID
* @param isf
* @param idFactory
* @return
*/
- public static ChildNodeEntry create(NodeState parent, QName childName,
- String childUUID, ItemStateFactory isf,
+ public static ChildNodeEntry create(NodeState parent, QName name,
+ String uniqueID, ItemStateFactory isf,
IdFactory idFactory) {
- if (childUUID == null) {
- return new PathElementReference(parent, childName, isf, idFactory);
+ if (uniqueID == null) {
+ return new PathElementReference(parent, name, isf, idFactory);
} else {
- return new UUIDReference(parent, idFactory.createNodeId(childUUID), isf, childName);
+ NodeId nId = idFactory.createNodeId(uniqueID);
+ return new UniqueIDReference(parent, nId, isf, name);
}
}
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/PathElementReference.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/PathElementReference.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/PathElementReference.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/PathElementReference.java Thu Dec 7 07:09:57 2006
@@ -88,9 +88,9 @@
/**
* This implementation always returns <code>null</code>.
* @inheritDoc
- * @see ChildNodeEntry#getUUID()
+ * @see ChildNodeEntry#getUniqueID()
*/
- public String getUUID() {
+ public String getUniqueID() {
return null;
}
}
Added: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/UniqueIDReference.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/UniqueIDReference.java?view=auto&rev=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/UniqueIDReference.java (added)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/UniqueIDReference.java Thu Dec 7 07:09:57 2006
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jcr2spi.state.entry;
+
+import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.jcr2spi.state.ItemStateFactory;
+import org.apache.jackrabbit.jcr2spi.state.ItemState;
+import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
+import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
+
+/**
+ * <code>UniqueIDReference</code> implements a {@link ChildNodeEntry} based on a
+ * <code>NodeId</code> with just a unique ID and no relative path component.
+ */
+class UniqueIDReference extends ChildNodeReference implements ChildNodeEntry {
+
+ /**
+ * The <code>NodeId</code> with just a unique ID that references the child node.
+ */
+ private final NodeId childId;
+
+ /**
+ * Creates a new <code>UniqueIDReference</code>.
+ *
+ * @param parent the <code>NodeState</code> that owns this child node
+ * reference.
+ * @param childId the id of the referenced <code>NodeState</code>. This id
+ * must not have a relative path component.
+ * @param name the name of the child node.
+ * @param isf the item state factory to create the node state.
+ * @throws IllegalArgumentException if <code>childId</code> has a relative
+ * path component.
+ */
+ UniqueIDReference(NodeState parent, NodeId childId, ItemStateFactory isf, QName name) {
+ super(parent, name, isf);
+ if (childId.getPath() != null) {
+ throw new IllegalArgumentException("Cannot build UniqueIDReference from childId '" + childId + "' containing a path.");
+ }
+ this.childId = childId;
+ }
+
+ /**
+ * Creates a new <code>UniqueIDReference</code> with the given parent
+ * <code>NodeState</code> and an already initialized child node state.
+ *
+ * @param child the child node state.
+ * @param isf the item state factory to re-create the node state.
+ * @throws IllegalArgumentException if the id of <code>child</code> has a
+ * relative path component.
+ */
+ UniqueIDReference(NodeState child, ItemStateFactory isf) {
+ super(child, isf);
+ this.childId = child.getNodeId();
+ if (childId.getPath() != null) {
+ throw new IllegalArgumentException("Cannot build UniqueIDReference from childId '" + childId + "' containing a path.");
+ }
+ }
+
+ /**
+ * @inheritDoc
+ * @see ChildItemReference#doResolve()
+ * <p/>
+ * Returns a <code>NodeState</code>.
+ */
+ protected ItemState doResolve()
+ throws NoSuchItemStateException, ItemStateException {
+ return isf.createNodeState(childId, parent);
+ }
+
+ /**
+ * @inheritDoc
+ * @see ChildNodeEntry#getId()
+ */
+ public NodeId getId() {
+ return childId;
+ }
+
+ /**
+ * This implementation always returns a non-null value.
+ * @inheritDoc
+ * @see ChildNodeEntry#getUniqueID()
+ */
+ public String getUniqueID() {
+ return childId.getUniqueID();
+ }
+}
Propchange: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/UniqueIDReference.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/entry/UniqueIDReference.java
------------------------------------------------------------------------------
svn:keywords = author date id revision url
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java Thu Dec 7 07:09:57 2006
@@ -233,7 +233,7 @@
QName[] qLabels = getQLabels();
for (int i = 0; i < qLabels.length; i++) {
if (qLabels[i].equals(l)) {
- String uuid = getVersionStateByLabel(qLabels[i]).getUUID();
+ String uuid = getVersionStateByLabel(qLabels[i]).getUniqueID();
return vUUID.equals(uuid);
}
}
@@ -278,7 +278,7 @@
List vlabels = new ArrayList();
QName[] qLabels = getQLabels();
for (int i = 0; i < qLabels.length; i++) {
- String uuid = getVersionStateByLabel(qLabels[i]).getUUID();
+ String uuid = getVersionStateByLabel(qLabels[i]).getUniqueID();
if (vUUID.equals(uuid)) {
try {
vlabels.add(NameFormat.format(qLabels[i], session.getNamespaceResolver()));
@@ -322,7 +322,7 @@
// since all version histories are referenceable, protected and live
// in the same workspace, a simple comparison of the UUIDs is sufficient.
VersionHistoryImpl other = ((VersionHistoryImpl) otherItem);
- return vhState.getUUID().equals(other.vhState.getUUID());
+ return vhState.getUniqueID().equals(other.vhState.getUniqueID());
}
return false;
}
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java Thu Dec 7 07:09:57 2006
@@ -326,7 +326,7 @@
// remember uuid mapping
EffectiveNodeType ent = session.getValidator().getEffectiveNodeType(nodeState);
if (ent.includesNodeType(QName.MIX_REFERENCEABLE)) {
- refTracker.mappedUUIDs(originalUUID, nodeState.getNodeId().getUUID());
+ refTracker.mappedUUIDs(originalUUID, nodeState.getNodeId().getUniqueID());
}
}
break;
Modified: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Batch.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Batch.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Batch.java (original)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Batch.java Thu Dec 7 07:09:57 2006
@@ -38,10 +38,10 @@
* @param parentId
* @param nodeName Name of the node to be created
* @param nodetypeName
- * @param uuid UUID of the node to be created or <code>null</code>. If due
- * to an import the uuid of the resulting node is already defined, it must
- * be passed as separate uuid parameter, indicating a binding value for
- * the server. Otherwise the uuid must be <code>null</code>.
+ * @param uuid Value for the jcr:uuid property of the node to be created or
+ * <code>null</code>. If due to an import the uuid of the resulting node is
+ * already defined, it must be passed as separate uuid parameter, indicating
+ * a binding value for the server. Otherwise the uuid must be <code>null</code>.
* @throws javax.jcr.ItemExistsException
* @throws javax.jcr.PathNotFoundException
* @throws javax.jcr.version.VersionException
Modified: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ChildInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ChildInfo.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ChildInfo.java (original)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ChildInfo.java Thu Dec 7 07:09:57 2006
@@ -25,7 +25,7 @@
public QName getName();
- public String getUUID();
+ public String getUniqueID();
public int getIndex();
}
Modified: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Event.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Event.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Event.java (original)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/Event.java Thu Dec 7 07:09:57 2006
@@ -88,13 +88,6 @@
public NodeId getParentId();
/**
- * @return the uuid of the 'associated' node of this event or <code>null</code>
- * if the node is not referenceable.
- * @see javax.jcr.observation.ObservationManager#addEventListener
- */
- public String getUUID();
-
- /**
* @return the name of the primary node type of the 'associated' node of
* this event.
* @see javax.jcr.observation.ObservationManager#addEventListener
Modified: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdFactory.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdFactory.java (original)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/IdFactory.java Thu Dec 7 07:09:57 2006
@@ -28,7 +28,7 @@
public NodeId createNodeId(NodeId parentId, Path path);
- public NodeId createNodeId(String uuid, Path path);
+ public NodeId createNodeId(String uniqueID, Path path);
- public NodeId createNodeId(String uuid);
+ public NodeId createNodeId(String uniqueID);
}
Modified: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemId.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemId.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemId.java (original)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/ItemId.java Thu Dec 7 07:09:57 2006
@@ -19,27 +19,28 @@
import org.apache.jackrabbit.name.Path;
/**
- * An <code>ItemId</code> identifies an item using a combination of UUID and
- * path. There are three basic forms of an ItemId. The following
+ * An <code>ItemId</code> identifies an item using a combination of unique ID
+ * and path. There are three basic forms of an ItemId. The following
* table shows each of the allowed combinations where an <b>X</b> in
* the column indicates that a value is set and a <b>-</b> indicates
* that the value is <code>null</code>:
* <table>
- * <tr><th>UUID</th><th>relative Path</th><th>Usage</th></tr>
+ * <tr><th>UniqueID</th><th>Path</th><th>Usage</th></tr>
* <tr valign="top"><td align="center"><b>X</b></td><td align="center"><b>-</b></td>
- * <td>The item can be identified with a UUID. In most cases such an item
+ * <td>The item can be identified with a unique ID. In most cases such an item
* is also mix:referenceable but there is no restriction in that respect. An
- * SPI implementation may also use a UUID to identify non-referenceable nodes.
+ * SPI implementation may also use a unique ID to identify non-referenceable nodes.
* Whether a node is referenceable is purely governed by its node type or
- * the assigned mixin types.</td></tr>
+ * the assigned mixin types. Note, that the format of the ID it is left to the
+ * implementation.</td></tr>
* <tr valign="top"><td align="center"><b>-</b></td><td align="center"><b>X</b></td>
- * <td>The item can not be identified with a UUID and none of its ancestors
- * can be identified with a UUID. The item is identified by an absolute path.
+ * <td>The item can not be identified with a unique ID and none of its ancestors
+ * can be identified with a unique ID. The item is identified by an absolute path.
* </td></tr>
* <tr valign="top"><td align="center"><b>X</b></td><td align="center"><b>X</b></td>
- * <td>The item can not be identified with a UUID but one of its ancestors
- * can. {@link #getUUID} returns the UUID of the nearest ancestor, which
- * can be identified with a UUID. The relative path provides a navigation
+ * <td>The item can not be identified with a unique ID but one of its ancestors
+ * can. {@link #getUniqueID} returns the unique ID of the nearest ancestor, which
+ * can be identified with a unique ID. The relative path provides a navigation
* path from the above mentioned ancestor to the item identified by the
* <code>ItemId</code>.
* </td></tr>
@@ -54,15 +55,15 @@
public boolean denotesNode();
/**
- * @return the UUID part of this item id or <code>null</code> if the
+ * @return the uniqueID part of this item id or <code>null</code> if the
* identified item nor any of its ancestors can be identified with a
- * UUID.
+ * uniqueID.
*/
- public String getUUID();
+ public String getUniqueID();
/**
* @return the path part of this item id. Returns <code>null</code>
- * if this item can be identified solely with a UUID.
+ * if this item can be identified solely with a uniqueID.
*/
public Path getPath();
}
Modified: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java (original)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java Thu Dec 7 07:09:57 2006
@@ -25,7 +25,7 @@
/**
* @return identifier for the item that is based on this info object. the id
- * can either be an absolute path or a uuid (+ relative path).
+ * can either be an absolute path or a uniqueID (+ relative path).
* @see RepositoryService#getNodeInfo(SessionInfo, NodeId)
*/
public NodeId getId();
Modified: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyInfo.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyInfo.java (original)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/PropertyInfo.java Thu Dec 7 07:09:57 2006
@@ -25,7 +25,7 @@
/**
* @return identifier for the item that is based on this info object. the id
- * can either be an absolute path or a uuid (+ relative path).
+ * can either be an absolute path or a uniqueID (+ relative path).
* @see RepositoryService#getNodeInfo(SessionInfo, NodeId)
*/
public PropertyId getId();
Modified: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java (original)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java Thu Dec 7 07:09:57 2006
@@ -51,7 +51,7 @@
/**
* Return the <code>IdFactory</code>
- *
+ *
* @return
*/
public IdFactory getIdFactory();
@@ -130,10 +130,10 @@
/**
* The <code>NodeId</code> of the root node may basically have two
- * characteristics. If the root node can be identified with a UUID the
- * returned <code>NodeId</code> simply has a UUID part and the path
+ * characteristics. If the root node can be identified with a unique ID the
+ * returned <code>NodeId</code> simply has a uniqueID part and the path
* part is <code>null</code>. If the root node cannot be identified with a
- * UUID the UUID part is <code>null</code> and the path part will be set
+ * unique ID the uniqueID part is <code>null</code> and the path part will be set
* to "/".
*
* @param sessionInfo
@@ -334,7 +334,7 @@
/**
* Retrieve available lock information for the given <code>NodeId</code>.
- *
+ *
* @param sessionInfo
* @param nodeId
* @return
@@ -566,7 +566,7 @@
* encoded as a bitmask.
* @param absPath An absolute path.
* @param isDeep A <code>boolean</code>.
- * @param uuid Array of UUIDs.
+ * @param uuid Array of jcr:uuid properties.
* @param nodeTypeName Array of node type names.
* @param noLocal A <code>boolean</code>.
* @return the event filter instance with the given parameters.
Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ChildInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ChildInfoImpl.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ChildInfoImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ChildInfoImpl.java Thu Dec 7 07:09:57 2006
@@ -26,12 +26,12 @@
private final QName qName;
private final int index;
- private final String uuid;
+ private final String uniqueID;
- ChildInfoImpl(QName qName, int index, String uuid) {
+ ChildInfoImpl(QName qName, int index, String uniqueID) {
this.qName = qName;
this.index = index;
- this.uuid = uuid;
+ this.uniqueID = uniqueID;
}
/**
@@ -42,10 +42,10 @@
}
/**
- * @see ChildInfo#getUUID()
+ * @see ChildInfo#getUniqueID()
*/
- public String getUUID() {
- return this.uuid;
+ public String getUniqueID() {
+ return this.uniqueID;
}
/**
Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventFilterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventFilterImpl.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventFilterImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventFilterImpl.java Thu Dec 7 07:09:57 2006
@@ -58,7 +58,7 @@
* @param eventTypes the event types this filter is interested in.
* @param absPath filter events that are below this path.
* @param isDeep whether this filter is applied deep.
- * @param uuids the uuids of the nodes this filter allows.
+ * @param uuids the jcr:uuid of the nodes this filter allows.
* @param nodeTypeNames the QNames of the already resolved node types this
* filter allows.
* @param noLocal whether this filter accepts local events or not.
@@ -93,7 +93,7 @@
NodeId parentId = event.getParentId();
if (uuids != null) {
if (parentId.getPath() == null) {
- if (!uuids.contains(parentId.getUUID())) {
+ if (!uuids.contains(parentId.getUniqueID())) {
return false;
}
} else {
Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java Thu Dec 7 07:09:57 2006
@@ -67,10 +67,6 @@
return parentId;
}
- public String getUUID() {
- return getItemId().getUUID();
- }
-
public QName getPrimaryNodeTypeName() {
// TODO not available from XML_EVENT element
return null;
Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdFactoryImpl.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdFactoryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdFactoryImpl.java Thu Dec 7 07:09:57 2006
@@ -57,27 +57,27 @@
}
}
- public NodeId createNodeId(String uuid, Path path) {
- return new NodeIdImpl(uuid, path);
+ public NodeId createNodeId(String uniqueID, Path path) {
+ return new NodeIdImpl(uniqueID, path);
}
- public NodeId createNodeId(String uuid) {
- return new NodeIdImpl(uuid);
+ public NodeId createNodeId(String uniqueID) {
+ return new NodeIdImpl(uniqueID);
}
//------------------------------------------------------< Inner classes >---
private static abstract class ItemIdImpl implements ItemId {
- private final String uuid;
+ private final String uniqueID;
private final Path path;
private int hashCode = 0;
- private ItemIdImpl(String uuid, Path path) {
- if (uuid == null && path == null) {
- throw new IllegalArgumentException("Only uuid or relative path might be null.");
+ private ItemIdImpl(String uniqueID, Path path) {
+ if (uniqueID == null && path == null) {
+ throw new IllegalArgumentException("Only uniqueID or relative path might be null.");
}
- this.uuid = uuid;
+ this.uniqueID = uniqueID;
this.path = path;
}
@@ -85,7 +85,7 @@
if (parentId == null || name == null) {
throw new IllegalArgumentException("Invalid ItemIdImpl: parentId and name must not be null.");
}
- this.uuid = parentId.getUUID();
+ this.uniqueID = parentId.getUniqueID();
Path parentPath = parentId.getPath();
if (parentPath != null) {
this.path = Path.create(parentPath, name, true);
@@ -96,8 +96,8 @@
public abstract boolean denotesNode();
- public String getUUID() {
- return uuid;
+ public String getUniqueID() {
+ return uniqueID;
}
public Path getPath() {
@@ -122,7 +122,7 @@
}
boolean equals(ItemId other) {
- return (uuid == null) ? other.getUUID() == null : uuid.equals(other.getUUID())
+ return (uniqueID == null) ? other.getUniqueID() == null : uniqueID.equals(other.getUniqueID())
&& ((path == null) ? other.getPath() == null : path.equals(other.getPath()));
}
@@ -148,8 +148,8 @@
*/
public String toString() {
StringBuffer b = new StringBuffer();
- if (uuid != null) {
- b.append(uuid);
+ if (uniqueID != null) {
+ b.append(uniqueID);
}
if (path != null) {
b.append(path.toString());
@@ -160,16 +160,16 @@
private static class NodeIdImpl extends ItemIdImpl implements NodeId {
- public NodeIdImpl(String uuid) {
- super(uuid, null);
+ public NodeIdImpl(String uniqueID) {
+ super(uniqueID, null);
}
- public NodeIdImpl(String uuid, Path path) {
- super(uuid, path);
+ public NodeIdImpl(String uniqueID, Path path) {
+ super(uniqueID, path);
}
public NodeIdImpl(NodeId parentId, Path path) throws MalformedPathException {
- super(parentId.getUUID(), (parentId.getPath() != null) ? Path.create(parentId.getPath(), path, true) : path);
+ super(parentId.getUniqueID(), (parentId.getPath() != null) ? Path.create(parentId.getPath(), path, true) : path);
}
public boolean denotesNode() {
Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java Thu Dec 7 07:09:57 2006
@@ -100,6 +100,7 @@
import org.apache.jackrabbit.name.QName;
import org.apache.jackrabbit.name.NameFormat;
import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.NameException;
import org.apache.jackrabbit.spi.Batch;
import org.apache.jackrabbit.spi.RepositoryService;
import org.apache.jackrabbit.spi.SessionInfo;
@@ -314,6 +315,38 @@
return parentId;
}
+ String getUniqueID(DavPropertySet propSet) {
+ if (propSet.contains(ItemResourceConstants.JCR_UUID)) {
+ return propSet.get(ItemResourceConstants.JCR_UUID).getValue().toString();
+ } else {
+ return null;
+ }
+ }
+
+ QName getQName(DavPropertySet propSet) throws RepositoryException {
+ DavProperty nameProp = propSet.get(ItemResourceConstants.JCR_NAME);
+ if (nameProp != null && nameProp.getValue() != null) {
+ // not root node. Note that 'unespacing' is not required since
+ // the jcr:name property does not provide the value in escaped form.
+ String jcrName = nameProp.getValue().toString();
+ try {
+ return NameFormat.parse(jcrName, nsResolver);
+ } catch (NameException e) {
+ throw new RepositoryException(e);
+ }
+ } else {
+ return QName.ROOT;
+ }
+ }
+
+ int getIndex(DavPropertySet propSet) {
+ int index = Path.INDEX_UNDEFINED;
+ DavProperty indexProp = propSet.get(ItemResourceConstants.JCR_INDEX);
+ if (indexProp != null && indexProp.getValue() != null) {
+ index = Integer.parseInt(indexProp.getValue().toString());
+ }
+ return index;
+ }
//--------------------------------------------------------------------------
/**
@@ -766,9 +799,9 @@
if (childProps.contains(DavPropertyName.RESOURCETYPE) &&
childProps.get(DavPropertyName.RESOURCETYPE).getValue() != null) {
- QName qName = uriResolver.getQName(childProps);
- int index = uriResolver.getIndex(childProps);
- String uuid = uriResolver.getUUID(childProps);
+ QName qName = getQName(childProps);
+ int index = getIndex(childProps);
+ String uuid = getUniqueID(childProps);
ChildInfo childInfo = new ChildInfoImpl(qName, index, uuid);
childEntries.add(childInfo);
Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java Thu Dec 7 07:09:57 2006
@@ -33,7 +33,6 @@
import org.apache.jackrabbit.util.Text;
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
import org.apache.jackrabbit.webdav.property.DavPropertySet;
-import org.apache.jackrabbit.webdav.property.DavProperty;
import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
import org.apache.jackrabbit.webdav.jcr.version.report.LocateByUuidReport;
import org.apache.jackrabbit.webdav.client.methods.DavMethodBase;
@@ -116,18 +115,18 @@
StringBuffer uriBuffer = new StringBuffer();
Path path = itemId.getPath();
- String uuid = itemId.getUUID();
+ String uniqueID = itemId.getUniqueID();
// resolver uuid part
- if (uuid != null) {
- ItemId uuidId = (path == null) ? itemId : service.getIdFactory().createNodeId(uuid);
+ if (uniqueID != null) {
+ ItemId uuidId = (path == null) ? itemId : service.getIdFactory().createNodeId(uniqueID);
if (path != null & cache.containsItemId(uuidId)) {
// append uri of parent node, that is already cached
uriBuffer.append(cache.getUri(uuidId));
} else {
// try to request locate-by-uuid report to build the uri
ReportInfo rInfo = new ReportInfo(LocateByUuidReport.LOCATE_BY_UUID_REPORT);
- rInfo.setContentElement(DomUtil.hrefToXml(uuid, domFactory));
+ rInfo.setContentElement(DomUtil.hrefToXml(uniqueID, domFactory));
ReportMethod rm = null;
try {
@@ -141,7 +140,7 @@
uriBuffer.append(ms.getResponses()[0].getHref());
cache.add(ms.getResponses()[0].getHref(), uuidId);
} else {
- throw new ItemNotFoundException("Cannot identify item with uuid " + uuid);
+ throw new ItemNotFoundException("Cannot identify item with uniqueID " + uniqueID);
}
} catch (IOException e) {
@@ -185,54 +184,21 @@
NodeId nodeId;
DavPropertySet propSet = response.getProperties(DavServletResponse.SC_OK);
- String uuid = getUUID(propSet);
- if (uuid != null) {
- nodeId = service.getIdFactory().createNodeId(uuid);
+ String uniqueID = service.getUniqueID(propSet);
+ if (uniqueID != null) {
+ nodeId = service.getIdFactory().createNodeId(uniqueID);
} else {
- QName qName = getQName(propSet);
+ QName qName = service.getQName(propSet);
if (qName == QName.ROOT) {
nodeId = service.getIdFactory().createNodeId((String) null, Path.ROOT);
} else {
- int index = getIndex(propSet);
+ int index = service.getIndex(propSet);
nodeId = service.getIdFactory().createNodeId(parentId, Path.create(qName, index));
}
}
// cache
cache.add(response.getHref(), nodeId);
return nodeId;
- }
-
- String getUUID(DavPropertySet propSet) {
- if (propSet.contains(ItemResourceConstants.JCR_UUID)) {
- return propSet.get(ItemResourceConstants.JCR_UUID).getValue().toString();
- } else {
- return null;
- }
- }
-
- QName getQName(DavPropertySet propSet) throws RepositoryException {
- DavProperty nameProp = propSet.get(ItemResourceConstants.JCR_NAME);
- if (nameProp != null && nameProp.getValue() != null) {
- // not root node. Note that 'unespacing' is not required since
- // the jcr:name property does not provide the value in escaped form.
- String jcrName = nameProp.getValue().toString();
- try {
- return NameFormat.parse(jcrName, nsResolver);
- } catch (NameException e) {
- throw new RepositoryException(e);
- }
- } else {
- return QName.ROOT;
- }
- }
-
- int getIndex(DavPropertySet propSet) {
- int index = Path.INDEX_UNDEFINED;
- DavProperty indexProp = propSet.get(ItemResourceConstants.JCR_INDEX);
- if (indexProp != null && indexProp.getValue() != null) {
- index = Integer.parseInt(indexProp.getValue().toString());
- }
- return index;
}
PropertyId buildPropertyId(NodeId parentId, MultiStatusResponse response,
Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ValueFactoryImpl.java?view=diff&rev=483477&r1=483476&r2=483477
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ValueFactoryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ValueFactoryImpl.java Thu Dec 7 07:09:57 2006
@@ -95,7 +95,7 @@
/**
* A <code>ReferenceValue</code> provides an implementation
* of the <code>Value</code> interface representing a <code>REFERENCE</code> value
- * (a UUID of an existing node).
+ * (a jcr:uuid property of an existing, referenceable node).
*/
private static class ReferenceValue extends org.apache.jackrabbit.value.ReferenceValue {
@@ -119,19 +119,20 @@
* Returns a new <code>ReferenceValue</code> initialized to the value
* represented by the specified <code>String</code>.
* <p/>
- * The specified <code>String</code> must denote the UUID of an existing
- * node.
+ * The specified <code>String</code> must denote the jcr:uuid property
+ * of an existing node.
*
* @param s the string to be parsed.
- * @return a newly constructed <code>ReferenceValue</code> representing the
- * the specified value.
- * @throws javax.jcr.ValueFormatException If the <code>String</code> is null or empty String.
+ * @return a newly constructed <code>ReferenceValue</code> representing
+ * the specified value.
+ * @throws javax.jcr.ValueFormatException If the <code>String</code> is
+ * null or empty String.
*/
public static org.apache.jackrabbit.value.ReferenceValue valueOf(String s) throws ValueFormatException {
if (s != null && !"".equals(s)) {
return new ReferenceValue(s);
} else {
- throw new ValueFormatException("not a valid UUID format");
+ throw new ValueFormatException("Invalid format for jcr:uuid");
}
}
}