drools-eclipse/org.guvnor.eclipse.webdav/src/client/org/eclipse/webdav/client/AbstractResourceHandle.java
public URLTable getVersionTree() throws DAVException {

        // Issue a version tree report against the receiver to retrieve
        // the successor set of all the versions.
        Document document = newDocument();
        Element root = ElementEditor.create(document, "version-tree"); //$NON-NLS-1$
        Element propElement = ElementEditor.appendChild(root, "prop"); //$NON-NLS-1$
        ElementEditor.appendChild(propElement, "predecessor-set"); //$NON-NLS-1$

        IResponse response = null;
        try {
            // Run the REPORT and check for errors.
            response = davClient.report(locator, newContext(), document);
            examineResponse(response);

            if (!response.hasDocumentBody())
                throw new DAVException(Policy.bind("exception.respMustHaveElmtBody")); //$NON-NLS-1$

            // Get the body as a MultiStatus.
            Element documentElement = response.getDocumentBody().getDocumentElement();
            if (documentElement == null)
                throw new DAVException(Policy.bind("exception.bodyMustHaveElmt")); //$NON-NLS-1$
            MultiStatus multistatus = new MultiStatus(documentElement);

            // Construct the predecessor table.
            // This will contain the result.
            URLTable predecessorTable = new URLTable();

            // For each response.
            Enumeration responses = multistatus.getResponses();
            while (responses.hasMoreElements()) {
                ResponseBody responseBody = (ResponseBody) responses.nextElement();

                // Get the absolute URL of the resource.
                String href = responseBody.getHref();
                URL resourceURL = new URL(new URL(locator.getResourceURL()), href);

                // Add an entry to the predecessor table.
                Vector predecessors = new Vector();
                predecessorTable.put(resourceURL, predecessors);

                // For each propstat.
                Enumeration propstats = responseBody.getPropStats();
                while (propstats.hasMoreElements()) {
                    PropStat propstat = (PropStat) propstats.nextElement();

                    // We are going to assume that the status is OK, or error out.
                    if (propstat.getStatusCode() != IResponse.SC_OK)
                        throw new DAVException(Policy.bind("exception.errorRetrievingProp")); //$NON-NLS-1$

                    // For each property in the prop (there should only be one).
                    Prop prop = propstat.getProp();
                    Enumeration elements = prop.getProperties();
                    while (elements.hasMoreElements()) {
                        Element element = (Element) elements.nextElement();

                        //  Look explicitly for the DAV:predecessor-set
                        QualifiedName name = ElementEditor.getQualifiedName(element);
                        if (name.equals(DAV_PREDECESSOR_SET)) {
                            Enumeration e = new HrefSet(element, DAV_PREDECESSOR_SET).getHrefs();
                            while (e .hasMoreElements()) {
                                URL predURL = new URL((String) e.nextElement());
                                predecessors.add(predURL);
                            } // end-while
                        } //end-if
                    } // end-while
                } // end-while
            } //end-while

            // Phew, were done.
            return predecessorTable;

        } catch (IOException e) {
            throw new SystemException(e);
        } catch (MalformedElementException e) {
            throw new SystemException(e);
        } finally {
            closeResponse(response);
        }
    }
public URLTable getVersionTree() throws DAVException {

        // Issue a version tree report against the receiver to retrieve
        // the successor set of all the versions.
        Document document = newDocument();
        Element root = ElementEditor.create(document, "version-tree"); //$NON-NLS-1$
        Element propElement = ElementEditor.appendChild(root, "prop"); //$NON-NLS-1$
        ElementEditor.appendChild(propElement, "predecessor-set"); //$NON-NLS-1$

        IResponse response = null;
        try {
            // Run the REPORT and check for errors.
            response = davClient.report(locator, newContext(), document);
            examineResponse(response);

            if (!response.hasDocumentBody())
                throw new DAVException(Policy.bind("exception.respMustHaveElmtBody")); //$NON-NLS-1$

            // Get the body as a MultiStatus.
            Element documentElement = response.getDocumentBody().getDocumentElement();
            if (documentElement == null)
                throw new DAVException(Policy.bind("exception.bodyMustHaveElmt")); //$NON-NLS-1$
            MultiStatus multistatus = new MultiStatus(documentElement);

            // Construct the predecessor table.
            // This will contain the result.
            URLTable predecessorTable = new URLTable();

            // For each response.
            Enumeration responses = multistatus.getResponses();
            while (responses.hasMoreElements()) {
                ResponseBody responseBody = (ResponseBody) responses.nextElement();

                // Get the absolute URL of the resource.
                String href = responseBody.getHref();
                URL resourceURL = new URL(new URL(locator.getResourceURL()), href);

                // Add an entry to the predecessor table.
                Vector predecessors = new Vector();
                predecessorTable.put(resourceURL, predecessors);

                // For each propstat.
                Enumeration propstats = responseBody.getPropStats();
                while (propstats.hasMoreElements()) {
                    PropStat propstat = (PropStat) propstats.nextElement();

                    // We are going to assume that the status is OK, or error out.
                    if (propstat.getStatusCode() != IResponse.SC_OK)
                        throw new DAVException(Policy.bind("exception.errorRetrievingProp")); //$NON-NLS-1$

                    // For each property in the prop (there should only be one).
                    Prop prop = propstat.getProp();
                    Enumeration elements = prop.getProperties();
                    while (elements.hasMoreElements()) {
                        Element element = (Element) elements.nextElement();

                        //  Look explicitly for the DAV:predecessor-set
                        QualifiedName name = ElementEditor.getQualifiedName(element);
                        if (name.equals(DAV_PREDECESSOR_SET)) {
                            Enumeration e = new HrefSet(element, DAV_PREDECESSOR_SET).getHrefs();
                            while (e .hasMoreElements()) {
                                URL predURL = new URL((String) e.nextElement());
                                predecessors.add(predURL);
                            } // end-while
                        } //end-if
                    } // end-while
                } // end-while
            } //end-while

            // Phew, were done.
            return predecessorTable;

        } catch (IOException e) {
            throw new SystemException(e);
        } catch (MalformedElementException e) {
            throw new SystemException(e);
        } finally {
            closeResponse(response);
        }
    }
