Return-Path: Delivered-To: apmail-jakarta-slide-dev-archive@apache.org Received: (qmail 35163 invoked from network); 12 Apr 2002 15:39:25 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 12 Apr 2002 15:39:25 -0000 Received: (qmail 20087 invoked by uid 97); 12 Apr 2002 15:39:27 -0000 Delivered-To: qmlist-jakarta-archive-slide-dev@jakarta.apache.org Received: (qmail 20071 invoked by uid 97); 12 Apr 2002 15:39:26 -0000 Mailing-List: contact slide-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Slide Developers Mailing List" Reply-To: "Slide Developers Mailing List" Delivered-To: mailing list slide-dev@jakarta.apache.org Received: (qmail 20060 invoked by uid 97); 12 Apr 2002 15:39:26 -0000 Date: 12 Apr 2002 15:39:22 -0000 Message-ID: <20020412153922.1601.qmail@icarus.apache.org> From: pnever@apache.org To: jakarta-slide-cvs@apache.org Subject: cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method VersionControlMethod.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N pnever 02/04/12 08:39:22 Modified: src/webdav/server/org/apache/slide/webdav/method VersionControlMethod.java Log: Additional semantics for the workspace feature ... see 6.7 of RFC3253 Revision Changes Path 1.11 +46 -6 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java Index: VersionControlMethod.java =================================================================== RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- VersionControlMethod.java 5 Apr 2002 05:45:10 -0000 1.10 +++ VersionControlMethod.java 12 Apr 2002 15:39:22 -0000 1.11 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java,v 1.10 2002/04/05 05:45:10 juergen Exp $ - * $Revision: 1.10 $ - * $Date: 2002/04/05 05:45:10 $ + * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java,v 1.11 2002/04/12 15:39:22 pnever Exp $ + * $Revision: 1.11 $ + * $Date: 2002/04/12 15:39:22 $ * * ==================================================================== * @@ -109,6 +109,12 @@ private String resourcePath; /** + * The VERSION-CONTROL request can be used to create a new VCR for an existing + * version history (see 6.7 of RFC3253) + */ + private String existingVersionPath; + + /** * VERSION-CONTROL method constructor. * * @param token Namespace access token @@ -134,22 +140,53 @@ if (resourcePath == null) { resourcePath = "/"; } + + if( req.getContentLength() > 0 ) { try{ retrieveRequestContent(); + Element vce = getRequestContent().getRootElement(); + Element ve = null; + if( vce == null || !vce.getName().equals(E_VERSION_CONTROL) ) { + Domain.warn( "Root element must be "+E_VERSION_CONTROL ); + resp.setStatus(WebdavStatus.SC_BAD_REQUEST); + throw new WebdavException(WebdavStatus.SC_BAD_REQUEST); + } + Iterator i = vce.getChildren().iterator(); + while( i.hasNext() ) { + Element e = (Element)i.next(); + if( e.getName().equals(E_VERSION) ) { + // version element found + ve = e; + // get the href element + try { + Element hre = (Element)ve.getChildren().get(0); + if( hre == null || !hre.getName().equals(E_HREF) ) + throw new Exception(); + existingVersionPath = getSlidePath( hre.getText() ); } - catch (SAXException e){ + catch( Exception x ) { + Domain.warn( E_VERSION+" element must contain "+E_HREF+" element" ); resp.setStatus(WebdavStatus.SC_BAD_REQUEST); throw new WebdavException(WebdavStatus.SC_BAD_REQUEST); } - catch (IOException e){ + break; + } + } + } + catch( org.xml.sax.SAXException x ){ + resp.setStatus(WebdavStatus.SC_BAD_REQUEST); + throw new WebdavException(WebdavStatus.SC_BAD_REQUEST); + } + catch( IOException x ){ resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR); throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR); } - catch (ParserConfigurationException e){ + catch( javax.xml.parsers.ParserConfigurationException x ){ resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR); throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR); } } + } /** * Execute the request. @@ -164,7 +201,10 @@ try { VersioningHelper vh = VersioningHelper.getVersioningHelper( slideToken, token, req, resp, getConfig() ); + if( existingVersionPath == null ) vh.versionControl( resourcePath ); + else + vh.versionControl( resourcePath, existingVersionPath ); } catch (PreconditionViolationException e) { sendPreconditionViolation(e.getViolatedPrecondition()); -- To unsubscribe, e-mail: For additional commands, e-mail: