Spring Data Couchbase

org.springframework.data.couchbase.config
Class AbstractCouchbaseConfiguration

java.lang.Object
  extended by org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration

@Configuration
public abstract class AbstractCouchbaseConfiguration
extends Object

Base class for Spring Data Couchbase configuration using JavaConfig.

Author:
Michael Nitschinger

Constructor Summary
AbstractCouchbaseConfiguration()
           
 
Method Summary
protected  boolean abbreviateFieldNames()
          Set to true if field names should be abbreviated with the CamelCaseAbbreviatingFieldNamingStrategy.
protected abstract  List<String> bootstrapHosts()
          The list of hostnames (or IP addresses to bootstrap from).
 com.couchbase.client.CouchbaseClient couchbaseClient()
          Return the CouchbaseClient instance to connect to.
protected  String couchbaseLogger()
          Specifies the logger to use (defaults to SLF4J).
 CouchbaseMappingContext couchbaseMappingContext()
          Creates a CouchbaseMappingContext equipped with entity classes scanned from the mapping base package.
 CouchbaseTemplate couchbaseTemplate()
          Creates a CouchbaseTemplate.
 CustomConversions customConversions()
          Register custom Converters in a CustomConversions object if required.
protected  FieldNamingStrategy fieldNamingStrategy()
          Configures a FieldNamingStrategy on the CouchbaseMappingContext instance created.
protected abstract  String getBucketName()
          The name of the bucket to connect to.
protected abstract  String getBucketPassword()
          The password of the bucket (can be an empty string).
protected  Set<Class<?>> getInitialEntitySet()
          Scans the mapping base package for classes annotated with Document.
protected  String getMappingBasePackage()
          Return the base package to scan for mapped Documents.
 MappingCouchbaseConverter mappingCouchbaseConverter()
          Creates a MappingCouchbaseConverter using the configured couchbaseMappingContext().
 TranslationService translationService()
          Creates a TranslationService.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCouchbaseConfiguration

public AbstractCouchbaseConfiguration()
Method Detail

bootstrapHosts

protected abstract List<String> bootstrapHosts()
The list of hostnames (or IP addresses to bootstrap from).

Returns:
the list of bootstrap hosts.

getBucketName

protected abstract String getBucketName()
The name of the bucket to connect to.

Returns:
the name of the bucket.

getBucketPassword

protected abstract String getBucketPassword()
The password of the bucket (can be an empty string).

Returns:
the password of the bucket.

couchbaseClient

@Bean(destroyMethod="shutdown")
public com.couchbase.client.CouchbaseClient couchbaseClient()
                                                     throws Exception
Return the CouchbaseClient instance to connect to.

Throws:
Exception - on Bean construction failure.

couchbaseLogger

protected String couchbaseLogger()
Specifies the logger to use (defaults to SLF4J).

Returns:
the logger property string.

couchbaseTemplate

@Bean
public CouchbaseTemplate couchbaseTemplate()
                                    throws Exception
Creates a CouchbaseTemplate.

Throws:
Exception - on Bean construction failure.

mappingCouchbaseConverter

@Bean
public MappingCouchbaseConverter mappingCouchbaseConverter()
                                                    throws Exception
Creates a MappingCouchbaseConverter using the configured couchbaseMappingContext().

Throws:
Exception - on Bean construction failure.

translationService

@Bean
public TranslationService translationService()
Creates a TranslationService.

Returns:
TranslationService, defaulting to JacksonTranslationService.

couchbaseMappingContext

@Bean
public CouchbaseMappingContext couchbaseMappingContext()
                                                throws Exception
Creates a CouchbaseMappingContext equipped with entity classes scanned from the mapping base package.

Throws:
Exception - on Bean construction failure.

customConversions

@Bean
public CustomConversions customConversions()
Register custom Converters in a CustomConversions object if required. These CustomConversions will be registered with the mappingCouchbaseConverter() and couchbaseMappingContext(). Returns an empty CustomConversions instance by default.

Returns:
must not be null.

getInitialEntitySet

protected Set<Class<?>> getInitialEntitySet()
                                     throws ClassNotFoundException
Scans the mapping base package for classes annotated with Document.

Throws:
ClassNotFoundException - if intial entity sets could not be loaded.

getMappingBasePackage

protected String getMappingBasePackage()
Return the base package to scan for mapped Documents. Will return the package name of the configuration class (the concrete class, not this one here) by default.

So if you have a com.acme.AppConfig extending AbstractCouchbaseConfiguration the base package will be considered com.acme unless the method is overridden to implement alternate behavior.

Returns:
the base package to scan for mapped Document classes or null to not enable scanning for entities.

abbreviateFieldNames

protected boolean abbreviateFieldNames()
Set to true if field names should be abbreviated with the CamelCaseAbbreviatingFieldNamingStrategy.

Returns:
true if field names should be abbreviated, default is false.

fieldNamingStrategy

protected FieldNamingStrategy fieldNamingStrategy()
Configures a FieldNamingStrategy on the CouchbaseMappingContext instance created.

Returns:
the naming strategy.

Spring Data Couchbase

Copyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.