Class ObjectFactory<O>
java.lang.Object
org.frankframework.jdbc.datasource.ObjectFactory<O>
- Type Parameters:
O
- Object class used by clients
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
DataSourceFactory
,JndiConnectionFactoryFactory
,JndiMongoClientFactory
public class ObjectFactory<O>
extends Object
implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Baseclass for Object lookups.
Already created Objects are stored in a ConcurrentHashMap.
Objects will be searched in all available
IObjectLocators
. If it cannot find the object in the first locator, it will attempt to do so in the next available one.
Every Objects can be augmented before it is added.- Author:
- Gerrit van Brakel, Niels Meijer
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdd and augment an Object to this factory so it can be used without the need of a lookup.void
protected O
Allow implementing classes to augment the looked up object class 'O'.void
destroy()
protected final O
get
(String name, Properties environment) Returns the object matching the name and return type.void
setObjectLocators
(List<? extends IObjectLocator> objectLocators)
-
Field Details
-
log
protected final org.apache.logging.log4j.Logger log
-
-
Constructor Details
-
ObjectFactory
-
-
Method Details
-
augment
Allow implementing classes to augment the looked up object class 'O'. -
get
Returns the object matching the name and return type. If not cached yet, attempts to traverse allIObjectLocators
to do so. -
add
Add and augment an Object to this factory so it can be used without the need of a lookup. Should only be called during jUnit Tests or when registering an Object through Spring. Never through a lookup. -
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
getObjectNames
-
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
-
setObjectLocators
-