Not getting correct repository name in document URLs

I tried to configure separate repositories for encrypted and non-encrypted documents. I managed to do save documents in respective repositories as well but the URL received by Nuxeo after creation show 'default' repository only.

E.g. http://localhost:9090/nuxeo/nxfile/default/5f23fb17-a5b7-4c21-a176-9c16f9c20871/file:content/TestNEnc.png?changeToken=0-0

Here, in the above link I am still getting 'defalut' as repository name.

Below the changes I did.

  1. Added below line in Nuxeo.conf.
    nuxeo.db.xaMode=true
    
  2. Added custom datasource file called datasources-encrypted-config.xml for encrypted documents.
<?xml version="1.0"?>
<component name="datasources-encrypted-config">
  <extension target="org.nuxeo.runtime.datasource" point="datasources">
    <datasource name="jdbc/repository_encrypted" driverClassName="org.postgresql.Driver"
      url="jdbc:postgresql://localhost:5432/sboot" username="sboot" password="sboot"
      maxPoolSize="100"
      minPoolSize="5"
      blockingTimeoutMillis="1000"
      idleTimeoutMinutes="5"
      activeTimeoutMinutes="0"
      sqlExceptionSorter="org.nuxeo.runtime.datasource.DatasourceExceptionSorter"
      validationQuery=""
      accessToUnderlyingConnectionAllowed="true" />
    <link name="jdbc/NuxeoDS" global="jdbc/nuxeo" type="javax.sql.DataSource" />
    <link name="jdbc/nxsqldirectory" global="jdbc/nuxeo" type="javax.sql.DataSource" />
    <link name="jdbc/nxrelations-default-jena" global="jdbc/nuxeo" type="javax.sql.DataSource" />
    <link name="jdbc/comment-relations" global="jdbc/nuxeo" type="javax.sql.DataSource" />
    <link name="jdbc/nxaudit-logs" global="jdbc/nuxeo" type="javax.sql.DataSource" />
    <link name="jdbc/nxjbpm" global="jdbc/nuxeo" type="javax.sql.DataSource" />
    <link name="jdbc/placeful_service_ds" global="jdbc/nuxeo" type="javax.sql.DataSource" />
    <link name="jdbc/nxwebwidgets" global="jdbc/nuxeo" type="javax.sql.DataSource" />
    <link name="jdbc/nxuidsequencer" global="jdbc/nuxeo" type="javax.sql.DataSource" />
    <link name="jdbc/keyvaluestore" global="jdbc/nuxeo" type="javax.sql.DataSource" />
    <link name="jdbc/repository_default" global="jdbc/nuxeo" type="javax.sql.DataSource" />
  </extension>
</component>
  1. Added encrypted-repository-config.xml.nxftl
<#escape x as x?xml>
<?xml version="1.0"?>
<component name="encrypted-repository-config">
  <extension target="org.nuxeo.ecm.core.blob.BlobManager" point="configuration">
    <blobprovider name="encrypted">
      <class>org.nuxeo.ecm.core.blob.binary.AESBinaryManager</class>
      <property name="path">binaries-encrypted</property>
    </blobprovider>
  </extension>

<#if "${nuxeo.mongodb.server}" == "">

  <extension target="org.nuxeo.ecm.core.storage.sql.RepositoryService"
    point="repository">
    <repository name="encrypted" label="label.encrypted.repository" factory="org.nuxeo.ecm.core.storage.sql.ra.PoolingRepositoryFactory">
      <pool minPoolSize="${nuxeo.vcs["min-pool-size"]}" maxPoolSize="${nuxeo.vcs["max-pool-size"]}"
        blockingTimeoutMillis="${nuxeo.vcs["blocking-timeout-millis"]}"
        idleTimeoutMinutes="${nuxeo.vcs["idle-timeout-minutes"]}"
        activeTimeoutMinutes="${nuxeo.vcs["active-timeout-minutes"]}" />
      <clustering id="${repository.clustering.id}" enabled="${repository.clustering.enabled}" delay="${repository.clustering.delay}" />
      <clusterInvalidatorClass>org.nuxeo.ecm.core.storage.sql.VCSPubSubInvalidator</clusterInvalidatorClass>
      <noDDL>${nuxeo.vcs.noddl}</noDDL>
      <ddlMode>${nuxeo.vcs.ddlmode}</ddlMode>
      <aclOptimizations enabled="${nuxeo.vcs.optimizations.acl.enabled}"/>
      <pathOptimizations enabled="${nuxeo.vcs.optimizations.path.enabled}"/>
      <idType>${nuxeo.vcs.idtype}</idType>
      <changeTokenEnabled>${nuxeo.changetoken.enabled}</changeTokenEnabled>
      <indexing>
