+3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/.classpath
+3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/.project
+3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/.settings/
+3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/.classpath
+3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/.project
+3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/.settings/
3rdparty/nuxeo/nuxeo-platform-listener/.project
3rdparty/nuxeo/nuxeo-platform-listener/.settings/
services/JaxRsServiceProvider/.settings/.jsdtscope
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<tenant:TenantBindingConfig
+ xmlns:merge='http://xmlmerge.el4j.elca.ch'
+ xmlns:tenant='http://collectionspace.org/services/config/tenant'>
+
+ <tenant:tenantBinding id="1" name="core.collectionspace.org" displayName="CollectionSpace Core Demo Tenant" version="0.1">
+ <tenant:repositoryDomain name="default-domain" storageName="core-domain" repositoryClient="nuxeo-java" />
+ </tenant:tenantBinding>
+
+</tenant:TenantBindingConfig>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<tenant:TenantBindingConfig xmlns:merge="http://xmlmerge.el4j.elca.ch" xmlns:tenant="http://collectionspace.org/services/config/tenant">
+
+ <tenant:tenantBinding id="2" name="lifesci.collectionspace.org" displayName="Life Sciences/Natural History Demo Tenant" version="0.1">
+
+ <tenant:repositoryDomain name="default-domain" storageName="lifesci_domain" repositoryName="lifesci_domain" repositoryClient="nuxeo-java"/>
+
+ <tenant:serviceBindings merge:matcher="id" id="CollectionObjects">
+ <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/config/service">
+ <service:params>
+ <service:ListResultsFields>
+ <service:ListResultField merge:matcher="skip" merge:action="insert">
+ <service:element>taxon</service:element>
+ <service:schema>collectionobjects_naturalhistory</service:schema>
+ <service:xpath>taxonomicIdentGroupList/[0]/taxon</service:xpath>
+ </service:ListResultField>
+ </service:ListResultsFields>
+ </service:params>
+ </service:DocHandlerParams>
+
+ <service:object xmlns:service="http://collectionspace.org/services/config/service">
+ <service:part id="3" merge:matcher="skip" merge:action="insert" control_group="Managed" versionable="true" auditable="false" label="collectionobjects_naturalhistory" updated="" order="3">
+ <!-- Include authRefs for fields in the added schema -->
+ <service:properties>
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>authRef</types:key>
+ <types:value>taxonomicIdentGroupList/*/taxon</types:value>
+ </types:item>
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>authRef</types:key>
+ <types:value>associatedTaxaGroupList/*/taxon</types:value>
+ </types:item>
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>authRef</types:key>
+ <types:value>taxonomicIdentGroupList/*/identBy</types:value>
+ </types:item>
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>authRef</types:key>
+ <types:value>taxonomicIdentGroupList/*/institution</types:value>
+ </types:item>
+ <!--
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>authRef</types:key>
+ <types:value>annotationGroupList/*/annotationAuthor</types:value>
+ </types:item>
+ -->
+ </service:properties>
+ <service:content contentType="application/xml">
+ <service:xmlContent namespaceURI="http://collectionspace.org/services/collectionobject/domain/naturalhistory" schemaLocation="http://collectionspace.org/services/collectionobject/domain/naturalhistory http://collectionspace.org/services/collectionobject/domain/collectionobjects_naturalhistory.xsd"/>
+ </service:content>
+ </service:part>
+ </service:object>
+
+ </tenant:serviceBindings>
+
+ <tenant:serviceBindings merge:matcher="id" id="Movements">
+ <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/config/service">
+ <service:params>
+ <service:SupportsVersioning>true</service:SupportsVersioning>
+ <service:ListResultsFields merge:action="preserve"/>
+ </service:params>
+ </service:DocHandlerParams>
+ </tenant:serviceBindings>
+
+ <tenant:serviceBindings merge:matcher="id" id="Persons">
+ <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/config/service">
+ <service:params>
+ <service:ListResultsFields>
+ <service:ListResultField merge:matcher="skip" merge:action="insert">
+ <service:element>entityType</service:element>
+ <service:schema>persons_naturalhistory</service:schema>
+ <service:xpath>entityType</service:xpath>
+ </service:ListResultField>
+ </service:ListResultsFields>
+ </service:params>
+ </service:DocHandlerParams>
+
+ <service:object xmlns:service="http://collectionspace.org/services/config/service">
+ <service:part id="3" merge:matcher="skip" merge:action="insert" control_group="Managed" versionable="true" auditable="false" label="persons_naturalhistory" updated="" order="3">
+ <service:content contentType="application/xml">
+ <service:xmlContent namespaceURI="http://collectionspace.org/services/person/domain/naturalhistory" schemaLocation="http://collectionspace.org/services/person/domain/naturalhistory http://collectionspace.org/services/person/domain/persons_naturalhistory.xsd"/>
+ </service:content>
+ <service:properties>
+ <!-- See CSPACE-3938 for potential additional authRef and termRef entries -->
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>authRef</types:key>
+ <types:value>affiliatedPersonOrgGroupList/*/affiliatedPersonOrg</types:value>
+ </types:item>
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>authRef</types:key>
+ <types:value>orgContactNames|orgContactName</types:value>
+ </types:item>
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>termRef</types:key>
+ <types:value>affiliatedPersonOrgGroupList/*/affiliatedPersonOrgType</types:value>
+ </types:item>
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>termRef</types:key>
+ <types:value>nameTypes|nameType</types:value>
+ </types:item>
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>termRef</types:key>
+ <types:value>nameSource</types:value>
+ </types:item>
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>termRef</types:key>
+ <types:value>entityType</types:value>
+ </types:item>
+ </service:properties>
+ </service:part>
+ </service:object>
+ </tenant:serviceBindings>
+
+ </tenant:tenantBinding>
+
+</tenant:TenantBindingConfig>
*/
public class TenantBindingConfigReaderImpl
extends AbstractConfigReaderImpl<List<TenantBindingType>> {
- final private static String TENANT_BINDINGS_ERROR = "Tenant bindings error: ";
+ final private static String TENANT_BINDINGS_ERROR = "Tenant bindings error(s) for tenant: ";
final private static String TENANT_BINDINGS_DELTA_FILENAME = JEEServerDeployment.TENANT_BINDINGS_FILENAME_PREFIX + ".delta.xml";
final private static String MERGED_SUFFIX = ".merged.xml";
+ private static final String NO_SERVICE_BINDINGS_FOUND_ERR = "No Service bindings found.";
final Logger logger = LoggerFactory.getLogger(TenantBindingConfigReaderImpl.class);
private List<TenantBindingType> tenantBindingTypeList;
return TENANT_BINDINGS_DELTA_FILENAME;
}
+ private String getFileName(String tenantName, boolean useAppGeneratedBindings) {
+ String result = getFileName();
+
+ if (useAppGeneratedBindings == true) {
+ result = tenantName + "-" + result;
+ }
+
+ return result;
+ }
+
+
protected File getTenantsRootDir() {
File result = null;
String errMessage = null;
throw new Exception("Cound not find tenant bindings root directory: " +
tenantRootDirPath);
}
- File protoBindingsFile = new File(tenantRootDirPath + File.separator +
- JEEServerDeployment.TENANT_BINDINGS_PROTOTYPE_FILENAME);
List<File> tenantDirs = getDirectories(tenantsRootDir);
- tenantBindingTypeList = readTenantConfigs(protoBindingsFile, tenantDirs, useAppGeneratedBindings);
+ tenantBindingTypeList = readTenantConfigs(new File(tenantRootDirPath), tenantDirs, useAppGeneratedBindings);
+ if (tenantBindingTypeList == null || tenantBindingTypeList.size() < 1) {
+ throw new Exception(NO_SERVICE_BINDINGS_FOUND_ERR);
+ }
for (TenantBindingType tenantBinding : tenantBindingTypeList) {
- if(tenantBindings.get(tenantBinding.getId()) != null) {
+ if (tenantBindings.get(tenantBinding.getId()) != null) {
TenantBindingType tenantBindingOld = tenantBindings.get(tenantBinding.getId());
logger.error("Ignoring duplicate binding definition for tenant id="
+ tenantBinding.getId()
String errMessage = null;
File tenantBindingsProtoFile = null;
+ String tenantName = tenantDir.getName(); // By convention, the directory name should be the tenant name
if (useAppGeneratedBindings == true) {
- String tenantName = tenantDir.getName(); // By convention, the directory name should be the tenant name
tenantBindingsProtoFile = new File(protoBindingsDir.getAbsolutePath() + File.separator + tenantName +
"-" + JEEServerDeployment.TENANT_BINDINGS_PROTOTYPE_FILENAME);
} else {
JEEServerDeployment.TENANT_BINDINGS_PROTOTYPE_FILENAME);
}
- File configFile = new File(tenantDir.getAbsoluteFile() + File.separator + getFileName());
- if (configFile.exists() == true) {
- InputStream tenantBindingsStream = this.merge(tenantBindingsProtoFile, configFile);
- TenantBindingConfig tenantBindingConfig = null;
- try {
- tenantBindingConfig = (TenantBindingConfig) parse(tenantBindingsStream,
- TenantBindingConfig.class);
- } catch (Exception e) {
- logger.error("Could not parse the merged tenant bindings.", e);
- }
- if (tenantBindingConfig != null) {
- TenantBindingType binding = tenantBindingConfig.getTenantBinding();
- if (binding != null) {
- result.add(binding);
- found = true;
- if (logger.isInfoEnabled() == true) {
- logger.info("Parsed tenant configureation for: " + binding.getDisplayName());
+ if (tenantBindingsProtoFile.exists() == true) {
+ File configFile = new File(tenantDir.getAbsoluteFile() + File.separator + getFileName(tenantName, useAppGeneratedBindings));
+ if (configFile.exists() == true) {
+ InputStream tenantBindingsStream = this.merge(tenantBindingsProtoFile, configFile);
+ TenantBindingConfig tenantBindingConfig = null;
+ try {
+ tenantBindingConfig = (TenantBindingConfig) parse(tenantBindingsStream,
+ TenantBindingConfig.class);
+ } catch (Exception e) {
+ logger.error("Could not parse the merged tenant bindings.", e);
+ }
+ if (tenantBindingConfig != null) {
+ TenantBindingType binding = tenantBindingConfig.getTenantBinding();
+ if (binding != null) {
+ result.add(binding);
+ found = true;
+ if (logger.isInfoEnabled() == true) {
+ logger.info("Parsed tenant configureation for: " + binding.getDisplayName());
+ }
+ } else {
+ errMessage = "Cound not parse the tentant bindings in: ";
}
} else {
- errMessage = "Cound not parse the tentant bindings in: ";
+ errMessage = "Could not parse the tenant bindings file: ";
}
} else {
- errMessage = "Could not parse the tenant bindings file: ";
+ errMessage = "Expected to, but could not, find the tenant delta configuration file: " + configFile.getAbsolutePath();
}
} else {
- errMessage = "Cound not find a tenant configuration file: ";
+ errMessage = "Expected to, but could not, find the tenant proto configuration file: " + tenantBindingsProtoFile.getAbsolutePath();
}
+
if (found == false) {
if (logger.isErrorEnabled() == true) {
errMessage = errMessage != null ? errMessage : TENANT_BINDINGS_ERROR;
- logger.error(errMessage + configFile.getAbsolutePath());
+ logger.error(errMessage + tenantName);
}
}
} // else-for