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 Details

    • log

      protected final org.apache.logging.log4j.Logger log
  • Constructor Details

    • ObjectFactory

      protected ObjectFactory(Class<O> lookupClass)
  • Method Details

    • augment

      protected O augment(O object, String objectName)
      Allow implementing classes to augment the looked up object class 'O'.
    • get

      protected final O get(String name, Properties environment)
      Returns the object matching the name and return type. If not cached yet, attempts to traverse all IObjectLocators to do so.
    • add

      public O add(O object, String name)
      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

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • getObjectNames

      protected List<String> getObjectNames()
    • destroy

      public void destroy() throws Exception
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception
    • setObjectLocators

      public void setObjectLocators(List<? extends IObjectLocator> objectLocators)