jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r718979 - /jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
Date Wed, 19 Nov 2008 15:01:55 GMT
Author: angela
Date: Wed Nov 19 07:01:55 2008
New Revision: 718979

URL: http://svn.apache.org/viewvc?rev=718979&view=rev
Log:
minor improvements including
- improved exception message converting Path-part of ItemIds to jcr-path
- getValues: avoid replacing ItemNotFoundException by RepositoryException

Modified:
    jackrabbit/sandbox/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java

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=718979&r1=718978&r2=718979&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
Wed Nov 19 07:01:55 2008
@@ -151,19 +151,17 @@
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
 
 import javax.jcr.AccessDeniedException;
 import javax.jcr.Credentials;
 import javax.jcr.InvalidItemStateException;
-import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.LoginException;
 import javax.jcr.MergeException;
 import javax.jcr.NamespaceException;
 import javax.jcr.NoSuchWorkspaceException;
-import javax.jcr.PathNotFoundException;
 import javax.jcr.PropertyType;
-import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.Value;
@@ -178,9 +176,9 @@
 import javax.xml.parsers.ParserConfigurationException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.io.Reader;
 import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -208,7 +206,7 @@
         ALL_EVENTS[3] = SubscriptionImpl.getEventType(javax.jcr.observation.Event.PROPERTY_CHANGED);
         ALL_EVENTS[4] = SubscriptionImpl.getEventType(javax.jcr.observation.Event.PROPERTY_REMOVED);
     }
-    private static final SubscriptionInfo S_INFO = new SubscriptionInfo(ALL_EVENTS, true,
DavConstants.INFINITE_TIMEOUT);
+    private static final SubscriptionInfo S_INFO = new SubscriptionInfo(ALL_EVENTS, true,
INFINITE_TIMEOUT);
 
     private final IdFactory idFactory;
     private final NameFactory nameFactory;
@@ -310,6 +308,37 @@
         return requestURI.equals(href);
     }
 
+    private String saveGetIdString(ItemId id, SessionInfo sessionInfo) {
+        NamePathResolver resolver = null;
+        try {
+            resolver = getNamePathResolver(sessionInfo);
+        } catch (RepositoryException e) {
+            // ignore.
+        }
+        return saveGetIdString(id, resolver);
+    }
+
+    private String saveGetIdString(ItemId id, NamePathResolver resolver) {
+        StringBuffer bf = new StringBuffer();
+        String uid = id.getUniqueID();
+        if (uid != null) {
+            bf.append(uid);
+        }
+        Path p = id.getPath();
+        if (p != null) {
+            if (resolver == null) {
+                bf.append(p.toString());
+            } else {
+                try {
+                    bf.append(resolver.getJCRPath(p));
+                } catch (NamespaceException e) {
+                    bf.append(p.toString());
+                }
+            }
+        }
+        return bf.toString();
+    }
+
     protected NamePathResolver getNamePathResolver(SessionInfo sessionInfo) throws RepositoryException
{
         checkSessionInfo(sessionInfo);
         NamePathResolver resolver = ((SessionInfoImpl) sessionInfo).getNamePathResolver();
@@ -350,7 +379,8 @@
         return uriResolver.getItemUri(itemId, sessionInfo.getWorkspaceName(), sessionInfo);
     }
 
