import java.util.Locale;
import java.util.Map;
import java.util.NavigableMap;
-import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import javax.xml.validation.Schema;
import org.argeo.api.acr.Content;
import org.argeo.api.acr.ContentSession;
// TODO synchronize ?
private NavigableMap<String, String> prefixes = new TreeMap<>();
- private Schema schema;
+// private Schema schema;
private CmsContentSession systemSession;
});
Document document;
- if (Files.exists(path)) {
+ if (path != null && Files.exists(path)) {
InputSource inputSource = new InputSource(path.toAbsolutePath().toUri().toString());
inputSource.setEncoding(StandardCharsets.UTF_8.name());
// TODO public id as well?
document = dBuilder.newDocument();
// Element root = document.createElementNS(CrName.ROOT.getNamespaceURI(),
// CrName.ROOT.get().toPrefixedString());
- Element root = document.createElement(CrName.ROOT.get().toPrefixedString());
+ Element root = document.createElementNS(CrName.CR_NAMESPACE_URI, CrName.ROOT.get().toPrefixedString());
// root.setAttribute("xmlns", "");
- root.setAttribute("xmlns:" + CrName.CR_DEFAULT_PREFIX, CrName.CR_NAMESPACE_URI);
+// root.setAttribute("xmlns:" + CrName.CR_DEFAULT_PREFIX, CrName.CR_NAMESPACE_URI);
document.appendChild(root);
// write it
- TransformerFactory transformerFactory = TransformerFactory.newInstance();
- Transformer transformer = transformerFactory.newTransformer();
- DOMSource source = new DOMSource(document);
- try (Writer writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
- StreamResult result = new StreamResult(writer);
- transformer.transform(source, result);
+ if (path != null) {
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ Transformer transformer = transformerFactory.newTransformer();
+ DOMSource source = new DOMSource(document);
+ try (Writer writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
+ StreamResult result = new StreamResult(writer);
+ transformer.transform(source, result);
+ }
}
}
@Override
public Content get(String path) {
Map.Entry<String, ContentProvider> entry = partitions.floorEntry(path);
+ if (entry == null)
+ throw new IllegalArgumentException("No entry provider found for " + path);
String mountPath = entry.getKey();
ContentProvider provider = entry.getValue();
String relativePath = path.substring(mountPath.length());