Package org.apache.jackrabbit.webdav

Examples of org.apache.jackrabbit.webdav.DavException


                          ValueFactory valueFactory)
        throws RepositoryException, DavException {
        super(property.getName(), false);

        if (!(JCR_VALUES.equals(property.getName()) || JCR_VALUE.equals(getName()))) {
            throw new DavException(DavServletResponse.SC_BAD_REQUEST, "ValuesProperty may only be created with a property that has name="+JCR_VALUES.getName());
        }

        // retrieve jcr-values from child 'value'-element(s)
        List<Element> valueElements = new ArrayList<Element>();
        Object propValue = property.getValue();
View Full Code Here


        locator = resource.getLocator();
        Session s = JcrDavSession.getRepositorySession(resource.getSession());
        try {
            obsMgr = s.getWorkspace().getObservationManager();
        } catch (RepositoryException e) {
            throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e);
        }
    }
View Full Code Here

     * @throws DavException if the given event type does not define a valid
     * JCR event type, such as returned by {@link #getEventType(int)}.
     */
    public static int getJcrEventType(EventType eventType) throws DavException {
        if (eventType == null || !NAMESPACE.equals(eventType.getNamespace())) {
            throw new DavException(DavServletResponse.SC_UNPROCESSABLE_ENTITY, "Invalid JCR event type: "+ eventType + ": Namespace mismatch.");
        }
        int eType;
        String eventName = eventType.getName();
        if (EVENT_NODEADDED.equals(eventName)) {
            eType = Event.NODE_ADDED;
        } else if (EVENT_NODEREMOVED.equals(eventName)) {
            eType = Event.NODE_REMOVED;
        } else if (EVENT_PROPERTYADDED.equals(eventName)) {
            eType = Event.PROPERTY_ADDED;
        } else if (EVENT_PROPERTYCHANGED.equals(eventName)) {
            eType = Event.PROPERTY_CHANGED;
        } else if (EVENT_PROPERTYREMOVED.equals(eventName)) {
            eType = Event.PROPERTY_REMOVED;
        } else if (EVENT_NODEMOVED.equals(eventName)) {
            eType = Event.NODE_MOVED;
        } else if (EVENT_PERSIST.equals(eventName)) {
            eType = Event.PERSIST;
        } else {
            throw new DavException(DavServletResponse.SC_UNPROCESSABLE_ENTITY, "Invalid event type: "+eventName);
        }
        return eType;
    }
View Full Code Here

    @Override
    public ActiveLock refreshLock(LockInfo reqLockInfo, String lockToken)
            throws DavException {

        if (lockToken == null) {
            throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
        }

        ActiveLock lock = getLock(reqLockInfo.getType(), reqLockInfo.getScope());
        if (lock == null) {
            throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "No lock with the given scope/type present on this resource.");
        }

        if (Type.WRITE.equals(lock.getType())) {
            try {
                Lock jcrLock = ((Node) item).getLock();
View Full Code Here

     * @return write lock or <code>null</code>
     * @throws DavException if this resource does not represent a repository item.
     */
    private ActiveLock getWriteLock() throws DavException {
        if (!exists()) {
            throw new DavException(DavServletResponse.SC_NOT_FOUND, "Unable to retrieve write lock for non existing repository item (" + getResourcePath() + ")");
        }
        ActiveLock writeLock = getLock(Type.WRITE, Scope.EXCLUSIVE);
        if (writeLock == null) {
            writeLock = getLock(Type.WRITE, EXCLUSIVE_SESSION);
        }
View Full Code Here

     * @see org.apache.jackrabbit.webdav.ordering.OrderingResource#orderMembers(org.apache.jackrabbit.webdav.ordering.OrderPatch)
     * @see Node#orderBefore(String, String)
     */
    public void orderMembers(OrderPatch orderPatch) throws DavException {
        if (!isOrderable()) {
            throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
        }
        // only custom ordering is allowed
        if (!OrderingConstants.ORDERING_TYPE_CUSTOM.equalsIgnoreCase(orderPatch.getOrderingType())) {
            throw new DavException(DavServletResponse.SC_UNPROCESSABLE_ENTITY, "Only DAV:custom ordering type supported.");
        }

        Node n = (Node)item;
        try {
            for (OrderPatch.Member instruction : orderPatch.getOrderInstructions()) {
View Full Code Here

            ntIter = getNodeTypes(getRepositorySession(), info);
        } catch (RepositoryException e) {
            throw new JcrDavException(e);
        }
        if (ntIter == null) {
            throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
View Full Code Here

            // None of the simple types. test if a report for individual
            // nodetype was request. If not, the request body is not valid.
            List<Element> elemList = info.getContentElements(XML_NODETYPE, NAMESPACE);
            if (elemList.isEmpty()) {
                // throw exception if the request body does not contain a single nodetype element
                throw new DavException(DavServletResponse.SC_BAD_REQUEST, "NodeTypes report: request body has invalid format.");
            }

            // todo: find better solution...
            List<NodeType> ntList = new ArrayList<NodeType>();
            for (Element el : elemList) {
View Full Code Here

    public void init(DavResource resource, ReportInfo info) throws DavException {
        // delegate basic validation to super class
        super.init(resource, info);
        // make also sure, the info contains a DAV:href child element
        if (!info.containsContentElement(DavConstants.XML_HREF, DavConstants.NAMESPACE)) {
            throw new DavException(DavServletResponse.SC_BAD_REQUEST, "dcr:locate-by-uuid element must at least contain a single DAV:href child.");
        }
        // immediately build the final multistatus element
        try {
            Element hrefElem = info.getContentElement(DavConstants.XML_HREF, DavConstants.NAMESPACE);
            String uuid = DomUtil.getTextTrim(hrefElem);
View Full Code Here

        super.init(resource, info);
        // specific for this report: a workspace href must be provided
        Element workspace = info.getContentElement(DeltaVConstants.WORKSPACE.getName(), DeltaVConstants.WORKSPACE.getNamespace());
        String workspaceHref = DomUtil.getChildTextTrim(workspace, DavConstants.XML_HREF, DavConstants.NAMESPACE);
        if (workspaceHref == null || "".equals(workspaceHref)) {
            throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Request body must define the href of a source workspace");
        }
        // retrieve href of the corresponding resource in the other workspace
        try {
            this.correspHref = getCorrespondingResourceHref(resource, getRepositorySession(), workspaceHref);
        } catch (RepositoryException e) {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.webdav.DavException

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.