Skip to content

Commit

Permalink
Fix AerospikeRepositoryConfigurationExtension and ReactiveAerospikeRe…
Browse files Browse the repository at this point in the history
…positoryConfigurationExtension for multi-storage usage
  • Loading branch information
Anastasiia Smirnova authored and Aloren committed Dec 6, 2019
1 parent 252df08 commit 3190aec
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import com.aerospike.client.query.IndexType;
import org.springframework.data.aerospike.IndexAlreadyExistsException;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.Repository;

Expand All @@ -28,7 +27,6 @@
* @author Peter Milne
* @author Jean Mercier
*/
@NoRepositoryBean
public interface AerospikeRepository<T, ID> extends PagingAndSortingRepository<T, ID> {

<T> void createIndex(Class<T> domainType, String indexName, String binName, IndexType indexType);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.springframework.data.aerospike.repository;

import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;

Expand All @@ -9,7 +8,6 @@
*
* @author Igor Ermolenko
*/
@NoRepositoryBean
public interface ReactiveAerospikeRepository<T, ID> extends ReactiveCrudRepository<T, ID> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,11 @@
*/
public class AerospikeRepositoriesRegistrar extends RepositoryBeanDefinitionRegistrarSupport {

/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport#getAnnotation()
*/
@Override
protected Class<? extends Annotation> getAnnotation() {
return EnableAerospikeRepositories.class;
}

/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport#getExtension()
*/
@Override
protected RepositoryConfigurationExtension getExtension() {
return new AerospikeRepositoryConfigurationExtension();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,52 @@
package org.springframework.data.aerospike.repository.config;

import org.springframework.data.aerospike.mapping.Document;
import org.springframework.data.aerospike.repository.AerospikeRepository;
import org.springframework.data.aerospike.repository.support.AerospikeRepositoryFactoryBean;
import org.springframework.data.repository.config.RepositoryConfigurationExtension;
import org.springframework.data.repository.core.RepositoryMetadata;

import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.Collections;

/**
* {@link RepositoryConfigurationExtension} for Aerospike.
*
* @author Oliver Gierke
*/
public class AerospikeRepositoryConfigurationExtension extends BaseAerospikeRepositoryConfigurationExtension {

/*
* (non-Javadoc)
* @see org.springframework.data.keyvalue.repository.config.KeyValueRepositoryConfigurationExtension#getModuleName()
*/
@Override
public String getModuleName() {
return "Aerospike";
}

/*
* (non-Javadoc)
* @see org.springframework.data.keyvalue.repository.config.KeyValueRepositoryConfigurationExtension#getModulePrefix()
*/
@Override
protected String getModulePrefix() {
return "aerospike";
}

/*
* (non-Javadoc)
* @see org.springframework.data.keyvalue.repository.config.KeyValueRepositoryConfigurationExtension#getDefaultKeyValueTemplateRef()
*/
@Override
protected String getDefaultKeyValueTemplateRef() {
return "aerospikeTemplate";
}

@Override
public String getRepositoryFactoryBeanClassName() {
return AerospikeRepositoryFactoryBean.class.getName();
}

@Override
protected Collection<Class<? extends Annotation>> getIdentifyingAnnotations() {
return Collections.singleton(Document.class);
}

@Override
protected Collection<Class<?>> getIdentifyingTypes() {
return Collections.singleton(AerospikeRepository.class);
}

@Override
protected boolean useRepositoryConfiguration(RepositoryMetadata metadata) {
return !metadata.isReactiveRepository();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,11 @@
*/
public class ReactiveAerospikeRepositoriesRegistrar extends RepositoryBeanDefinitionRegistrarSupport {

/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport#getAnnotation()
*/
@Override
protected Class<? extends Annotation> getAnnotation() {
return EnableReactiveAerospikeRepositories.class;
}

/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport#getExtension()
*/
@Override
protected RepositoryConfigurationExtension getExtension() {
return new ReactiveAerospikeRepositoryConfigurationExtension();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
package org.springframework.data.aerospike.repository.config;

import org.springframework.data.aerospike.mapping.Document;
import org.springframework.data.aerospike.repository.ReactiveAerospikeRepository;
import org.springframework.data.aerospike.repository.support.ReactiveAerospikeRepositoryFactoryBean;
import org.springframework.data.repository.config.RepositoryConfigurationExtension;
import org.springframework.data.repository.core.RepositoryMetadata;

import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.Collections;

/**
* {@link RepositoryConfigurationExtension} for reactive Aerospike.
*
Expand All @@ -25,6 +32,21 @@ protected String getDefaultKeyValueTemplateRef() {
return "reactiveAerospikeTemplate";
}

@Override
public String getRepositoryFactoryBeanClassName() {
return ReactiveAerospikeRepositoryFactoryBean.class.getName();
}

@Override
protected Collection<Class<? extends Annotation>> getIdentifyingAnnotations() {
return Collections.singleton(Document.class);
}

@Override
protected Collection<Class<?>> getIdentifyingTypes() {
return Collections.singleton(ReactiveAerospikeRepository.class);
}

@Override
protected boolean useRepositoryConfiguration(RepositoryMetadata metadata) {
return metadata.isReactiveRepository();
Expand Down

0 comments on commit 3190aec

Please sign in to comment.