diff --git a/modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryConfiguration.java b/modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryConfiguration.java index 88e821935a..66cc98ca93 100644 --- a/modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryConfiguration.java +++ b/modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryConfiguration.java @@ -1287,6 +1287,9 @@ public Properties getIndexStorageProperties() { setDefProp(props, FieldName.INDEX_STORAGE_INFINISPAN_CHUNK_SIZE_IN_BYTES, Default.INDEX_STORAGE_INFINISPAN_CHUNK_SIZE_IN_BYTES); + setDefProp(props, FieldName.CACHE_CONFIGURATION, getCacheConfiguration()); + // The cache names will be set when the Hibernate Search configuration is created; that way we don't have + // the repository name hard-coded in the properties ... } return props; } diff --git a/modeshape-jcr/src/main/java/org/modeshape/jcr/query/lucene/basic/BasicLuceneConfiguration.java b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/lucene/basic/BasicLuceneConfiguration.java index 3b52ffb657..84e89a0ad4 100644 --- a/modeshape-jcr/src/main/java/org/modeshape/jcr/query/lucene/basic/BasicLuceneConfiguration.java +++ b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/lucene/basic/BasicLuceneConfiguration.java @@ -116,6 +116,17 @@ public BasicLuceneConfiguration( String repositoryName, setProperty("hibernate.search.default.data_cachename", dataCacheName); setProperty("hibernate.search.default.metadata_cachename", metaCacheName); setProperty("hibernate.search.default.chunk_size", chunkSize); + String cacheConfigValue = storage.getProperty(FieldName.CACHE_CONFIGURATION); + if (cacheConfigValue != null && cacheConfigValue.trim().length() != 0) { + File configFile = new File(cacheConfigValue); + if (configFile.exists() && configFile.isFile() && configFile.canRead() && configFile.getName().endsWith(".xml")) { + // Looks like a file and ends in ".xml", so we'll assume a file ... + setProperty("hibernate.search.default.configuration_resourcename", configFile.getAbsolutePath()); + } else { + // Must be a JNDI reference ?? + setProperty("hibernate.search.default.cachemanager_jndiname", cacheConfigValue.trim()); + } + } } else if (storageType.equals(FieldValue.INDEX_STORAGE_CUSTOM)) { storageType = storage.getProperty(FieldName.CLASSNAME); setProperty("hibernate.search.default.directory_provider", storageType);