Class ObjectFactory<O,P>
java.lang.Object
org.frankframework.jdbc.datasource.ObjectFactory<O,P>
- 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
,JmsConnectionFactoryFactory
,JndiMongoClientFactory
,MqttClientFactory
public abstract class ObjectFactory<O,P>
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
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ObjectFactory
(Class<P> lookupClass, String resourcePrefix, String displayName) -
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'.final void
destroy()
protected void
destroyObject
(O object) This method is called when the objects stored in this Factory are removed.protected final O
get
(String name, Properties environment) Returns the object matching the name and return type.protected ObjectFactory.ObjectInfo
toObjectInfo
(String name) Mapping fromto a information object, used for logging and console actions.
-
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'. Allows the originally created object to be mutated to another object. Useful to generate an object from a filled DTO. -
get
Returns the object matching the name and return type. If not cached yet, attempts to traverse allIObjectLocators
to do so. When using a JNDI environment it allows initial properties to use for JNDI lookups. -
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
-
getObjectInfo
-
toObjectInfo
Mapping fromto a information object, used for logging and console actions. -
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
-
destroyObject
This method is called when the objects stored in this Factory are removed. It allows implementations to handle their own close actions.- Throws:
Exception
-