Skip to content

Commit

Permalink
MODE-1510 Corrected configuration of Infinispan for index storage
Browse files Browse the repository at this point in the history
ModeShape internally generates a Hibernate Search engine configuration based upon ModeShape's configuration.
Hibernate Search can use the Infinispan Lucene Directory to store Lucene indexes in Infinispan, but
ModeShape incorrectly passed down the information about where the Infinispan configuration was, preventing
using the same Infinispan configuration for both content storage and index storage.

This change corrects this problem, and allows defaulting to the same file-based Infinispan configuration
for index storage that's used for content storage. This fix should also work in AS7, since the JNDI
name of the cache container is passed through.

The build completes successfully with these changes.
  • Loading branch information
rhauch committed Jun 11, 2012
1 parent 691fc23 commit 643859e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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);
Expand Down

0 comments on commit 643859e

Please sign in to comment.