Permalink
Browse files

make PersistenceContextInterceptorAggregator aware of neo4j

  • Loading branch information...
1 parent 5654be2 commit 03d7526d0b8d942d450a83cde7d9216e8bfe3be4 @sarmbruster committed Feb 3, 2013
@@ -36,6 +36,7 @@ class PersistenceContextInterceptorAggregator implements BeanDefinitionRegistryP
private boolean mongo
private boolean redis
private boolean aggregate
+ private boolean neo4j
private List<PersistenceContextInterceptor> interceptors = []
protected Log log = LogFactory.getLog(PersistenceContextInterceptorAggregator)
@@ -59,6 +60,10 @@ class PersistenceContextInterceptorAggregator implements BeanDefinitionRegistryP
count++
redis = true
}
+ if (registry.containsBeanDefinition('neo4jPersistenceInterceptor')) {
+ count++
+ neo4j = true
+ }
if (count < 2) {
log.info "Not processing, there are $count interceptors"
@@ -78,6 +83,10 @@ class PersistenceContextInterceptorAggregator implements BeanDefinitionRegistryP
if (registry.containsBeanDefinition('redisDatastorePersistenceInterceptor')) {
registry.removeBeanDefinition 'redisDatastorePersistenceInterceptor'
}
+
+ if (registry.containsBeanDefinition('neo4jPersistenceInterceptor')) {
+ registry.removeBeanDefinition 'neo4jPersistenceInterceptor'
+ }
}
void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
@@ -104,6 +113,10 @@ class PersistenceContextInterceptorAggregator implements BeanDefinitionRegistryP
interceptors << new DatastorePersistenceContextInterceptor(beanFactory.getBean('redisDatastore'))
}
+ if (neo4j) {
+ interceptors << new DatastorePersistenceContextInterceptor(beanFactory.getBean('neo4jDatastore'))
+ }
+
beanFactory.registerSingleton('persistenceInterceptor',
new AggregatePersistenceContextInterceptor(interceptors))
}

0 comments on commit 03d7526

Please sign in to comment.