public class MongoConnectionDetails extends Object implements Serializable
Hold Mongo connection details.
Constructor and Description |
---|
MongoConnectionDetails() |
Modifier and Type | Method and Description |
---|---|
com.mongodb.MongoClient |
buildMongoClient(String crawlerId)
Builds a MongoClient object based on these connection details.
|
static com.mongodb.MongoCredential |
buildMongoCredential(String username,
String dbName,
char[] password,
String mechanism)
Builds a MongoCredential object based on these connection details.
|
boolean |
equals(Object other) |
String |
getDatabaseName() |
String |
getHost() |
String |
getMechanism()
Gets the authentication mechanism to use (
MONGODB-CR ,
SCRAM-SHA-1 or null to use default). |
String |
getPassword() |
EncryptionKey |
getPasswordKey()
Gets the password encryption key.
|
int |
getPort() |
String |
getSafeDatabaseName(String crawlerId)
Gets a safe database name using MongoUtil, and treating a crawlerId as
the default.
|
String |
getUsername() |
int |
hashCode() |
boolean |
isSslEnabled()
Gets whether to use SSL.
|
boolean |
isSslInvalidHostNameAllowed()
Gets whether invalid host names should be allowed if SSL is enabled.
|
void |
setDatabaseName(String databaseName) |
void |
setHost(String host) |
void |
setMechanism(String mechanism)
Sets the authentication mechanism to use (
MONGODB-CR ,
SCRAM-SHA-1 or null to use default). |
void |
setPassword(String password) |
void |
setPasswordKey(EncryptionKey passwordKey)
Sets the password encryption key.
|
void |
setPort(int port) |
void |
setSslEnabled(boolean sslEnabled)
Sets whether to use SSL.
|
void |
setSslInvalidHostNameAllowed(boolean sslInvalidHostNameAllowed)
Sets whether invalid host names should be allowed if SSL is enabled.
|
void |
setUsername(String username) |
String |
toString() |
public int getPort()
public void setPort(int port)
public String getHost()
public void setHost(String host)
public String getDatabaseName()
public void setDatabaseName(String databaseName)
public String getUsername()
public void setUsername(String username)
public String getPassword()
public void setPassword(String password)
public boolean isSslEnabled()
true
if SSL should be usedpublic void setSslEnabled(boolean sslEnabled)
sslEnabled
- true
if SSL should be usedpublic boolean isSslInvalidHostNameAllowed()
true
if invalid host names are allowedpublic void setSslInvalidHostNameAllowed(boolean sslInvalidHostNameAllowed)
sslInvalidHostNameAllowed
- true
if invalid host
names are allowedpublic String getMechanism()
MONGODB-CR
,
SCRAM-SHA-1
or null
to use default).public void setMechanism(String mechanism)
MONGODB-CR
,
SCRAM-SHA-1
or null
to use default).mechanism
- authentication mechanismpublic EncryptionKey getPasswordKey()
null
if the password is not
encrypted.EncryptionUtil
public void setPasswordKey(EncryptionKey passwordKey)
passwordKey
- password keyEncryptionUtil
public String getSafeDatabaseName(String crawlerId)
crawlerId
- crawler id from collector configurationMongoCrawlDataStore
public com.mongodb.MongoClient buildMongoClient(String crawlerId)
crawlerId
- crawler id from collector configurationMongoCrawlDataStore
public static com.mongodb.MongoCredential buildMongoCredential(String username, String dbName, char[] password, String mechanism)
username
- Mongo usernamedbName
- Mongo database namepassword
- Mongo passwordmechanism
- Mongo authentication mechanismbuildMongoClient(String)
Copyright © 2014–2021 Norconex Inc.. All rights reserved.