public class OPDPFObjectFactory extends Object implements ObjectFactory
An implementation of ObjectFactory
that returns an OPartitionedDatabasePoolFactory
instance in
response to a JNDI lookup.
The auth
attribute should have the value "Container
".
The maximum number of connections can be set with the capacity
attribute.
The resource should always be a singleton and a closeMethod
attribute with the value "close
" should also be present.
Use the name of this class as the value of the factory
attribute of the <Resource>
tag.
The server
attribute is optional and should be used when running an embedded database. It references an
OServer
instance produced by an OServerObjectFactory
factory. If the server attribute is
present and this element is not, you will get a naming exception. If the other resource element is present but the
server attribute is not declared here, your server may never be started because the JNDI lookup never occurs.
The type
attribute is com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory.
An example resource declaration:
<Resource auth="Container" capacity="100" closeMethod="close" factory="com.ashtonit.odb.OPDPFObjectFactory" name="opdpfactory" server="oserver" singleton="true" type="com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory" />
Constructor and Description |
---|
OPDPFObjectFactory() |
Modifier and Type | Method and Description |
---|---|
com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory |
getObjectInstance(Object obj,
Name name,
Context nameCtx,
Hashtable<?,?> environment)
Returns an OPartitionedDatabasePoolFactory instance and optionally initializes an embedded OServer instance if
the resource name is passed in as an attribute.
|
public com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws NamingException
The OServer instance is just looked up in JNDI, if it is declared in the resource element. It is the
responsibility of the OServer object factory to actually start the server up. Be sure to add a
OServerObjectFactory
resource element for the server if you do reference it here.
getObjectInstance
in interface ObjectFactory
obj
- the naming referencename
- not usednameCtx
- the naming context used if presentenvironment
- used to create an initial context if a naming context is not passed inOPartitionedDatabasePoolFactory
instanceNamingException
- if the declared server instance cannot be found in the JNDI contextObjectFactory.getObjectInstance(Object, Name, Context, Hashtable)
Copyright © 2016. All rights reserved.