use of org.apache.jackrabbit.webdav.client.methods.HttpUpdate in project jackrabbit by apache.
the class RepositoryServiceImpl method update.
private void update(String uri, Path relPath, String[] updateSource, int updateType, boolean removeExisting, SessionInfo sessionInfo) throws RepositoryException {
HttpUpdate request = null;
try {
UpdateInfo uInfo;
String[] tmpUpdateSource = obtainAbsolutePathsFromUris(updateSource);
if (removeExisting || relPath != null) {
Element uElem = UpdateInfo.createUpdateElement(tmpUpdateSource, updateType, DomUtil.createDocument());
if (removeExisting) {
DomUtil.addChildElement(uElem, JcrRemotingConstants.XML_REMOVEEXISTING, ItemResourceConstants.NAMESPACE);
}
if (relPath != null) {
DomUtil.addChildElement(uElem, JcrRemotingConstants.XML_RELPATH, ItemResourceConstants.NAMESPACE, getNamePathResolver(sessionInfo).getJCRPath(relPath));
}
uInfo = new UpdateInfo(uElem);
} else {
uInfo = new UpdateInfo(tmpUpdateSource, updateType, new DavPropertyNameSet());
}
request = new HttpUpdate(uri, uInfo);
initMethod(request, sessionInfo, !isUnLockMethod(request));
HttpResponse response = executeRequest(sessionInfo, request);
request.checkSuccess(response);
} catch (IOException e) {
throw new RepositoryException(e);
} catch (ParserConfigurationException e) {
throw new RepositoryException(e);
} catch (DavException e) {
throw ExceptionConverter.generate(e);
} finally {
if (request != null) {
request.releaseConnection();
}
}
}
Aggregations