Search in sources :

Example 1 with HttpProppatch

use of org.apache.jackrabbit.webdav.client.methods.HttpProppatch in project jackrabbit by apache.

the class RepositoryServiceImpl method internalSetNamespaces.

/**
     *
     * @param sessionInfo
     * @param namespaces
     * @throws NamespaceException
     * @throws UnsupportedRepositoryOperationException
     * @throws AccessDeniedException
     * @throws RepositoryException
     */
private void internalSetNamespaces(SessionInfo sessionInfo, Map<String, String> namespaces) throws RepositoryException {
    DavPropertySet setProperties = new DavPropertySet();
    setProperties.add(createNamespaceProperty(namespaces));
    HttpProppatch request = null;
    try {
        String uri = uriResolver.getWorkspaceUri(sessionInfo.getWorkspaceName());
        request = new HttpProppatch(uri, setProperties, new DavPropertyNameSet());
        initMethod(request, sessionInfo, true);
        HttpResponse response = executeRequest(sessionInfo, request);
        request.checkSuccess(response);
    } catch (IOException e) {
        throw new RepositoryException(e);
    } catch (DavException e) {
        throw ExceptionConverter.generate(e);
    } finally {
        if (request != null) {
            request.releaseConnection();
        }
    }
}
Also used : DavPropertySet(org.apache.jackrabbit.webdav.property.DavPropertySet) HttpProppatch(org.apache.jackrabbit.webdav.client.methods.HttpProppatch) DavException(org.apache.jackrabbit.webdav.DavException) DavPropertyNameSet(org.apache.jackrabbit.webdav.property.DavPropertyNameSet) HttpResponse(org.apache.http.HttpResponse) RepositoryException(javax.jcr.RepositoryException) IOException(java.io.IOException)

Example 2 with HttpProppatch

use of org.apache.jackrabbit.webdav.client.methods.HttpProppatch in project jackrabbit by apache.

the class RepositoryServiceImpl method registerNodeTypes.

@Override
public void registerNodeTypes(SessionInfo sessionInfo, QNodeTypeDefinition[] nodeTypeDefinitions, boolean allowUpdate) throws RepositoryException {
    HttpProppatch request = null;
    try {
        DavPropertySet setProperties = new DavPropertySet();
        setProperties.add(createRegisterNodeTypesProperty(sessionInfo, nodeTypeDefinitions, allowUpdate));
        String uri = uriResolver.getWorkspaceUri(sessionInfo.getWorkspaceName());
        request = new HttpProppatch(uri, setProperties, new DavPropertyNameSet());
        initMethod(request, sessionInfo, true);
        HttpResponse response = executeRequest(sessionInfo, request);
        request.checkSuccess(response);
    } catch (IOException e) {
        throw new RepositoryException(e);
    } catch (DavException e) {
        throw ExceptionConverter.generate(e);
    } finally {
        if (request != null) {
            request.releaseConnection();
        }
    }
}
Also used : DavPropertySet(org.apache.jackrabbit.webdav.property.DavPropertySet) HttpProppatch(org.apache.jackrabbit.webdav.client.methods.HttpProppatch) DavException(org.apache.jackrabbit.webdav.DavException) DavPropertyNameSet(org.apache.jackrabbit.webdav.property.DavPropertyNameSet) HttpResponse(org.apache.http.HttpResponse) RepositoryException(javax.jcr.RepositoryException) IOException(java.io.IOException)

Example 3 with HttpProppatch

use of org.apache.jackrabbit.webdav.client.methods.HttpProppatch in project jackrabbit by apache.

the class RepositoryServiceImpl method resolveMergeConflict.

