\r
import org.collectionspace.services.common.api.Tools;\r
import org.collectionspace.services.common.config.ConfigUtils;\r
+import org.collectionspace.services.config.tenant.TenantBindingType;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
logger.error(errMsg);\r
throw new NamingException(errMsg);\r
}\r
- \r
- // FIXME: REM - We can rid ourselves of this special case by using the DEFAULT_NUXEO_DATABASE_NAME as the default\r
- // value for the "repositoryName" attribute in the tenant bindings XSD (XML Schema) definition.\r
- //\r
- // *Special Case* - Nuxeo's default repository name is "default" but the database is called "nuxeo"\r
- //\r
- if (dataSourceName.equals(JDBCTools.NUXEO_DATASOURCE_NAME) &&\r
- repositoryName.equals(JDBCTools.DEFAULT_NUXEO_REPOSITORY_NAME)) {\r
- repositoryName = DEFAULT_NUXEO_DATABASE_NAME;\r
- }\r
- \r
+ \r
/*\r
* We synch this block as a workaround to not have separate DataSource instances for\r
* each Nuxeo repo/DB. Ideally, we should replace the need for this synch block by\r
(org.apache.tomcat.dbcp.dbcp.BasicDataSource)getDataSource(dataSourceName);\r
// Get the template URL value from the JNDI datasource and substitute the databaseName\r
String urlTemplate = dataSource.getUrl();\r
- String connectionUrl = urlTemplate.replace(URL_DATABASE_NAME, repositoryName);\r
+ String databaseName = getDatabaseName(repositoryName);\r
+ String connectionUrl = urlTemplate.replace(URL_DATABASE_NAME, databaseName);\r
dataSource.setUrl(connectionUrl);\r
\r
try {\r
return result;\r
}\r
\r
+ /*\r
+ * By convention, the repository name and database name are the same. However, this\r
+ * call encapulates that convention and allows overrides.\r
+ */\r
+ public static String getDatabaseName(String repoName) {\r
+ String result = repoName;\r
+ \r
+ if (result.equalsIgnoreCase(DEFAULT_NUXEO_REPOSITORY_NAME) == true) {\r
+ result = DEFAULT_NUXEO_DATABASE_NAME;\r
+ }\r
+ \r
+ return result;\r
+ }\r
+ \r
/**\r
* Returns the catalog name for an open JDBC connection.\r
* \r
return result;
}
-
- /*
- * By convention, the repository name and database name are the same. However, this
- * call encapulates that convention and allows overrides.
- */
- public static String getDatabaseName(TenantBindingType tenantBindingType, String domainName) {
- String result = getRepositoryName(tenantBindingType, domainName);
-
- if (result.equalsIgnoreCase(DEFAULT_NUXEO_REPOSITORY_NAME) == true) {
- result = DEFAULT_NUXEO_DATABASE_NAME;
- }
-
- return result;
- }
-
+
public static String getRepositoryName(TenantBindingType tenantBindingType, String domainName) {
String result = null;