public class MongoClientFactory
extends java.lang.Object
implements javax.naming.spi.ObjectFactory
Constructor and Description |
---|
MongoClientFactory() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getObjectInstance(java.lang.Object obj,
javax.naming.Name name,
javax.naming.Context nameCtx,
java.util.Hashtable<?,?> environment)
This implementation will create instances of
MongoClient based on a connection string conforming to the format specified in
MongoClientURI . |
public java.lang.Object getObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable<?,?> environment) throws java.lang.Exception
MongoClient
based on a connection string conforming to the format specified in
MongoClientURI
.
The connection string is specified in one of two ways:
String
value of a property in the environment
parameter with a key of "connectionString"
String
value of a RefAddr
with type "connectionString"
in an obj
parameter
of type Reference
environment
parameter takes precedence over specification in the obj
parameter. The name
and nameCtx
parameters are ignored.
If a non-empty connection string is not specified in either of these two ways, a MongoException
is thrown.getObjectInstance
in interface javax.naming.spi.ObjectFactory
MongoClient
based on the specified connection stringMongoException
- Note: Not all options that can be specified via MongoClientOptions
can be specified via the connection string.java.lang.Exception
Copyright © 2010 - 2020 Adobe. All Rights Reserved