You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2005/01/28 16:46:54 UTC
svn commit: r148894 - in incubator/jackrabbit/trunk: . src/java/org/apache/jackrabbit/core src/java/org/apache/jackrabbit/core/jndi src/java/org/apache/jackrabbit/core/nodetype src/java/org/apache/jackrabbit/core/search src/java/org/apache/jackrabbit/core/search/lucene src/java/org/apache/jackrabbit/core/util src/java/org/apache/jackrabbit/core/version src/java/org/apache/jackrabbit/core/xml src/test/org/apache/jackrabbit/test/search
Author: stefan
Date: Fri Jan 28 07:46:52 2005
New Revision: 148894
URL: http://svn.apache.org/viewcvs?view=rev&rev=148894
Log:
porting jackrabbit to v0.16.2 of jsr170 spec
(work in progress...)
Added:
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASession.java (contents, props changed)
Removed:
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FilteredPropertyIterator.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PropertyIteratorImpl.java
Modified:
incubator/jackrabbit/trunk/project.xml
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/BindableRepository.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryManagerImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryParser.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/IteratorHelper.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java
incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java
incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/AbstractQueryTest.java
incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/OrderByTest.java
incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SimpleQueryTest.java
Modified: incubator/jackrabbit/trunk/project.xml
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/project.xml?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/project.xml&r1=148893&p2=incubator/jackrabbit/trunk/project.xml&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/project.xml (original)
+++ incubator/jackrabbit/trunk/project.xml Fri Jan 28 07:46:52 2005
@@ -21,7 +21,7 @@
<pomVersion>3</pomVersion>
<id>jackrabbit</id>
<name>Jackrabbit</name>
- <currentVersion>0.15-dev</currentVersion>
+ <currentVersion>0.16.2-dev</currentVersion>
<organization>
<name>The Apache Software Foundation</name>
<url>http://incubator.apache.org/projects/jackrabbit.html</url>
@@ -254,8 +254,8 @@
<dependency>
<groupId>jsr170</groupId>
<artifactId>jcr</artifactId>
- <version>0.15</version>
- <url>http://www.day.com/maven/jsr170/jars/jcr-0.15.jar</url>
+ <version>0.16.2</version>
+ <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.2.jar</url>
</dependency>
<dependency>
<id>log4j</id>
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java Fri Jan 28 07:46:52 2005
@@ -1074,7 +1074,7 @@
/**
* @see Item#remove
*/
- public void remove() throws RepositoryException {
+ public void remove() throws VersionException, LockException, RepositoryException {
// check state of this instance
sanityCheck();
@@ -1110,7 +1110,7 @@
NodeImpl parentNode = (NodeImpl) getParent();
- // check if versioning allows write
+ // check if versioning allows write (only cheap call)
if (!parentNode.isCheckedOut(false)) {
String msg = parentNode.safeGetJCRPath() + ": cannot remove a child of a checked-in node";
log.error(msg);
@@ -1136,9 +1136,9 @@
* @see Item#save
*/
public void save()
- throws AccessDeniedException, LockException,
- ConstraintViolationException, InvalidItemStateException,
- ReferentialIntegrityException, RepositoryException {
+ throws AccessDeniedException, ConstraintViolationException,
+ InvalidItemStateException, ReferentialIntegrityException,
+ VersionException, LockException, RepositoryException {
// check state of this instance
sanityCheck();
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java Fri Jan 28 07:46:52 2005
@@ -23,6 +23,7 @@
import javax.jcr.NamespaceException;
import javax.jcr.NamespaceRegistry;
import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
@@ -223,7 +224,8 @@
* @see NamespaceRegistry#registerNamespace
*/
public void registerNamespace(String prefix, String uri)
- throws NamespaceException, RepositoryException {
+ throws NamespaceException, UnsupportedRepositoryOperationException,
+ RepositoryException {
if (prefix == null || uri == null) {
throw new IllegalArgumentException("prefix/uri can not be null");
}
@@ -278,7 +280,8 @@
* @see NamespaceRegistry#unregisterNamespace
*/
public void unregisterNamespace(String prefix)
- throws NamespaceException, RepositoryException {
+ throws NamespaceException, UnsupportedRepositoryOperationException,
+ RepositoryException {
if (reservedPrefixes.contains(prefix)) {
throw new NamespaceException("reserved prefix: " + prefix);
}
@@ -296,14 +299,14 @@
/**
* @see NamespaceRegistry#getPrefixes
*/
- public String[] getPrefixes() {
+ public String[] getPrefixes() throws RepositoryException {
return (String[]) prefixToURI.keySet().toArray(new String[prefixToURI.keySet().size()]);
}
/**
* @see NamespaceRegistry#getURIs
*/
- public String[] getURIs() {
+ public String[] getURIs() throws RepositoryException {
return (String[]) uriToPrefix.keySet().toArray(new String[uriToPrefix.keySet().size()]);
}
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java Fri Jan 28 07:46:52 2005
@@ -188,6 +188,21 @@
}
}
+ /**
+ * Determines if there are pending unsaved changes either on <i>this</i>
+ * node or on any node or property in the subtree below it.
+ * @return <code>true</code> if there are pending unsaved changes,
+ * <code>false</code> otherwise.
+ * @throws RepositoryException if an error occured
+ */
+ protected boolean hasPendingChanges() throws RepositoryException {
+ if (isTransient()) {
+ return true;
+ }
+ Iterator iter = stateMgr.getDescendantTransientItemStates(id);
+ return iter.hasNext();
+ }
+
protected synchronized ItemState getOrCreateTransientItemState()
throws RepositoryException {
if (!isTransient()) {
@@ -255,7 +270,7 @@
// jcr:created property
genValues = new InternalValue[]{InternalValue.create(Calendar.getInstance())};
}
- } else if (nt.getQName().equals(NodeTypeRegistry.NT_MIME_RESOURCE)) {
+ } else if (nt.getQName().equals(NodeTypeRegistry.NT_RESOURCE)) {
// nt:mimeResource node type
if (name.equals(PROPNAME_LAST_MODIFIED)) {
// jcr:lastModified property
@@ -668,13 +683,6 @@
}
}
- // check if versioning allows write (only cheap call)
- if (!isCheckedOut(false)) {
- String msg = safeGetJCRPath() + ": cannot add a child to a checked-in node";
- log.error(msg);
- throw new VersionException(msg);
- }
-
// check protected flag of parent (i.e. this) node
if (getDefinition().isProtected()) {
String msg = safeGetJCRPath() + ": cannot add a child to a protected node";
@@ -822,6 +830,14 @@
}
/**
+ * Returns the (internal) uuid of this node.
+ * @return the uuid of this node
+ */
+ public String internalGetUUID() {
+ return ((NodeState) state).getUUID();
+ }
+
+ /**
* Sets the internal value of a property without checking any constraints.
* <p/>
* Note that no type conversion is being performed, i.e. it's the caller's
@@ -1257,11 +1273,18 @@
* @see Node#addNode(String)
*/
public synchronized Node addNode(String relPath)
- throws ItemExistsException, PathNotFoundException,
- ConstraintViolationException, RepositoryException {
+ throws ItemExistsException, PathNotFoundException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException {
// check state of this instance
sanityCheck();
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot add a child to a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
return internalAddNode(relPath, null);
}
@@ -1270,11 +1293,18 @@
*/
public synchronized Node addNode(String relPath, String nodeTypeName)
throws ItemExistsException, PathNotFoundException,
- NoSuchNodeTypeException, ConstraintViolationException,
- RepositoryException {
+ NoSuchNodeTypeException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException {
// check state of this instance
sanityCheck();
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot add a child to a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
NodeTypeImpl nt = (NodeTypeImpl) session.getNodeTypeManager().getNodeType(nodeTypeName);
return internalAddNode(relPath, nt);
}
@@ -1282,9 +1312,11 @@
/**
* @see Node#orderBefore(String, String)
*/
- public void orderBefore(String srcName, String destName)
- throws UnsupportedRepositoryOperationException, ConstraintViolationException,
- ItemNotFoundException, RepositoryException {
+ public synchronized void orderBefore(String srcName, String destName)
+ throws UnsupportedRepositoryOperationException, VersionException,
+ ConstraintViolationException, ItemNotFoundException, LockException,
+ RepositoryException {
+
if (!nodeType.hasOrderableChildNodes()) {
throw new UnsupportedRepositoryOperationException("child node ordering not supported on node " + safeGetJCRPath());
}
@@ -1409,16 +1441,32 @@
* @see Node#setProperty(String, Value[])
*/
public Property setProperty(String name, Value[] values)
- throws ValueFormatException, RepositoryException {
- // check state of this instance
- sanityCheck();
-
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
int type;
if (values == null || values.length == 0) {
- type = PropertyType.STRING;
+ type = PropertyType.UNDEFINED;
} else {
type = values[0].getType();
}
+ return setProperty(name, values, type);
+ }
+
+ /**
+ * @see Node#setProperty(String, Value[], int)
+ */
+ public Property setProperty(String name, Value[] values, int type)
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot set property of a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
BitSet status = new BitSet();
PropertyImpl prop = getOrCreateProperty(name, type, true, status);
@@ -1439,12 +1487,29 @@
* @see Node#setProperty(String, String[])
*/
public Property setProperty(String name, String[] values)
- throws ValueFormatException, RepositoryException {
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
+ return setProperty(name, values, PropertyType.STRING);
+ }
+
+ /**
+ * @see Node#setProperty(String, String[], int)
+ */
+ public Property setProperty(String name, String[] values, int type)
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
// check state of this instance
sanityCheck();
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot set property of a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
BitSet status = new BitSet();
- PropertyImpl prop = getOrCreateProperty(name, PropertyType.STRING, true, status);
+ PropertyImpl prop = getOrCreateProperty(name, type, true, status);
try {
prop.setValue(values);
} catch (RepositoryException re) {
@@ -1461,10 +1526,19 @@
/**
* @see Node#setProperty(String, String)
*/
- public Property setProperty(String name, String value) throws ValueFormatException, RepositoryException {
+ public Property setProperty(String name, String value)
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
// check state of this instance
sanityCheck();
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot set property of a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
BitSet status = new BitSet();
PropertyImpl prop = getOrCreateProperty(name, PropertyType.STRING, false, status);
try {
@@ -1484,10 +1558,18 @@
* @see Node#setProperty(String, Value)
*/
public Property setProperty(String name, Value value)
- throws ValueFormatException, RepositoryException {
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
// check state of this instance
sanityCheck();
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot set property of a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
int type = (value == null) ? PropertyType.STRING : value.getType();
BitSet status = new BitSet();
@@ -1509,10 +1591,18 @@
* @see Node#setProperty(String, InputStream)
*/
public Property setProperty(String name, InputStream value)
- throws ValueFormatException, RepositoryException {
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
// check state of this instance
sanityCheck();
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot set property of a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
BitSet status = new BitSet();
PropertyImpl prop = getOrCreateProperty(name, PropertyType.BINARY, false, status);
try {
@@ -1532,10 +1622,18 @@
* @see Node#setProperty(String, boolean)
*/
public Property setProperty(String name, boolean value)
- throws ValueFormatException, RepositoryException {
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
// check state of this instance
sanityCheck();
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot set property of a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
BitSet status = new BitSet();
PropertyImpl prop = getOrCreateProperty(name, PropertyType.BOOLEAN, false, status);
try {
@@ -1555,10 +1653,18 @@
* @see Node#setProperty(String, double)
*/
public Property setProperty(String name, double value)
- throws ValueFormatException, RepositoryException {
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
// check state of this instance
sanityCheck();
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot set property of a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
BitSet status = new BitSet();
PropertyImpl prop = getOrCreateProperty(name, PropertyType.DOUBLE, false, status);
try {
@@ -1578,10 +1684,18 @@
* @see Node#setProperty(String, long)
*/
public Property setProperty(String name, long value)
- throws ValueFormatException, RepositoryException {
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
// check state of this instance
sanityCheck();
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot set property of a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
BitSet status = new BitSet();
PropertyImpl prop = getOrCreateProperty(name, PropertyType.LONG, false, status);
try {
@@ -1601,10 +1715,18 @@
* @see Node#setProperty(String, Calendar)
*/
public Property setProperty(String name, Calendar value)
- throws ValueFormatException, RepositoryException {
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
// check state of this instance
sanityCheck();
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot set property of a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
BitSet status = new BitSet();
PropertyImpl prop = getOrCreateProperty(name, PropertyType.DATE, false, status);
try {
@@ -1624,10 +1746,18 @@
* @see Node#setProperty(String, Node)
*/
public Property setProperty(String name, Node value)
- throws ValueFormatException, RepositoryException {
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
// check state of this instance
sanityCheck();
+ // check if versioning allows write (only cheap call)
+ if (!isCheckedOut(false)) {
+ String msg = safeGetJCRPath() + ": cannot set property of a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
BitSet status = new BitSet();
PropertyImpl prop = getOrCreateProperty(name, PropertyType.REFERENCE, false, status);
try {
@@ -1903,8 +2033,8 @@
* @see Node#addMixin(String)
*/
public void addMixin(String mixinName)
- throws NoSuchNodeTypeException, ConstraintViolationException,
- RepositoryException {
+ throws NoSuchNodeTypeException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException {
// check state of this instance
sanityCheck();
@@ -1912,7 +2042,7 @@
if (!isCheckedOut(true)) {
String msg = safeGetJCRPath() + ": cannot add a mixin node type to a checked-in node";
log.error(msg);
- throw new ConstraintViolationException(msg);
+ throw new VersionException(msg);
}
// check protected flag
@@ -2012,8 +2142,8 @@
* @see Node#removeMixin(String)
*/
public void removeMixin(String mixinName)
- throws NoSuchNodeTypeException, ConstraintViolationException,
- RepositoryException {
+ throws NoSuchNodeTypeException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException {
// check state of this instance
sanityCheck();
@@ -2021,7 +2151,7 @@
if (!isCheckedOut(true)) {
String msg = safeGetJCRPath() + ": cannot remove a mixin node type from a checked-in node";
log.error(msg);
- throw new ConstraintViolationException(msg);
+ throw new VersionException(msg);
}
// check protected flag
@@ -2261,37 +2391,17 @@
// check state of this instance
sanityCheck();
- PropertyIterator propIter = getProperties();
- // check properties first
- while (propIter.hasNext()) {
- Property p = propIter.nextProperty();
- PropertyDef pd = p.getDefinition();
- if (pd.isPrimaryItem()) {
- // found a 'primary' property
- return p;
- }
- }
- // check child nodes
- NodeIterator nodeIter = getNodes();
- while (nodeIter.hasNext()) {
- Node n = nodeIter.nextNode();
- NodeDef nd = n.getDefinition();
- if (nd.isPrimaryItem()) {
-/*
- // found a 'primary' child node,
- // recursively check if it has a
- // primary child item
- try {
- return n.getPrimaryItem();
- } catch (ItemNotFoundException infe) {
- return n;
- }
-*/
- // don't recurse
- return n;
- }
+ String name = nodeType.getPrimaryItemName();
+ if (name == null) {
+ throw new ItemNotFoundException();
+ }
+ if (hasProperty(name)) {
+ return getProperty(name);
+ } else if (hasNode(name)) {
+ return getProperty(name);
+ } else {
+ throw new ItemNotFoundException();
}
- throw new ItemNotFoundException();
}
/**
@@ -2305,56 +2415,103 @@
throw new UnsupportedRepositoryOperationException();
}
- NodeState thisState = (NodeState) state;
- return thisState.getUUID();
+ return ((NodeState) state).getUUID();
}
/**
- * @see Node#getUUID()
+ * @see Node#getCorrespondingNodePath(String)
*/
- public String internalGetUUID() throws RepositoryException {
+ public String getCorrespondingNodePath(String workspaceName)
+ throws ItemNotFoundException, NoSuchWorkspaceException,
+ AccessDeniedException, RepositoryException {
// check state of this instance
sanityCheck();
- return ((NodeState) state).getUUID();
+
+ if (isNodeType(NodeTypeRegistry.MIX_REFERENCEABLE)) {
+ String uuid = ((NodeState) state).getUUID();
+ }
+/*
+ // @todo FIXME need to get session with same credentials as current
+ SessionImpl srcSession = rep.getSystemSession(srcWorkspaceName);
+ Node root = session.getRootNode();
+ // if (isRepositoryRoot()) [don't know, if this works correctly with workspaces]
+ if (isSame(root)) {
+ return (NodeImpl) srcSession.getRootNode();
+ }
+
+ // if this node is referenceable, return the corresponding one
+ if (isNodeType(NodeTypeRegistry.MIX_REFERENCEABLE)) {
+ try {
+ return (NodeImpl) srcSession.getNodeByUUID(getUUID());
+ } catch (ItemNotFoundException e) {
+ return null;
+ }
+ }
+
+ // search nearest ancestor that is referenceable
+ NodeImpl m1 = this;
+ while (!m1.isSame(root) && !m1.isNodeType(NodeTypeRegistry.MIX_REFERENCEABLE)) {
+ m1 = (NodeImpl) m1.getParent();
+ }
+ // special treatment for root
+ if (m1.isSame(root)) {
+ return (NodeImpl) srcSession.getItem(getPath());
+ }
+
+ // calculate relative path. please note, that this cannot be done
+ // iteratively in the 'while' loop above, since getName() does not
+ // return the relative path, but just the name (without path indices)
+ // n1.getPath() = /foo/bar/something[1]
+ // m1.getPath() = /foo
+ // relpath = bar/something[1]
+ String relPath = getPath().substring(m1.getPath().length() + 1);
+ try {
+ return (NodeImpl) srcSession.getNodeByUUID(m1.getUUID()).getNode(relPath);
+ } catch (ItemNotFoundException e) {
+ return null;
+ }
+*/
+ // @todo implement Node#getCorrespondingNodePath
+ throw new RepositoryException("not yet implemented");
}
- //-------------------------------------------------< versioning support >---
/**
- * Checks if this node is versionable, i.e. has 'mix:versionable'.
- *
- * @throws UnsupportedRepositoryOperationException
- * if this node is not versionable
+ * @see Node#getIndex()
*/
- private void checkVersionable()
- throws UnsupportedRepositoryOperationException, RepositoryException {
- if (!isNodeType(NodeTypeRegistry.MIX_VERSIONABLE)) {
- String msg = "Unable to perform versioning operation on non versionable node: " + safeGetJCRPath();
- log.debug(msg);
- throw new UnsupportedRepositoryOperationException(msg);
- }
+ public int getIndex() throws RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ // @todo optimize, no need to build entire path just to find this node's index
+ int index = getPrimaryPath().getNameElement().getIndex();
+ return (index == 0) ? 1 : index;
}
+ //------------------------------< versioning support: public Node methods >
/**
* @see Node#checkin()
*/
public Version checkin()
throws VersionException, UnsupportedRepositoryOperationException,
- RepositoryException {
+ InvalidItemStateException, LockException, RepositoryException {
+ // check state of this instance
+ sanityCheck();
// check if versionable
checkVersionable();
// check if checked out
+ // @todo FIXME semantics of isCheckedOut() have changed!
if (!isCheckedOut()) {
String msg = safeGetJCRPath() + ": Node is already checked-in. ignoring.";
log.debug(msg);
return getBaseVersion();
}
- // check transient state
- if (isModified()) {
- String msg = "Unable to checkin node. Not allowed on transient node. " + safeGetJCRPath();
- log.debug(msg);
+ // check for pending changes
+ if (hasPendingChanges()) {
+ String msg = "Unable to checkin node. Node has pending changes: " + safeGetJCRPath();
+ log.error(msg);
throw new InvalidItemStateException(msg);
}
@@ -2379,24 +2536,21 @@
* @see Node#checkout()
*/
public void checkout()
- throws UnsupportedRepositoryOperationException, RepositoryException {
+ throws UnsupportedRepositoryOperationException, LockException,
+ RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
// check if versionable
checkVersionable();
// check if already checked out
- if (isCheckedOut()) {
+ if (isCheckedOut(false)) {
String msg = safeGetJCRPath() + ": Node is already checked-out. ignoring.";
log.debug(msg);
return;
}
- // check transient state
- if (isModified()) {
- String msg = "Unable to checkout node. Not allowed on transient node. " + safeGetJCRPath();
- log.debug(msg);
- throw new InvalidItemStateException(msg);
- }
-
Property prop = internalSetProperty(VersionManager.PROPNAME_IS_CHECKED_OUT, InternalValue.create(true));
prop.save();
prop = internalSetProperty(VersionManager.PROPNAME_PREDECESSORS,
@@ -2407,98 +2561,288 @@
}
/**
- * @see Node#addPredecessor(Version)
+ * @see Node#update(String)
*/
- public void addPredecessor(Version v)
- throws VersionException, UnsupportedRepositoryOperationException,
- RepositoryException {
- if (!isCheckedOut()) {
- throw new VersionException("Unable to add predecessor. Node not checked-out.");
- }
+ public void update(String srcWorkspaceName)
+ throws NoSuchWorkspaceException, AccessDeniedException,
+ LockException, InvalidItemStateException, RepositoryException {
+ // check state of this instance
+ sanityCheck();
- // can only add predecessor of same version history
- if (!v.getParent().getUUID().equals(getVersionHistory().getUUID())) {
- String msg = "Unable to add predecessor. Not same version history " + safeGetJCRPath();
- log.debug(msg);
- throw new VersionException(msg);
+ // check for pending changes
+ if (session.hasPendingChanges()) {
+ String msg = "Unable to checkin node. Session has pending changes.";
+ log.error(msg);
+ throw new InvalidItemStateException(msg);
}
- Value[] values = getProperty(VersionManager.PROPNAME_PREDECESSORS).getValues();
- InternalValue[] preds = new InternalValue[values.length + 1];
- for (int i = 0; i < values.length; i++) {
- if (values[i].getString().equals(v.getUUID())) {
- // ignore duplicates
- return;
- }
- preds[i + 1] = InternalValue.create(new UUID(values[i].getString()));
+
+ NodeImpl srcNode = getCorrespondingNode(srcWorkspaceName);
+ if (srcNode == null) {
+ throw new ItemNotFoundException("No corresponding node for " + safeGetJCRPath());
}
- preds[0] = InternalValue.create(new UUID(v.getUUID()));
- Property prop = internalSetProperty(VersionManager.PROPNAME_PREDECESSORS, preds);
- prop.save();
+ // not sure, if clone overrides 'this' node.
+ session.getWorkspace().clone(srcWorkspaceName, srcNode.getPath(), getPath(), true);
}
/**
- * @see Node#removePredecessor(Version)
+ * @see Node#merge(String, boolean)
*/
- public void removePredecessor(Version v)
- throws VersionException, UnsupportedRepositoryOperationException,
- RepositoryException {
- if (!isCheckedOut()) {
- throw new VersionException("Unable to remove predecessor. Node not checked-out.");
- }
+ public void merge(String srcWorkspace, boolean bestEffort)
+ throws UnsupportedRepositoryOperationException,
+ NoSuchWorkspaceException, AccessDeniedException, VersionException,
+ LockException, InvalidItemStateException, RepositoryException {
+ // check state of this instance
+ sanityCheck();
- Value[] values = getProperty(VersionManager.PROPNAME_PREDECESSORS).getValues();
- if (values.length > 0) {
- boolean found = false;
- InternalValue[] preds = new InternalValue[values.length - 1];
- for (int i = 0, j = 0; i < values.length; i++) {
- if (!values[i].getString().equals(v.getUUID())) {
- if (j < preds.length) {
- preds[j++] = InternalValue.create(new UUID(values[i].getString()));
- }
+ // check for pending changes
+ if (session.hasPendingChanges()) {
+ String msg = "Unable to merge. Session has pending changes.";
+ log.error(msg);
+ throw new InvalidItemStateException(msg);
+ }
+
+ NodeImpl srcNode = doMergeTest(srcWorkspace, bestEffort);
+ if (srcNode != null) {
+ // remove properties
+ PropertyIterator pi = getProperties();
+ while (pi.hasNext()) {
+ Property p = pi.nextProperty();
+ if (!srcNode.hasProperty(p.getName())) {
+ p.setValue((Value) null);
+ }
+ }
+ // copy properties
+ pi = srcNode.getProperties();
+ while (pi.hasNext()) {
+ PropertyImpl p = (PropertyImpl) pi.nextProperty();
+ internalCopyPropertyFrom(p);
+ }
+
+ // remove subnodes
+ NodeIterator ni = getNodes();
+ while (ni.hasNext()) {
+ // if the subnode does not exist in the src, and this is update,
+ // so delete here as well?
+ Node n = ni.nextNode();
+ if (!srcNode.hasNode(n.getName())) {
+ // todo: how does this work for same name siblings?
+ n.remove();
+ }
+ }
+ // 'clone' nodes that do not exist
+ ni = srcNode.getNodes();
+ while (ni.hasNext()) {
+ Node n = ni.nextNode();
+ if (!hasNode(n.getName())) {
+ // todo: probably need some internal stuff
+ // todo: how does this work for same name siblings?
+ // todo: since clone is a ws operation, 'save' does not work later
+ session.getWorkspace().clone(srcWorkspace, n.getPath(), getPath() + "/" + n.getName(), true);
} else {
- found = true;
+ // do recursive merge
+ n.merge(srcWorkspace, bestEffort);
}
}
- if (found) {
- Property prop = internalSetProperty(VersionManager.PROPNAME_PREDECESSORS, preds);
- prop.save();
- return;
+ } else {
+ // do not change this node, but recuse merge
+ NodeIterator ni = srcNode.getNodes();
+ while (ni.hasNext()) {
+ ni.nextNode().merge(srcWorkspace, bestEffort);
}
}
- String msg = "Unable to remove predecessor. Does not exist in version " + safeGetJCRPath();
- log.debug(msg);
- throw new VersionException(msg);
+ save();
}
/**
- * @see Version#getPredecessors()
+ * @see Node#cancelMerge(Version)
*/
- public Version[] getPredecessors() throws RepositoryException {
- if (hasProperty(VersionManager.PROPNAME_PREDECESSORS)) {
- Value[] values = getProperty(VersionManager.PROPNAME_PREDECESSORS).getValues();
- Version[] preds = new Version[values.length];
- for (int i = 0; i < values.length; i++) {
- preds[i] = (Version) session.getNodeByUUID(values[i].getString());
- }
- return preds;
+ public void cancelMerge(Version version)
+ throws VersionException, InvalidItemStateException,
+ UnsupportedRepositoryOperationException, RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ // check for pending changes
+ if (hasPendingChanges()) {
+ String msg = "Unable to checkin node. Node has pending changes: " + safeGetJCRPath();
+ log.error(msg);
+ throw new InvalidItemStateException(msg);
}
- return new Version[0];
+
+ // @todo implement Node#cancelMerge(Version)
+ throw new UnsupportedRepositoryOperationException("not yet implemented");
}
/**
- * @see Node#update(String)
+ * @see Node#doneMerge(Version)
*/
- public void update(String srcWorkspaceName)
- throws NoSuchWorkspaceException, AccessDeniedException,
+ public void doneMerge(Version version) throws VersionException,
+ InvalidItemStateException, UnsupportedRepositoryOperationException,
RepositoryException {
+ // check state of this instance
+ sanityCheck();
- NodeImpl srcNode = getCorrespondingNode(srcWorkspaceName);
- if (srcNode == null) {
- throw new ItemNotFoundException("No corresponding node for " + safeGetJCRPath());
+ // check for pending changes
+ if (hasPendingChanges()) {
+ String msg = "Unable to checkin node. Node has pending changes: " + safeGetJCRPath();
+ log.error(msg);
+ throw new InvalidItemStateException(msg);
+ }
+
+ // @todo implement Node#doneMerge(Version)
+ throw new UnsupportedRepositoryOperationException("not yet implemented");
+ }
+
+ /**
+ * @see Node#isCheckedOut()
+ */
+ public boolean isCheckedOut() throws RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ return isCheckedOut(true);
+ }
+
+ /**
+ * @see Node#restore(String, boolean)
+ */
+ public void restore(String versionName, boolean removeExisting)
+ throws VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ InvalidItemStateException, RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ // check for pending changes
+ if (session.hasPendingChanges()) {
+ String msg = "Unable to restore version. Session has pending changes.";
+ log.error(msg);
+ throw new InvalidItemStateException(msg);
+ }
+
+ GenericVersionSelector gvs = new GenericVersionSelector();
+ gvs.setName(versionName);
+ internalRestore(getVersionHistory().getVersion(versionName), gvs, removeExisting);
+ save();
+ }
+
+ /**
+ * @see Node#restore(Version, boolean)
+ */
+ public void restore(Version version, boolean removeExisting)
+ throws VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ // check for pending changes
+ if (session.hasPendingChanges()) {
+ String msg = "Unable to restore version. Session has pending changes.";
+ log.error(msg);
+ throw new InvalidItemStateException(msg);
+ }
+
+ // check if 'own' version
+ if (!version.getParent().getUUID().equals(getVersionHistory().getUUID())) {
+ throw new VersionException("Unable to restore version. Not same version history.");
+ }
+ internalRestore(version, new GenericVersionSelector(version.getCreated()), removeExisting);
+ save();
+ }
+
+ /**
+ * @see Node#restore(Version, String, boolean)
+ */
+ public void restore(Version version, String relPath, boolean removeExisting)
+ throws PathNotFoundException, ItemExistsException, VersionException,
+ ConstraintViolationException, UnsupportedRepositoryOperationException,
+ LockException, InvalidItemStateException, RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ // check for pending changes
+ if (session.hasPendingChanges()) {
+ String msg = "Unable to restore version. Session has pending changes.";
+ log.error(msg);
+ throw new InvalidItemStateException(msg);
+ }
+
+ // if node exists, do a 'normal' restore
+ if (hasNode(relPath)) {
+ getNode(relPath).restore(version, removeExisting);
+ } else {
+ // recreate node from frozen state
+ NodeImpl node = addNode(relPath, ((VersionImpl) version).getFrozenNode());
+ node.internalRestore(version, new GenericVersionSelector(version.getCreated()), removeExisting);
+ node.getParent().save();
+ }
+ }
+
+ /**
+ * @see Node#restoreByLabel(String, boolean)
+ */
+ public void restoreByLabel(String versionLabel, boolean removeExisting)
+ throws VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ InvalidItemStateException, RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ // check for pending changes
+ if (session.hasPendingChanges()) {
+ String msg = "Unable to restore version. Session has pending changes.";
+ log.error(msg);
+ throw new InvalidItemStateException(msg);
+ }
+
+ Version v = getVersionHistory().getVersionByLabel(versionLabel);
+ if (v == null) {
+ throw new VersionException("No version for label " + versionLabel + " found.");
+ }
+ internalRestore(v, new GenericVersionSelector(versionLabel), removeExisting);
+ save();
+ }
+
+ /**
+ * @see Node#getVersionHistory()
+ */
+ public VersionHistory getVersionHistory()
+ throws UnsupportedRepositoryOperationException, RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ checkVersionable();
+ return (VersionHistory) getProperty(VersionManager.PROPNAME_VERSION_HISTORY).getNode();
+ }
+
+ /**
+ * @see Node#getBaseVersion()
+ */
+ public Version getBaseVersion()
+ throws UnsupportedRepositoryOperationException, RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ checkVersionable();
+ return (Version) getProperty(VersionManager.PROPNAME_BASE_VERSION).getNode();
+ }
+
+ //-----------------------------------< versioning support: implementation >
+ /**
+ * Checks if this node is versionable, i.e. has 'mix:versionable'.
+ *
+ * @throws UnsupportedRepositoryOperationException
+ * if this node is not versionable
+ */
+ private void checkVersionable()
+ throws UnsupportedRepositoryOperationException, RepositoryException {
+ if (!isNodeType(NodeTypeRegistry.MIX_VERSIONABLE)) {
+ String msg = "Unable to perform versioning operation on non versionable node: " + safeGetJCRPath();
+ log.debug(msg);
+ throw new UnsupportedRepositoryOperationException(msg);
}
- // not sure, if clone overrides 'this' node.
- session.getWorkspace().clone(srcWorkspaceName, srcNode.getPath(), getPath());
}
/**
@@ -2529,6 +2873,7 @@
throws NoSuchWorkspaceException, AccessDeniedException,
RepositoryException {
+ // @todo FIXME need to get session with same credentials as current
SessionImpl srcSession = rep.getSystemSession(srcWorkspaceName);
Node root = session.getRootNode();
// if (isRepositoryRoot()) [don't know, if this works correctly with workspaces]
@@ -2570,66 +2915,6 @@
}
/**
- * @see Node#merge(String, boolean)
- */
- public void merge(String srcWorkspace, boolean bestEffort)
- throws UnsupportedRepositoryOperationException, NoSuchWorkspaceException,
- AccessDeniedException, MergeException, RepositoryException {
-
- NodeImpl srcNode = doMergeTest(srcWorkspace, bestEffort);
- if (srcNode != null) {
- // remove properties
- PropertyIterator pi = getProperties();
- while (pi.hasNext()) {
- Property p = pi.nextProperty();
- if (!srcNode.hasProperty(p.getName())) {
- p.setValue((Value) null);
- }
- }
- // copy properties
- pi = srcNode.getProperties();
- while (pi.hasNext()) {
- PropertyImpl p = (PropertyImpl) pi.nextProperty();
- internalCopyPropertyFrom(p);
- }
-
- // remove subnodes
- NodeIterator ni = getNodes();
- while (ni.hasNext()) {
- // if the subnode does not exist in the src, and this is update,
- // so delete here as well?
- Node n = ni.nextNode();
- if (!srcNode.hasNode(n.getName())) {
- // todo: how does this work for same name siblings?
- n.remove();
- }
- }
- // 'clone' nodes that do not exist
- ni = srcNode.getNodes();
- while (ni.hasNext()) {
- Node n = ni.nextNode();
- if (!hasNode(n.getName())) {
- // todo: probably need some internal stuff
- // todo: how does this work for same name siblings?
- // todo: since clone is a ws operation, 'save' does not work later
- session.getWorkspace().clone(srcWorkspace, n.getPath(), getPath() + "/" + n.getName());
- } else {
- // do recursive merge
- n.merge(srcWorkspace, bestEffort);
- }
- }
- } else {
- // do not change this node, but recuse merge
- NodeIterator ni = srcNode.getNodes();
- while (ni.hasNext()) {
- ni.nextNode().merge(srcWorkspace, bestEffort);
- }
- }
-
- save();
- }
-
- /**
* Performs the merge test. If the result is 'update', then the corresponding
* source node is returned. if the result is 'leave' or 'besteffort-fail'
* then <code>null</code> is returned. If the result of the merge test is
@@ -2695,14 +2980,14 @@
}
/**
- * Same as {@link javax.jcr.Node#isCheckedOut()} but if <code>inherit</code>
+ * Same as {@link Node#isCheckedOut()} but if <code>inherit</code>
* is <code>true</code>, a non-versionable node will return the checked out
* state of its parent.
*
* @param inherit
* @see Node#isCheckedOut()
*/
- public boolean isCheckedOut(boolean inherit) throws RepositoryException {
+ protected boolean isCheckedOut(boolean inherit) throws RepositoryException {
// search nearest ancestor that is versionable
NodeImpl node = this;
while (!node.hasProperty(VersionManager.PROPNAME_IS_CHECKED_OUT)) {
@@ -2715,106 +3000,6 @@
}
/**
- * @see Node#isCheckedOut()
- */
- public boolean isCheckedOut() throws RepositoryException {
- return isCheckedOut(false);
- }
-
- /**
- * @see Node#restore(String)
- */
- public void restore(String versionName)
- throws VersionException, UnsupportedRepositoryOperationException,
- RepositoryException {
- boolean removeExisting = true;
-
- // check if transient
- if (session.hasPendingChanges()) {
- String msg = "Unable to restore version. Session has pending changes.";
- log.error(msg);
- throw new InvalidItemStateException(msg);
- }
-
- GenericVersionSelector gvs = new GenericVersionSelector();
- gvs.setName(versionName);
- internalRestore(getVersionHistory().getVersion(versionName), gvs, removeExisting);
- save();
- }
-
- /**
- * @see Node#restore(Version)
- */
- public void restore(Version version)
- throws UnsupportedRepositoryOperationException, RepositoryException {
- boolean removeExisting = true;
-
- // check if transient
- if (session.hasPendingChanges()) {
- String msg = "Unable to restore version. Session has pending changes.";
- log.error(msg);
- throw new InvalidItemStateException(msg);
- }
-
- // check if 'own' version
- if (!version.getParent().getUUID().equals(getVersionHistory().getUUID())) {
- throw new VersionException("Unable to restore version. Not same version history.");
- }
- internalRestore(version, new GenericVersionSelector(version.getCreated()), removeExisting);
- save();
- }
-
-
- /**
- * @see Node#restore(Version, String)
- */
- public void restore(Version version, String relPath)
- throws PathNotFoundException, ItemExistsException,
- ConstraintViolationException, UnsupportedRepositoryOperationException,
- RepositoryException {
- boolean removeExisting = true;
-
- // check if transient
- if (session.hasPendingChanges()) {
- String msg = "Unable to restore version. Session has pending changes.";
- log.error(msg);
- throw new InvalidItemStateException(msg);
- }
-
- // if node exists, do a 'normal' restore
- if (hasNode(relPath)) {
- getNode(relPath).restore(version);
- } else {
- // recreate node from frozen state
- NodeImpl node = addNode(relPath, ((VersionImpl) version).getFrozenNode());
- node.internalRestore(version, new GenericVersionSelector(version.getCreated()), removeExisting);
- node.getParent().save();
- }
- }
-
- /**
- * @see Node#restoreByLabel(String)
- */
- public void restoreByLabel(String versionLabel)
- throws UnsupportedRepositoryOperationException, RepositoryException {
- boolean removeExisting = false;
-
- // check if transient
- if (session.hasPendingChanges()) {
- String msg = "Unable to restore version. Session has pending changes.";
- log.error(msg);
- throw new InvalidItemStateException(msg);
- }
-
- Version v = getVersionHistory().getVersionByLabel(versionLabel);
- if (v == null) {
- throw new VersionException("No version for label " + versionLabel + " found.");
- }
- internalRestore(v, new GenericVersionSelector(versionLabel), removeExisting);
- save();
- }
-
- /**
* Creates a new node at <code>relPath</code> of the node type, uuid and
* eventual mixin types stored in the frozen node. The same as
* <code>{@link #addNode(String relPath)}</code> except that the primary
@@ -3003,10 +3188,8 @@
// 3. N�s jcr:isCheckedOut property is set to false.
internalSetProperty(VersionManager.PROPNAME_IS_CHECKED_OUT, InternalValue.create(false));
-
}
-
/**
* Creates the frozen state from a node
*
@@ -3140,24 +3323,6 @@
}
/**
- * @see Node#getVersionHistory()
- */
- public VersionHistory getVersionHistory()
- throws UnsupportedRepositoryOperationException, RepositoryException {
- checkVersionable();
- return (VersionHistory) getProperty(VersionManager.PROPNAME_VERSION_HISTORY).getNode();
- }
-
- /**
- * @see Node#getBaseVersion()
- */
- public Version getBaseVersion()
- throws UnsupportedRepositoryOperationException, RepositoryException {
- checkVersionable();
- return (Version) getProperty(VersionManager.PROPNAME_BASE_VERSION).getNode();
- }
-
- /**
* Copies a property to this node
*
* @param prop
@@ -3177,29 +3342,24 @@
}
}
-
- //----------------------------------------------------< locking support >---
- /**
- * Checks if this node is lockable, i.e. has 'mix:lockable'.
- *
- * @throws UnsupportedRepositoryOperationException
- * if this node is not lockable
- */
- private void checkLockable()
- throws UnsupportedRepositoryOperationException, RepositoryException {
- if (!isNodeType(NodeTypeRegistry.MIX_LOCKABLE)) {
- String msg = "Unable to perform locking operation on non lockable node: " + safeGetJCRPath();
- log.debug(msg);
- throw new UnsupportedRepositoryOperationException(msg);
- }
- }
-
+ //------------------------------------------------------< locking support >
/**
* @see Node#lock(boolean, boolean)
*/
public Lock lock(boolean isDeep, boolean isSessionScoped)
throws UnsupportedRepositoryOperationException, LockException,
- AccessDeniedException, RepositoryException {
+ AccessDeniedException, InvalidItemStateException,
+ RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ // check for pending changes
+ if (hasPendingChanges()) {
+ String msg = "Unable to checkin node. Node has pending changes: " + safeGetJCRPath();
+ log.error(msg);
+ throw new InvalidItemStateException(msg);
+ }
+
checkLockable();
// @todo implement locking support
@@ -3212,6 +3372,9 @@
public Lock getLock()
throws UnsupportedRepositoryOperationException, LockException,
AccessDeniedException, RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
checkLockable();
// @todo implement locking support
@@ -3223,7 +3386,18 @@
*/
public void unlock()
throws UnsupportedRepositoryOperationException, LockException,
- AccessDeniedException, RepositoryException {
+ AccessDeniedException, InvalidItemStateException,
+ RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ // check for pending changes
+ if (hasPendingChanges()) {
+ String msg = "Unable to checkin node. Node has pending changes: " + safeGetJCRPath();
+ log.error(msg);
+ throw new InvalidItemStateException(msg);
+ }
+
checkLockable();
// @todo implement locking support
@@ -3234,6 +3408,9 @@
* @see Node#holdsLock()
*/
public boolean holdsLock() throws RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
// @todo implement locking support
return false;
}
@@ -3242,7 +3419,26 @@
* @see Node#isLocked()
*/
public boolean isLocked() throws RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
// @todo implement locking support
return false;
+ }
+
+ /**
+ * Checks if this node is lockable, i.e. has 'mix:lockable'.
+ *
+ * @throws UnsupportedRepositoryOperationException
+ * if this node is not lockable
+ * @throws RepositoryException if another error occurs
+ */
+ private void checkLockable()
+ throws UnsupportedRepositoryOperationException, RepositoryException {
+ if (!isNodeType(NodeTypeRegistry.MIX_LOCKABLE)) {
+ String msg = "Unable to perform locking operation on non-lockable node: " + safeGetJCRPath();
+ log.debug(msg);
+ throw new UnsupportedRepositoryOperationException(msg);
+ }
}
}
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java Fri Jan 28 07:46:52 2005
@@ -22,6 +22,7 @@
import org.apache.log4j.Logger;
import javax.jcr.*;
+import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.PropertyDef;
import javax.jcr.version.VersionException;
@@ -183,7 +184,7 @@
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ throw new VersionException("cannot set the value of a property of a checked-in node " + safeGetJCRPath());
}
// check protected flag
@@ -236,7 +237,7 @@
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ throw new VersionException("cannot set the value of a property of a checked-in node " + safeGetJCRPath());
}
// check protected flag
@@ -520,13 +521,15 @@
/**
* @see Property#setValue(Calendar)
*/
- public void setValue(Calendar date) throws ValueFormatException, RepositoryException {
+ public void setValue(Calendar date)
+ throws ValueFormatException, VersionException,
+ LockException, RepositoryException {
// check state of this instance
sanityCheck();
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ throw new VersionException("cannot set the value of a property of a checked-in node " + safeGetJCRPath());
}
// check protected flag
@@ -565,13 +568,15 @@
/**
* @see Property#setValue(double)
*/
- public void setValue(double number) throws ValueFormatException, RepositoryException {
+ public void setValue(double number)
+ throws ValueFormatException, VersionException,
+ LockException, RepositoryException {
// check state of this instance
sanityCheck();
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ throw new VersionException("cannot set the value of a property of a checked-in node " + safeGetJCRPath());
}
// check protected flag
@@ -605,13 +610,15 @@
/**
* @see Property#setValue(java.io.InputStream)
*/
- public void setValue(InputStream stream) throws ValueFormatException, RepositoryException {
+ public void setValue(InputStream stream)
+ throws ValueFormatException, VersionException,
+ LockException, RepositoryException {
// check state of this instance
sanityCheck();
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ throw new VersionException("cannot set the value of a property of a checked-in node " + safeGetJCRPath());
}
// check protected flag
@@ -656,13 +663,15 @@
/**
* @see Property#setValue(String)
*/
- public void setValue(String string) throws ValueFormatException, RepositoryException {
+ public void setValue(String string)
+ throws ValueFormatException, VersionException,
+ LockException, RepositoryException {
// check state of this instance
sanityCheck();
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ throw new VersionException("cannot set the value of a property of a checked-in node " + safeGetJCRPath());
}
// check protected flag
@@ -700,13 +709,15 @@
/**
* @see Property#setValue(String)
*/
- public void setValue(String[] strings) throws ValueFormatException, RepositoryException {
+ public void setValue(String[] strings)
+ throws ValueFormatException, VersionException,
+ LockException, RepositoryException {
// check state of this instance
sanityCheck();
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ throw new VersionException("cannot set the value of a property of a checked-in node " + safeGetJCRPath());
}
// check protected flag
@@ -751,13 +762,15 @@
/**
* @see Property#setValue(boolean)
*/
- public void setValue(boolean b) throws ValueFormatException, RepositoryException {
+ public void setValue(boolean b)
+ throws ValueFormatException, VersionException,
+ LockException, RepositoryException {
// check state of this instance
sanityCheck();
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ throw new VersionException("cannot set the value of a property of a checked-in node " + safeGetJCRPath());
}
// check protected flag
@@ -791,13 +804,15 @@
/**
* @see Property#setValue(Node)
*/
- public void setValue(Node target) throws ValueFormatException, RepositoryException {
+ public void setValue(Node target)
+ throws ValueFormatException, VersionException,
+ LockException, RepositoryException {
// check state of this instance
sanityCheck();
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ throw new VersionException("cannot set the value of a property of a checked-in node " + safeGetJCRPath());
}
// check protected flag
@@ -843,13 +858,15 @@
/**
* @see Property#setValue(long)
*/
- public void setValue(long number) throws ValueFormatException, RepositoryException {
+ public void setValue(long number)
+ throws ValueFormatException, VersionException,
+ LockException, RepositoryException {
// check state of this instance
sanityCheck();
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ throw new VersionException("cannot set the value of a property of a checked-in node " + safeGetJCRPath());
}
// check protected flag
@@ -883,13 +900,15 @@
/**
* @see Property#setValue(Value)
*/
- public synchronized void setValue(Value value) throws ValueFormatException, RepositoryException {
+ public synchronized void setValue(Value value)
+ throws ValueFormatException, VersionException,
+ LockException, RepositoryException {
// check state of this instance
sanityCheck();
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- String msg = "Cannot alter the value of a property of a checked-in node " + safeGetJCRPath();
+ String msg = "cannot set the value of a property of a checked-in node " + safeGetJCRPath();
log.error(msg);
throw new VersionException(msg);
}
@@ -929,13 +948,15 @@
/**
* @see Property#setValue(Value[])
*/
- public void setValue(Value[] values) throws ValueFormatException, RepositoryException {
+ public void setValue(Value[] values)
+ throws ValueFormatException, VersionException,
+ LockException, RepositoryException {
// check state of this instance
sanityCheck();
// check if versioning allows write
if (!((NodeImpl) getParent()).isCheckedOut(false)) { // only cheap call yet
- throw new VersionException("Cannot alter the value of a property of a checked-in node " + safeGetJCRPath());
+ throw new VersionException("cannot set the value of a property of a checked-in node " + safeGetJCRPath());
}
// check protected flag
@@ -1090,6 +1111,16 @@
*/
public PropertyDef getDefinition() {
return definition;
+ }
+
+ /**
+ * @see Property#getType()
+ */
+ public int getType() throws RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ return ((PropertyState) state).getType();
}
//-----------------------------------------------------------------< Item >
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java Fri Jan 28 07:46:52 2005
@@ -79,12 +79,12 @@
// pre-defined values of well known repository properties
// @todo update as necessary
- private static final String SPEC_VERSION = "0.15";
+ private static final String SPEC_VERSION = "0.16.2";
private static final String SPEC_NAME = "Content Repository API for Java(TM) Technology Specification";
private static final String REP_VENDOR = "Apache Software Foundation";
private static final String REP_VENDOR_URL = "http://www.apache.org/";
private static final String REP_NAME = "Jackrabbit";
- private static final String REP_VERSION = "0.15";
+ private static final String REP_VERSION = "0.16.2";
// system root location (jcr:system)
public static final QName SYSTEM_ROOT_NAME = new QName(NamespaceRegistryImpl.NS_JCR_URI, "system");
@@ -383,10 +383,10 @@
}
/**
- * Returns the names of all workspaces of this repository.
+ * Returns the names of <i>all</i> workspaces in this repository.
*
- * @return the names of all workspaces of this repository.
- * @see SessionImpl#getWorkspaceNames
+ * @return the names of all workspaces in this repository.
+ * @see javax.jcr.Workspace#getAccessibleWorkspaceNames()
*/
String[] getWorkspaceNames() {
return (String[]) wspInfos.keySet().toArray(new String[wspInfos.keySet().size()]);
@@ -538,12 +538,25 @@
repProps.clear();
if (!propFile.exists() || propFile.length() == 0) {
// initialize properties with pre-defined values
- repProps.setProperty(SPEC_VERSION_PROPERTY, SPEC_VERSION);
- repProps.setProperty(SPEC_NAME_PROPERTY, SPEC_NAME);
- repProps.setProperty(REP_VENDOR_PROPERTY, REP_VENDOR);
- repProps.setProperty(REP_VENDOR_URL_PROPERTY, REP_VENDOR_URL);
- repProps.setProperty(REP_NAME_PROPERTY, REP_NAME);
- repProps.setProperty(REP_VERSION_PROPERTY, REP_VERSION);
+ repProps.setProperty(SPEC_VERSION_DESC, SPEC_VERSION);
+ repProps.setProperty(SPEC_NAME_DESC, SPEC_NAME);
+ repProps.setProperty(REP_VENDOR_DESC, REP_VENDOR);
+ repProps.setProperty(REP_VENDOR_URL_DESC, REP_VENDOR_URL);
+ repProps.setProperty(REP_NAME_DESC, REP_NAME);
+ repProps.setProperty(REP_VERSION_DESC, REP_VERSION);
+
+ // @todo check repository descriptor values with current state of implementation
+ repProps.setProperty(LEVEL_1_SUPPORTED, "true");
+ repProps.setProperty(LEVEL_2_SUPPORTED, "true");
+ repProps.setProperty(OPTION_TRANSACTIONS_SUPPORTED, "true");
+ repProps.setProperty(OPTION_VERSIONING_SUPPORTED, "true");
+ repProps.setProperty(OPTION_OBSERVATION_SUPPORTED, "true");
+ repProps.setProperty(OPTION_LOCKING_SUPPORTED, "true");
+ repProps.setProperty(OPTION_QUERY_SQL_SUPPORTED, "true");
+ repProps.setProperty(QUERY_XPATH_POS_INDEX, "true");
+ repProps.setProperty(QUERY_XPATH_DOC_ORDER, "true");
+ repProps.setProperty(QUERY_JCRPATH, "true");
+ repProps.setProperty(QUERY_JCRSCORE, "true");
repProps.setProperty(STATS_NODE_COUNT_PROPERTY, Long.toString(nodesCount));
repProps.setProperty(STATS_PROP_COUNT_PROPERTY, Long.toString(propsCount));
@@ -585,31 +598,6 @@
}
/**
- * @return
- */
- public Properties getProperties() {
- // check state
- if (disposed) {
- throw new IllegalStateException("repository instance has been shut down");
- }
-
- return (Properties) repProps.clone();
- }
-
- /**
- * @param key
- * @return
- */
- public String getProperty(String key) {
- // check state
- if (disposed) {
- throw new IllegalStateException("repository instance has been shut down");
- }
-
- return repProps.getProperty(key);
- }
-
- /**
* Returns the system root node (i.e. /jcr:system)
*
* @param session
@@ -631,7 +619,7 @@
* @return the workspace persistence manager
* @throws RepositoryException if the persistence manager could not be instantiated/initialized
*/
- public static PersistenceManager createPersistenceManager(File homeDir,
+ private static PersistenceManager createPersistenceManager(File homeDir,
FileSystem fs,
PersistenceManagerConfig pmConfig,
String rootNodeUUID,
@@ -706,6 +694,35 @@
public Session login(String workspaceName)
throws LoginException, NoSuchWorkspaceException, RepositoryException {
return login(null, workspaceName);
+ }
+
+ /**
+ * @see Repository#login()
+ */
+ public Session login() throws LoginException, RepositoryException {
+ return login(null, null);
+ }
+
+ /**
+ * @see Repository#login(Credentials)
+ */
+ public Session login(Credentials credentials)
+ throws LoginException, RepositoryException {
+ return login(credentials, null);
+ }
+
+ /**
+ * @see Repository#getDescriptor(String)
+ */
+ public String getDescriptor(String key) {
+ return repProps.getProperty(key);
+ }
+
+ /**
+ * @see Repository#getDescriptorKeys()
+ */
+ public String[] getDescriptorKeys() {
+ return (String[]) repProps.keySet().toArray(new String[repProps.keySet().size()]);
}
//------------------------------------------------------< SessionListener >
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java Fri Jan 28 07:46:52 2005
@@ -26,6 +26,8 @@
import org.apache.jackrabbit.core.version.VersionManager;
import org.apache.jackrabbit.core.xml.ImportHandler;
import org.apache.log4j.Logger;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -33,11 +35,13 @@
import org.xml.sax.helpers.XMLReaderFactory;
import javax.jcr.*;
+import javax.jcr.version.VersionException;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
+import java.io.OutputStream;
import java.security.AccessControlException;
import java.util.*;
@@ -333,7 +337,7 @@
*
* @return the names of all accessible workspaces
*/
- public String[] getWorkspaceNames() {
+ protected String[] getWorkspaceNames() {
// @todo filter workspace names based on credentials of this session
return rep.getWorkspaceNames();
}
@@ -342,10 +346,13 @@
* Creates a workspace with the given name.
*
* @param workspaceName name of the new workspace
+ * @throws AccessDeniedException if the current session is not allowed to
+ * create the workspace
* @throws RepositoryException if a workspace with the given name
* already exists or if another error occurs
*/
- public void createWorkspace(String workspaceName) throws RepositoryException {
+ protected void createWorkspace(String workspaceName)
+ throws AccessDeniedException, RepositoryException {
// @todo verify that this session has the right privileges for this operation
rep.createWorkspace(workspaceName);
}
@@ -641,8 +648,9 @@
/**
* @see Session#save
*/
- public void save() throws AccessDeniedException, LockException,
- ConstraintViolationException, InvalidItemStateException,
+ public void save()
+ throws AccessDeniedException, ConstraintViolationException,
+ InvalidItemStateException, VersionException, LockException,
RepositoryException {
// check sanity of this session
sanityCheck();
@@ -680,7 +688,7 @@
*/
public void move(String srcAbsPath, String destAbsPath)
throws ItemExistsException, PathNotFoundException,
- ConstraintViolationException, RepositoryException {
+ VersionException, RepositoryException {
// check sanity of this session
sanityCheck();
@@ -798,7 +806,9 @@
/**
* @see Session#getImportContentHandler(String)
*/
- public ContentHandler getImportContentHandler(String parentAbsPath) throws PathNotFoundException, RepositoryException {
+ public ContentHandler getImportContentHandler(String parentAbsPath)
+ throws PathNotFoundException, ConstraintViolationException,
+ VersionException, LockException, RepositoryException {
// check sanity of this session
sanityCheck();
@@ -818,6 +828,21 @@
throw new RepositoryException(msg);
}
NodeImpl parent = (NodeImpl) item;
+
+ // check if versioning allows write (only cheap call)
+ if (!parent.isCheckedOut(false)) {
+ String msg = parentAbsPath + ": cannot add a child to a checked-in node";
+ log.error(msg);
+ throw new VersionException(msg);
+ }
+
+ // check protected flag of parent node
+ if (parent.getDefinition().isProtected()) {
+ String msg = parentAbsPath + ": cannot add a child to a protected node";
+ log.error(msg);
+ throw new ConstraintViolationException(msg);
+ }
+
return new ImportHandler(parent, rep.getNamespaceRegistry(), this);
}
@@ -826,8 +851,8 @@
*/
public void importXML(String parentAbsPath, InputStream in)
throws IOException, PathNotFoundException, ItemExistsException,
- ConstraintViolationException, InvalidSerializedDataException,
- RepositoryException {
+ ConstraintViolationException, VersionException,
+ InvalidSerializedDataException, LockException, RepositoryException {
// check sanity of this session
sanityCheck();
@@ -851,6 +876,105 @@
}
/**
+ * @see Session#exportDocView(String, ContentHandler, boolean, boolean)
+ */
+ public void exportDocView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws InvalidSerializedDataException, PathNotFoundException, SAXException, RepositoryException {
+ // @todo implement Session#exportDocView(String, ContentHandler, boolean, boolean)
+ throw new RepositoryException("not yet implemented");
+/*
+ // check path & retrieve state
+ Path path;
+ Path.PathElement name;
+ NodeState state;
+ try {
+ path = Path.create(absPath, session.getNamespaceResolver(), true);
+ name = path.getNameElement();
+ state = getNodeState(path, hierMgr, stateMgr);
+ } catch (MalformedPathException mpe) {
+ String msg = "invalid path: " + absPath;
+ log.error(msg, mpe);
+ throw new RepositoryException(msg, mpe);
+ }
+
+ // check read access
+ if (!session.getAccessManager().isGranted(state.getId(), AccessManager.READ)) {
+ throw new PathNotFoundException(absPath);
+ }
+
+ new DocViewSAXEventGenerator(state, name.getName(), noRecurse, binaryAsLink,
+ stateMgr, rep.getNamespaceRegistry(),
+ session.getAccessManager(), hierMgr, contentHandler).serialize();
+ }
+*/
+ }
+
+ /**
+ * @see Session#exportDocView(String, OutputStream, boolean, boolean)
+ */
+ public void exportDocView(String absPath, OutputStream out,
+ boolean skipBinary, boolean noRecurse)
+ throws InvalidSerializedDataException, IOException,
+ PathNotFoundException, RepositoryException {
+ OutputFormat format = new OutputFormat("xml", "UTF-8", true);
+ XMLSerializer serializer = new XMLSerializer(out, format);
+ try {
+ exportDocView(absPath, serializer.asContentHandler(), skipBinary, noRecurse);
+ } catch (SAXException se) {
+ throw new RepositoryException(se);
+ }
+ }
+
+ /**
+ * @see Session#exportSysView(String, ContentHandler, boolean, boolean)
+ */
+ public void exportSysView(String absPath, ContentHandler contentHandler,
+ boolean skipBinary, boolean noRecurse)
+ throws PathNotFoundException, SAXException, RepositoryException {
+ // @todo implement Session#exportSysView(String, ContentHandler, boolean, boolean)
+ throw new RepositoryException("not yet implemented");
+/*
+ // check path & retrieve state
+ Path path;
+ Path.PathElement name;
+ NodeState state;
+ try {
+ path = Path.create(absPath, session.getNamespaceResolver(), true);
+ name = path.getNameElement();
+ state = getNodeState(path, hierMgr, stateMgr);
+ } catch (MalformedPathException mpe) {
+ String msg = "invalid path: " + absPath;
+ log.error(msg, mpe);
+ throw new RepositoryException(msg, mpe);
+ }
+
+ // check read access
+ if (!session.getAccessManager().isGranted(state.getId(), AccessManager.READ)) {
+ throw new PathNotFoundException(absPath);
+ }
+
+ new SysViewSAXEventGenerator(state, name.getName(), noRecurse, binaryAsLink,
+ stateMgr, rep.getNamespaceRegistry(),
+ session.getAccessManager(), hierMgr, contentHandler).serialize();
+ }
+*/
+ }
+
+ /**
+ * @see Session#exportSysView(String, OutputStream, boolean, boolean)
+ */
+ public void exportSysView(String absPath, OutputStream out,
+ boolean skipBinary, boolean noRecurse)
+ throws IOException, PathNotFoundException, RepositoryException {
+ OutputFormat format = new OutputFormat("xml", "UTF-8", true);
+ XMLSerializer serializer = new XMLSerializer(out, format);
+ try {
+ exportSysView(absPath, serializer.asContentHandler(), skipBinary, noRecurse);
+ } catch (SAXException se) {
+ throw new RepositoryException(se);
+ }
+ }
+
+ /**
* @see Session#logout()
*/
public synchronized void logout() {
@@ -906,28 +1030,32 @@
/**
* @see Session#setNamespacePrefix(String, String)
*/
- public void setNamespacePrefix(String prefix, String uri) throws NamespaceException, RepositoryException {
+ public void setNamespacePrefix(String prefix, String uri)
+ throws NamespaceException, RepositoryException {
nsMappings.setNamespacePrefix(prefix, uri);
}
/**
* @see Session#getNamespacePrefixes
*/
- public String[] getNamespacePrefixes() {
+ public String[] getNamespacePrefixes()
+ throws NamespaceException, RepositoryException {
return nsMappings.getPrefixes();
}
/**
* @see Session#getNamespaceURI(String)
*/
- public String getNamespaceURI(String prefix) throws NamespaceException {
+ public String getNamespaceURI(String prefix)
+ throws NamespaceException, RepositoryException {
return nsMappings.getURI(prefix);
}
/**
* @see Session#getNamespaceURI(String)
*/
- public String getNamespacePrefix(String uri) throws NamespaceException {
+ public String getNamespacePrefix(String uri)
+ throws NamespaceException, RepositoryException {
return nsMappings.getPrefix(uri);
}
@@ -1033,7 +1161,7 @@
}
}
- String[] getPrefixes() {
+ String[] getPrefixes() throws RepositoryException {
if (prefixToURI.isEmpty()) {
// shortcut
return nsReg.getPrefixes();
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java Fri Jan 28 07:46:52 2005
@@ -23,20 +23,17 @@
import org.apache.log4j.PropertyConfigurator;
import javax.jcr.*;
-import javax.jcr.xa.XASession;
import javax.jcr.nodetype.NodeType;
import javax.jcr.nodetype.NodeTypeIterator;
import javax.jcr.nodetype.NodeTypeManager;
import javax.jcr.util.TraversingItemVisitor;
+import javax.jcr.util.ISO8601;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.io.*;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Hashtable;
-import java.util.Properties;
+import java.util.*;
public class Test {
private static Logger log = Logger.getLogger(Test.class);
@@ -79,11 +76,8 @@
/*
if (root.canAddMixin("mix:versionable")) {
root.addMixin("mix:versionable");
- if (root.canAddMixin("mix:accessControllable")) {
- root.addMixin("mix:accessControllable");
- }
dumpTree(root, System.out);
- boolean accessControllable = root.isNodeType("mix:accessControllable");
+ boolean versionable = root.isNodeType("mix:versionable");
root.removeMixin("mix:versionable");
root.save();
}
@@ -313,7 +307,7 @@
}
} else {
Node newNode = parent.addNode(file.getName(), "nt:file");
- Node content = newNode.addNode("jcr:content", "nt:mimeResource");
+ Node content = newNode.addNode("jcr:content", "nt:resource");
content.setProperty("jcr:data", new FileInputStream(file));
content.setProperty("jcr:lastModified", Calendar.getInstance());
content.setProperty("jcr:mimeType", "application/octet-stream");
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java Fri Jan 28 07:46:52 2005
@@ -21,15 +21,16 @@
import org.apache.jackrabbit.core.search.QueryManagerImpl;
import org.apache.jackrabbit.core.state.*;
import org.apache.jackrabbit.core.util.uuid.UUID;
-import org.apache.jackrabbit.core.xml.DocViewSAXEventGenerator;
-import org.apache.jackrabbit.core.xml.SysViewSAXEventGenerator;
+import org.apache.jackrabbit.core.xml.ImportHandler;
import org.apache.log4j.Logger;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
import org.xml.sax.ContentHandler;
+import org.xml.sax.XMLReader;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+import org.xml.sax.helpers.XMLReaderFactory;
import javax.jcr.*;
+import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.NodeTypeManager;
import javax.jcr.observation.EventListener;
@@ -39,7 +40,7 @@
import javax.jcr.version.Version;
import javax.jcr.version.VersionException;
import java.io.IOException;
-import java.io.OutputStream;
+import java.io.InputStream;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.Iterator;
@@ -147,14 +148,33 @@
/**
* Performs a sanity check on this workspace and the associated session.
+ *
* @throws RepositoryException if this workspace has been rendered invalid
- * for some reason
+ * for some reason
*/
protected void sanityCheck() throws RepositoryException {
// check session status
session.sanityCheck();
}
+ /**
+ * Creates a workspace with the given name.
+ *
+ * @param workspaceName name of the new workspace
+ * @throws AccessDeniedException if the current session is not allowed to
+ * create the workspace
+ * @throws RepositoryException if a workspace with the given name
+ * already exists or if another error occurs
+ * @see #getAccessibleWorkspaceNames()
+ */
+ public void createWorkspace(String workspaceName)
+ throws AccessDeniedException, RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ session.createWorkspace(workspaceName);
+ }
+
//-----------< misc. static helper methods for cross-workspace operations >
/**
* @param nodePath
@@ -631,6 +651,9 @@
* @see Workspace#getNamespaceRegistry
*/
public NamespaceRegistry getNamespaceRegistry() throws RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
return rep.getNamespaceRegistry();
}
@@ -638,21 +661,34 @@
* @see Workspace#getNodeTypeManager
*/
public NodeTypeManager getNodeTypeManager() throws RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
return session.getNodeTypeManager();
}
/**
- * @see Workspace#clone(String, String, String)
+ * @see Workspace#clone(String, String, String, boolean)
*/
- public void clone(String srcWorkspace, String srcAbsPath, String destAbsPath)
+ public void clone(String srcWorkspace, String srcAbsPath,
+ String destAbsPath, boolean removeExisting)
throws NoSuchWorkspaceException, ConstraintViolationException,
- AccessDeniedException, PathNotFoundException,
- ItemExistsException, RepositoryException {
+ VersionException, AccessDeniedException, PathNotFoundException,
+ ItemExistsException, LockException, RepositoryException {
+
+ // check state of this instance
+ sanityCheck();
+
+ // @todo reimplement Workspace#clone according to new spec
+ // @todo check ckecked-out status
+ // @todo check locked-status status
+
// clone (i.e. pull) subtree at srcAbsPath from srcWorkspace
// to 'this' workspace at destAbsPath
ItemStateManager srcStateMgr = rep.getWorkspaceStateManager(srcWorkspace);
// FIXME need to setup a hierarchy manager for source workspace
- HierarchyManagerImpl srcHierMgr = new HierarchyManagerImpl(rep.getRootNodeUUID(), srcStateMgr, session.getNamespaceResolver());
+ HierarchyManagerImpl srcHierMgr =
+ new HierarchyManagerImpl(rep.getRootNodeUUID(), srcStateMgr, session.getNamespaceResolver());
// do cross-workspace copy
internalCopy(srcAbsPath, srcStateMgr, srcHierMgr,
destAbsPath, stateMgr, hierMgr,
@@ -664,8 +700,17 @@
* @see Workspace#copy(String, String)
*/
public void copy(String srcAbsPath, String destAbsPath)
- throws ConstraintViolationException, AccessDeniedException,
- PathNotFoundException, ItemExistsException, RepositoryException {
+ throws ConstraintViolationException, VersionException,
+ AccessDeniedException, PathNotFoundException, ItemExistsException,
+ LockException, RepositoryException {
+
+ // check state of this instance
+ sanityCheck();
+
+ // @todo reimplement Workspace#copy according to new spec
+ // @todo check ckecked-out status
+ // @todo check locked-status status
+
// do intra-workspace copy
internalCopy(srcAbsPath, stateMgr, hierMgr,
destAbsPath, stateMgr, hierMgr,
@@ -678,8 +723,16 @@
*/
public void copy(String srcWorkspace, String srcAbsPath, String destAbsPath)
throws NoSuchWorkspaceException, ConstraintViolationException,
- AccessDeniedException, PathNotFoundException, ItemExistsException,
- RepositoryException {
+ VersionException, AccessDeniedException, PathNotFoundException,
+ ItemExistsException, LockException, RepositoryException {
+
+ // check state of this instance
+ sanityCheck();
+
+ // @todo reimplement Workspace#copy according to new spec
+ // @todo check ckecked-out status
+ // @todo check locked-status status
+
// copy (i.e. pull) subtree at srcAbsPath from srcWorkspace
// to 'this' workspace at destAbsPath
ItemStateManager srcStateMgr = rep.getWorkspaceStateManager(srcWorkspace);
@@ -696,8 +749,16 @@
* @see Workspace#move
*/
public void move(String srcAbsPath, String destAbsPath)
- throws ConstraintViolationException, AccessDeniedException,
- PathNotFoundException, ItemExistsException, RepositoryException {
+ throws ConstraintViolationException, VersionException,
+ AccessDeniedException, PathNotFoundException, ItemExistsException,
+ LockException, RepositoryException {
+
+ // check state of this instance
+ sanityCheck();
+
+ // @todo reimplement Workspace#move according to new spec
+ // @todo check ckecked-out status
+ // @todo check locked-status status
// intra-workspace move...
@@ -798,6 +859,10 @@
*/
public synchronized ObservationManager getObservationManager()
throws UnsupportedRepositoryOperationException, RepositoryException {
+
+ // check state of this instance
+ sanityCheck();
+
if (obsMgr == null) {
try {
obsMgr = rep.getObservationManagerFactory(wspConfig.getName()).createObservationManager(session, session.getItemManager());
@@ -815,6 +880,10 @@
* @see Workspace#getQueryManager
*/
public QueryManager getQueryManager() throws RepositoryException {
+
+ // check state of this instance
+ sanityCheck();
+
if (queryManager == null) {
try {
SearchManager searchManager = rep.getSearchManager(wspConfig.getName());
@@ -836,95 +905,72 @@
}
/**
- * @see Workspace#restore(Version[])
- */
- public void restore(Version[] versions) throws UnsupportedRepositoryOperationException, VersionException, RepositoryException {
- // @todo implement versioning support
- throw new UnsupportedRepositoryOperationException();
- }
-
- /**
- * @see Workspace#exportDocView(String, ContentHandler, boolean, boolean)
+ * @see Workspace#restore(Version[], boolean)
*/
- public void exportDocView(String absPath, ContentHandler contentHandler, boolean binaryAsLink, boolean noRecurse)
- throws InvalidSerializedDataException, PathNotFoundException, SAXException, RepositoryException {
- // check path & retrieve state
- Path path;
- Path.PathElement name;
- NodeState state;
- try {
- path = Path.create(absPath, session.getNamespaceResolver(), true);
- name = path.getNameElement();
- state = getNodeState(path, hierMgr, stateMgr);
- } catch (MalformedPathException mpe) {
- String msg = "invalid path: " + absPath;
- log.error(msg, mpe);
- throw new RepositoryException(msg, mpe);
- }
+ public void restore(Version[] versions, boolean removeExisting)
+ throws ItemExistsException, UnsupportedRepositoryOperationException,
+ VersionException, LockException, InvalidItemStateException,
+ RepositoryException {
- // check read access
- if (!session.getAccessManager().isGranted(state.getId(), AccessManager.READ)) {
- throw new PathNotFoundException(absPath);
- }
+ // check state of this instance
+ sanityCheck();
- new DocViewSAXEventGenerator(state, name.getName(), noRecurse, binaryAsLink,
- stateMgr, rep.getNamespaceRegistry(),
- session.getAccessManager(), hierMgr, contentHandler).serialize();
+ // @todo implement Workspace#restore
+ throw new UnsupportedRepositoryOperationException();
}
/**
- * @see Workspace#exportDocView(String, OutputStream, boolean, boolean)
+ * @see Workspace#getAccessibleWorkspaceNames
*/
- public void exportDocView(String absPath, OutputStream out, boolean binaryAsLink, boolean noRecurse)
- throws InvalidSerializedDataException, IOException, PathNotFoundException, RepositoryException {
- OutputFormat format = new OutputFormat("xml", "UTF-8", true);
- XMLSerializer serializer = new XMLSerializer(out, format);
- try {
- exportDocView(absPath, serializer.asContentHandler(), binaryAsLink, noRecurse);
- } catch (SAXException se) {
- throw new RepositoryException(se);
- }
+ public String[] getAccessibleWorkspaceNames() throws RepositoryException {
+ // check state of this instance
+ sanityCheck();
+
+ return session.getWorkspaceNames();
}
/**
- * @see Workspace#exportSysView(String, ContentHandler, boolean, boolean)
+ * @see Workspace#getImportContentHandler(String, int)
*/
- public void exportSysView(String absPath, ContentHandler contentHandler, boolean binaryAsLink, boolean noRecurse)
- throws PathNotFoundException, SAXException, RepositoryException {
- // check path & retrieve state
- Path path;
- Path.PathElement name;
- NodeState state;
- try {
- path = Path.create(absPath, session.getNamespaceResolver(), true);
- name = path.getNameElement();
- state = getNodeState(path, hierMgr, stateMgr);
- } catch (MalformedPathException mpe) {
- String msg = "invalid path: " + absPath;
- log.error(msg, mpe);
- throw new RepositoryException(msg, mpe);
- }
+ public ContentHandler getImportContentHandler(String parentAbsPath,
+ int uuidBehavior)
+ throws PathNotFoundException, ConstraintViolationException,
+ VersionException, LockException, RepositoryException {
- // check read access
- if (!session.getAccessManager().isGranted(state.getId(), AccessManager.READ)) {
- throw new PathNotFoundException(absPath);
- }
+ // check state of this instance
+ sanityCheck();
- new SysViewSAXEventGenerator(state, name.getName(), noRecurse, binaryAsLink,
- stateMgr, rep.getNamespaceRegistry(),
- session.getAccessManager(), hierMgr, contentHandler).serialize();
+ // @todo implement Workspace#getImportContentHandler
+ throw new RepositoryException("not yet implemented");
}
/**
- * @see Workspace#exportSysView(String, OutputStream, boolean, boolean)
+ * @see Workspace#importXML(String, InputStream, int)
*/
- public void exportSysView(String absPath, OutputStream out, boolean binaryAsLink, boolean noRecurse) throws IOException, PathNotFoundException, RepositoryException {
- OutputFormat format = new OutputFormat("xml", "UTF-8", true);
- XMLSerializer serializer = new XMLSerializer(out, format);
+ public void importXML(String parentAbsPath, InputStream in,
+ int uuidBehavior)
+ throws IOException, PathNotFoundException, ItemExistsException,
+ ConstraintViolationException, InvalidSerializedDataException,
+ LockException, RepositoryException {
+
+ ImportHandler handler =
+ (ImportHandler) getImportContentHandler(parentAbsPath, uuidBehavior);
try {
- exportSysView(absPath, serializer.asContentHandler(), binaryAsLink, noRecurse);
+ XMLReader parser =
+ XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
+ parser.setContentHandler(handler);
+ parser.setErrorHandler(handler);
+ parser.parse(new InputSource(in));
} catch (SAXException se) {
- throw new RepositoryException(se);
+ // check for wrapped repository exception
+ Exception e = se.getException();
+ if (e != null && e instanceof RepositoryException) {
+ throw (RepositoryException) e;
+ } else {
+ String msg = "failed to parse XML stream";
+ log.error(msg, se);
+ throw new InvalidSerializedDataException(msg, se);
+ }
}
}
}
Added: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASession.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASession.java?view=auto&rev=148894
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASession.java Fri Jan 28 07:46:52 2005
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core;
+
+import javax.jcr.Session;
+import javax.transaction.xa.XAResource;
+
+/**
+ * The <code>XASession</code> interface extends the capability of
+ * <code>Session</code> by adding access to a JCR repository's support for
+ * the Java Transaction API (JTA).
+ * <p>
+ * This support takes the form of a <code>javax.transaction.xa.XAResource</code>
+ * object. The functionality of this object closely resembles that defined by
+ * the standard X/Open XA Resource interface.
+ * <p>
+ * This interface is used by the transaction manager; an application does not
+ * use it directly.
+ */
+public interface XASession extends Session {
+
+ /**
+ * Retrieves an <code>XAResource</code> object that the transaction manager
+ * will use to manage this <code>XASession</code> object's participation in
+ * a distributed transaction.
+ *
+ * @return the <code>XAResource</code> object.
+ */
+ public XAResource getXAResource();
+}
\ No newline at end of file
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java Fri Jan 28 07:46:52 2005
@@ -16,22 +16,20 @@
*/
package org.apache.jackrabbit.core;
-import org.apache.jackrabbit.core.*;
+import org.apache.jackrabbit.core.config.WorkspaceConfig;
+import org.apache.jackrabbit.core.observation.EventStateCollection;
import org.apache.jackrabbit.core.state.TransactionContext;
import org.apache.jackrabbit.core.state.TransactionException;
import org.apache.jackrabbit.core.state.TransactionListener;
-import org.apache.jackrabbit.core.config.WorkspaceConfig;
-import org.apache.jackrabbit.core.observation.EventStateCollection;
import org.apache.log4j.Logger;
import javax.jcr.Credentials;
import javax.jcr.RepositoryException;
-import javax.jcr.xa.XASession;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
-import java.util.Map;
import java.util.HashMap;
+import java.util.Map;
/**
* Session extension that provides XA support.
@@ -77,7 +75,7 @@
//-------------------------------------------------------------< XASession >
/**
- * @see javax.jcr.xa.XASession#getXAResource
+ * @see XASession#getXAResource
*/
public XAResource getXAResource() {
return this;
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/BindableRepository.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/BindableRepository.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/BindableRepository.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/BindableRepository.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/BindableRepository.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/BindableRepository.java Fri Jan 28 07:46:52 2005
@@ -25,7 +25,6 @@
import javax.naming.Referenceable;
import javax.naming.StringRefAddr;
import java.io.*;
-import java.util.Properties;
/**
* <code>BindableRepository</code> ...
@@ -74,20 +73,6 @@
//-----------------------------------------------------------< Repository >
/**
- * @see Repository#getProperties()
- */
- public Properties getProperties() {
- return delegatee.getProperties();
- }
-
- /**
- * @see Repository#getProperty(String)
- */
- public String getProperty(String key) {
- return delegatee.getProperty(key);
- }
-
- /**
* @see Repository#login(Credentials, String)
*/
public Session login(Credentials credentials, String workspaceName)
@@ -101,6 +86,35 @@
public Session login(String workspaceName)
throws LoginException, NoSuchWorkspaceException, RepositoryException {
return delegatee.login(workspaceName);
+ }
+
+ /**
+ * @see Repository#login()
+ */
+ public Session login() throws LoginException, RepositoryException {
+ return delegatee.login();
+ }
+
+ /**
+ * @see Repository#login(Credentials)
+ */
+ public Session login(Credentials credentials)
+ throws LoginException, RepositoryException {
+ return delegatee.login(credentials);
+ }
+
+ /**
+ * @see Repository#getDescriptor(String)
+ */
+ public String getDescriptor(String key) {
+ return delegatee.getDescriptor(key);
+ }
+
+ /**
+ * @see Repository#getDescriptorKeys()
+ */
+ public String[] getDescriptorKeys() {
+ return delegatee.getDescriptorKeys();
}
//--------------------------------------------------------< Referenceable >
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java Fri Jan 28 07:46:52 2005
@@ -36,7 +36,6 @@
private int onParentVersion = OnParentVersionAction.COPY;
private boolean writeProtected = false;
private boolean mandatory = false;
- private boolean primaryItem = false;
protected Object clone() throws CloneNotSupportedException {
// delegate to superclass which does a shallow copy;
@@ -56,8 +55,7 @@
&& autoCreate == other.autoCreate
&& onParentVersion == other.onParentVersion
&& writeProtected == other.writeProtected
- && mandatory == other.mandatory
- && primaryItem == other.primaryItem;
+ && mandatory == other.mandatory;
}
return false;
}
@@ -92,10 +90,6 @@
this.mandatory = mandatory;
}
- public void setPrimaryItem(boolean primaryItem) {
- this.primaryItem = primaryItem;
- }
-
public QName getDeclaringNodeType() {
return declaringNodeType;
}
@@ -118,10 +112,6 @@
public boolean isMandatory() {
return mandatory;
- }
-
- public boolean isPrimaryItem() {
- return primaryItem;
}
public boolean definesResidual() {
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java Fri Jan 28 07:46:52 2005
@@ -111,13 +111,6 @@
}
/**
- * @see ItemDef#isPrimaryItem
- */
- public boolean isPrimaryItem() {
- return itemDef.isPrimaryItem();
- }
-
- /**
* @see ItemDef#isProtected
*/
public boolean isProtected() {
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java Fri Jan 28 07:46:52 2005
@@ -33,6 +33,7 @@
private QName[] supertypes;
private boolean mixin;
private boolean orderableChildNodes;
+ private QName primaryItemName;
private PropDef[] propDefs;
private ChildNodeDef[] nodeDefs;
private Set dependencies;
@@ -65,6 +66,7 @@
if (obj instanceof NodeTypeDef) {
NodeTypeDef other = (NodeTypeDef) obj;
return (name == null ? other.name == null : name.equals(other.name))
+ && (primaryItemName == null ? other.primaryItemName == null : primaryItemName.equals(other.primaryItemName))
&& Arrays.equals(supertypes, other.supertypes)
&& mixin == other.mixin
&& orderableChildNodes == other.orderableChildNodes
@@ -169,6 +171,16 @@
}
/**
+ * Sets the name of the primary item (one of the child items of the node's
+ * of this node type)
+ *
+ * @param primaryItemName The name of the primary item.
+ */
+ public void setPrimaryItemName(QName primaryItemName) {
+ this.primaryItemName = primaryItemName;
+ }
+
+ /**
* Sets the property definitions.
*
* @param defs An array of <code>PropertyDef</code> objects.
@@ -224,6 +236,16 @@
*/
public boolean hasOrderableChildNodes() {
return orderableChildNodes;
+ }
+
+ /**
+ * Returns the name of the primary item (one of the child items of the
+ * node's of this node type) or <code>null</code> if not set.
+ *
+ * @return the name of the primary item or <code>null</code> if not set.
+ */
+ public QName getPrimaryItemName() {
+ return primaryItemName;
}
/**
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java Fri Jan 28 07:46:52 2005
@@ -32,8 +32,8 @@
* The following modifications are considered <code>TRIVIAL</code>:
* <ul>
* <li>changing node type <code>orderableChildNodes</code> flag
+ * <li>changing node type <code>primaryItemName</code> value
* <li>adding non-<code>mandatory</code> property/child node
- * <li>changing property/child node <code>primaryItem</code> flag
* <li>changing property/child node <code>protected</code> flag
* <li>changing property/child node <code>onParentVersion</code> value
* <li>changing property/child node <code>mandatory</code> flag to <code>false</code>
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java Fri Jan 28 07:46:52 2005
@@ -48,6 +48,7 @@
private static final String NAME_ATTRIBUTE = "name";
private static final String MIXIN_ATTRIBUTE = "mixin";
private static final String ORDERABLECHILDNODES_ATTRIBUTE = "orderableChildNodes";
+ private static final String PRIMARYITEMNAME_ATTRIBUTE = "primaryItemName";
private static final String SUPERTYPES_ELEMENT = "supertypes";
private static final String SUPERTYPE_ELEMENT = "supertype";
private static final String PROPERTYDEF_ELEMENT = "propertyDef";
@@ -59,7 +60,6 @@
private static final String AUTOCREATE_ATTRIBUTE = "autoCreate";
private static final String MANDATORY_ATTRIBUTE = "mandatory";
private static final String PROTECTED_ATTRIBUTE = "protected";
- private static final String PRIMARYITEM_ATTRIBUTE = "primaryItem";
private static final String MULTIPLE_ATTRIBUTE = "multiple";
private static final String SAMENAMESIBS_ATTRIBUTE = "sameNameSibs";
private static final String ONPARENTVERSION_ATTRIBUTE = "onParentVersion";
@@ -268,6 +268,18 @@
ntDef.setOrderableChildNodes(Boolean.valueOf(orderableChildNodes).booleanValue());
}
+ // primaryItemName
+ String primaryItemName = ntElem.getAttributeValue(PRIMARYITEMNAME_ATTRIBUTE);
+ if (primaryItemName != null && primaryItemName.length() > 0) {
+ try {
+ ntDef.setPrimaryItemName(QName.fromJCRName(primaryItemName, nsResolver));
+ } catch (BaseException e) {
+ String msg = "invalid serialized node type definition [" + sntName + "]: invalid primaryItemName: " + primaryItemName;
+ log.error(msg, e);
+ throw new InvalidNodeTypeDefException(msg, e);
+ }
+ }
+
// property definitions
list.clear();
Iterator iter = ntElem.getChildren(PROPERTYDEF_ELEMENT).iterator();
@@ -377,11 +389,6 @@
if (writeProtected != null && writeProtected.length() > 0) {
pd.setProtected(Boolean.valueOf(writeProtected).booleanValue());
}
- // primaryItem
- String primaryItem = elem.getAttributeValue(PRIMARYITEM_ATTRIBUTE);
- if (primaryItem != null && primaryItem.length() > 0) {
- pd.setPrimaryItem(Boolean.valueOf(primaryItem).booleanValue());
- }
// multiple
String multiple = elem.getAttributeValue(MULTIPLE_ATTRIBUTE);
if (multiple != null && multiple.length() > 0) {
@@ -476,11 +483,6 @@
if (writeProtected != null && writeProtected.length() > 0) {
cnd.setProtected(Boolean.valueOf(writeProtected).booleanValue());
}
- // primaryItem
- String primaryItem = elem.getAttributeValue(PRIMARYITEM_ATTRIBUTE);
- if (primaryItem != null && primaryItem.length() > 0) {
- cnd.setPrimaryItem(Boolean.valueOf(primaryItem).booleanValue());
- }
// sameNameSibs
String sameNameSibs = elem.getAttributeValue(SAMENAMESIBS_ATTRIBUTE);
if (sameNameSibs != null && sameNameSibs.length() > 0) {
@@ -520,6 +522,10 @@
// orderableChildNodes
ntElem.setAttribute(ORDERABLECHILDNODES_ATTRIBUTE, Boolean.toString(ntd.hasOrderableChildNodes()));
+ // primaryItemName
+ String primaryItemName = ntd.getPrimaryItemName() == null ? "" : ntd.getPrimaryItemName().toJCRName(nsResolver);
+ ntElem.setAttribute(PRIMARYITEMNAME_ATTRIBUTE, primaryItemName);
+
// property definitions
PropDef[] pda = ntd.getPropertyDefs();
for (int i = 0; i < pda.length; i++) {
@@ -562,8 +568,6 @@
elem.setAttribute(ONPARENTVERSION_ATTRIBUTE, OnParentVersionAction.nameFromValue(pd.getOnParentVersion()));
// protected
elem.setAttribute(PROTECTED_ATTRIBUTE, Boolean.toString(pd.isProtected()));
- // primaryItem
- elem.setAttribute(PRIMARYITEM_ATTRIBUTE, Boolean.toString(pd.isPrimaryItem()));
// multiple
elem.setAttribute(MULTIPLE_ATTRIBUTE, Boolean.toString(pd.isMultiple()));
}
@@ -600,8 +604,6 @@
elem.setAttribute(ONPARENTVERSION_ATTRIBUTE, OnParentVersionAction.nameFromValue(nd.getOnParentVersion()));
// protected
elem.setAttribute(PROTECTED_ATTRIBUTE, Boolean.toString(nd.isProtected()));
- // primaryItem
- elem.setAttribute(PRIMARYITEM_ATTRIBUTE, Boolean.toString(nd.isPrimaryItem()));
// sameNameSibs
elem.setAttribute(SAMENAMESIBS_ATTRIBUTE, Boolean.toString(nd.allowSameNameSibs()));
}
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java Fri Jan 28 07:46:52 2005
@@ -289,6 +289,19 @@
}
/**
+ * @see NodeType#getPrimaryItemName
+ */
+ public String getPrimaryItemName() {
+ try {
+ return ntd.getPrimaryItemName().toJCRName(nsResolver);
+ } catch (NoPrefixDeclaredException npde) {
+ // should never get here
+ log.error("encountered unregistered namespace in name of primary item", npde);
+ return ntd.getName().toString();
+ }
+ }
+
+ /**
* @see NodeType#isMixin
*/
public boolean isMixin() {
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java Fri Jan 28 07:46:52 2005
@@ -58,9 +58,9 @@
// nt:hierarchyNode
public static final QName NT_HIERARCHYNODE =
new QName(NamespaceRegistryImpl.NS_NT_URI, "hierarchyNode");
- // nt:mimeResource
- public static final QName NT_MIME_RESOURCE =
- new QName(NamespaceRegistryImpl.NS_NT_URI, "mimeResource");
+ // nt:resource
+ public static final QName NT_RESOURCE =
+ new QName(NamespaceRegistryImpl.NS_NT_URI, "resource");
// nt:query
public static final QName NT_QUERY =
new QName(NamespaceRegistryImpl.NS_NT_URI, "query");
@@ -267,7 +267,6 @@
def.setMandatory(true);
def.setProtected(false);
def.setOnParentVersion(OnParentVersionAction.VERSION);
- def.setPrimaryItem(false);
def.setAllowSameNameSibs(false);
def.setAutoCreate(true);
return def;
@@ -596,8 +595,6 @@
}
}
- ChildItemDef primaryItem = null;
-
// validate property definitions
PropDef[] pda = ntd.getPropertyDefs();
for (int i = 0; i < pda.length; i++) {
@@ -607,25 +604,11 @@
* make sure declaring node type matches name of node type definition
*/
if (!name.equals(pd.getDeclaringNodeType())) {
- String msg = "[" + name + "#" + pd.getName() + "] invalid declaring node type specified";
+ String msg = "[" + name + "#" + pd.getName()
+ + "] invalid declaring node type specified";
log.error(msg);
throw new InvalidNodeTypeDefException(msg);
}
- // check primary item flag
- if (pd.isPrimaryItem()) {
- if (pd.definesResidual()) {
- String msg = "[" + name + "#" + pd.getName() + "] primary item must specify a name";
- log.error(msg);
- throw new InvalidNodeTypeDefException(msg);
- }
- if (primaryItem != null) {
- String msg = "[" + name + "#" + pd.getName() + "] more than one primary item specified";
- log.error(msg);
- throw new InvalidNodeTypeDefException(msg);
- } else {
- primaryItem = pd;
- }
- }
// check that auto-created properties specify a name
if (pd.definesResidual() && pd.isAutoCreate()) {
String msg = "[" + name + "#" + pd.getName()
@@ -725,27 +708,11 @@
* make sure declaring node type matches name of node type definition
*/
if (!name.equals(cnd.getDeclaringNodeType())) {
- String msg = "[" + name + "#" + cnd.getName() + "] invalid declaring node type specified";
+ String msg = "[" + name + "#" + cnd.getName()
+ + "] invalid declaring node type specified";
log.error(msg);
throw new InvalidNodeTypeDefException(msg);
}
- // check primary item flag
- if (cnd.isPrimaryItem()) {
- if (cnd.definesResidual()) {
- String msg = "[" + name + "#" + cnd.getName()
- + "] primary item must specify a name";
- log.error(msg);
- throw new InvalidNodeTypeDefException(msg);
- }
- if (primaryItem != null) {
- String msg = "[" + name + "#" + cnd.getName()
- + "] more than one primary item specified";
- log.error(msg);
- throw new InvalidNodeTypeDefException(msg);
- } else {
- primaryItem = cnd;
- }
- }
// check that auto-created child-nodes specify a name
if (cnd.definesResidual() && cnd.isAutoCreate()) {
String msg = "[" + name + "#" + cnd.getName()
@@ -1513,6 +1480,7 @@
}
ps.println("\tMixin\t" + ntd.isMixin());
ps.println("\tOrderableChildNodes\t" + ntd.hasOrderableChildNodes());
+ ps.println("\tPrimaryItemName\t" + (ntd.getPrimaryItemName() == null ? "<null>" : ntd.getPrimaryItemName().toString()));
PropDef[] pd = ntd.getPropertyDefs();
for (int i = 0; i < pd.length; i++) {
ps.print("\tPropertyDef");
@@ -1550,7 +1518,6 @@
ps.println("\t\tMandatory\t" + pd[i].isMandatory());
ps.println("\t\tOnVersion\t" + OnParentVersionAction.nameFromValue(pd[i].getOnParentVersion()));
ps.println("\t\tProtected\t" + pd[i].isProtected());
- ps.println("\t\tPrimaryItem\t" + pd[i].isPrimaryItem());
ps.println("\t\tMultiple\t" + pd[i].isMultiple());
}
ChildNodeDef[] nd = ntd.getChildNodeDefs();
@@ -1572,7 +1539,6 @@
ps.println("\t\tMandatory\t" + nd[i].isMandatory());
ps.println("\t\tOnVersion\t" + OnParentVersionAction.nameFromValue(nd[i].getOnParentVersion()));
ps.println("\t\tProtected\t" + nd[i].isProtected());
- ps.println("\t\tPrimaryItem\t" + nd[i].isPrimaryItem());
ps.println("\t\tAllowSameNameSibs\t" + nd[i].allowSameNameSibs());
}
}
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml Fri Jan 28 07:46:52 2005
@@ -25,6 +25,7 @@
name CDATA #REQUIRED
mixin (true|false) #REQUIRED
orderableChildNodes (true|false) #REQUIRED
+ primaryItemName CDATA #REQUIRED
>
<!ELEMENT supertypes (supertype+)>
<!ELEMENT supertype (CDATA)>
@@ -37,7 +38,6 @@
mandatory (true|false) #REQUIRED
onParentVersion (COPY|VERSION|INITIALIZE|COMPUTE|IGNORE|ABORT) #REQUIRED
protected (true|false) #REQUIRED
- primaryItem (true|false) #REQUIRED
multiple (true|false) #REQUIRED
>
<!ELEMENT valueConstraints (valueConstraint+)>
@@ -53,7 +53,6 @@
mandatory (true|false) #REQUIRED
onParentVersion (COPY|VERSION|INITIALIZE|COMPUTE|IGNORE|ABORT) #REQUIRED
protected (true|false) #REQUIRED
- primaryItem (true|false) #REQUIRED
sameNameSibs (true|false) #REQUIRED
>
<!ELEMENT requiredPrimaryTypes (requiredPrimaryType+)>
@@ -66,210 +65,218 @@
xmlns:jcr="http://www.jcp.org/jcr/1.0">
<!-- primary types -->
- <nodeType name="nt:base" mixin="false" orderableChildNodes="false">
- <propertyDef name="jcr:primaryType" type="Name" autoCreate="true" mandatory="true" onParentVersion="COMPUTE" protected="true" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:mixinTypes" type="Name" autoCreate="false" mandatory="false" onParentVersion="COMPUTE" protected="true" primaryItem="false" multiple="true"/>
+ <nodeType name="nt:base" mixin="false" orderableChildNodes="false" primaryItemName="">
+ <propertyDef name="jcr:primaryType" type="Name" autoCreate="true" mandatory="true" onParentVersion="COMPUTE" protected="true" multiple="false"/>
+ <propertyDef name="jcr:mixinTypes" type="Name" autoCreate="false" mandatory="false" onParentVersion="COMPUTE" protected="true" multiple="true"/>
</nodeType>
- <nodeType name="nt:unstructured" mixin="false" orderableChildNodes="true">
+ <nodeType name="nt:unstructured" mixin="false" orderableChildNodes="true" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
</supertypes>
- <childNodeDef name="*" defaultPrimaryType="nt:unstructured" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" sameNameSibs="true">
+ <childNodeDef name="*" defaultPrimaryType="nt:unstructured" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSibs="true">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:base</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDef>
- <propertyDef name="*" type="undefined" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="true"/>
- <propertyDef name="*" type="undefined" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+ <propertyDef name="*" type="undefined" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
+ <propertyDef name="*" type="undefined" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
</nodeType>
- <nodeType name="nt:hierarchyNode" mixin="false" orderableChildNodes="false">
+ <nodeType name="nt:hierarchyNode" mixin="false" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
</supertypes>
- <propertyDef name="jcr:created" type="Date" autoCreate="true" mandatory="true" onParentVersion="COPY" protected="true" primaryItem="false" multiple="false"/>
+ <propertyDef name="jcr:created" type="Date" autoCreate="true" mandatory="true" onParentVersion="COPY" protected="true" multiple="false"/>
</nodeType>
- <nodeType name="nt:file" mixin="false" orderableChildNodes="false">
+ <nodeType name="nt:file" mixin="false" orderableChildNodes="false" primaryItemName="jcr:content">
<supertypes>
<supertype>nt:hierarchyNode</supertype>
</supertypes>
- <childNodeDef name="jcr:content" defaultPrimaryType="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="true" sameNameSibs="false">
+ <childNodeDef name="jcr:content" defaultPrimaryType="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" sameNameSibs="false">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:base</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDef>
</nodeType>
- <nodeType name="nt:mimeResource" mixin="false" orderableChildNodes="false">
+ <nodeType name="nt:resource" mixin="false" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
<supertype>mix:referenceable</supertype>
</supertypes>
- <propertyDef name="jcr:encoding" type="String" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:mimeType" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:data" type="Binary" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="true" multiple="false"/>
- <propertyDef name="jcr:lastModified" type="Date" autoCreate="true" mandatory="true" onParentVersion="COMPUTE" protected="false" primaryItem="false" multiple="false"/>
+ <propertyDef name="jcr:encoding" type="String" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:mimeType" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:data" type="Binary" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:lastModified" type="Date" autoCreate="true" mandatory="true" onParentVersion="COMPUTE" protected="false" multiple="false"/>
</nodeType>
- <nodeType name="nt:folder" mixin="false" orderableChildNodes="false">
+ <nodeType name="nt:folder" mixin="false" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:hierarchyNode</supertype>
</supertypes>
- <childNodeDef name="*" defaultPrimaryType="" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" primaryItem="false" sameNameSibs="false">
+ <childNodeDef name="*" defaultPrimaryType="" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" sameNameSibs="false">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:hierarchyNode</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDef>
</nodeType>
- <nodeType name="nt:nodeType" mixin="false" orderableChildNodes="false">
+ <nodeType name="nt:nodeType" mixin="false" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
</supertypes>
- <propertyDef name="jcr:nodeTypeName" type="Name" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:supertypes" type="Name" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="true"/>
- <propertyDef name="jcr:isMixin" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:orderableChildNodes" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <childNodeDef name="jcr:propertyDef" defaultPrimaryType="nt:propertyDef" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" primaryItem="false" sameNameSibs="true">
+ <propertyDef name="jcr:nodeTypeName" type="Name" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:supertypes" type="Name" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="true"/>
+ <propertyDef name="jcr:isMixin" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:orderableChildNodes" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <childNodeDef name="jcr:propertyDef" defaultPrimaryType="nt:propertyDef" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" sameNameSibs="true">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:propertyDef</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDef>
- <childNodeDef name="jcr:childNodeDef" defaultPrimaryType="nt:childNodeDef" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" primaryItem="false" sameNameSibs="true">
+ <childNodeDef name="jcr:childNodeDef" defaultPrimaryType="nt:childNodeDef" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" sameNameSibs="true">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:childNodeDef</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDef>
</nodeType>
- <nodeType name="nt:propertyDef" mixin="false" orderableChildNodes="false">
+ <nodeType name="nt:propertyDef" mixin="false" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
</supertypes>
- <propertyDef name="jcr:name" type="Name" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:type" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:valueConstraints" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="true"/>
- <propertyDef name="jcr:defaultValues" type="undefined" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="true"/>
- <propertyDef name="jcr:autoCreate" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:mandatory" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:onParentVersion" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:protected" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:primaryItem" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:multiple" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+ <propertyDef name="jcr:name" type="Name" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:type" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:valueConstraints" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="true"/>
+ <propertyDef name="jcr:defaultValues" type="undefined" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="true"/>
+ <propertyDef name="jcr:autoCreate" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:mandatory" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:onParentVersion" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:protected" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:primaryItem" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:multiple" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
</nodeType>
- <nodeType name="nt:childNodeDef" mixin="false" orderableChildNodes="false">
+ <nodeType name="nt:childNodeDef" mixin="false" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
</supertypes>
- <propertyDef name="jcr:name" type="Name" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:requiredPrimaryTypes" type="String" autoCreate="true" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="true">
+ <propertyDef name="jcr:name" type="Name" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:requiredPrimaryTypes" type="String" autoCreate="true" mandatory="true" onParentVersion="COPY" protected="false" multiple="true">
<defaultValues>
<defaultValue>nt:base</defaultValue>
</defaultValues>
</propertyDef>
- <propertyDef name="jcr:defaultPrimaryType" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:autoCreate" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:mandatory" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:onParentVersion" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:protected" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:primaryItem" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:sameNameSibs" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+ <propertyDef name="jcr:defaultPrimaryType" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:autoCreate" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:mandatory" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:onParentVersion" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:protected" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:primaryItem" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:sameNameSibs" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
</nodeType>
- <nodeType name="nt:versionHistory" mixin="false" orderableChildNodes="false">
+ <nodeType name="nt:versionHistory" mixin="false" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
<supertype>mix:referenceable</supertype>
</supertypes>
- <childNodeDef name="jcr:rootVersion" defaultPrimaryType="nt:version" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" sameNameSibs="false">
+ <childNodeDef name="jcr:rootVersion" defaultPrimaryType="nt:version" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" sameNameSibs="false">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:version</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDef>
- <childNodeDef name="*" defaultPrimaryType="nt:version" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" sameNameSibs="false">
+ <childNodeDef name="*" defaultPrimaryType="nt:version" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" sameNameSibs="false">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:version</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDef>
</nodeType>
- <nodeType name="nt:frozenVersionableChild" mixin="false" orderableChildNodes="false">
+ <nodeType name="nt:frozenVersionableChild" mixin="false" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
</supertypes>
- <propertyDef name="jcr:versionHistory" type="Reference" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false">
+ <propertyDef name="jcr:versionHistory" type="Reference" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" multiple="false">
<valueConstraints>
<valueConstraint>nt:versionHistory</valueConstraint>
</valueConstraints>
</propertyDef>
- <propertyDef name="jcr:baseVersion" type="Reference" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false">
+ <propertyDef name="jcr:baseVersion" type="Reference" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" multiple="false">
<valueConstraints>
<valueConstraint>nt:version</valueConstraint>
</valueConstraints>
</propertyDef>
</nodeType>
- <nodeType name="nt:version" mixin="false" orderableChildNodes="false">
+ <nodeType name="nt:versionedChild" mixin="false" orderableChildNodes="false" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ </supertypes>
+ <propertyDef name="jcr:child" type="Reference" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" multiple="false">
+ <valueConstraints>
+ <valueConstraint>nt:versionHistory</valueConstraint>
+ </valueConstraints>
+ </propertyDef>
+ </nodeType>
+ <nodeType name="nt:version" mixin="false" orderableChildNodes="false" primaryItemName="jcr:frozen">
<supertypes>
<supertype>nt:base</supertype>
<supertype>mix:referenceable</supertype>
</supertypes>
- <propertyDef name="jcr:versionLabels" type="String" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true"/>
- <propertyDef name="jcr:created" type="Date" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:frozenPrimaryType" type="Name" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:frozenMixinTypes" type="Name" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true"/>
- <propertyDef name="jcr:frozenUUID" type="String" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:predecessors" type="Reference" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true">
+ <propertyDef name="jcr:versionLabels" type="String" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" multiple="true"/>
+ <propertyDef name="jcr:created" type="Date" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" multiple="false"/>
+ <propertyDef name="jcr:frozenPrimaryType" type="Name" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" multiple="false"/>
+ <propertyDef name="jcr:frozenMixinTypes" type="Name" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" multiple="true"/>
+ <propertyDef name="jcr:frozenUUID" type="String" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" multiple="false"/>
+ <propertyDef name="jcr:predecessors" type="Reference" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" multiple="true">
<valueConstraints>
<valueConstraint>nt:version</valueConstraint>
</valueConstraints>
</propertyDef>
- <propertyDef name="jcr:successors" type="Reference" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true">
+ <propertyDef name="jcr:successors" type="Reference" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" multiple="true">
<valueConstraints>
<valueConstraint>nt:version</valueConstraint>
</valueConstraints>
</propertyDef>
- <childNodeDef name="jcr:frozen" defaultPrimaryType="nt:base" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="true" sameNameSibs="false">
+ <childNodeDef name="jcr:frozen" defaultPrimaryType="nt:base" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" sameNameSibs="false">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:base</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDef>
</nodeType>
- <nodeType name="nt:query" mixin="false" orderableChildNodes="false">
+ <nodeType name="nt:query" mixin="false" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
</supertypes>
- <propertyDef name="jcr:statement" type="String" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:language" type="String" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+ <propertyDef name="jcr:statement" type="String" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
+ <propertyDef name="jcr:language" type="String" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
</nodeType>
<!-- mixin types -->
- <nodeType name="mix:accessControllable" mixin="true" orderableChildNodes="false">
- </nodeType>
- <nodeType name="mix:lockable" mixin="true" orderableChildNodes="false">
- <propertyDef name="jcr:lockOwner" type="String" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false"/>
- <propertyDef name="jcr:lockIsDeep" type="Boolean" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false"/>
+ <nodeType name="mix:lockable" mixin="true" orderableChildNodes="false" primaryItemName="">
+ <propertyDef name="jcr:lockOwner" type="String" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" multiple="false"/>
+ <propertyDef name="jcr:lockIsDeep" type="Boolean" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" multiple="false"/>
</nodeType>
- <nodeType name="mix:referenceable" mixin="true" orderableChildNodes="false">
- <propertyDef name="jcr:uuid" type="String" autoCreate="true" mandatory="true" onParentVersion="INITIALIZE" protected="true" primaryItem="false" multiple="false"/>
+ <nodeType name="mix:referenceable" mixin="true" orderableChildNodes="false" primaryItemName="">
+ <propertyDef name="jcr:uuid" type="String" autoCreate="true" mandatory="true" onParentVersion="INITIALIZE" protected="true" multiple="false"/>
</nodeType>
- <nodeType name="mix:versionable" mixin="true" orderableChildNodes="false">
+ <nodeType name="mix:versionable" mixin="true" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>mix:referenceable</supertype>
</supertypes>
- <propertyDef name="jcr:versionHistory" type="Reference" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="true" primaryItem="false" multiple="false">
+ <propertyDef name="jcr:versionHistory" type="Reference" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="true" multiple="false">
<valueConstraints>
<valueConstraint>nt:versionHistory</valueConstraint>
</valueConstraints>
</propertyDef>
- <propertyDef name="jcr:baseVersion" type="Reference" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false">
+ <propertyDef name="jcr:baseVersion" type="Reference" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" multiple="false">
<valueConstraints>
<valueConstraint>nt:version</valueConstraint>
</valueConstraints>
</propertyDef>
- <propertyDef name="jcr:isCheckedOut" type="Boolean" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false">
+ <propertyDef name="jcr:isCheckedOut" type="Boolean" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" multiple="false">
<defaultValues>
<defaultValue>true</defaultValue>
</defaultValues>
</propertyDef>
- <propertyDef name="jcr:predecessors" type="Reference" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="true" primaryItem="false" multiple="true">
+ <propertyDef name="jcr:predecessors" type="Reference" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="true" multiple="true">
<valueConstraints>
<valueConstraint>nt:version</valueConstraint>
</valueConstraints>
</propertyDef>
- <propertyDef name="jcr:mergeFailed" type="Reference" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="true">
+ <propertyDef name="jcr:mergeFailed" type="Reference" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" multiple="true">
<valueConstraints>
<valueConstraint>nt:version</valueConstraint>
</valueConstraints>
@@ -277,48 +284,48 @@
</nodeType>
<!-- internal node types -->
- <nodeType name="rep:root" mixin="false" orderableChildNodes="true">
+ <nodeType name="rep:root" mixin="false" orderableChildNodes="true" primaryItemName="">
<supertypes>
<supertype>nt:unstructured</supertype>
</supertypes>
- <childNodeDef name="jcr:system" defaultPrimaryType="rep:system" autoCreate="false" mandatory="true" onParentVersion="IGNORE" protected="false" primaryItem="false" sameNameSibs="false">
+ <childNodeDef name="jcr:system" defaultPrimaryType="rep:system" autoCreate="false" mandatory="true" onParentVersion="IGNORE" protected="false" sameNameSibs="false">
<requiredPrimaryTypes>
<requiredPrimaryType>rep:system</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDef>
</nodeType>
- <nodeType name="rep:system" mixin="false" orderableChildNodes="true">
+ <nodeType name="rep:system" mixin="false" orderableChildNodes="true" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
</supertypes>
- <childNodeDef name="jcr:versionStorage" defaultPrimaryType="nt:unstructured" autoCreate="false" mandatory="true" onParentVersion="IGNORE" protected="false" primaryItem="false" sameNameSibs="false">
+ <childNodeDef name="jcr:versionStorage" defaultPrimaryType="nt:unstructured" autoCreate="true" mandatory="true" onParentVersion="IGNORE" protected="false" sameNameSibs="false">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:base</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDef>
- <childNodeDef name="*" defaultPrimaryType="nt:unstructured" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="false" primaryItem="false" sameNameSibs="true">
+ <childNodeDef name="*" defaultPrimaryType="nt:unstructured" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="false" sameNameSibs="true">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:base</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDef>
</nodeType>
<!-- internal nodetypes for persistent version manager -->
- <nodeType name="rep:versionHistory" mixin="false" orderableChildNodes="false">
+ <nodeType name="rep:versionHistory" mixin="false" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:unstructured</supertype>
</supertypes>
</nodeType>
- <nodeType name="rep:version" mixin="false" orderableChildNodes="false">
+ <nodeType name="rep:version" mixin="false" orderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:unstructured</supertype>
</supertypes>
</nodeType>
- <nodeType name="rep:frozen" mixin="false" orderableChildNodes="true">
+ <nodeType name="rep:frozen" mixin="false" orderableChildNodes="true" primaryItemName="">
<supertypes>
<supertype>nt:unstructured</supertype>
</supertypes>
</nodeType>
- <nodeType name="rep:frozenVersionHistory" mixin="false" orderableChildNodes="true">
+ <nodeType name="rep:frozenVersionHistory" mixin="false" orderableChildNodes="true" primaryItemName="">
<supertypes>
<supertype>nt:unstructured</supertype>
</supertypes>
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryManagerImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryManagerImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryManagerImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryManagerImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryManagerImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryManagerImpl.java Fri Jan 28 07:46:52 2005
@@ -21,6 +21,7 @@
import org.apache.jackrabbit.core.SessionImpl;
import javax.jcr.RepositoryException;
+import javax.jcr.Node;
import javax.jcr.query.InvalidQueryException;
import javax.jcr.query.Query;
import javax.jcr.query.QueryManager;
@@ -29,7 +30,7 @@
import java.util.List;
/**
- * This class implements the {@link javax.jcr.query.QueryManager} interface.
+ * This class implements the {@link QueryManager} interface.
*/
public class QueryManagerImpl implements QueryManager {
@@ -37,7 +38,7 @@
* Defines all supported query languages
*/
private static final String[] SUPPORTED_QUERIES = new String[]{
- Query.JCRQL, Query.XPATH_DOCUMENT_VIEW, Query.XPATH_SYSTEM_VIEW
+ Query.SQL, Query.XPATH
};
/**
@@ -87,20 +88,12 @@
}
/**
- * @see QueryManager#getQuery(java.lang.String)
+ * @see QueryManager#getQuery(Node)
*/
- public Query getQuery(String absPath)
+ public Query getQuery(Node node)
throws InvalidQueryException, RepositoryException {
- return searchMgr.createQuery(session, itemMgr, absPath);
- }
-
- /**
- * @see QueryManager#getQueryByUUID(java.lang.String)
- */
- public Query getQueryByUUID(String uuid)
- throws InvalidQueryException, RepositoryException {
- return getQuery(session.getNodeByUUID(uuid).getPath());
+ return searchMgr.createQuery(session, itemMgr, node.getPath());
}
/**
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryParser.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryParser.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryParser.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryParser.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryParser.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryParser.java Fri Jan 28 07:46:52 2005
@@ -39,9 +39,8 @@
* Parses a query <code>statement</code> according to a query
* <code>language</code> into a query tree.
* <p/>
- * <code>language</code> must be one of: {@link javax.jcr.query.Query#JCRQL},
- * {@link javax.jcr.query.Query#XPATH_DOCUMENT_VIEW},
- * {@link javax.jcr.query.Query#XPATH_SYSTEM_VIEW}.
+ * <code>language</code> must be one of: {@link javax.jcr.query.Query#SQL},
+ * {@link javax.jcr.query.Query#XPATH}.
*
* @param statement the query statement.
* @param language the language of the query statement.
@@ -54,9 +53,9 @@
NamespaceResolver resolver)
throws InvalidQueryException {
- if (Query.XPATH_DOCUMENT_VIEW.equals(language)) {
+ if (Query.XPATH.equals(language)) {
return XPathQueryBuilder.createQuery(statement, resolver);
- } else if ("sql".equals(language)) {
+ } else if (Query.SQL.equals(language)) {
return JCRSQLQueryBuilder.createQuery(statement, resolver);
} else {
throw new InvalidQueryException("Unsupported language: " + language);
@@ -87,9 +86,9 @@
NamespaceResolver resolver)
throws InvalidQueryException {
- if (Query.XPATH_DOCUMENT_VIEW.equals(language)) {
+ if (Query.XPATH.equals(language)) {
return XPathQueryBuilder.toString(root, resolver);
- } else if ("sql".equals(language)) {
+ } else if (Query.SQL.equals(language)) {
return JCRSQLQueryBuilder.toString(root, resolver);
} else {
throw new InvalidQueryException("Unsupported language: " + language);
Deleted: /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FilteredPropertyIterator.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FilteredPropertyIterator.java?view=auto&rev=148893
==============================================================================
Deleted: /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PropertyIteratorImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PropertyIteratorImpl.java?view=auto&rev=148893
==============================================================================
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryImpl.java Fri Jan 28 07:46:52 2005
@@ -39,11 +39,9 @@
import javax.jcr.nodetype.NodeTypeManager;
import javax.jcr.query.InvalidQueryException;
import javax.jcr.query.QueryResult;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.RepositoryException;
-import javax.jcr.Node;
-import javax.jcr.ItemExistsException;
-import javax.jcr.PathNotFoundException;
+import javax.jcr.*;
+import javax.jcr.lock.LockException;
+import javax.jcr.version.VersionException;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
@@ -202,24 +200,13 @@
}
}
- public String getPersistentQueryUUID() throws ItemNotFoundException {
- if (path == null) {
- throw new ItemNotFoundException("not a persistent query");
- }
- try {
- // FIXME what if nt:query does not have a mix:referencable?
- return session.getRootNode().getNode(path.toJCRPath(session.getNamespaceResolver())).getUUID();
- } catch (RepositoryException e) {
- throw new ItemNotFoundException(e.getMessage(), e);
- } catch (NoPrefixDeclaredException e) {
- throw new ItemNotFoundException(e.getMessage(), e);
- }
- }
-
public void save(String absPath)
throws ItemExistsException,
PathNotFoundException,
+ VersionException,
ConstraintViolationException,
+ LockException,
+ UnsupportedRepositoryOperationException,
RepositoryException {
try {
NamespaceResolver resolver = session.getNamespaceResolver();
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java Fri Jan 28 07:46:52 2005
@@ -17,14 +17,15 @@
package org.apache.jackrabbit.core.search.lucene;
import org.apache.jackrabbit.core.ItemManager;
-import org.apache.jackrabbit.core.QName;
import org.apache.jackrabbit.core.NamespaceResolver;
+import org.apache.jackrabbit.core.NoPrefixDeclaredException;
+import org.apache.jackrabbit.core.QName;
import org.apache.log4j.Logger;
import javax.jcr.NodeIterator;
-import javax.jcr.PropertyIterator;
import javax.jcr.RepositoryException;
import javax.jcr.query.QueryResult;
+import javax.jcr.query.RowIterator;
/**
* Implements the <code>javax.jcr.query.QueryResult</code> interface.
@@ -52,18 +53,36 @@
}
/**
- * @see QueryResult#getProperties()
+ * @see QueryResult#getPropertyNames()
*/
- public PropertyIterator getProperties() throws RepositoryException {
- return new PropertyIteratorImpl(selectProps,
- new NodeIteratorImpl(itemMgr, uuids),
- resolver);
+ public String[] getPropertyNames() throws RepositoryException {
+ try {
+ String[] propNames = new String[selectProps.length];
+ for (int i = 0; i < selectProps.length; i++) {
+ propNames[i] = selectProps[i].toJCRName(resolver);
+ }
+ return propNames;
+ } catch (NoPrefixDeclaredException npde) {
+ String msg = "encountered invalid property name";
+ log.error(msg, npde);
+ throw new RepositoryException(msg, npde);
+
+ }
}
+
/**
* @see QueryResult#getNodes()
*/
public NodeIterator getNodes() throws RepositoryException {
return new NodeIteratorImpl(itemMgr, uuids);
+ }
+
+ /**
+ * @see QueryResult#getRows()
+ */
+ public RowIterator getRows() throws RepositoryException {
+ // @todo implement QueryResult#getRows()
+ throw new RepositoryException("not yet implemented");
}
}
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/IteratorHelper.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/IteratorHelper.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/IteratorHelper.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/IteratorHelper.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/IteratorHelper.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/IteratorHelper.java Fri Jan 28 07:46:52 2005
@@ -28,7 +28,7 @@
* interfaces.
*/
public class IteratorHelper
- implements NodeIterator, PropertyIterator, NodeTypeIterator, StringIterator {
+ implements NodeIterator, PropertyIterator, NodeTypeIterator {
static final long UNDETERMINED_SIZE = -1;
@@ -127,12 +127,5 @@
*/
public NodeType nextNodeType() {
return (NodeType) next();
- }
-
- /**
- * @see StringIterator#nextString()
- */
- public String nextString() {
- return (String) next();
}
}
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java Fri Jan 28 07:46:52 2005
@@ -75,7 +75,8 @@
/**
* @see VersionHistory#getVersion(String)
*/
- public Version getVersion(String versionName) throws RepositoryException {
+ public Version getVersion(String versionName)
+ throws VersionException, RepositoryException {
try {
QName name = QName.fromJCRName(versionName, session.getNamespaceResolver());
InternalVersion v = history.getVersion(name);
@@ -96,13 +97,6 @@
}
/**
- * @see VersionHistory#addVersionLabel(String, String)
- */
- public void addVersionLabel(String version, String label) throws VersionException, RepositoryException {
- addVersionLabel(version, label, false);
- }
-
- /**
* @see VersionHistory#addVersionLabel(String, String, boolean)
*/
public void addVersionLabel(String version, String label, boolean move)
@@ -126,9 +120,49 @@
/**
+ * @see VersionHistory#getVersionLabels
+ */
+ public String[] getVersionLabels() {
+ return new String[0]; // @todo implement VersionHistory#getVersionLabels()
+ }
+
+ /**
+ * @see VersionHistory#getVersionLabels(Version)
+ */
+ public String[] getVersionLabels(Version version)
+ throws VersionException, RepositoryException {
+ return new String[0]; // @todo implement VersionHistory#getVersionLabels(Version)
+ }
+
+ /**
+ * @see VersionHistory#hasVersionLabel(String)
+ */
+ public boolean hasVersionLabel(String label) {
+ return false; // @todo implement VersionHistory#hasVersionLabel(String)
+ }
+
+ /**
+ * @see VersionHistory#hasVersionLabel(Version, String)
+ */
+ public boolean hasVersionLabel(Version version, String label)
+ throws VersionException, RepositoryException {
+ return false; // @todo implement VersionHistory#hasVersionLabel(Version, String)
+ }
+
+ /**
+ * @see VersionHistory#removeVersionLabel(String)
+ */
+ public void removeVersion(String label)
+ throws UnsupportedRepositoryOperationException, VersionException,
+ RepositoryException {
+ // @todo implement VersionHistory#removeVersionLabel(String)
+ }
+
+ /**
* @see javax.jcr.Node#getUUID()
*/
- public String getUUID() throws UnsupportedRepositoryOperationException, RepositoryException {
+ public String getUUID()
+ throws UnsupportedRepositoryOperationException, RepositoryException {
return history.getId();
}
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java Fri Jan 28 07:46:52 2005
@@ -64,20 +64,6 @@
}
/**
- * @see Version#getVersionLabels()
- */
- public String[] getVersionLabels() throws RepositoryException {
- return version.getLabels();
- }
-
- /**
- * @see Version#hasVersionLabel
- */
- public boolean hasVersionLabel(String label) {
- return version.hasLabel(label);
- }
-
- /**
* @see Version#getSuccessors()
*/
public Version[] getSuccessors() throws RepositoryException {
Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java&r1=148893&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/ImportHandler.java Fri Jan 28 07:46:52 2005
@@ -126,6 +126,8 @@
} catch (RepositoryException re) {
throw new SAXException("failed to register namespace " + uri + " with prefix " + prefix, re);
}
+ } catch (RepositoryException re) {
+ throw new SAXException("failed to check prefix for namespace " + uri, re);
}
}
Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/AbstractQueryTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/AbstractQueryTest.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/AbstractQueryTest.java&r1=148893&p2=incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/AbstractQueryTest.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/AbstractQueryTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/AbstractQueryTest.java Fri Jan 28 07:46:52 2005
@@ -73,6 +73,7 @@
*/
protected void checkResult(QueryResult result, int hits, int properties)
throws RepositoryException {
+/*
checkResult(result, hits);
// now check property count
int count = 0;
@@ -99,6 +100,9 @@
log.println(" NONE");
}
assertEquals("Wrong property count.", properties, count);
+*/
+ //@todo rewrite test case
+ fail("need to rewrite test case according to interface change");
}
}
Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/OrderByTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/OrderByTest.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/OrderByTest.java&r1=148893&p2=incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/OrderByTest.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/OrderByTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/OrderByTest.java Fri Jan 28 07:46:52 2005
@@ -128,7 +128,7 @@
checkResultOrder(result, new String[]{"node2", "node3", "node1"});
String xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured'] order by @value, @text";
- q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH_DOCUMENT_VIEW);
+ q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
result = q.execute();
checkResultOrder(result, new String[]{"node2", "node3", "node1"});
@@ -140,7 +140,7 @@
checkResultOrder(result, new String[]{"node1", "node3", "node2"});
xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured'] order by @value descending, @text descending";
- q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH_DOCUMENT_VIEW);
+ q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
result = q.execute();
checkResultOrder(result, new String[]{"node1", "node3", "node2"});
@@ -152,7 +152,7 @@
checkResultOrder(result, new String[]{"node1", "node2", "node3"});
xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured'] order by @value descending, @text";
- q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH_DOCUMENT_VIEW);
+ q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
result = q.execute();
checkResultOrder(result, new String[]{"node1", "node2", "node3"});
}
@@ -204,7 +204,7 @@
checkResultOrder(result, nodeNames);
String xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured'] order by @value";
- q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH_DOCUMENT_VIEW);
+ q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
result = q.execute();
checkResultOrder(result, nodeNames);
@@ -218,7 +218,7 @@
checkResultOrder(result, nodeNames);
xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured'] order by @value descending";
- q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH_DOCUMENT_VIEW);
+ q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
result = q.execute();
checkResultOrder(result, nodeNames);
}
Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SimpleQueryTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SimpleQueryTest.java?view=diff&rev=148894&p1=incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SimpleQueryTest.java&r1=148893&p2=incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SimpleQueryTest.java&r2=148894
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SimpleQueryTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SimpleQueryTest.java Fri Jan 28 07:46:52 2005
@@ -311,7 +311,7 @@
checkResult(result, 1);
String xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured' and fn:not(@mytext)]";
- q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH_DOCUMENT_VIEW);
+ q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
result = q.execute();
checkResult(result, 1);
@@ -331,7 +331,7 @@
checkResult(result, 1);
String xpath = "//*[@jcr:primaryType='nt:unstructured' and @mytext]";
- q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH_DOCUMENT_VIEW);
+ q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
result = q.execute();
checkResult(result, 1);
}
@@ -355,7 +355,7 @@
checkResult(result, 3); // foo, bar, bla
String xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured' and @text = 'foo']";
- q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH_DOCUMENT_VIEW);
+ q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
result = q.execute();
checkResult(result, 3); // foo, bar, bla
@@ -366,7 +366,7 @@
checkResult(result, 2); // bar, bla
xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured' and @text eq 'foo']";
- q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH_DOCUMENT_VIEW);
+ q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
result = q.execute();
checkResult(result, 2); // bar, bla
@@ -377,7 +377,7 @@
checkResult(result, 2); // bar, bla
xpath = "/" + testRoot + "/*[@jcr:primaryType='nt:unstructured' and @text != 'bar']";
- q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH_DOCUMENT_VIEW);
+ q = superuser.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH);
result = q.execute();
checkResult(result, 2); // bar, bla