Ejemplo n.º 1
0
  public void addLock(DAVLock lock, DAVResource resource) throws DAVException {
    DAVDepth depth = lock.getDepth();
    if (!resource.isCollection()) {
      depth = DAVDepth.DEPTH_ZERO;
    }

    appendLock(resource, lock);

    if (depth != DAVDepth.DEPTH_ZERO) {
      DAVResourceWalker walker = new DAVResourceWalker();
      DAVLockWalker lockHandler = new DAVLockWalker(resource, lock);
      DAVResponse response =
          walker.walk(
              this,
              resource,
              null,
              0,
              null,
              DAVResourceWalker.DAV_WALKTYPE_NORMAL | DAVResourceWalker.DAV_WALKTYPE_AUTH,
              lockHandler,
              DAVDepth.DEPTH_INFINITY);

      if (response != null) {
        throw new DAVException(
            "Error(s) occurred on resources during the addition of a depth lock.",
            ServletDAVHandler.SC_MULTISTATUS,
            0,
            response);
      }
    }
  }
Ejemplo n.º 2
0
  public String getSupportedLock(DAVResource resource) {
    if (resource.isCollection()) {
      return null;
    }

    StringBuffer buffer = new StringBuffer();
    buffer.append('\n');
    SVNXMLUtil.openXMLTag(
        SVNXMLUtil.DAV_NAMESPACE_PREFIX,
        DAVElement.LOCK_ENTRY.getName(),
        SVNXMLUtil.XML_STYLE_NORMAL,
        null,
        buffer);
    SVNXMLUtil.openXMLTag(
        SVNXMLUtil.DAV_NAMESPACE_PREFIX,
        DAVElement.LOCK_SCOPE.getName(),
        SVNXMLUtil.XML_STYLE_PROTECT_CDATA,
        null,
        buffer);
    SVNXMLUtil.openXMLTag(
        SVNXMLUtil.DAV_NAMESPACE_PREFIX,
        DAVElement.EXCLUSIVE.getName(),
        SVNXMLUtil.XML_STYLE_SELF_CLOSING | SVNXMLUtil.XML_STYLE_PROTECT_CDATA,
        null,
        buffer);

    SVNXMLUtil.closeXMLTag(
        SVNXMLUtil.DAV_NAMESPACE_PREFIX, DAVElement.LOCK_SCOPE.getName(), buffer);
    SVNXMLUtil.openXMLTag(
        SVNXMLUtil.DAV_NAMESPACE_PREFIX,
        DAVElement.LOCK_TYPE.getName(),
        SVNXMLUtil.XML_STYLE_PROTECT_CDATA,
        null,
        buffer);
    SVNXMLUtil.openXMLTag(
        SVNXMLUtil.DAV_NAMESPACE_PREFIX,
        DAVElement.WRITE.getName(),
        SVNXMLUtil.XML_STYLE_SELF_CLOSING | SVNXMLUtil.XML_STYLE_PROTECT_CDATA,
        null,
        buffer);
    SVNXMLUtil.closeXMLTag(SVNXMLUtil.DAV_NAMESPACE_PREFIX, DAVElement.LOCK_TYPE.getName(), buffer);
    SVNXMLUtil.closeXMLTag(
        SVNXMLUtil.DAV_NAMESPACE_PREFIX, DAVElement.LOCK_ENTRY.getName(), buffer);
    return buffer.toString();
  }