Package org.eso.ias.cdb
Class CdbReaderFactory
java.lang.Object
org.eso.ias.cdb.CdbReaderFactory
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 Summary
Modifier and TypeFieldDescriptionstatic final String
The parameter to set in the command line to build a CdbReader from a custom java classstatic final String
The long parameter to set in the command line to build a JSON/YAML CdbReaderstatic final String
The short parameter to set in the command line to build a JSON/YAML CdbReader -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CdbReader
getCdbReader
(String[] cmdLine) Gets and return the CdbReader to use to read the CDB applying the policy described in the javadoc of the class
-
Field Details
-
cdbClassCmdLineParam
The parameter to set in the command line to build a CdbReader from a custom java class- See Also:
-
sTxtCdbCmdLineParamLong
The long parameter to set in the command line to build a JSON/YAML CdbReader- See Also:
-
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
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
-