Class InstanceKeyDataSourceFactory
java.lang.Object
org.datanucleus.store.rdbms.datasource.dbcp2.datasources.InstanceKeyDataSourceFactory
- All Implemented Interfaces:
ObjectFactory
- Direct Known Subclasses:
PerUserPoolDataSourceFactory
,SharedPoolDataSourceFactory
A JNDI ObjectFactory which creates
SharedPoolDataSource
s or PerUserPoolDataSource
s- Since:
- 2.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
closeAll()
Closes all pools associated with this class.protected static final Object
deserialize
(byte[] data) Deserializes the provided byte array to create an object.protected abstract InstanceKeyDataSource
getNewInstance
(Reference ref) Creates an instance of the subclass and sets any properties contained in the Reference.getObjectInstance
(Object refObj, Name name, Context context, Hashtable<?, ?> env) Implements ObjectFactory to create an instance of SharedPoolDataSource or PerUserPoolDataSourceprotected abstract boolean
isCorrectClass
(String className) (package private) static String
(package private) static void
removeInstance
(String key) private void
setCommonProperties
(Reference ref, InstanceKeyDataSource ikds)
-
Field Details
-
instanceMap
-
-
Constructor Details
-
InstanceKeyDataSourceFactory
InstanceKeyDataSourceFactory()
-
-
Method Details
-
registerNewInstance
-
removeInstance
-
closeAll
Closes all pools associated with this class.- Throws:
Exception
- aListException
containing all exceptions thrown byInstanceKeyDataSource.close()
- Since:
- 2.4.0 throws a
ListException
instead of, in 2.3.0 and before, the first exception thrown byInstanceKeyDataSource.close()
. - See Also:
-
getObjectInstance
public Object getObjectInstance(Object refObj, Name name, Context context, Hashtable<?, ?> env) throws IOException, ClassNotFoundExceptionImplements ObjectFactory to create an instance of SharedPoolDataSource or PerUserPoolDataSource- Specified by:
getObjectInstance
in interfaceObjectFactory
- Throws:
IOException
ClassNotFoundException
-
setCommonProperties
private void setCommonProperties(Reference ref, InstanceKeyDataSource ikds) throws IOException, ClassNotFoundException - Throws:
IOException
ClassNotFoundException
-
isCorrectClass
- Parameters:
className
- The class name to test.- Returns:
- true if and only if className is the value returned from getClass().getName().toString()
-
getNewInstance
protected abstract InstanceKeyDataSource getNewInstance(Reference ref) throws IOException, ClassNotFoundException Creates an instance of the subclass and sets any properties contained in the Reference.- Parameters:
ref
- The properties to be set on the created DataSource- Returns:
- A configured DataSource of the appropriate type.
- Throws:
ClassNotFoundException
- If a class cannot be found during the deserialization of a configuration parameter.IOException
- If an I/O error occurs during the deserialization of a configuration parameter.
-
deserialize
Deserializes the provided byte array to create an object.- Parameters:
data
- Data to deserialize to create the configuration parameter.- Returns:
- The Object created by deserializing the data.
- Throws:
ClassNotFoundException
- If a class cannot be found during the deserialization of a configuration parameter.IOException
- If an I/O error occurs during the deserialization of a configuration parameter.
-