Spring Data MongoDB

org.springframework.data.mongodb.core
Class MongoFactoryBean

java.lang.Object
  extended by org.springframework.data.mongodb.core.MongoFactoryBean
All Implemented Interfaces:
DisposableBean, FactoryBean<com.mongodb.Mongo>, InitializingBean, PersistenceExceptionTranslator

public class MongoFactoryBean
extends Object
implements FactoryBean<com.mongodb.Mongo>, InitializingBean, DisposableBean, PersistenceExceptionTranslator

Convenient factory for configuring MongoDB.

Since:
1.0
Author:
Thomas Risberg, Graeme Rocher, Oliver Gierke

Constructor Summary
MongoFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 com.mongodb.Mongo getObject()
           
 Class<? extends com.mongodb.Mongo> getObjectType()
           
 boolean isSingleton()
           
 void setExceptionTranslator(PersistenceExceptionTranslator exceptionTranslator)
           
 void setHost(String host)
           
 void setMongoOptions(com.mongodb.MongoOptions mongoOptions)
           
 void setPort(int port)
           
 void setReplicaPair(com.mongodb.ServerAddress[] replicaPair)
           
 void setReplicaSetSeeds(com.mongodb.ServerAddress[] replicaSetSeeds)
           
 void setWriteConcern(com.mongodb.WriteConcern writeConcern)
          Sets the WriteConcern to be configured for the Mongo instance to be created.
 DataAccessException translateExceptionIfPossible(RuntimeException ex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MongoFactoryBean

public MongoFactoryBean()
Method Detail

setMongoOptions

public void setMongoOptions(com.mongodb.MongoOptions mongoOptions)

setReplicaSetSeeds

public void setReplicaSetSeeds(com.mongodb.ServerAddress[] replicaSetSeeds)

setReplicaPair

public void setReplicaPair(com.mongodb.ServerAddress[] replicaPair)

setHost

public void setHost(String host)

setPort

public void setPort(int port)

setWriteConcern

public void setWriteConcern(com.mongodb.WriteConcern writeConcern)
Sets the WriteConcern to be configured for the Mongo instance to be created.

Parameters:
writeConcern -

setExceptionTranslator

public void setExceptionTranslator(PersistenceExceptionTranslator exceptionTranslator)

getObject

public com.mongodb.Mongo getObject()
                            throws Exception
Specified by:
getObject in interface FactoryBean<com.mongodb.Mongo>
Throws:
Exception

getObjectType

public Class<? extends com.mongodb.Mongo> getObjectType()
Specified by:
getObjectType in interface FactoryBean<com.mongodb.Mongo>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface FactoryBean<com.mongodb.Mongo>

translateExceptionIfPossible

public DataAccessException translateExceptionIfPossible(RuntimeException ex)
Specified by:
translateExceptionIfPossible in interface PersistenceExceptionTranslator

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface DisposableBean
Throws:
Exception

Spring Data MongoDB

Copyright © 2011-2013-2013 SpringSource. All Rights Reserved.