-    private String getItemUri(NodeId parentId, Name childName, SessionInfo sessionInfo) throws
RepositoryException {
+    private String getItemUri(NodeId parentId, Name childName,
+                              SessionInfo sessionInfo) throws RepositoryException {
         String parentUri = uriResolver.getItemUri(parentId, sessionInfo.getWorkspaceName(),
sessionInfo);
         NamePathResolver resolver = getNamePathResolver(sessionInfo);
         return parentUri + "/" + Text.escape(resolver.getJCRName(childName));
@@ -459,7 +489,7 @@
      */
     public Map getRepositoryDescriptors() throws RepositoryException {
         if (descriptors == null) {
-            ReportInfo info = new ReportInfo(RepositoryDescriptorsReport.REPOSITORY_DESCRIPTORS_REPORT,
DavConstants.DEPTH_0);
+            ReportInfo info = new ReportInfo(RepositoryDescriptorsReport.REPOSITORY_DESCRIPTORS_REPORT,
DEPTH_0);
             ReportMethod method = null;
             try {
                 method = new ReportMethod(uriResolver.getRepositoryUri(), info);
@@ -526,7 +556,7 @@
             nameSet.add(DeltaVConstants.WORKSPACE);
             nameSet.add(ItemResourceConstants.JCR_WORKSPACE_NAME);
 
-            method = new PropFindMethod(uriResolver.getWorkspaceUri(workspaceName), nameSet,
DavConstants.DEPTH_0);
+            method = new PropFindMethod(uriResolver.getWorkspaceUri(workspaceName), nameSet,
DEPTH_0);
             getClient(sessionInfo).executeMethod(method);
 
             MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
@@ -633,7 +663,7 @@
 
             MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
             if (responses.length < 1) {
-                throw new ItemNotFoundException("Unable to retrieve permissions for item
" + itemId);
+                throw new ItemNotFoundException("Unable to retrieve permissions for item
" + saveGetIdString(itemId, sessionInfo));
             }
             DavProperty p = responses[0].getProperties(DavServletResponse.SC_OK).get(SecurityConstants.CURRENT_USER_PRIVILEGE_SET);
             if (p == null) {
@@ -698,10 +728,10 @@
 
             MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
             if (responses.length < 1) {
-                throw new ItemNotFoundException("Unable to retrieve the item definition for
" + itemId);
+                throw new ItemNotFoundException("Unable to retrieve the item definition for
" + saveGetIdString(itemId, sessionInfo));
             }
             if (responses.length > 1) {
-                throw new RepositoryException("Internal error: ambigous item definition found
'" + itemId + "'.");
+                throw new RepositoryException("Internal error: ambigous item definition found
'" + saveGetIdString(itemId, sessionInfo) + "'.");
             }
             DavPropertySet propertySet = responses[0].getProperties(DavServletResponse.SC_OK);
 
@@ -728,7 +758,7 @@
                 }
             }
             if (definition == null) {
-                throw new RepositoryException("Unable to retrieve definition for item with
id '" + itemId + "'.");
+                throw new RepositoryException("Unable to retrieve definition for item with
id '" + saveGetIdString(itemId, resolver) + "'.");
             }
             return definition;
         } catch (IOException e) {
@@ -745,7 +775,7 @@
     /**
      * @see RepositoryService#getNodeInfo(SessionInfo, NodeId)
      */
-    public NodeInfo getNodeInfo(SessionInfo sessionInfo, NodeId nodeId) throws ItemNotFoundException,
RepositoryException {
+    public NodeInfo getNodeInfo(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException
{
         // set of properties to be retrieved
         DavPropertyNameSet nameSet = new DavPropertyNameSet();
         nameSet.add(ItemResourceConstants.JCR_INDEX);
@@ -767,7 +797,7 @@
 
             MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
             if (responses.length < 1) {
-                throw new ItemNotFoundException("Unable to retrieve the node with id " +
nodeId);
+                throw new ItemNotFoundException("Unable to retrieve the node with id " +
saveGetIdString(nodeId, sessionInfo));
             }
 
             MultiStatusResponse nodeResponse = null;
@@ -781,14 +811,14 @@
             }
 
             if (nodeResponse == null) {
-                throw new ItemNotFoundException("Unable to retrieve the node " + nodeId);
+                throw new ItemNotFoundException("Unable to retrieve the node " + saveGetIdString(nodeId,
sessionInfo));
             }
 
             DavPropertySet propSet = nodeResponse.getProperties(DavServletResponse.SC_OK);
             Object type = propSet.get(DavPropertyName.RESOURCETYPE).getValue();
             if (type == null) {
                 // the given id points to a Property instead of a Node
-                throw new ItemNotFoundException("No node for id " + nodeId);
+                throw new ItemNotFoundException("No node for id " + saveGetIdString(nodeId,
sessionInfo));
             }
 
             NamePathResolver resolver = getNamePathResolver(sessionInfo);
@@ -826,7 +856,7 @@
     /**
      * @see RepositoryService#getItemInfos(SessionInfo, NodeId)
      */
-    public Iterator getItemInfos(SessionInfo sessionInfo, NodeId nodeId) throws ItemNotFoundException,
RepositoryException {
+    public Iterator getItemInfos(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException
{
         // TODO: implement batch read properly:
         // currently: missing 'value/values' property PropertyInfo cannot be built
         // currently: missing prop-names with child-NodeInfo
@@ -895,7 +925,7 @@
     /**
      * @see RepositoryService#getChildInfos(SessionInfo, NodeId)
      */
-    public Iterator getChildInfos(SessionInfo sessionInfo, NodeId parentId) throws ItemNotFoundException,
RepositoryException {
+    public Iterator getChildInfos(SessionInfo sessionInfo, NodeId parentId) throws RepositoryException
{
         // set of properties to be retrieved
         DavPropertyNameSet nameSet = new DavPropertyNameSet();
         nameSet.add(ItemResourceConstants.JCR_NAME);
@@ -913,7 +943,7 @@
 
             MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
             if (responses.length < 1) {
-                throw new ItemNotFoundException("Unable to retrieve the node with id " +
parentId);
+                throw new ItemNotFoundException("Unable to retrieve the node with id " +
saveGetIdString(parentId, sessionInfo));
             } else if (responses.length == 1) {
                 // no child nodes nor properties
                 return Collections.EMPTY_LIST.iterator();
@@ -953,7 +983,7 @@
     /**
      * @see RepositoryService#getPropertyInfo(SessionInfo, PropertyId)
      */
-    public PropertyInfo getPropertyInfo(SessionInfo sessionInfo, PropertyId propertyId) throws
ItemNotFoundException, RepositoryException {
+    public PropertyInfo getPropertyInfo(SessionInfo sessionInfo, PropertyId propertyId) throws
RepositoryException {
         GetMethod method = null;
         try {
             String uri = getItemUri(propertyId, sessionInfo);
@@ -969,7 +999,7 @@
             Path path = uriResolver.getQPath(uri, sessionInfo);
 
             String ct = null;
-            Header hd = method.getResponseHeader(DavConstants.HEADER_CONTENT_TYPE);
+            Header hd = method.getResponseHeader(HEADER_CONTENT_TYPE);
             if (hd != null) {
                 ct = hd.getValue();
             }
@@ -1001,11 +1031,11 @@
                 isMultiValued = false;
             } else if (ct.startsWith("text/xml")) {
                 // jcr:values property spooled
-                values = getValues(method.getResponseBodyAsStream(), resolver);
-                type = (values.length > 0) ? values[0].getType() : loadType(uri, client);
+                values = getValues(method.getResponseBodyAsStream(), resolver, propertyId);
+                type = (values.length > 0) ? values[0].getType() : loadType(uri, client,
propertyId, resolver);
                 isMultiValued = true;
             } else {
-                throw new ItemNotFoundException("Unable to retrieve the property with id
" + propertyId);
+                throw new ItemNotFoundException("Unable to retrieve the property with id
" + saveGetIdString(propertyId, resolver));
             }
 
             PropertyInfo pInfo = new PropertyInfoImpl(propertyId, path, type, isMultiValued,
values);
@@ -1023,7 +1053,7 @@
         }
     }
 
-    private QValue[] getValues(InputStream response, NamePathResolver resolver) throws RepositoryException
{
+    private QValue[] getValues(InputStream response, NamePathResolver resolver, ItemId id)
throws RepositoryException {
         try {
             DocumentBuilder db = DomUtil.BUILDER_FACTORY.newDocumentBuilder();
             Document doc = db.parse(response);
@@ -1031,7 +1061,7 @@
             if (prop == null) {
                 // no jcr-values present in the response body -> apparently
                 // not representation of a jcr-property
-                throw new ItemNotFoundException();
+                throw new ItemNotFoundException("No property found at " + saveGetIdString(id,
resolver));
             } else {
                 DavProperty p = DefaultDavProperty.createFromXml(prop);
                 ValuesProperty vp = new ValuesProperty(p, PropertyType.STRING, valueFactory);
@@ -1051,19 +1081,27 @@
                 }
                 return qvs;
             }
-        } catch (Exception e) {
-            log.error("Internal Error: ", e);
+        } catch (SAXException e) {
+            log.warn("Internal error: ", e.getMessage());
+            throw new RepositoryException(e);
+        } catch (IOException e) {
+            log.warn("Internal error: ", e.getMessage());
             throw new RepositoryException(e);
+        } catch (ParserConfigurationException e) {
+            log.warn("Internal error: ", e.getMessage());
+            throw new RepositoryException(e);
+        } catch (DavException e) {
+            throw ExceptionConverter.generate(e);
         }
     }
 
-    private int loadType(String propertyURI, HttpClient client) throws IOException, DavException,
RepositoryException {
+    private int loadType(String propertyURI, HttpClient client, PropertyId propertyId, NamePathResolver
resolver) throws IOException, DavException, RepositoryException {
         DavPropertyNameSet nameSet = new DavPropertyNameSet();
         nameSet.add(ItemResourceConstants.JCR_TYPE);
 
         DavMethodBase method = null;
         try {
-            method = new PropFindMethod(propertyURI, nameSet, DavConstants.DEPTH_0);
+            method = new PropFindMethod(propertyURI, nameSet, DEPTH_0);
             client.executeMethod(method);
             method.checkSuccess();
 
@@ -1074,10 +1112,10 @@
                 if (type != null) {
                     return PropertyType.valueFromName(type.getValue().toString());
                 } else {
-                    throw new RepositoryException("Internal error. Cannot retrieve property
type at " + propertyURI);
+                    throw new RepositoryException("Internal error. Cannot retrieve property
type at " + saveGetIdString(propertyId, resolver));
                 }
             } else {
-                throw new ItemNotFoundException("Internal error. Cannot retrieve property
type at " + propertyURI);
+                throw new ItemNotFoundException("Internal error. Cannot retrieve property
type at " + saveGetIdString(propertyId, resolver));
             }
         } finally {
             method.releaseConnection();
@@ -1139,7 +1177,7 @@
     /**
      * @see RepositoryService#importXml(SessionInfo, NodeId, InputStream, int)
      */
-    public void importXml(SessionInfo sessionInfo, NodeId parentId, InputStream xmlStream,
int uuidBehaviour) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException,
LockException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException
{
+    public void importXml(SessionInfo sessionInfo, NodeId parentId, InputStream xmlStream,
int uuidBehaviour) throws RepositoryException {
         // TODO: improve. currently random name is built instead of retrieving name of new
resource from top-level xml element within stream
         Name nodeName = getNameFactory().create(Name.NS_DEFAULT_URI, UUID.randomUUID().toString());
         String uri = getItemUri(parentId, nodeName, sessionInfo);
@@ -1152,7 +1190,7 @@
     /**
      * @see RepositoryService#move(SessionInfo, NodeId, NodeId, Name)
      */
-    public void move(SessionInfo sessionInfo, NodeId srcNodeId, NodeId destParentNodeId,
Name destName) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException,
LockException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException
{
+    public void move(SessionInfo sessionInfo, NodeId srcNodeId, NodeId destParentNodeId,
Name destName) throws RepositoryException {
         String uri = getItemUri(srcNodeId, sessionInfo);
         String destUri = getItemUri(destParentNodeId, destName, sessionInfo);
         MoveMethod method = new MoveMethod(uri, destUri, true);
@@ -1162,7 +1200,7 @@
     /**
      * @see RepositoryService#copy(SessionInfo, String, NodeId, NodeId, Name)
      */
-    public void copy(SessionInfo sessionInfo, String srcWorkspaceName, NodeId srcNodeId,
NodeId destParentNodeId, Name destName) throws NoSuchWorkspaceException, ConstraintViolationException,
VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException,
UnsupportedRepositoryOperationException, RepositoryException {
+    public void copy(SessionInfo sessionInfo, String srcWorkspaceName, NodeId srcNodeId,
NodeId destParentNodeId, Name destName) throws RepositoryException {
         String uri = uriResolver.getItemUri(srcNodeId, srcWorkspaceName, sessionInfo);
         String destUri = getItemUri(destParentNodeId, destName, sessionInfo);
         CopyMethod method = new CopyMethod(uri, destUri, true, false);
@@ -1172,7 +1210,7 @@
     /**
      * @see RepositoryService#update(SessionInfo, NodeId, String)
      */
-    public void update(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceName) throws
NoSuchWorkspaceException, AccessDeniedException, LockException, InvalidItemStateException,
RepositoryException {
+    public void update(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceName) throws
RepositoryException {
         String uri = getItemUri(nodeId, sessionInfo);
         String workspUri = uriResolver.getWorkspaceUri(srcWorkspaceName);
 
@@ -1182,7 +1220,7 @@
     /**
      * @see RepositoryService#clone(SessionInfo, String, NodeId, NodeId, Name, boolean)
      */
-    public void clone(SessionInfo sessionInfo, String srcWorkspaceName, NodeId srcNodeId,
NodeId destParentNodeId, Name destName, boolean removeExisting) throws NoSuchWorkspaceException,
ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException,
ItemExistsException, LockException, UnsupportedRepositoryOperationException, RepositoryException
{
+    public void clone(SessionInfo sessionInfo, String srcWorkspaceName, NodeId srcNodeId,
NodeId destParentNodeId, Name destName, boolean removeExisting) throws RepositoryException
{
         // TODO: missing implementation
         throw new UnsupportedOperationException("Missing implementation");
     }
@@ -1208,7 +1246,7 @@
 
             MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
             if (responses.length != 1) {
-                throw new ItemNotFoundException("Unable to retrieve the property with id
" + nodeId);
+                throw new ItemNotFoundException("Unable to retrieve the LockInfo. No such
node " + saveGetIdString(nodeId, sessionInfo));
             }
 
             DavPropertySet ps = responses[0].getProperties(DavServletResponse.SC_OK);
@@ -1219,7 +1257,7 @@
                 return retrieveLockInfo(ld, sessionInfo, nodeId, parentId);
             }  else {
                 // no lock present
-                log.debug("No Lock present on node with id " + nodeId);
+                log.debug("No Lock present on node with id " + saveGetIdString(nodeId, sessionInfo));
                 return null;
             }
         } catch (IOException e) {
@@ -1236,12 +1274,13 @@
     /**
      * @see RepositoryService#lock(SessionInfo, NodeId, boolean, boolean)
      */
-    public LockInfo lock(SessionInfo sessionInfo, NodeId nodeId, boolean deep, boolean sessionScoped)
throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException,
RepositoryException {
+    public LockInfo lock(SessionInfo sessionInfo, NodeId nodeId, boolean deep,
+                         boolean sessionScoped) throws RepositoryException {
         try {
             String uri = getItemUri(nodeId, sessionInfo);
             Scope scope = (sessionScoped) ? ItemResourceConstants.EXCLUSIVE_SESSION : Scope.EXCLUSIVE;
             LockMethod method = new LockMethod(uri, scope, Type.WRITE,
-                sessionInfo.getUserID(), DavConstants.INFINITE_TIMEOUT, deep);
+                sessionInfo.getUserID(), INFINITE_TIMEOUT, deep);
             execute(method, sessionInfo);
 
             String lockToken = method.getLockToken();
@@ -1259,25 +1298,25 @@
     /**
      * @see RepositoryService#refreshLock(SessionInfo, NodeId)
      */
-    public void refreshLock(SessionInfo sessionInfo, NodeId nodeId) throws LockException,
RepositoryException {
+    public void refreshLock(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException
{
         String uri = getItemUri(nodeId, sessionInfo);
         // since sessionInfo does not allow to retrieve token by NodeId,
         // pass all available lock tokens to the LOCK method (TODO: correct?)
-        LockMethod method = new LockMethod(uri, DavConstants.INFINITE_TIMEOUT, sessionInfo.getLockTokens());
+        LockMethod method = new LockMethod(uri, INFINITE_TIMEOUT, sessionInfo.getLockTokens());
         execute(method, sessionInfo);
     }
 
     /**
      * @see RepositoryService#unlock(SessionInfo, NodeId)
      */
-    public void unlock(SessionInfo sessionInfo, NodeId nodeId) throws UnsupportedRepositoryOperationException,
LockException, AccessDeniedException, InvalidItemStateException, RepositoryException {
+    public void unlock(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException
{
         String uri = getItemUri(nodeId, sessionInfo);
         // Note: since sessionInfo does not allow to identify the id of the
         // lock holding node, we need to access the token via lockInfo
         // TODO: review this.
         LockInfo lInfo = getLockInfo(sessionInfo, nodeId);
         if (lInfo == null) {
-            throw new LockException("No Lock present on Node with id " + nodeId);
+            throw new LockException("No Lock present on Node with id " + saveGetIdString(nodeId,
sessionInfo));
         }
 
         String lockToken = lInfo.getLockToken();
@@ -1291,8 +1330,7 @@
     }
 
     private LockInfo retrieveLockInfo(LockDiscovery lockDiscovery, SessionInfo sessionInfo,
-                                      NodeId nodeId, NodeId parentId)
-        throws LockException, RepositoryException {
+                                      NodeId nodeId, NodeId parentId) throws RepositoryException
{
         List activeLocks = (List) lockDiscovery.getValue();
         Iterator it = activeLocks.iterator();
         ActiveLock activeLock = null;
@@ -1301,14 +1339,14 @@
             Scope sc = l.getScope();
             if (l.getType() == Type.WRITE && (sc == Scope.EXCLUSIVE || sc == ItemResourceConstants.EXCLUSIVE_SESSION))
{
                 if (activeLock != null) {
-                    throw new RepositoryException("Node " + nodeId + " contains multiple
exclusive write locks.");
+                    throw new RepositoryException("Node " + saveGetIdString(nodeId, sessionInfo)
+ " contains multiple exclusive write locks.");
                 } else {
                     activeLock = l;
                 }
             }
         }
         if (activeLock == null) {
-            log.debug("No lock present on node " + nodeId);
+            log.debug("No lock present on node " + saveGetIdString(nodeId, sessionInfo));
             return null;
         }
         if (activeLock.isDeep() && parentId != null) {
@@ -1346,7 +1384,7 @@
     /**
      * @see RepositoryService#removeVersion(SessionInfo, NodeId, NodeId)
      */
-    public void removeVersion(SessionInfo sessionInfo, NodeId versionHistoryId, NodeId versionId)
throws ReferentialIntegrityException, AccessDeniedException, UnsupportedRepositoryOperationException,
VersionException, RepositoryException {
+    public void removeVersion(SessionInfo sessionInfo, NodeId versionHistoryId, NodeId versionId)
throws RepositoryException {
         String uri = getItemUri(versionId, sessionInfo);
         DeleteMethod method = new DeleteMethod(uri);
         execute(method, sessionInfo);
@@ -1355,7 +1393,7 @@
     /**
      * @see RepositoryService#restore(SessionInfo, NodeId, NodeId, boolean)
      */
-    public void restore(SessionInfo sessionInfo, NodeId nodeId, NodeId versionId, boolean
removeExisting) throws VersionException, PathNotFoundException, ItemExistsException, UnsupportedRepositoryOperationException,
LockException, InvalidItemStateException, RepositoryException {
+    public void restore(SessionInfo sessionInfo, NodeId nodeId, NodeId versionId, boolean
removeExisting) throws RepositoryException {
         String uri = getItemUri(nodeId, sessionInfo);
         String vUri = getItemUri(versionId, sessionInfo);
 
@@ -1365,7 +1403,7 @@
     /**
      * @see RepositoryService#restore(SessionInfo, NodeId[], boolean)
      */
-    public void restore(SessionInfo sessionInfo, NodeId[] versionIds, boolean removeExisting)
throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException,
InvalidItemStateException, RepositoryException {
+    public void restore(SessionInfo sessionInfo, NodeId[] versionIds, boolean removeExisting)
throws RepositoryException {
         String uri = uriResolver.getWorkspaceUri(sessionInfo.getWorkspaceName());
         String[] vUris = new String[versionIds.length];
         for (int i = 0; i < versionIds.length; i++) {
@@ -1726,7 +1764,7 @@
                 continue;
             }
 
-            String href = DomUtil.getChildTextTrim(evElem, DavConstants.XML_HREF, DavConstants.NAMESPACE);
+            String href = DomUtil.getChildTextTrim(evElem, XML_HREF, NAMESPACE);
 
             int type;
             Path eventPath;
@@ -1735,11 +1773,11 @@
                 eventPath = uriResolver.getQPath(href, sessionInfo);
             } catch (DavException e) {
                 // should not occur
-                log.error("Internal error while building Event", e);
+                log.error("Internal error while building Event", e.getMessage());
                 continue;
             } catch (RepositoryException e) {
                 // should not occur
-                log.error("Internal error while building Event", e);
+                log.error("Internal error while building Event", e.getMessage());
                 continue;
             }
 
@@ -1751,14 +1789,14 @@
                     eventId = uriResolver.getPropertyId(href, sessionInfo);
                 }
             } catch (RepositoryException e) {
-                log.warn("Unable to build event itemId: ", e);
+                log.warn("Unable to build event itemId: ", e.getMessage());
             }
             String parentHref = Text.getRelativeParent(href, 1, true);
             NodeId parentId = null;
             try {
                 parentId = uriResolver.getNodeId(parentHref, sessionInfo);
             } catch (RepositoryException e) {
-                log.warn("Unable to build event parentId: ", e);
+                log.warn("Unable to build event parentId: ", e.getMessage());
             }
 
             events.add(new EventImpl(eventId, eventPath, parentId, type, evElem));
@@ -2002,7 +2040,7 @@
             String uri = getItemUri(targetId, sessionInfo);
             try {
                 // start special 'lock'
-                LockMethod method = new LockMethod(uri, TransactionConstants.LOCAL, TransactionConstants.TRANSACTION,
null, DavConstants.INFINITE_TIMEOUT, true);
+                LockMethod method = new LockMethod(uri, TransactionConstants.LOCAL, TransactionConstants.TRANSACTION,
null, INFINITE_TIMEOUT, true);
                 initMethod(method, sessionInfo, true);
 
                 HttpClient client = getClient(sessionInfo);
@@ -2076,7 +2114,7 @@
         /**
          * @see Batch#addNode(NodeId, Name, Name, String)
          */
-        public void addNode(NodeId parentId, Name nodeName, Name nodetypeName, String uuid)
throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException,
NoSuchNodeTypeException, LockException, AccessDeniedException, UnsupportedRepositoryOperationException,
RepositoryException {
+        public void addNode(NodeId parentId, Name nodeName, Name nodetypeName, String uuid)
throws RepositoryException {
             checkConsumed();
             try {
                 // TODO: TOBEFIXED. WebDAV does not allow MKCOL for existing resource ->
problem with SNS
@@ -2119,12 +2157,12 @@
         /**
          * @see Batch#addProperty(NodeId, Name, QValue)
          */
-        public void addProperty(NodeId parentId, Name propertyName, QValue value) throws
ValueFormatException, VersionException, LockException, ConstraintViolationException, PathNotFoundException,
ItemExistsException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException
{
+        public void addProperty(NodeId parentId, Name propertyName, QValue value) throws
RepositoryException {
             checkConsumed();
             String uri = getItemUri(parentId, propertyName, sessionInfo);
 
             PutMethod method = new PutMethod(uri);
-            method.setRequestHeader(DavConstants.HEADER_CONTENT_TYPE, JcrValueType.contentTypeFromType(value.getType()));
+            method.setRequestHeader(HEADER_CONTENT_TYPE, JcrValueType.contentTypeFromType(value.getType()));
             method.setRequestEntity(getEntity(value));
             methods.add(method);
         }
@@ -2132,7 +2170,7 @@
         /**
          * @see Batch#addProperty(NodeId, Name, QValue[])
          */
-        public void addProperty(NodeId parentId, Name propertyName, QValue[] values) throws
ValueFormatException, VersionException, LockException, ConstraintViolationException, PathNotFoundException,
ItemExistsException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException
{
+        public void addProperty(NodeId parentId, Name propertyName, QValue[] values) throws
RepositoryException {
             checkConsumed();
             // TODO: avoid usage of the ValuesProperty. specially for binary props.
             // TODO: replace by a multipart-POST
@@ -2166,7 +2204,7 @@
                 // TODO: use PUT in order to avoid the ValuesProperty-PROPPATCH call.
                 // TODO: actually not quite correct for PROPPATCH assert that prop really
exists.
                 PutMethod method = new PutMethod(uri);
-                method.setRequestHeader(DavConstants.HEADER_CONTENT_TYPE, JcrValueType.contentTypeFromType(value.getType()));
+                method.setRequestHeader(HEADER_CONTENT_TYPE, JcrValueType.contentTypeFromType(value.getType()));
                 method.setRequestEntity(ent);
                 methods.add(method);
             }
@@ -2231,7 +2269,7 @@
         /**
          * @see Batch#remove(ItemId)
          */
-        public void remove(ItemId itemId) throws VersionException, LockException, ConstraintViolationException,
AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException {
+        public void remove(ItemId itemId) throws RepositoryException {
             checkConsumed();
             String uri = getItemUri(itemId, sessionInfo);
             DeleteMethod method = new DeleteMethod(uri);
@@ -2242,7 +2280,7 @@
         /**
          * @see Batch#reorderNodes(NodeId, NodeId, NodeId)
          */
-        public void reorderNodes(NodeId parentId, NodeId srcNodeId, NodeId beforeNodeId)
throws UnsupportedRepositoryOperationException, VersionException, ConstraintViolationException,
ItemNotFoundException, LockException, AccessDeniedException, RepositoryException {
+        public void reorderNodes(NodeId parentId, NodeId srcNodeId, NodeId beforeNodeId)
throws RepositoryException {
             checkConsumed();
             try {
                 String uri = getItemUri(parentId, sessionInfo);
@@ -2299,7 +2337,7 @@
         /**
          * @see Batch#move(NodeId, NodeId, Name)
          */
-        public void move(NodeId srcNodeId, NodeId destParentNodeId, Name destName) throws
ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException,
LockException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException
{
+        public void move(NodeId srcNodeId, NodeId destParentNodeId, Name destName) throws
RepositoryException {
             checkConsumed();
             String uri = getItemUri(srcNodeId, sessionInfo);
             String destUri = getItemUri(destParentNodeId, destName, sessionInfo);



Mime
View raw message