X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Facr%2Fxml%2FDomContentProvider.java;h=845a6ab4c22a23629194b6bab0e3a0609d8ed2d9;hb=59b306feca8c82f1487a98562fc3d6a0db118337;hp=f76d38ce07a338401452834a3541400892c5cccf;hpb=c0342975a37c70895c2e8f6b341d790700168d7f;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/acr/xml/DomContentProvider.java b/org.argeo.cms/src/org/argeo/cms/acr/xml/DomContentProvider.java index f76d38ce0..845a6ab4c 100644 --- a/org.argeo.cms/src/org/argeo/cms/acr/xml/DomContentProvider.java +++ b/org.argeo.cms/src/org/argeo/cms/acr/xml/DomContentProvider.java @@ -57,16 +57,6 @@ public class DomContentProvider implements ContentProvider, NamespaceContext { }; } -// @Override -// public Content get() { -// return new DomContent(this, document.getDocumentElement()); -// } - -// public Element createElement(String name) { -// return document.createElementNS(null, name); -// -// } - @Override public ProvidedContent get(ProvidedSession session, String relativePath) { if ("".equals(relativePath)) @@ -76,7 +66,8 @@ public class DomContentProvider implements ContentProvider, NamespaceContext { if (nodes.getLength() > 1) throw new IllegalArgumentException("Multiple content found for " + relativePath + " under " + mountPath); if (nodes.getLength() == 0) - throw new ContentNotFoundException("Path " + relativePath + " under " + mountPath + " was not found"); + throw new ContentNotFoundException(session, mountPath + "/" + relativePath, + "Path " + relativePath + " under " + mountPath + " was not found"); Element element = (Element) nodes.item(0); return new DomContent(session, this, element); } @@ -85,8 +76,8 @@ public class DomContentProvider implements ContentProvider, NamespaceContext { if (relativePath.startsWith("/")) throw new IllegalArgumentException("Relative path cannot start with /"); String xPathExpression = '/' + relativePath; - if ("/".equals(mountPath)) - xPathExpression = "/" + CrName.root.qName() + xPathExpression; + if (Content.ROOT_PATH.equals(mountPath)) // repository root + xPathExpression = "/" + CrName.root.get() + xPathExpression; try { NodeList nodes = (NodeList) xPath.get().evaluate(xPathExpression, document, XPathConstants.NODESET); return nodes; @@ -104,6 +95,7 @@ public class DomContentProvider implements ContentProvider, NamespaceContext { return nodes.getLength() != 0; } + @Override public void persist(ProvidedSession session) { if (mountPath != null) { Content mountPoint = session.getMountPoint(mountPath);