public class Mongobee extends Object implements org.springframework.beans.factory.InitializingBean
| Constructor and Description |
|---|
Mongobee()
Simple constructor with default configuration of host (localhost) and port (27017).
|
Mongobee(com.mongodb.MongoClient mongoClient)
Constructor takes db.mongodb.MongoClient object as a parameter.
|
Mongobee(com.mongodb.MongoClientURI mongoClientURI)
Constructor takes db.mongodb.MongoClientURI object as a parameter.
|
Mongobee(String mongoURI)
Mongobee runner.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
For Spring users: executing mongobee after bean is created in the Spring context
|
void |
close()
Closes the Mongo instance used by Mongobee.
|
void |
execute()
Executing migration
|
boolean |
isEnabled() |
boolean |
isExecutionInProgress() |
Mongobee |
setChangelogCollectionName(String changelogCollectionName)
Overwrites a default mongobee changelog collection hardcoded in DEFAULT_CHANGELOG_COLLECTION_NAME.
|
Mongobee |
setChangeLogsScanPackage(String changeLogsScanPackage)
Package name where @ChangeLog-annotated classes are kept.
|
Mongobee |
setDbName(String dbName)
Used DB name should be set here or via MongoDB URI (in a constructor)
|
Mongobee |
setEnabled(boolean enabled)
Feature which enables/disables Mongobee runner execution
|
Mongobee |
setJongo(org.jongo.Jongo jongo)
Sets pre-configured
MongoTemplate instance to use by the Mongobee |
Mongobee |
setLockCollectionName(String lockCollectionName)
Overwrites a default mongobee lock collection hardcoded in DEFAULT_LOCK_COLLECTION_NAME
|
Mongobee |
setMongoClientURI(com.mongodb.MongoClientURI mongoClientURI)
Sets uri to MongoDB
|
Mongobee |
setMongoTemplate(org.springframework.data.mongodb.core.MongoTemplate mongoTemplate)
Sets pre-configured
MongoTemplate instance to use by the Mongobee |
Mongobee |
setSpringEnvironment(org.springframework.core.env.Environment environment)
Set Environment object for Spring Profiles (@Profile) integration
|
public Mongobee()
Simple constructor with default configuration of host (localhost) and port (27017). Although
the database name need to be provided using setDbName(String) setter.
It is recommended to use constructors with MongoURI
public Mongobee(com.mongodb.MongoClientURI mongoClientURI)
Constructor takes db.mongodb.MongoClientURI object as a parameter.
For more details about MongoClientURI please see com.mongodb.MongoClientURI docs
mongoClientURI - uri to your dbMongoClientURIpublic Mongobee(com.mongodb.MongoClient mongoClient)
Constructor takes db.mongodb.MongoClient object as a parameter.
For more details about MongoClient please see com.mongodb.MongoClient docs
mongoClient - database connection clientMongoClientpublic Mongobee(String mongoURI)
Mongobee runner. Correct MongoDB URI should be provided.
The format of the URI is:
mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database[.collection]][?options]]
mongodb:// Required prefixusername:password@ are optional. If given, the driver will attempt to login to a database after
connecting to a database server. For some authentication mechanisms, only the username is specified and the password is not,
in which case the ":" after the username is left off as well.host1 Required. It identifies a server address to connect to. More than one host can be provided.:portX is optional and defaults to :27017 if not provided./database the name of the database to login to and thus is only relevant if the
username:password@ syntax is used. If not specified the "admin" database will be used by default.
Mongobee will operate on the database provided here or on the database overriden by setter setDbName(String).
?options are connection options. For list of options please see com.mongodb.MongoClientURI docsFor details, please see com.mongodb.MongoClientURI
mongoURI - with correct formatMongoClientURIpublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanException - exceptionpublic void execute()
throws MongobeeException
MongobeeException - exceptionpublic boolean isExecutionInProgress()
throws MongobeeConnectionException
MongobeeConnectionException - exceptionpublic Mongobee setDbName(String dbName)
dbName - database namepublic Mongobee setMongoClientURI(com.mongodb.MongoClientURI mongoClientURI)
mongoClientURI - object with defined mongo uripublic Mongobee setChangeLogsScanPackage(String changeLogsScanPackage)
changeLogsScanPackage - package where your changelogs arepublic boolean isEnabled()
public Mongobee setEnabled(boolean enabled)
enabled - MOngobee will run only if this option is set to truepublic Mongobee setSpringEnvironment(org.springframework.core.env.Environment environment)
environment - org.springframework.core.env.Environment object to injectpublic Mongobee setMongoTemplate(org.springframework.data.mongodb.core.MongoTemplate mongoTemplate)
MongoTemplate instance to use by the MongobeemongoTemplate - instance of the MongoTemplatepublic Mongobee setJongo(org.jongo.Jongo jongo)
MongoTemplate instance to use by the Mongobeejongo - Jongo instancepublic Mongobee setChangelogCollectionName(String changelogCollectionName)
changelogCollectionName - a new changelog collection namepublic Mongobee setLockCollectionName(String lockCollectionName)
lockCollectionName - a new lock collection namepublic void close()
Copyright © 2017. All rights reserved.