Class CpoAdapterFactoryManager

java.lang.Object
org.synchronoss.cpo.core.cache.CpoAdapterFactoryCache
org.synchronoss.cpo.core.CpoAdapterFactoryManager

public final class CpoAdapterFactoryManager extends CpoAdapterFactoryCache
CpoAdapterFactoryManager is the static entry point applications use to obtain CpoAdapter, CpoTrxAdapter, and CpoXaResource instances by named configuration context. On class initialization (and whenever loadAdapters() is called again) it reads cpoConfig.xml from the classpath, or the path named by the CPO_CONFIG system property or environment variable, and builds a CpoAdapterFactory for each declared dataConfig entry.
Author:
dberry
  • Field Details

    • CPO_CONFIG

      public static final String CPO_CONFIG
      Name of the system property / environment variable that overrides the config file path.
      See Also:
  • Method Details

    • getCpoAdapter

      public static CpoAdapter getCpoAdapter() throws CpoException
      Gets the CpoAdapter for the default configuration context.
      Returns:
      the default CpoAdapter
      Throws:
      CpoException - if the adapter cannot be created
    • getCpoAdapter

      public static CpoAdapter getCpoAdapter(String context) throws CpoException
      Gets the CpoAdapter for the named configuration context.
      Parameters:
      context - the name of the dataConfig entry to use, as declared in cpoConfig.xml
      Returns:
      the CpoAdapter for context, or null if no factory is registered for it
      Throws:
      CpoException - if the adapter cannot be created
    • getCpoTrxAdapter

      public static CpoTrxAdapter getCpoTrxAdapter() throws CpoException
      Gets a CpoTrxAdapter for the default configuration context.
      Returns:
      the default CpoTrxAdapter
      Throws:
      CpoException - if the adapter cannot be created
    • getCpoTrxAdapter

      public static CpoTrxAdapter getCpoTrxAdapter(String context) throws CpoException
      Gets a CpoTrxAdapter for the named configuration context.
      Parameters:
      context - the name of the dataConfig entry to use, as declared in cpoConfig.xml
      Returns:
      the CpoTrxAdapter for context, or null if no factory is registered for it
      Throws:
      CpoException - if the adapter cannot be created
    • getCpoXaAdapter

      public static CpoXaResource getCpoXaAdapter() throws CpoException
      Gets the CpoXaResource for the default configuration context.
      Returns:
      the default CpoXaResource
      Throws:
      CpoException - if the adapter cannot be created
    • getCpoXaAdapter

      public static CpoXaResource getCpoXaAdapter(String context) throws CpoException
      Gets the CpoXaResource for the named configuration context.
      Parameters:
      context - the name of the dataConfig entry to use, as declared in cpoConfig.xml
      Returns:
      the CpoXaResource for context, or null if no factory is registered for it
      Throws:
      CpoException - if the adapter cannot be created
    • loadAdapters

      public static void loadAdapters()
      LoadAdapters is responsible for loading the config file and then subsequently loading all the metadata.
    • makeCpoAdapterFactory

      public static CpoAdapterFactory makeCpoAdapterFactory(org.synchronoss.cpo.cpoconfig.CtDataSourceConfig dataSourceConfig) throws CpoException
      Instantiates the dataSourceConfig's configured CpoConfigProcessor and uses it to build a CpoAdapterFactory for that datasource.
      Parameters:
      dataSourceConfig - the datasource configuration to process
      Returns:
      the resulting adapter factory
      Throws:
      CpoException - if the configured processor class cannot be located, instantiated, or invoked