public URLTable getVersionTree ( ) throws DAVException { // Issue a version tree report against the receiver to retrieve // the successor set of all the versions. Document document = newDocument ( ) ; Element root = ElementEditor . create ( document , "version-tree" ) ; //$NON-NLS-1$ Element propElement = ElementEditor . appendChild ( root , "prop" ) ; //$NON-NLS-1$ ElementEditor . appendChild ( propElement , "predecessor-set" ) ; //$NON-NLS-1$ IResponse response = null ; try { // Run the REPORT and check for errors. response = davClient . report ( locator , newContext ( ) , document ) ; examineResponse ( response ) ; if ( ! response . hasDocumentBody ( ) ) throw new DAVException ( Policy . bind ( "exception.respMustHaveElmtBody" ) ) ; //$NON-NLS-1$ // Get the body as a MultiStatus. Element documentElement = response . getDocumentBody ( ) . getDocumentElement ( ) ; if ( documentElement == null ) throw new DAVException ( Policy . bind ( "exception.bodyMustHaveElmt" ) ) ; //$NON-NLS-1$ MultiStatus multistatus = new MultiStatus ( documentElement ) ; // Construct the predecessor table. // This will contain the result. URLTable predecessorTable = new URLTable ( ) ; // For each response. Enumeration responses = multistatus . getResponses ( ) ; while ( responses . hasMoreElements ( ) ) { ResponseBody responseBody = ( ResponseBody ) responses . nextElement ( ) ; // Get the absolute URL of the resource. String href = responseBody . getHref ( ) ; URL resourceURL = new URL ( new URL ( locator . getResourceURL ( ) ) , href ) ; // Add an entry to the predecessor table. Vector predecessors = new Vector ( ) ; predecessorTable . put ( resourceURL , predecessors ) ; // For each propstat. Enumeration propstats = responseBody . getPropStats ( ) ; while ( propstats . hasMoreElements ( ) ) { PropStat propstat = ( PropStat ) propstats . nextElement ( ) ; // We are going to assume that the status is OK, or error out. if ( propstat . getStatusCode ( ) != IResponse . SC_OK ) throw new DAVException ( Policy . bind ( "exception.errorRetrievingProp" ) ) ; //$NON-NLS-1$ // For each property in the prop (there should only be one). Prop prop = propstat . getProp ( ) ; Enumeration elements = prop . getProperties ( ) ; while ( elements . hasMoreElements ( ) ) { Element element = ( Element ) elements . nextElement ( ) ; //  Look explicitly for the DAV:predecessor-set QualifiedName name = ElementEditor . getQualifiedName ( element ) ; if ( name . equals ( DAV_PREDECESSOR_SET ) ) { Enumeration e = new HrefSet ( element , DAV_PREDECESSOR_SET ) . getHrefs ( ) ; while ( e . hasMoreElements ( ) ) { URL predURL = new URL ( ( String ) e . nextElement ( ) ) ; predecessors . add ( predURL ) ; } // end-while } //end-if } // end-while } // end-while } //end-while // Phew, were done. return predecessorTable ; } catch ( IOException e ) { throw new SystemException ( e ) ; } catch ( MalformedElementException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }
Retrieve the version tree infomration for the receiver, assuming
that the receiver is a version or a version-controlled resource.
<p>
The version tree info comprises a <code>URLTable</code> whose keys
are the <code>URL</code>s of each version in the version history,
and whose values are <code>Vector</code>s of the resource's immediate
predecessor <code>URL</code>s.  Note that the root version is
(uniquely) identified by an empty set of predecessors.</p>

@return the map from resource URL to predecessor set.
Retrieve the version tree infomration for the receiver assuming that the receiver is a version or a version - controlled resource . <p > The version tree info comprises a <code > URLTable< / code > whose keys are the <code > URL< / code > s of each version in the version history and whose values are <code > Vector< / code > s of the resource s immediate predecessor <code > URL< / code > s . Note that the root version is ( uniquely ) identified by an empty set of predecessors . < / p >