You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2008/05/09 16:45:35 UTC
svn commit: r654829 - in /jackrabbit/sandbox/spi:
client/src/test/java/org/apache/jackrabbit/jcr2spi/
client/src/test/java/org/apache/jackrabbit/jcr2spi/query/
client/src/test/resources/
spi-logger/src/main/java/org/apache/jackrabbit/spi/logger/ spi-rm...
Author: angela
Date: Fri May 9 07:45:35 2008
New Revision: 654829
URL: http://svn.apache.org/viewvc?rev=654829&view=rev
Log:
JCR-1576 Remove RepositoryService exists()
JCR-1577 Remove RepositoryService.getRootId()
JCR-1405 SPI: Introduce NodeInfo.getChildInfos()
JCR-1159: was not yet adjusted in spi2dav
sync tests
Modified:
jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java
jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java
jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/QueryTest.java
jackrabbit/sandbox/spi/client/src/test/resources/repositoryStubImpl.properties
jackrabbit/sandbox/spi/spi-logger/src/main/java/org/apache/jackrabbit/spi/logger/RepositoryServiceLogger.java
jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/client/ClientRepositoryService.java
jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/remote/RemoteRepositoryService.java
jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/server/ServerRepositoryService.java
jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java
jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java
jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
Modified: jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java?rev=654829&r1=654828&r2=654829&view=diff
==============================================================================
--- jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java (original)
+++ jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java Fri May 9 07:45:35 2008
@@ -89,8 +89,6 @@
public void testGetProperties() throws RepositoryException {
Session readSession = helper.getReadOnlySession();
dump((Node) readSession.getItem(fileNode.getPath()));
-
- System.out.println("bla");
}
/** Recursively outputs the contents of the given node. */
Modified: jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java?rev=654829&r1=654828&r2=654829&view=diff
==============================================================================
--- jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java (original)
+++ jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java Fri May 9 07:45:35 2008
@@ -30,6 +30,7 @@
import javax.jcr.ItemExistsException;
import javax.jcr.Session;
import javax.jcr.Property;
+import javax.jcr.PathNotFoundException;
import javax.jcr.version.VersionException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -45,17 +46,16 @@
private static Logger log = LoggerFactory.getLogger(UpdateTest.class);
private String currentWorkspace;
- private String[] accessibleWorkspaces;
protected void setUp() throws Exception {
super.setUp();
currentWorkspace = testRootNode.getSession().getWorkspace().getName();
- accessibleWorkspaces = testRootNode.getSession().getWorkspace().getAccessibleWorkspaceNames();
}
public void testInvalidSrcWorkspace() throws RepositoryException, InvalidItemStateException, AccessDeniedException {
String nonExistingWorkspace = "nonExistingWorkspace";
+ String[] accessibleWorkspaces = testRootNode.getSession().getWorkspace().getAccessibleWorkspaceNames();
List l = Arrays.asList(accessibleWorkspaces);
while (l.contains(nonExistingWorkspace)) {
nonExistingWorkspace = nonExistingWorkspace + "_";
@@ -73,14 +73,16 @@
testRootNode.save();
String srcWorkspace = null;
- for (int i = 0; i < accessibleWorkspaces.length; i++) {
- if (!accessibleWorkspaces[i].equals(currentWorkspace)) {
- try {
- n.getCorrespondingNodePath(accessibleWorkspaces[i]);
- } catch (ItemNotFoundException e) {
- srcWorkspace = accessibleWorkspaces[i];
- }
- }
+ String wspName = helper.getProperty("org.apache.jackrabbit.jcr2spi.workspace2.name");
+ if (wspName == null) {
+ throw new NotExecutableException("Cannot run update. Missing config param.");
+ }
+ try {
+ n.getCorrespondingNodePath(wspName);
+ } catch (ItemNotFoundException e) {
+ srcWorkspace = wspName;
+ } catch (RepositoryException e) {
+ throw new NotExecutableException("Cannot run update. Workspace " + srcWorkspace + " does not exist or is not accessible.");
}
if (srcWorkspace == null) {
throw new NotExecutableException("Cannot run update. No workspace found, that misses the corresponding node.");
@@ -132,8 +134,8 @@
if (root.isSame(testRootNode)) {
throw new NotExecutableException();
}
- if (root.canAddMixin("mixLockable")) {
- root.addMixin("mixLockable");
+ if (root.canAddMixin(mixLockable)) {
+ root.addMixin(mixLockable);
} else {
root.setProperty(propertyName1, "anyValue");
}
@@ -170,6 +172,10 @@
// ok first check if node has no longer propertis
assertFalse("Node updated with Node.update() should have property removed", testRootNode.hasProperty(propertyName2));
+ } catch (PathNotFoundException e) {
+ throw new NotExecutableException();
+ } catch (ItemNotFoundException e) {
+ throw new NotExecutableException();
} finally {
session2.logout();
}
@@ -199,21 +205,27 @@
testRootNode.hasProperty(nodeName1+"/"+propertyName2) &&
testRootNode.hasProperty(propertyName1);
assertTrue("Node updated with Node.update() should have received childrens", allPresent);
+ } catch (PathNotFoundException e) {
+ throw new NotExecutableException();
+ } catch (ItemNotFoundException e) {
+ throw new NotExecutableException();
} finally {
session2.logout();
}
}
- private String getAnotherWorkspace() throws NotExecutableException {
- String srcWorkspace = null;
- for (int i = 0; i < accessibleWorkspaces.length; i++) {
- if (!accessibleWorkspaces[i].equals(currentWorkspace)) {
- srcWorkspace = accessibleWorkspaces[i];
- }
+ private String getAnotherWorkspace() throws NotExecutableException, RepositoryException {
+ String srcWorkspace = helper.getProperty("org.apache.jackrabbit.jcr2spi.workspace2.name");;
+ if (srcWorkspace == null || srcWorkspace.equals(currentWorkspace)) {
+ throw new NotExecutableException("no alternative workspace configured");
}
- if (srcWorkspace == null) {
- throw new NotExecutableException("Cannot run update. No workspace found, that misses the corresponding node.");
+
+ String[] accessible = testRootNode.getSession().getWorkspace().getAccessibleWorkspaceNames();
+ for (int i = 0; i < accessible.length; i++) {
+ if (accessible[i].equals(srcWorkspace)) {
+ return srcWorkspace;
+ }
}
- return srcWorkspace;
+ throw new NotExecutableException("configured workspace does not exist.");
}
}
Modified: jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/QueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/QueryTest.java?rev=654829&r1=654828&r2=654829&view=diff
==============================================================================
--- jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/QueryTest.java (original)
+++ jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/QueryTest.java Fri May 9 07:45:35 2008
@@ -55,14 +55,10 @@
Node n = testRootNode.addNode("spiTest:node");
testRootNode.save();
- long time = System.currentTimeMillis();
for (int i = 0; i < 10; i++) {
String prefix = defaultPrefix + i;
superuser.setNamespacePrefix(prefix, namespaceURI);
executeXPathQuery(superuser, testPath + "/" + prefix + ":node", new Node[]{n});
}
- time = System.currentTimeMillis() - time;
- System.out.println("Executed 10 queries in " + time + " ms");
- System.out.println("Time per query: " + (time / 10) + " ms");
}
}
Modified: jackrabbit/sandbox/spi/client/src/test/resources/repositoryStubImpl.properties
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/test/resources/repositoryStubImpl.properties?rev=654829&r1=654828&r2=654829&view=diff
==============================================================================
--- jackrabbit/sandbox/spi/client/src/test/resources/repositoryStubImpl.properties (original)
+++ jackrabbit/sandbox/spi/client/src/test/resources/repositoryStubImpl.properties Fri May 9 07:45:35 2008
@@ -37,7 +37,11 @@
# config for JCR2SPIRepositoryStub (SPI2DAV)
org.apache.jackrabbit.jcr2spi.repository.url=http://localhost:4302/jackrabbit/server/
+
+# name of the default workspace
org.apache.jackrabbit.jcr2spi.workspace.name=default
+# alternative workspace used for update tests etc.
+org.apache.jackrabbit.jcr2spi.workspace2.name=test
# config for jackrabbit repository implementation when testing SPI2JCR
org.apache.jackrabbit.repository.config=src/test/resources/repository.xml
Modified: jackrabbit/sandbox/spi/spi-logger/src/main/java/org/apache/jackrabbit/spi/logger/RepositoryServiceLogger.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi-logger/src/main/java/org/apache/jackrabbit/spi/logger/RepositoryServiceLogger.java?rev=654829&r1=654828&r2=654829&view=diff
==============================================================================
--- jackrabbit/sandbox/spi/spi-logger/src/main/java/org/apache/jackrabbit/spi/logger/RepositoryServiceLogger.java (original)
+++ jackrabbit/sandbox/spi/spi-logger/src/main/java/org/apache/jackrabbit/spi/logger/RepositoryServiceLogger.java Fri May 9 07:45:35 2008
@@ -174,15 +174,6 @@
}, "isGranted(SessionInfo,ItemId,String[])", new Object[]{itemId})).booleanValue();
}
- public NodeId getRootId(final SessionInfo sessionInfo)
- throws RepositoryException {
- return (NodeId) execute(new Callable() {
- public Object call() throws RepositoryException {
- return service.getRootId(sessionInfo);
- }
- }, "getRootId(SessionInfo)", new Object[]{});
- }
-
public QNodeDefinition getNodeDefinition(final SessionInfo sessionInfo,
final NodeId nodeId)
throws RepositoryException {
@@ -203,15 +194,6 @@
}, "getPropertyDefinition(SessionInfo,PropertyId)", new Object[]{propertyId});
}
- public boolean exists(final SessionInfo sessionInfo, final ItemId itemId)
- throws RepositoryException {
- return ((Boolean) execute(new Callable() {
- public Object call() throws RepositoryException {
- return new Boolean(service.exists(sessionInfo, itemId));
- }
- }, "exists(SessionInfo,ItemId)", new Object[]{itemId})).booleanValue();
- }
-
public NodeInfo getNodeInfo(final SessionInfo sessionInfo,
final NodeId nodeId)
throws ItemNotFoundException, RepositoryException {
Modified: jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/client/ClientRepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/client/ClientRepositoryService.java?rev=654829&r1=654828&r2=654829&view=diff
==============================================================================
--- jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/client/ClientRepositoryService.java (original)
+++ jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/client/ClientRepositoryService.java Fri May 9 07:45:35 2008
@@ -213,18 +213,6 @@
/**
* {@inheritDoc}
*/
- public NodeId getRootId(SessionInfo sessionInfo)
- throws RepositoryException {
- try {
- return remoteService.getRootId(getRemoteSessionInfo(sessionInfo));
- } catch (RemoteException e) {
- throw new RemoteRepositoryException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
public QNodeDefinition getNodeDefinition(SessionInfo sessionInfo,
NodeId nodeId)
throws RepositoryException {
@@ -252,19 +240,6 @@
/**
* {@inheritDoc}
*/
- public boolean exists(SessionInfo sessionInfo, ItemId itemId)
- throws RepositoryException {
- try {
- return remoteService.exists(
- getRemoteSessionInfo(sessionInfo), itemId);
- } catch (RemoteException e) {
- throw new RemoteRepositoryException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
public NodeInfo getNodeInfo(SessionInfo sessionInfo, NodeId nodeId)
throws ItemNotFoundException, RepositoryException {
try {
Modified: jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/remote/RemoteRepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/remote/RemoteRepositoryService.java?rev=654829&r1=654828&r2=654829&view=diff
==============================================================================
--- jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/remote/RemoteRepositoryService.java (original)
+++ jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/remote/RemoteRepositoryService.java Fri May 9 07:45:35 2008
@@ -130,23 +130,6 @@
throws RepositoryException, RemoteException;
/**
- * The <code>NodeId</code> of the root node may basically have two
- * characteristics. If the root node can be identified with a unique ID the
- * returned <code>NodeId</code> simply has a uniqueID part and the path
- * part is <code>null</code>. If the root node cannot be identified with a
- * unique ID the uniqueID part is <code>null</code> and the path part will be set
- * to "/".
- *
- * @param sessionInfo
- * @return
- * @throws RepositoryException
- * @throws RemoteException if an error occurs.
- * @see org.apache.jackrabbit.spi.RepositoryService#getRootId(org.apache.jackrabbit.spi.SessionInfo)
- */
- public NodeId getRootId(RemoteSessionInfo sessionInfo)
- throws RepositoryException, RemoteException;
-
- /**
*
* @param sessionInfo
* @param nodeId
@@ -171,18 +154,7 @@
public QPropertyDefinition getPropertyDefinition(RemoteSessionInfo sessionInfo,
PropertyId propertyId)
throws RepositoryException, RemoteException;
-
- /**
- * @param sessionInfo
- * @param itemId
- * @return true if the item with the given id exists
- * @throws javax.jcr.RepositoryException
- * @throws RemoteException if an error occurs.
- * @see org.apache.jackrabbit.spi.RepositoryService#exists(org.apache.jackrabbit.spi.SessionInfo, org.apache.jackrabbit.spi.ItemId)
- */
- public boolean exists(RemoteSessionInfo sessionInfo, ItemId itemId)
- throws RepositoryException, RemoteException;
-
+
/**
* @param sessionInfo
* @param nodeId
Modified: jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/server/ServerRepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/server/ServerRepositoryService.java?rev=654829&r1=654828&r2=654829&view=diff
==============================================================================
--- jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/server/ServerRepositoryService.java (original)
+++ jackrabbit/sandbox/spi/spi-rmi/src/main/java/org/apache/jackrabbit/spi/rmi/server/ServerRepositoryService.java Fri May 9 07:45:35 2008
@@ -204,19 +204,6 @@
/**
* {@inheritDoc}
*/
- public NodeId getRootId(RemoteSessionInfo sessionInfo)
- throws RepositoryException, RemoteException {
- try {
- NodeId id = service.getRootId(getSessionInfo(sessionInfo));
- return idFactory.createNodeId(id.getUniqueID(), id.getPath());
- } catch (RepositoryException e) {
- throw getRepositoryException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
public QNodeDefinition getNodeDefinition(RemoteSessionInfo sessionInfo,
NodeId nodeId)
throws RepositoryException, RemoteException {
@@ -255,18 +242,6 @@
/**
* {@inheritDoc}
*/
- public boolean exists(RemoteSessionInfo sessionInfo, ItemId itemId)
- throws RepositoryException, RemoteException {
- try {
- return service.exists(getSessionInfo(sessionInfo), itemId);
- } catch (RepositoryException e) {
- throw getRepositoryException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
public NodeInfo getNodeInfo(RemoteSessionInfo sessionInfo, NodeId nodeId)
throws RepositoryException, RemoteException {
try {
Modified: jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java?rev=654829&r1=654828&r2=654829&view=diff
==============================================================================
--- jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java (original)
+++ jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java Fri May 9 07:45:35 2008
@@ -27,6 +27,7 @@
import org.apache.jackrabbit.spi.PropertyId;
import org.apache.jackrabbit.spi.Name;
import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.ChildInfo;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
@@ -51,6 +52,7 @@
private final List references = new ArrayList();
private final List propertyIds = new ArrayList();
+ private List childInfos = null;
public NodeInfoImpl(NodeId id, DavPropertySet propSet,
NamePathResolver resolver) throws RepositoryException, NameException {
@@ -127,6 +129,10 @@
return propertyIds.iterator();
}
+ public Iterator getChildInfos() {
+ return (childInfos == null) ? null : childInfos.iterator();
+ }
+
//--------------------------------------------------------------------------
void addReference(PropertyId referenceId) {
references.add(referenceId);
@@ -135,4 +141,11 @@
void addPropertyId(PropertyId childId) {
propertyIds.add(childId);
}
+
+ void addChildInfo(ChildInfo childInfo) {
+ if (childInfos == null) {
+ childInfos = new ArrayList();
+ }
+ childInfos.add(childInfo);
+ }
}
\ No newline at end of file
Modified: jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java?rev=654829&r1=654828&r2=654829&view=diff
==============================================================================
--- jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java (original)
+++ jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java Fri May 9 07:45:35 2008
@@ -91,6 +91,9 @@
ElementIterator it = DomUtil.getChildren(child, DEFAULTVALUE_ELEMENT, null);
while (it.hasNext()) {
String jcrVal = DomUtil.getText(it.nextElement());
+ if (jcrVal == null) {
+ jcrVal = "";
+ }
QValue qValue;
if (requiredType == PropertyType.BINARY) {
// TODO: improve
Modified: jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?rev=654829&r1=654828&r2=654829&view=diff
==============================================================================
--- jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java (original)
+++ jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java Fri May 9 07:45:35 2008
@@ -24,7 +24,6 @@
import org.apache.commons.httpclient.URI;
import org.apache.commons.httpclient.URIException;
import org.apache.commons.httpclient.auth.AuthScope;
-import org.apache.commons.httpclient.methods.HeadMethod;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
import org.apache.jackrabbit.spi.commons.conversion.IllegalNameException;
@@ -634,14 +633,6 @@
}
/**
- * @see RepositoryService#getRootId(SessionInfo)
- */
- public NodeId getRootId(SessionInfo sessionInfo) throws RepositoryException {
- String rootUri = uriResolver.getRootItemUri(sessionInfo.getWorkspaceName());
- return uriResolver.getNodeId(rootUri, sessionInfo);
- }
-
- /**
* @see RepositoryService#getNodeDefinition(SessionInfo, NodeId)
*/
public QNodeDefinition getNodeDefinition(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException {
@@ -721,30 +712,6 @@
}
/**
- * @see RepositoryService#exists(SessionInfo, ItemId)
- */
- public boolean exists(SessionInfo sessionInfo, ItemId itemId) throws RepositoryException {
- HeadMethod method = new HeadMethod(getItemUri(itemId, sessionInfo));
- try {
- int statusCode = getClient(sessionInfo).executeMethod(method);
- if (statusCode == DavServletResponse.SC_OK) {
- return true;
- } else if (statusCode == DavServletResponse.SC_NOT_FOUND) {
- return false;
- } else {
- String msg = "Unexpected status code ("+ statusCode +") while testing existence of item with id " + itemId;
- log.error(msg);
- throw new RepositoryException(msg);
- }
- } catch (IOException e) {
- log.error("Unexpected error while testing existence of item.",e);
- throw new RepositoryException(e);
- } finally {
- method.releaseConnection();
- }
- }
-
- /**
* @see RepositoryService#getNodeInfo(SessionInfo, NodeId)
*/
public NodeInfo getNodeInfo(SessionInfo sessionInfo, NodeId nodeId) throws ItemNotFoundException, RepositoryException {
@@ -804,7 +771,8 @@
if (childProps.contains(DavPropertyName.RESOURCETYPE) &&
childProps.get(DavPropertyName.RESOURCETYPE).getValue() != null) {
// any other resource type than default (empty) is represented by a node item
- // --> ignore
+ // --> build child info object
+ nInfo.addChildInfo(buildChildInfo(childProps, sessionInfo));
} else {
PropertyId childId = uriResolver.buildPropertyId(nInfo.getId(), resp, sessionInfo.getWorkspaceName(), getNamePathResolver(sessionInfo));
nInfo.addPropertyId(childId);
@@ -863,11 +831,7 @@
nameSet.add(ItemResourceConstants.JCR_NAME);
nameSet.add(ItemResourceConstants.JCR_INDEX);
nameSet.add(ItemResourceConstants.JCR_PARENT);
- nameSet.add(ItemResourceConstants.JCR_PRIMARYNODETYPE);
- nameSet.add(ItemResourceConstants.JCR_MIXINNODETYPES);
- nameSet.add(ItemResourceConstants.JCR_REFERENCES);
nameSet.add(ItemResourceConstants.JCR_UUID);
- nameSet.add(ItemResourceConstants.JCR_PATH);
nameSet.add(DavPropertyName.RESOURCETYPE);
DavMethodBase method = null;
@@ -892,13 +856,7 @@
DavPropertySet childProps = resp.getProperties(DavServletResponse.SC_OK);
if (childProps.contains(DavPropertyName.RESOURCETYPE) &&
childProps.get(DavPropertyName.RESOURCETYPE).getValue() != null) {
-
- Name qName = getQName(childProps, getNamePathResolver(sessionInfo));
- int index = getIndex(childProps);
- String uuid = getUniqueID(childProps);
-
- ChildInfo childInfo = new ChildInfoImpl(qName, uuid, index);
- childEntries.add(childInfo);
+ childEntries.add(buildChildInfo(childProps, sessionInfo));
} // else: property -> ignore
} // else: ignore the response related to the parent
}
@@ -914,6 +872,14 @@
}
}
+ private ChildInfo buildChildInfo(DavPropertySet properties, SessionInfo sessionInfo) throws RepositoryException {
+ Name qName = getQName(properties, getNamePathResolver(sessionInfo));
+ int index = getIndex(properties);
+ String uuid = getUniqueID(properties);
+
+ return new ChildInfoImpl(qName, uuid, index);
+ }
+
/**
* @see RepositoryService#getPropertyInfo(SessionInfo, PropertyId)
*/
@@ -1190,11 +1156,9 @@
}
if (activeLock.isDeep() && parentId != null) {
// try if lock is inherited
- try {
- return getLockInfo(sessionInfo, parentId);
- } catch (LockException e) {
- // no lock on parent
- return new LockInfoImpl(activeLock, nodeId);
+ LockInfo pLockInfo = getLockInfo(sessionInfo, parentId);
+ if (pLockInfo != null) {
+ return pLockInfo;
}
}
// no deep lock or parentID == null or lock is not present on parent