throw new ManifoldCFException("GridFS: Metadata URL field cannot be empty.");
}
if (StringUtils.isEmpty(host) && StringUtils.isEmpty(port)) {
try {
session = new MongoClient().getDB(db);
} catch (UnknownHostException ex) {
throw new ManifoldCFException("GridFS: Default host is not found. Does mongod process run?" + ex.getMessage(), ex);
}
} else if (!StringUtils.isEmpty(host) && StringUtils.isEmpty(port)) {
try {
session = new MongoClient(host).getDB(db);
} catch (UnknownHostException ex) {
throw new ManifoldCFException("GridFS: Given host information is not valid or mongod process doesn't run" + ex.getMessage(), ex);
}
} else if (!StringUtils.isEmpty(host) && !StringUtils.isEmpty(port)) {
try {
int integerPort = Integer.parseInt(port);
session = new MongoClient(host, integerPort).getDB(db);
} catch (UnknownHostException ex) {
throw new ManifoldCFException("GridFS: Given information is not valid or mongod process doesn't run" + ex.getMessage(), ex);
} catch (NumberFormatException ex) {
throw new ManifoldCFException("GridFS: Given port is not valid number. " + ex.getMessage(), ex);
}
} else if (StringUtils.isEmpty(host) && !StringUtils.isEmpty(port)) {
try {
int integerPort = Integer.parseInt(port);
session = new MongoClient(host, integerPort).getDB(db);
} catch (UnknownHostException ex) {
throw new ManifoldCFException("GridFS: Given information is not valid or mongod process doesn't run" + ex.getMessage(), ex);
} catch (NumberFormatException ex) {
throw new ManifoldCFException("GridFS: Given port is not valid number. " + ex.getMessage(), ex);
}