</fileset>\r
<fileset dir="${basedir}/nuxeo-server/${nuxeo.release}"/>\r
</copy>\r
- <copy todir="${jee.server.cspace}/nuxeo-server/config" overwrite="true">\r
- <fileset dir="${basedir}/nuxeo-server/${nuxeo.release}/config"/>\r
+ <echo message="Copying Nuxeo prototype repo config file ..."/>\r
+ <copy todir="${jee.server.cspace}/cspace/services" overwrite="true">\r
+ <fileset dir="${basedir}/nuxeo-server/${nuxeo.release}/config/proto-repo-config.xml"/>\r
<filterset>\r
- <filter token="DB" value="${db}" />\r
- <filter token="DB_NUXEO_NAME" value="${db.nuxeo.name}" />\r
- <filter token="DB_URL" value="jdbc:${db}://${db.host}:${db.port}/${db.nuxeo.name}"/>\r
+ <filter token="DB_NUXEO_NAME" value="${db.nuxeo.name}" />\r
+ <!-- The specific database name will be appended to the following JDBC URL during system -->\r
+ <!-- startup, within each repository-specific config file that is 'cloned' from the -->\r
+ <!-- prototype repo config file being written to here. -->\r
+ <filter token="DB_URL" value="jdbc:${db}://${db.host}:${db.port}/"/>\r
<filter token="DB_SERVER_HOSTNAME" value="${db.host}"/>\r
- <filter token="XA_DATASOURCE" value="${db.xaDataSource}" />\r
+ <filter token="XA_DATASOURCE" value="${db.xaDataSource}" />\r
<filter token="NUXEO_USER" value="${db.nuxeo.user}" />\r
<filter token="NUXEO_PW" value="${db.nuxeo.user.password}" />\r
</filterset>\r
</copy>\r
- <echo message="Copying Nuxeo prototype repo config file ..."/>\r
- <copy file="${basedir}/nuxeo-server/${nuxeo.release}/config/proto-repo-config.xml"\r
- todir="${jee.server.cspace}/cspace/services" overwrite="true"/>\r
<ant antfile="nuxeo-platform-collectionspace/build.xml" target="deploy" inheritall="false"/>\r
<ant antfile="nuxeo-platform-listener/build.xml" target="deploy" inheritall="false"/>\r
<!-- Disabled due to integration issues between ImageMagick and Ghostscript on Linux systems \r
blockingTimeoutMillis="100" idleTimeoutMinutes="10" />
<clustering enabled="false" delay="1000" />
<binaryStore path="" />
+ <!-- Values in the following elements are primarily added during execution -->
+ <!-- of the 'ant deploy' command, within the Services source code tree. -->
+ <!-- (Several values are also added during system startup, into repository-specific -->
+ <!-- 'clones' of this prototype configuration file, as noted below.) -->
<!-- The transactional datasource for Nuxeo -->
- <xa-datasource>@XA_DATASOURCE@</xa-datasource>
+ <xa-datasource>@XA_DATASOURCE@</xa-datasource>
+ <!-- While the following element's value is primarily inserted during 'ant deploy' -->
+ <!-- the database name at the end of this JDBC URL is added during system startup. -->
<property name="URL">@DB_URL@</property>
- <property name="ServerName">@DB_SERVER_HOSTNAME@</property>
- <property name="DatabaseName">nuxeo</property>
+ <property name="ServerName">@DB_SERVER_HOSTNAME@</property>
+ <!-- The value of the following element is added during system startup. -->
+ <property name="DatabaseName"></property>
<property name="User">@NUXEO_USER@</property>
<property name="Password">@NUXEO_PW@</property>
</repository>
import javax.servlet.ServletContext;\r
import javax.sql.DataSource;\r
\r
+import org.apache.tomcat.dbcp.dbcp.BasicDataSource;\r
import org.collectionspace.authentication.AuthN;\r
import org.collectionspace.services.common.api.JEEServerDeployment;\r
import org.collectionspace.services.common.api.Tools;\r
REPOSITORY_EXTENSION_POINT_XPATH + "/repository", "name", repositoryName);\r
repoConfigDoc = XmlTools.setAttributeValue(repoConfigDoc,\r
REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository", "name", repositoryName);\r
- repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
- REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/xa-datasource", PLACEHOLDER);\r
- repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
- REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='URL']", PLACEHOLDER);\r
- repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
- REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='ServerName']", PLACEHOLDER);\r
+// repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
+// REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/xa-datasource", PLACEHOLDER);\r
+ String url = XmlTools.getElementValue(repoConfigDoc,\r
+ REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='URL']");\r
+ if (! Tools.isBlank(url)) {\r
+ repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
+ REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='URL']",\r
+ url + repositoryName);\r
+ }\r
+// repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
+// REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='ServerName']", PLACEHOLDER);\r
repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='DatabaseName']", repositoryName);\r
- repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
- REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='User']", PLACEHOLDER);\r
- repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
- REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='Password']", PLACEHOLDER);\r
+// repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
+// REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='User']", PLACEHOLDER);\r
+// repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
+// REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='Password']", PLACEHOLDER);\r
// Text substitutions within second extension point, "repositories"\r
repoConfigDoc = XmlTools.setElementValue(repoConfigDoc,\r
- REPOSITORIES_EXTENSION_POINT_XPATH + "/documentation", PLACEHOLDER);\r
+ REPOSITORIES_EXTENSION_POINT_XPATH + "/documentation",\r
+ String.format("The %s repository", repositoryName));\r
repoConfigDoc = XmlTools.setAttributeValue(repoConfigDoc,\r
REPOSITORIES_EXTENSION_POINT_XPATH + "/repository", "name", repositoryName);\r
repoConfigDoc = XmlTools.setAttributeValue(repoConfigDoc,\r
- REPOSITORIES_EXTENSION_POINT_XPATH + "/repository", "label", PLACEHOLDER);\r
+ REPOSITORIES_EXTENSION_POINT_XPATH + "/repository", "label",\r
+ String.format("%s Repository", repositoryName));\r
return repoConfigDoc;\r
}\r
}\r
}
}
+ /**
+ * Returns 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.
+ * @return The (text node) value of the matched element, if any.
+ */
+ public static String getElementValue(Document doc, String xpathExpr) {
+ String elementValue = "";
+ if (Tools.isBlank(xpathExpr)) {
+ return elementValue;
+ }
+ try {
+ Node node = doc.selectSingleNode(xpathExpr);
+ if ((node == null) || (node.getNodeType() != Node.ELEMENT_NODE)) {
+ return elementValue;
+ }
+ Element element = (Element) node;
+ elementValue = element.getText();
+ } catch (Exception e) {
+ System.err.println(e.getStackTrace());
+ } finally {
+ return elementValue;
+ }
+ }
+
/**
* 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.
+ * @param elementValue The value that the element should contain. If this
+ * provided value is null, the element's value will be set to an empty string.
* @return The document with the (text node) value of the matched element, if
* any, set to the provided value.
*/