Class CdbReaderFactory

java.lang.Object
org.eso.ias.cdb.CdbReaderFactory

public class CdbReaderFactory extends Object
The factory to get the CdbReader implementation to use. This class checks the parameters of the command line, the java properties and the environment variable to build and return the CdbReader to use for reading the CDB. It offers a common strategy to be used consistently by all the IAS tools. The strategy is as follows: - if -cdbClass java.class param is present in the command line then the passed class is dynamically loaded and built (empty constructor); the configuration parameters eventually expected by such class will be passed by means of java properties (-D...) - else if jCdb file.path param is present in the command line then the JSON/YAML CDB implementation will be returned with the passed file path (the type JSON/YAML is retrieved from the content of the folder itself) - else the RDB implementation is returned (note that the parameters to connect to the RDB are passed in the hibernate configuration file) RDB implementation is the fallback if none of the other possibilities succeeds.
  • Field Details

    • cdbClassCmdLineParam

      public static final String cdbClassCmdLineParam
      The parameter to set in the command line to build a CdbReader from a custom java class
      See Also:
    • sTxtCdbCmdLineParamLong

      public static final String sTxtCdbCmdLineParamLong
      The long parameter to set in the command line to build a JSON/YAML CdbReader
      See Also:
    • sTxtCdbCmdLineParamShort

      public static final String sTxtCdbCmdLineParamShort
      The short parameter to set in the command line to build a JSON/YAML CdbReader
      See Also:
  • Constructor Details

    • CdbReaderFactory

      public CdbReaderFactory()
  • Method Details

    • getCdbReader

      public static CdbReader getCdbReader(String[] cmdLine) throws Exception
      Gets and return the CdbReader to use to read the CDB applying the policy described in the javadoc of the class
      Parameters:
      cmdLine - The command line
      Returns:
      the CdbReader to read the CDB
      Throws:
      Exception - in case of error building the CdbReader