From e144286c74972e2a9046fd1f4242697cce10ec71 Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Wed, 8 Oct 2014 15:23:27 -0700 Subject: [PATCH] CSPACE-6393: The proto-repo-config.xml file now includes a 'binaryStore' element for specifying either a partial or full directory path for Nuxeo binaries. Partial paths are relative to the Nuxeo data directory. --- .../5.5-HF07/config/proto-repo-config.xml | 30 ++++++++++++++----- .../services/common/ServiceMain.java | 15 ++++++++-- .../services/common/blob/BlobInput.java | 2 +- services/config/src/main/resources/tenant.xsd | 1 + 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/proto-repo-config.xml b/3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/proto-repo-config.xml index af0c6b857..5e9274776 100644 --- a/3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/proto-repo-config.xml +++ b/3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/proto-repo-config.xml @@ -1,4 +1,23 @@ + + + + + + + + + @@ -7,14 +26,9 @@ - - - - - - - - @XA_DATASOURCE@ + + + @XA_DATASOURCE@ @DB_URL@ diff --git a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java index b4a3d4f2e..c8f8bb472 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java +++ b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java @@ -873,7 +873,7 @@ public class ServiceMain { } if (repositoryNameList == null || repositoryNameList.isEmpty() == true) { logger.warn(String.format("Could not get repository name(s) for tenant %s", tbt.getName())); - continue; + continue; //break out of loop } else { for (String repositoryName : repositoryNameList) { if (Tools.isBlank(repositoryName)) { @@ -891,7 +891,9 @@ public class ServiceMain { repositoryConfigDoc = (Document) prototypeConfigDoc.clone(); // Update this config file by inserting values pertinent to the // current repository. - repositoryConfigDoc = updateRepositoryConfigDoc(repositoryConfigDoc, repositoryName, this.getCspaceInstanceId()); + String binaryStorePath = tbt.getBinaryStorePath(); + repositoryConfigDoc = updateRepositoryConfigDoc(repositoryConfigDoc, repositoryName, + this.getCspaceInstanceId(), binaryStorePath); if (logger.isTraceEnabled()) { logger.trace("Updated Nuxeo repo config file contents=\n" + repositoryConfigDoc.asXML()); } @@ -907,7 +909,11 @@ public class ServiceMain { } } - private Document updateRepositoryConfigDoc(Document repoConfigDoc, String repositoryName, String cspaceInstanceId) { + /* + * This method is filling out the proto-repo-config.xml file with tenant specific repository information. + */ + private Document updateRepositoryConfigDoc(Document repoConfigDoc, String repositoryName, + String cspaceInstanceId, String binaryStorePath) { String databaseName = JDBCTools.getDatabaseName(repositoryName, cspaceInstanceId); repoConfigDoc = XmlTools.setAttributeValue(repoConfigDoc, @@ -917,6 +923,9 @@ public class ServiceMain { REPOSITORY_EXTENSION_POINT_XPATH + "/repository", "name", repositoryName); repoConfigDoc = XmlTools.setAttributeValue(repoConfigDoc, REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository", "name", repositoryName); + repoConfigDoc = XmlTools.setAttributeValue(repoConfigDoc, + REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/binaryStore", "path", + Tools.isBlank(binaryStorePath) ? repositoryName : binaryStorePath); // Can be either partial or full path. Partial path will be relative to Nuxeo's data directory String url = XmlTools.getElementValue(repoConfigDoc, REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='URL']"); if (! Tools.isBlank(url)) { diff --git a/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java b/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java index 817bc756d..8cd38fb8e 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java +++ b/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java @@ -184,7 +184,7 @@ public class BlobInput { URL blobUrl = new URL(theBlobUri); File theBlobFile = null; - if (blobUrl.getProtocol().equalsIgnoreCase("http")) { + if (blobUrl.getProtocol().equalsIgnoreCase("http")) { //REM: Add support for https as well Download fetchedFile = new Download(blobUrl); if (logger.isDebugEnabled() == true) { logger.debug("Starting blob download into temp file:" + fetchedFile.getFilePath()); diff --git a/services/config/src/main/resources/tenant.xsd b/services/config/src/main/resources/tenant.xsd index b1b3b7ae2..5eb4e99c8 100644 --- a/services/config/src/main/resources/tenant.xsd +++ b/services/config/src/main/resources/tenant.xsd @@ -45,6 +45,7 @@ + -- 2.47.3