<?xml version="1.0"?>
<component name="config:default-repository">
<extension target="org.nuxeo.ecm.core.repository.RepositoryService"
- point="repository">
+ point="repository">
<repository name="default"
- factory="org.nuxeo.ecm.core.storage.sql.ra.PoolingRepositoryFactory">
+ factory="org.nuxeo.ecm.core.storage.sql.ra.PoolingRepositoryFactory">
<repository name="default">
<pool minPoolSize="0" maxPoolSize="20"
- blockingTimeoutMillis="100" idleTimeoutMinutes="10" />
+ blockingTimeoutMillis="100" idleTimeoutMinutes="10" />
<clustering enabled="false" delay="1000" />
<binaryStore path="" />
<!-- The transactional datasource for Nuxeo -->
</extension>
<extension target="org.nuxeo.ecm.core.api.repository.RepositoryManager"
- point="repositories">
+ point="repositories">
<documentation>The default repository</documentation>
<repository name="default" label="Default Repository" />
</extension>
logger.warn("After second attribute edit=\n" + repoDoc.asXML());\r
repoDoc = XmlTools.setAttributeValue(repoDoc, "/component/extension[@point='repositories']/repository", "name", repositoryName);\r
logger.warn("After third attribute edit=\n" + repoDoc.asXML());\r
+ repoDoc = XmlTools.setElementValue(repoDoc, "/component/extension[@point='repository']/repository/repository/property[@name='DatabaseName']", repositoryName);\r
+ logger.warn("After first element edit=\n" + repoDoc.asXML());\r
// FIXME: Edit additional element and/or attribute values.\r
// FIXME: Emit serialized XML and write it to an appropriately named file\r
// in the Nuxeo server config directory.\r
}\r
}\r
}\r
+ } else {\r
+ logger.error(String.format("Could not either find, or read, the prototype Nuxeo config file '%s'",\r
+ prototypeNuxeoConfigFile.getCanonicalPath()));\r
}\r
//\r
// Start up and initialize our embedded Nuxeo server instance\r
return doc;
}
+ /**
+ * Sets the (text node) value of a specified element in a dom4j XML document.
+ * @param doc A dom4j XML document.
+ * @param xpathExpr An XPath expression intended to match a single element
+ * in the XML document, in the default namespace.
+ * @param elementValue The value that the element should contain.
+ * @return The document with the (text node) value of the matched element, if
+ * any, set to the provided value.
+ */
+ public static Document setElementValue(Document doc, String xpathExpr,
+ String elementValue) {
+ if (Tools.isBlank(xpathExpr)) {
+ return doc;
+ }
+ try {
+ Node node = doc.selectSingleNode(xpathExpr);
+ if ((node == null) || (node.getNodeType() != Node.ELEMENT_NODE)) {
+ return doc;
+ }
+ Element element = (Element) node;
+ element.setText(elementValue == null ? "" : elementValue);
+ return doc;
+ } catch (Exception e) {
+ System.out.println(e.getStackTrace());
+ } finally {
+ return doc;
+ }
+ }
+
/**
* Sets the value of a specified attribute in a dom4j XML document.
* @param doc A dom4j XML document.
return doc;
}
Element element = (Element) node;
- element.addAttribute(attributeName, attributeValue);
+ element.addAttribute(attributeName, attributeValue == null ? "" : attributeValue);
return doc;
} catch (Exception e) {
System.out.println(e.getStackTrace());