@Override
public void resolveMergeConflict(SessionInfo sessionInfo, NodeId nodeId, NodeId[] mergeFailedIds, NodeId[] predecessorIds) throws RepositoryException {
    HttpProppatch request = null;
    try {
        List<HrefProperty> changeList = new ArrayList<HrefProperty>();
        String[] mergeFailedHref = new String[mergeFailedIds.length];
        for (int i = 0; i < mergeFailedIds.length; i++) {
            mergeFailedHref[i] = getItemUri(mergeFailedIds[i], sessionInfo);
        }
        changeList.add(new HrefProperty(VersionControlledResource.AUTO_MERGE_SET, mergeFailedHref, false));
        if (predecessorIds != null && predecessorIds.length > 0) {
            String[] pdcHrefs = new String[predecessorIds.length];
            for (int i = 0; i < predecessorIds.length; i++) {
                pdcHrefs[i] = getItemUri(predecessorIds[i], sessionInfo);
            }
            changeList.add(new HrefProperty(VersionControlledResource.PREDECESSOR_SET, pdcHrefs, false));
        }
        request = new HttpProppatch(getItemUri(nodeId, sessionInfo), changeList);
        initMethod(request, sessionInfo, !isUnLockMethod(request));
        HttpResponse response = executeRequest(sessionInfo, request);
        request.checkSuccess(response);
    } catch (IOException e) {
        throw new RepositoryException(e);
    } catch (DavException e) {
        throw ExceptionConverter.generate(e);
    } finally {
        if (request != null) {
            request.releaseConnection();
        }
    }
}
Also used : HttpProppatch(org.apache.jackrabbit.webdav.client.methods.HttpProppatch) HrefProperty(org.apache.jackrabbit.webdav.property.HrefProperty) DavException(org.apache.jackrabbit.webdav.DavException) ArrayList(java.util.ArrayList) HttpResponse(org.apache.http.HttpResponse) RepositoryException(javax.jcr.RepositoryException) IOException(java.io.IOException)

Example 4 with HttpProppatch

use of org.apache.jackrabbit.webdav.client.methods.HttpProppatch in project jackrabbit by apache.

the class RepositoryServiceImpl method unregisterNodeTypes.

@Override
public void unregisterNodeTypes(SessionInfo sessionInfo, Name[] nodeTypeNames) throws RepositoryException {
    HttpProppatch request = null;
    try {
        DavPropertySet setProperties = new DavPropertySet();
        setProperties.add(createUnRegisterNodeTypesProperty(sessionInfo, nodeTypeNames));
        String uri = uriResolver.getWorkspaceUri(sessionInfo.getWorkspaceName());
        request = new HttpProppatch(uri, setProperties, new DavPropertyNameSet());
        initMethod(request, sessionInfo, true);
        HttpResponse response = executeRequest(sessionInfo, request);
        request.checkSuccess(response);
    } catch (IOException e) {
        throw new RepositoryException(e);
    } catch (DavException e) {
        throw ExceptionConverter.generate(e);
    } finally {
        if (request != null) {
            request.releaseConnection();
        }
    }
}
Also used : DavPropertySet(org.apache.jackrabbit.webdav.property.DavPropertySet) HttpProppatch(org.apache.jackrabbit.webdav.client.methods.HttpProppatch) DavException(org.apache.jackrabbit.webdav.DavException) DavPropertyNameSet(org.apache.jackrabbit.webdav.property.DavPropertyNameSet) HttpResponse(org.apache.http.HttpResponse) RepositoryException(javax.jcr.RepositoryException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)4 RepositoryException (javax.jcr.RepositoryException)4 HttpResponse (org.apache.http.HttpResponse)4 DavException (org.apache.jackrabbit.webdav.DavException)4 HttpProppatch (org.apache.jackrabbit.webdav.client.methods.HttpProppatch)4 DavPropertyNameSet (org.apache.jackrabbit.webdav.property.DavPropertyNameSet)3 DavPropertySet (org.apache.jackrabbit.webdav.property.DavPropertySet)3 ArrayList (java.util.ArrayList)1 HrefProperty (org.apache.jackrabbit.webdav.property.HrefProperty)1