<#if "${nuxeo.db.type}" == "postgresql">
        <fulltext disabled="${nuxeo.vcs.fulltext.disabled}" searchDisabled="${nuxeo.vcs.fulltext.search.disabled}"
                  analyzer="${nuxeo.vcs.fulltext.analyzer.language}">
          <index name="default">
            <!-- all props implied -->
          </index>
          <index name="title">
            <field>dc:title</field>
          </index>
          <index name="description">
            <field>dc:description</field>
          </index>
        </fulltext>
<#elseif "${nuxeo.db.type}" == "oracle">
        <fulltext disabled="${nuxeo.vcs.fulltext.disabled}" searchDisabled="${nuxeo.vcs.fulltext.search.disabled}">
          <index name="default">
            <!-- all props implied -->
          </index>
          <index name="title">
            <field>dc:title</field>
          </index>
          <index name="description">
            <field>dc:description</field>
          </index>
        </fulltext>
        <!--
          For Oracle (Oracle Text indexing parameters):
          <fulltext analyzer="LEXER MY_LEXER"/>
          See doc at:
          http://jira.nuxeo.org/browse/NXP-4035
          http://download.oracle.com/docs/cd/B19306_01/text.102/b14218/cdatadic.htm
        -->
<#elseif "${nuxeo.db.type}" == "mssql">
        <fulltext disabled="${nuxeo.vcs.fulltext.disabled}" searchDisabled="${nuxeo.vcs.fulltext.search.disabled}"
                  analyzer="${nuxeo.vcs.fulltext.analyzer.language}">
          <index name="default">
            <!-- all props implied -->
          </index>
          <!-- SQL Server does not support more than one fulltext index per
          table: to add support for multiple fulltext index would required to
          change the datamodel of VCS -->
       </fulltext>
<#elseif "${nuxeo.db.type}" == "mysql">
        <!-- For MySQL -->
        <fulltext disabled="${nuxeo.vcs.fulltext.disabled}" searchDisabled="${nuxeo.vcs.fulltext.search.disabled}">
          <index name="default">
            <!-- all props implied -->
          </index>
          <index name="title">
            <field>dc:title</field>
          </index>
          <index name="description">
            <field>dc:description</field>
          </index>
        </fulltext>
<#else>
        <!-- for H2 (Lucene Analyzer): -->
        <fulltext disabled="${nuxeo.vcs.fulltext.disabled}" searchDisabled="${nuxeo.vcs.fulltext.search.disabled}" analyzer="org.apache.lucene.analysis.standard.StandardAnalyzer">
          <index name="default">
            <!-- all props implied -->
          </index>
          <index name="title">
            <field>dc:title</field>
          </index>
          <index name="description">
            <field>dc:description</field>
          </index>
        </fulltext>
</#if>
      </indexing>
<#if "${nuxeo.db.type}" != "mysql">
      <usersSeparator key="${nuxeo.db.user_separator_key}" />
</#if>
<#if "${nuxeo.db.type}" == "mysql">
      <schema>
        <field type="largetext">var_ParallelDocumentReview:review_result</field>
      </schema>
</#if>
    </repository>
  </extension>

  <extension target="org.nuxeo.runtime.kv.KeyValueService" point="configuration">
    <store name="default" class="org.nuxeo.ecm.core.storage.sql.kv.SQLKeyValueStore">
      <property name="datasource">jdbc/keyvaluestore</property>
      <property name="table">kv</property>
    </store>
  </extension>

<#else>

  <require>org.nuxeo.runtime.mongodb.MongoDBComponent</require>

  <extension target="org.nuxeo.ecm.core.storage.mongodb.MongoDBRepositoryService"
      point="repository">
    <!-- it will lookup for "repository/default" connection -->
    <repository name="default" label="label.default.repository">
      <fulltext disabled="${nuxeo.vcs.fulltext.disabled}" searchDisabled="${nuxeo.vcs.fulltext.search.disabled}" />
      <cache enabled="${nuxeo.dbs.cache.enabled}" maxSize="${nuxeo.dbs.cache.maxSize}"
             concurrencyLevel="${nuxeo.dbs.cache.concurrencyLevel}" ttl="${nuxeo.dbs.cache.ttl}" />
      <clustering id="${repository.clustering.id}" enabled="${repository.clustering.enabled}">
        <invalidatorClass>org.nuxeo.ecm.core.storage.dbs.DBSPubSubInvalidator</invalidatorClass>
      </clustering>
      <changeTokenEnabled>${nuxeo.changetoken.enabled}</changeTokenEnabled>
    </repository>
  </extension>

</#if>

</component>
</#escape>
0 votes

1 answers

148 views

ANSWER



Hello,

I think you missed one step. You have to deactivate the default single-datasource mode in nuxeo.conf

nuxeo.db.singleDataSource=

Info: https://doc.nuxeo.com/nxdoc/multiple-repositories-configuration/

Regards.

0 votes