]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6393: The proto-repo-config.xml file now includes a 'binaryStore' element...
authorRichard Millet <remillet@berkeley.edu>
Wed, 8 Oct 2014 22:23:27 +0000 (15:23 -0700)
committerRichard Millet <remillet@berkeley.edu>
Wed, 8 Oct 2014 22:23:27 +0000 (15:23 -0700)
3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/proto-repo-config.xml
services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java
services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java
services/config/src/main/resources/tenant.xsd

index af0c6b857e6486e0288cef4af1d82622b8818907..5e927477632d48b95ded9f026876be8b6aa385d2 100644 (file)
@@ -1,4 +1,23 @@
 <?xml version="1.0"?>
+<!--
+       This is a prototype/template file for Nuxeo repository configuration files.
+       For each tenant that has their own repository specified in the CollectionSpace
+       tenant bindings file, we will create a corresponding Nuxeo repository config-
+       uration file.  You won't have to change the value for most of these elements
+       and attributes because they will be set when CollectionSpace starts.
+       
+       *** NOTE *** One value you may want to change is the 'binaryStore' path which is the location
+       that Nuxeo places binary files like images and PDF documents. Be sure to read the comment to
+       the right of the <binaryStore> element below.
+-->
+
+<!-- *** WARNING *** Don't manually change the values here unless you know exactly what you're doing. -->
+
+<!-- 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.) --> 
+
 <component name="config:default-repository">
     <extension target="org.nuxeo.ecm.core.repository.RepositoryService"
                point="repository">
@@ -7,14 +26,9 @@
             <repository name="default">
                 <pool minPoolSize="0" maxPoolSize="20"
                       blockingTimeoutMillis="100" idleTimeoutMinutes="10" />
-                <clustering enabled="false" delay="1000" />
-                <binaryStore path="" /> <!-- Should be parameterized. See CSPACE-6393 -->
-                <!-- 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> 
+                <clustering enabled="false" delay="1000" />                
+                <binaryStore path="" /> <!-- Default value will be repository/database name.  Can be partial or full system path.  Partial path is relative to Nuxeo's data dir -->
+                <xa-datasource>@XA_DATASOURCE@</xa-datasource> <!-- The transactional datasource for Nuxeo -->
                 <!-- 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>
index b4a3d4f2e41b4e3c6d45b98a717b286b7852b46f..c8f8bb4723b645f896c6f0bd9482d6f485b8afd6 100644 (file)
@@ -873,7 +873,7 @@ public class ServiceMain {
             }\r
             if (repositoryNameList == null || repositoryNameList.isEmpty() == true) {\r
               logger.warn(String.format("Could not get repository name(s) for tenant %s", tbt.getName()));\r
-              continue;\r
+              continue; //break out of loop\r
             } else {\r
                 for (String repositoryName : repositoryNameList) {\r
                     if (Tools.isBlank(repositoryName)) {\r
@@ -891,7 +891,9 @@ public class ServiceMain {
                     repositoryConfigDoc = (Document) prototypeConfigDoc.clone();\r
                     // Update this config file by inserting values pertinent to the\r
                     // current repository.\r
-                    repositoryConfigDoc = updateRepositoryConfigDoc(repositoryConfigDoc, repositoryName, this.getCspaceInstanceId());\r
+                    String binaryStorePath = tbt.getBinaryStorePath();\r
+                    repositoryConfigDoc = updateRepositoryConfigDoc(repositoryConfigDoc, repositoryName,\r
+                               this.getCspaceInstanceId(), binaryStorePath);\r
                     if (logger.isTraceEnabled()) {\r
                         logger.trace("Updated Nuxeo repo config file contents=\n" + repositoryConfigDoc.asXML());\r
                     }\r
@@ -907,7 +909,11 @@ public class ServiceMain {
         }\r
     }\r
     \r
-    private Document updateRepositoryConfigDoc(Document repoConfigDoc, String repositoryName, String cspaceInstanceId) {\r
+    /*\r
+     * This method is filling out the proto-repo-config.xml file with tenant specific repository information.\r
+     */\r
+    private Document updateRepositoryConfigDoc(Document repoConfigDoc, String repositoryName,\r
+               String cspaceInstanceId, String binaryStorePath) {\r
         String databaseName = JDBCTools.getDatabaseName(repositoryName, cspaceInstanceId);\r
 \r
         repoConfigDoc = XmlTools.setAttributeValue(repoConfigDoc,\r
@@ -917,6 +923,9 @@ public class ServiceMain {
                 REPOSITORY_EXTENSION_POINT_XPATH + "/repository", "name", repositoryName);\r
         repoConfigDoc = XmlTools.setAttributeValue(repoConfigDoc,\r
                 REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository", "name", repositoryName);\r
+        repoConfigDoc = XmlTools.setAttributeValue(repoConfigDoc,\r
+                REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/binaryStore", "path",\r
+                Tools.isBlank(binaryStorePath) ? repositoryName : binaryStorePath);  // Can be either partial or full path.  Partial path will be relative to Nuxeo's data directory\r
         String url = XmlTools.getElementValue(repoConfigDoc,\r
                 REPOSITORY_EXTENSION_POINT_XPATH + "/repository/repository/property[@name='URL']");\r
         if (! Tools.isBlank(url)) {\r
index 817bc756ddd9c2562e0cd31150726f3456959e4f..8cd38fb8e4b6b18cc352d547d94440e7c0bda890 100644 (file)
@@ -184,7 +184,7 @@ public class BlobInput {
                URL blobUrl = new URL(theBlobUri);\r
        File theBlobFile = null;\r
 \r
-               if (blobUrl.getProtocol().equalsIgnoreCase("http")) {\r
+               if (blobUrl.getProtocol().equalsIgnoreCase("http")) { //REM: Add support for https as well\r
                        Download fetchedFile = new Download(blobUrl);\r
                        if (logger.isDebugEnabled() == true) {\r
                                logger.debug("Starting blob download into temp file:" + fetchedFile.getFilePath());\r
index b1b3b7ae2f8827556779f0a5eaf5bce7a77ef46d..5eb4e99c89be06be81b10dc5941374aba26ab707 100644 (file)
@@ -45,6 +45,7 @@
         </xs:annotation>
         <xs:sequence>
             <xs:element name="repositoryDomain" type="RepositoryDomainType" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element name="binaryStorePath" type="xs:string" minOccurs="0" maxOccurs="1"/>
             <xs:element name="properties" type="types:PropertyType" minOccurs="0" maxOccurs="unbounded"/>
             <xs:element name="serviceBindings" type="service:ServiceBindingType" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>