Package org.apache.slide.webdav

Examples of org.apache.slide.webdav.WebdavException


               
            }
            catch( Exception e ) {
                int statusCode = getErrorCode( e );
                sendError( statusCode, e );
                throw new WebdavException( statusCode );
            }
        }
        else {
            int statusCode = WebdavStatus.SC_BAD_REQUEST;
            sendError( statusCode, getClass().getName()+".missingRequestBody" );
            throw new WebdavException( statusCode );
        }
       
    }
View Full Code Here


        // check lock-null resources
        try {
            if (isLockNull(resourcePath)) {
                int statusCode = WebdavStatus.SC_NOT_FOUND;
                sendError( statusCode, "lock-null resource", new Object[]{resourcePath} );
                throw new WebdavException( statusCode );
            }
        }
        catch (ServiceAccessException e) {
            int statusCode = getErrorCode((Exception)e);
            sendError( statusCode, e );
            throw new WebdavException( statusCode );
        }

        try {
           
            VersioningHelper vHelp =
                VersioningHelper.getVersioningHelper(slideToken, token, req, resp, getConfig() );
            NodeRevisionDescriptors revisionDescriptors =
                content.retrieve(slideToken, resourcePath);
           
            NodeRevisionNumber revisionNumber =
                revisionDescriptors.getLatestRevision();
            NodeRevisionDescriptor revisionDescriptor = null;
            if (revisionNumber != null) {
                try {
                    revisionDescriptor = content.retrieve
                        (slideToken, revisionDescriptors);
                } catch (RevisionDescriptorNotFoundException e) {
                }
            }
           
            if (revisionDescriptor == null) {
                revisionDescriptor = new NodeRevisionDescriptor(0);
            }
           
            ResourceKind resourceKind = AbstractResourceKind.determineResourceKind(token, resourcePath, revisionDescriptor);
           
            // check preconditions
            ViolatedPrecondition violatedPrecondition = getPreconditionViolation(revisionDescriptors, revisionDescriptor, resourceKind);
            if (violatedPrecondition != null) {
                throw new PreconditionViolationException(violatedPrecondition, resourcePath);
            }
           
            // Changed for DeltaV --start--
            boolean mustCheckIn = false;
            if( Configuration.useVersionControl() &&
                   (resourceKind instanceof CheckedInVersionControlled) &&
               versioningHelper.mustCheckoutAutoVersionedVCR(revisionDescriptors, revisionDescriptor) ) {
               
                vHelp.checkout(revisionDescriptors, revisionDescriptor, false, false, true );
                mustCheckIn = versioningHelper.mustCheckinAutoVersionedVCR(slideToken, revisionDescriptors, revisionDescriptor);
            }
           
            // Modifying the properties
           
            Iterator propertyIterator = null;
           
            propertyIterator = propertiesToSet.iterator();
            PropPatchProperty currentProperty = null;
            while (propertyIterator.hasNext()) {
               
                currentProperty = (PropPatchProperty)propertyIterator.next();
                if (checkPropertyModification(currentProperty, revisionDescriptor, resourceKind)) {
                    NodeProperty newProperty =
                        new NodeProperty(currentProperty.getName(),
                                         currentProperty.getValue(),
                                         currentProperty.getNamespace());
                    revisionDescriptor.setProperty(newProperty);
                   
                }
                else {
                    allOperationsExcecuted = false;
                }
            }
           
            propertyIterator = propertiesToRemove.iterator();
            while (propertyIterator.hasNext()) {
               
                currentProperty = (PropPatchProperty)propertyIterator.next();
                if (checkPropertyModification(currentProperty, revisionDescriptor, resourceKind)) {
                    revisionDescriptor.removeProperty(currentProperty.getName(),
                                                      currentProperty.getNamespace());
                }
                else {
                    allOperationsExcecuted = false;
                }
               
            }
           
            if (allOperationsExcecuted)
                content.store(slideToken, resourcePath, revisionDescriptor, null);
           
            // Changed for DeltaV --start--
            if( Configuration.useVersionControl() && mustCheckIn) {
                vHelp.checkin(revisionDescriptors, revisionDescriptor, false, false, true ); //forkOk=false, keepCheckedOut=false
            }
            // Changed for DeltaV --end--
           
            resp.setContentType(TEXT_XML_UTF_8);
           
            resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
           
        }
        catch (PreconditionViolationException e) {
            sendPreconditionViolation(e);
            throw e;
        }
        catch (Exception e) {
            int statusCode = getErrorCode( e );
            sendError( statusCode, e );
            throw new WebdavException( statusCode );
        }
       
       
        // No serious errors. Printing the XML report.
        writeReport();
       
        if (!allOperationsExcecuted) {
            throw new WebdavException( WebdavStatus.SC_ACCEPTED ); // abort the TA
        }
       
    }
View Full Code Here

                output(new Document(multistatus), writer);
            writer.flush();
        } catch (Exception e) {
            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
            sendError( statusCode, e );
            throw new WebdavException( statusCode );
        }
       
    }
View Full Code Here

                return Collections.EMPTY_LIST;
            }
            else if (stIf == ST_INVALID) {
                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
                sendError( sc, "Invalid header If: "+hIfStr );
                throw new WebdavException( sc );
            }
            else {
                return hIf;
            }
        }
View Full Code Here

                return null;
            }
            else if (stLockToken == ST_INVALID) {
                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
                sendError( sc, "Invalid header LockToken: "+hLockTokenStr );
                throw new WebdavException( sc );
            }
            else {
                return hLockToken;
            }
        }
View Full Code Here

                return defaultValue;
            }
            else if (stDepth == ST_INVALID) {
                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
                sendError( sc, "Invalid header Depth: "+hDepthStr );
                throw new WebdavException( sc );
            }
            else {
                return hDepth;
            }
        }
View Full Code Here

                return null;
            }
            else if (stDestination == ST_INVALID) {
                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
                sendError( sc, "Invalid header Destination: "+hDestinationStr );
                throw new WebdavException( sc );
            }
            else {
                return hDestination;
            }
        }
View Full Code Here

                return defaultValue;
            }
            else if (stOverwrite == ST_INVALID) {
                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
                sendError( sc, "Invalid header Overwrite: "+hOverwriteStr );
                throw new WebdavException( sc );
            }
            else {
                return hOverwrite;
            }
        }
View Full Code Here

                return null;
            }
            else if (stLabel == ST_INVALID) {
                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
                sendError( sc, "Invalid header Label: "+hLabelStr );
                throw new WebdavException( sc );
            }
            else {
                return hLabel;
            }
        }
View Full Code Here

                return defaultValue;
            }
            else if (stTimeout == ST_INVALID) {
                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
                sendError( sc, "Invalid header Timeout: "+hTimeoutStr );
                throw new WebdavException( sc );
            }
            else {
                return hTimeout;
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.slide.webdav.WebdavException

Copyright © 2018 www.massapicom. 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.