Examples of DAVElement


Examples of org.tmatesoft.svn.core.internal.io.dav.DAVElement

    protected void init() throws SVNException {
        getRootElement().setElementName(GET_LOCATIONS_REPORT);
        List children = getRootElement().getChildren();
        for (Iterator iterator = children.iterator(); iterator.hasNext();) {
            DAVElementProperty property = (DAVElementProperty) iterator.next();
            DAVElement element = property.getName();
            if (element == ScmDAVElement.PATH) {
                String path = property.getFirstValue(false);
                DAVPathUtil.testCanonical(path);
                setPath(path);
            } else if (element == PEG_REVISION) {
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.io.dav.DAVElement

        DAVElementProperty rootElement = getRootElement();
        rootElement.setElementName(EDITOR_REPORT);
        List children = rootElement.getChildren();
        for (Iterator iterator = children.iterator(); iterator.hasNext();) {
            DAVElementProperty property = (DAVElementProperty) iterator.next();
            DAVElement element = property.getName();
            if (element == ScmDAVElement.REVISION) {
                assertNullCData(element, property);
                try {
                    setRevision(Long.parseLong(property.getFirstValue(true)));
                } catch (NumberFormatException nfe) {
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.io.dav.DAVElement

        DAVPropPatchRequest requestXMLObject = getPropPatchRequest()
        DAVElementProperty rootElement = requestXMLObject.getRoot();
        List childrenElements = rootElement.getChildren();
        for (Iterator childrenIter = childrenElements.iterator(); childrenIter.hasNext();) {
            DAVElementProperty childElement = (DAVElementProperty) childrenIter.next();
            DAVElement childElementName = childElement.getName();
            if (!DAVElement.DAV_NAMESPACE.equals(childElementName.getNamespace()) || (childElementName != DAVPropPatchRequest.REMOVE &&
                    childElementName != DAVPropPatchRequest.SET)) {
                continue;
            }

            DAVElementProperty propChildrenElement = childElement.getChild(DAVElement.PROP);
            if (propChildrenElement == null) {
                autoCheckIn(resource, true, false, avInfo);
                SVNDebugLog.getDefaultLog().logError(SVNLogType.NETWORK, "A \"prop\" element is missing inside the propertyupdate command.");
                setResponseStatus(HttpServletResponse.SC_BAD_REQUEST);
                return;
            }
           
            boolean isRemove = childElementName == DAVPropPatchRequest.REMOVE;
            List propChildren = propChildrenElement.getChildren();
            for (Iterator propsIter = propChildren.iterator(); propsIter.hasNext();) {
                DAVElementProperty property = (DAVElementProperty) propsIter.next();
                DAVElement propertyName = property.getName();
                PropertyChangeContext propContext = new PropertyChangeContext();
                propContext.myIsSet = !isRemove;
                propContext.myProperty = property;
                properties.add(propContext);
                validateProp(propertyName, propsProvider, propContext);
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.io.dav.DAVElement

    protected void init() throws SVNException {
        boolean revisionPropertyRequested = false;
        List children = getRootElement().getChildren();
        for (Iterator iterator = children.iterator(); iterator.hasNext();) {
            DAVElementProperty property = (DAVElementProperty) iterator.next();
            DAVElement element = property.getName();
            if (element == DISCOVER_CHANGED_PATHS) {
                setDiscoverChangedPaths(true);
            } else if (element == STRICT_NODE_HISTORY) {
                setStrictNodeHistory(true);
            } else if (element == INCLUDE_MERGED_REVISIONS) {
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.io.dav.DAVElement

            int i = 0;
            for (Iterator iterator = namespaces.iterator(); iterator.hasNext();) {
                Object item = iterator.next();
                String currentNamespace = null;
                if (item instanceof DAVElement) {
                    DAVElement currentElement = (DAVElement) item;
                    currentNamespace = currentElement.getNamespace();
                } else if (item instanceof String) {
                    currentNamespace = (String) item;
                }
                if (currentNamespace != null && currentNamespace.length() > 0 && (useIndexedPrefixes ||
                        !usedNamespaces.contains(currentNamespace))) {
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.io.dav.DAVElement

        for (Iterator iterator = supportedElements.iterator(); iterator.hasNext();) {
            Object item = iterator.next();
            if (requestedElements.isEmpty() || requestedElements.contains(item)) {
                Map attrs = new SVNHashMap();
                if (item instanceof DAVElement) {
                    DAVElement currentElement = (DAVElement) item;
                    attrs.put(NAME_ATTR, currentElement.getNamespace());
                    attrs.put(NAMESPACE_ATTR, currentElement.getName());
                } else if (item instanceof String) {
                    String currentName = (String) item;
                    attrs.put(NAME_ATTR, currentName);
                }
                SVNXMLUtil.openXMLTag(prefix, tagName, SVNXMLUtil.XML_STYLE_SELF_CLOSING, attrs, xmlBuffer);
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.io.dav.DAVElement

        String owner = null;
        DAVLockScope lockScope = DAVLockScope.UNKNOWN;
        DAVLockType lockType = DAVLockType.UNKNOWN;
        for (Iterator childrenIter = rootElement.getChildren().iterator(); childrenIter.hasNext();) {
            DAVElementProperty childElement = (DAVElementProperty) childrenIter.next();
            DAVElement childElementName = childElement.getName();
            if (childElementName == DAVElement.LOCK_TYPE && childElement.getChildren() != null && lockType == DAVLockType.UNKNOWN) {
                DAVElementProperty writeChild = childElement.getChild(DAVElement.WRITE);
                if (writeChild != null) {
                    lockType = DAVLockType.WRITE;
                    continue;
                }
            }
            if (childElementName == DAVElement.LOCK_SCOPE && childElement.getChildren() != null && lockScope == DAVLockScope.UNKNOWN) {
                if (childElement.getChild(DAVElement.EXCLUSIVE) != null) {
                    lockScope = DAVLockScope.EXCLUSIVE;
                } else if (childElement.getChild(DAVElement.SHARED) != null) {
                    lockScope = DAVLockScope.SHARED;
                }
                if (lockScope != DAVLockScope.UNKNOWN) {
                    continue;
                }
            }
           
            if (childElementName == DAVElement.LOCK_OWNER) {
                //TODO: maybe make this recursive for all possible subelements  
                StringBuffer buffer = new StringBuffer();
                String namespace = childElementName.getNamespace();
                buffer.append("<");
                if (namespace == null || "".equals(namespace)) {
                    buffer.append(childElementName.getName());
                } else {
                    buffer.append(SVNXMLUtil.PREFIX_MAP.get(namespace));
                    buffer.append(":");
                    buffer.append(childElementName.getName());
                }
               
                Map attributes = childElement.getAttributes();
                if (attributes != null) {
                    for (Iterator attrsIter = attributes.keySet().iterator(); attrsIter.hasNext();) {
                        String attrName = (String) attrsIter.next();
                        String attrValue = (String) attributes.get(attrName);
                        buffer.append(" ");
                        buffer.append(attrName);
                        buffer.append("=\"");
                        buffer.append(attrValue);
                        buffer.append("\"");
                    }
                }
               
                for (Iterator namespacesIter = namespaces.iterator(); namespacesIter.hasNext();) {
                    String nextNamespace = (String) namespacesIter.next();
                    buffer.append(" xmlns:");
                    buffer.append(SVNXMLUtil.PREFIX_MAP.get(nextNamespace));
                    buffer.append("=\"");
                    buffer.append(nextNamespace);
                    buffer.append("\"");
                }
               
                if (childElement.isEmpty()) {
                    buffer.append(" />");
                } else {
                    buffer.append(">");
                    buffer.append(SVNEncodingUtil.xmlEncodeCDATA(childElement.getFirstValue(false), false));
                    buffer.append("</");
                    if (namespace == null || "".equals(namespace)) {
                        buffer.append(childElementName.getName());
                    } else {
                        buffer.append(SVNXMLUtil.PREFIX_MAP.get(namespace));
                        buffer.append(":");
                        buffer.append(childElementName.getName());
                    }
                    buffer.append(">");
                }
               
                owner = buffer.toString();
                continue;
            }
           
            throw new DAVException("The server cannot satisfy the LOCK request due to an unknown XML element (\"{0}\") within the DAV:lockinfo element.",
                    new Object[] { childElementName.getName() }, HttpServletResponse.SC_PRECONDITION_FAILED, 0);
        }
       
        return new DAVLock(resource.getUserName(), depth, resource.exists(), lockToken, owner, DAVLockRecType.DIRECT, lockScope, lockType, timeout);

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.