public class HdfsMongoDbJob extends AbstractModuleFixture<HdfsMongoDbJob>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_COLLECTION_NAME |
static java.lang.String |
DEFAULT_DIRECTORY |
static java.lang.String |
DEFAULT_FILE_NAME |
static java.lang.String |
DEFAULT_ID_FIELD |
static java.lang.String |
DEFAULT_NAMES |
label
Constructor and Description |
---|
HdfsMongoDbJob(java.lang.String dir,
java.lang.String fileName,
java.lang.String collectionName,
java.lang.String names,
java.lang.String idField,
org.springframework.data.mongodb.MongoDbFactory mongoDbFactory)
Construct a new HdfsMongoDbJob using the provided directory and file names.
|
Modifier and Type | Method and Description |
---|---|
HdfsMongoDbJob |
collectionName(java.lang.String collectionName)
Sets the name of the collection where the data will be written.
|
HdfsMongoDbJob |
dir(java.lang.String dir)
Sets the directory where the file will be read from the hdfs.
|
void |
dropCollection(java.lang.String collectionName)
The drops the collection.
|
HdfsMongoDbJob |
fileName(java.lang.String fileName)
Sets the fileName of the file to be read
|
java.util.Map<java.lang.String,java.lang.String> |
getSingleObject(java.lang.String collectionName)
Returns a single object from the collection.
|
HdfsMongoDbJob |
host(java.lang.String host)
Sets the host where the mongo server is running
|
HdfsMongoDbJob |
idField(java.lang.String idField)
Sets the idField for the data that will be inserted by this job
|
void |
isReady()
Checks to see if the default mongo port 2000 is available on the configured host waiting up to 2 seconds
|
HdfsMongoDbJob |
names(java.lang.String names)
Sets the column names that will be written to.
|
HdfsMongoDbJob |
port(int port)
Sets the port that the HdfsMongoDb Job will transmit mongo commands
|
java.lang.String |
toDSL()
Renders the default DSL for this fixture.
|
static HdfsMongoDbJob |
withDefaults(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory)
Creates a HdfsMongoDb Instance using defaults.
|
label, toString
public static final java.lang.String DEFAULT_DIRECTORY
public static final java.lang.String DEFAULT_FILE_NAME
public static final java.lang.String DEFAULT_COLLECTION_NAME
public static final java.lang.String DEFAULT_NAMES
public static final java.lang.String DEFAULT_ID_FIELD
public HdfsMongoDbJob(java.lang.String dir, java.lang.String fileName, java.lang.String collectionName, java.lang.String names, java.lang.String idField, org.springframework.data.mongodb.MongoDbFactory mongoDbFactory)
dir
- the directory where the source file is located on hdfsfileName
- The file from which data will be pulled.collectionName
- the collection where the data will be written.names
- a comma delimited list of column names that are contained in the source file.mongoDbFactory
- The db factory for mongopublic static HdfsMongoDbJob withDefaults(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory)
mongoDbFactory
- The mongoDbFactory that will be used to connect to mongo.public java.lang.String toDSL()
toDSL
in class AbstractModuleFixture<HdfsMongoDbJob>
public HdfsMongoDbJob dir(java.lang.String dir)
dir
- the directory path.public HdfsMongoDbJob fileName(java.lang.String fileName)
fileName
- the name of the filepublic HdfsMongoDbJob collectionName(java.lang.String collectionName)
collectionName
- The name of the collectionpublic HdfsMongoDbJob names(java.lang.String names)
names
- Comma delimited list of column names.public HdfsMongoDbJob idField(java.lang.String idField)
idField
- The column that represents the id field;public HdfsMongoDbJob host(java.lang.String host)
host
- The mongo host serverpublic HdfsMongoDbJob port(int port)
port
- The port mongodb is monitoringpublic void isReady()
java.lang.IllegalStateException
- if can not connect in the specified timeout.public void dropCollection(java.lang.String collectionName)
collectionName
- the name of the database to drop.public java.util.Map<java.lang.String,java.lang.String> getSingleObject(java.lang.String collectionName)
collectionName
- the name of the collection to queryjava.lang.IllegalStateException
- if the number of objects in the collection is not one