Package org.eso.ias.cdb.structuredtext
Class StructuredTextReader
java.lang.Object
org.eso.ias.cdb.structuredtext.StructuredTextReader
- All Implemented Interfaces:
CdbReader
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal TextFileTypeThe type of the files of the CDBprotected final AtomicBooleanSignal if the reader has been closedprotected final AtomicBooleanSignal if the reader has been initialized -
Constructor Summary
ConstructorsConstructorDescriptionStructuredTextReader(File parentFolder) Constructor that guesses the type of the folder from the content of the CDB folder from the content of the parentFolder.StructuredTextReader(CdbFiles cdbFiles) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanReadFromFile(File inF) Check if the passed file is readableRead the ASCE configuration from the file.Get the IDs of the ASCEs.Return the ASCEs belonging to the given DASU.Get the configuration of the client with the passed identifier.Read the DASU configuration from the file.Get the IDs of the DASUs.Return the DASUs belonging to the given Supervisor.getIas()Get the Ias configuration from a CDB.Get the IASIO with the given ID The implementation is not optimized for performances and memory usage because it gets all the IASIOs delegating togetIasios()then look for the one with the given ID if present.Get the IASIOs from the file.Return the IASIOs in input to the given ASCE.protected com.fasterxml.jackson.databind.ObjectMapperGet theObjectMapperdepending on the type of files in the CDBGet the configuration of the plugin with the passed identifier.getSupervisor(String id) Read the supervisor configuration from the CDB.Get the IDs of the Supervisors.getTemplate(String template_id) Read the template configuration from the CDB.Return the templated IASIOs in input to the given ASCE.Get the all the templates from the file.getTransferFunction(String tf_id) Read the transfer function configuration from the CDB.Get all the TFs.voidinit()Initialize the CDBvoidshutdown()Close the CDB and release the associated resources
-
Field Details
-
initialized
Signal if the reader has been initialized -
cdbFilesType
The type of the files of the CDB -
closed
Signal if the reader has been closed
-
-
Constructor Details
-
StructuredTextReader
Constructor- Parameters:
cdbFiles- The files of the CDB
-
StructuredTextReader
Constructor that guesses the type of the folder from the content of the CDB folder from the content of the parentFolder.- Parameters:
parentFolder- the parent folder of the CDB- Throws:
IasCdbException- if it was not possible to get the type of CDB from the passed parent folder
-
-
Method Details
-
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()Get theObjectMapperdepending on the type of files in the CDB- Returns:
- The
ObjectMapperto parse the files
-
canReadFromFile
Check if the passed file is readable- Parameters:
inF- The file to check- Returns:
- true if the file exists and is readable
-
init
Initialize the CDB- Specified by:
initin interfaceCdbReader- Throws:
IasCdbException
-
shutdown
Close the CDB and release the associated resources- Specified by:
shutdownin interfaceCdbReader- Throws:
IasCdbException
-
getIas
Get the Ias configuration from a CDB.- Specified by:
getIasin interfaceCdbReader- Returns:
- The ias configuration read from the CDB
- Throws:
IasCdbException- In case of error getting the IAS
-
getSupervisor
Read the supervisor configuration from the CDB. This methods reads the JsonSupervisorDao and convert it to SupervisorDao. The tricky part is the conversion of the JsonDasuToDeployDao of the JsonSupervisorDao to a DasuToDeployDao that needs to replace the ID of the DASU to deploy with a DasuDao. The DasuDao can be easily retrieved by callinggetDasu(String). In the same way, the instance of TemplateDao can be easily retrieved by callinggetTemplate(String)- Specified by:
getSupervisorin interfaceCdbReader- Parameters:
id- The notnullnor empty supervisor identifier- Returns:
- The Supervisor read from the CDB
- Throws:
IasCdbException- if the supervisor file does not exist or is unreadable
-
getDasu
Read the DASU configuration from the file.- Specified by:
getDasuin interfaceCdbReader- Parameters:
id- The not null nor empty DASU identifier- Returns:
- The DASU read from the file
- Throws:
IasCdbException- In case of error getting the DASU
-
getAsce
Read the ASCE configuration from the file.- Specified by:
getAscein interfaceCdbReader- Parameters:
id- The not null nor empty ASCE identifier- Returns:
- The ASCE read from the file
- Throws:
IasCdbException- In case of error getting the ASCE
-
getIasios
Get the IASIOs from the file.- Specified by:
getIasiosin interfaceCdbReader- Returns:
- The IASIOs read from the configuration file
- Throws:
IasCdbException- In case of error getting the IASIOs- See Also:
-
getIasio
Get the IASIO with the given ID The implementation is not optimized for performances and memory usage because it gets all the IASIOs delegating togetIasios()then look for the one with the given ID if present.
It should be ok for a testing CDB but can be an issue importing/exporting the production CDB.- Specified by:
getIasioin interfaceCdbReader- Parameters:
id- The ID of the IASIO to read the configuration- Returns:
- The IASIO red from the file
- Throws:
IasCdbException- In case of error getting the IASIO
-
getTransferFunction
Description copied from interface:CdbReaderRead the transfer function configuration from the CDB.- Specified by:
getTransferFunctionin interfaceCdbReader- Parameters:
tf_id- The notnullnor empty transfer function identifier- Returns:
- The transfer function read from the CDB
- Throws:
IasCdbException- in case of error reading from the CDB
-
getTransferFunctions
Get all the TFs.- Specified by:
getTransferFunctionsin interfaceCdbReader- Returns:
- The TFs read from the configuration file
- Throws:
IasCdbException- In case of error getting the IASIOs
-
getTemplates
Get the all the templates from the file.- Specified by:
getTemplatesin interfaceCdbReader- Returns:
- The templates read from the configuration file
- Throws:
IasCdbException- In case of error getting the IASIOs
-
getTemplate
Read the template configuration from the CDB.- Specified by:
getTemplatein interfaceCdbReader- Parameters:
template_id- The notnullnor empty identifier of the template- Returns:
- The template read from the CDB
- Throws:
IasCdbException- in case of error reading from the CDB
-
getAscesForDasu
Return the ASCEs belonging to the given DASU.- Specified by:
getAscesForDasuin interfaceCdbReader- Parameters:
id- The notnullnor empty identifier of the supervisor- Returns:
- A set of DASUs running in the supervisor with the passed id
- Throws:
IasCdbException- in case of error reading CDB or if the DASU with the give identifier does not exist
-
getDasusToDeployInSupervisor
Return the DASUs belonging to the given Supervisor.- Specified by:
getDasusToDeployInSupervisorin interfaceCdbReader- Parameters:
id- The notnullnor empty identifier of the supervisor- Returns:
- A set of DASUs running in the supervisor with the passed id
- Throws:
IasCdbException- in case of error reading CDB or if the supervisor with the give identifier does not exist
-
getIasiosForAsce
Return the IASIOs in input to the given ASCE.- Specified by:
getIasiosForAscein interfaceCdbReader- Parameters:
id- The notnullnor empty identifier of the ASCE- Returns:
- A set of IASIOs running in the ASCE with the passed id
- Throws:
IasCdbException- in case of error reading CDB or if the ASCE with the give identifier does not exist
-
getSupervisorIds
Get the IDs of the Supervisors. This method is useful to deploy the supervisors- Specified by:
getSupervisorIdsin interfaceCdbReader- Returns:
- The the IDs of the supervisors read from the CDB
- Throws:
IasCdbException- In case of error getting the IDs of the supervisors
-
getDasuIds
Get the IDs of the DASUs.- Specified by:
getDasuIdsin interfaceCdbReader- Returns:
- The IDs of the DASUs read from the CDB
- Throws:
IasCdbException- In case of error getting the IDs of the DASUs
-
getAsceIds
Get the IDs of the ASCEs.- Specified by:
getAsceIdsin interfaceCdbReader- Returns:
- The IDs of the ASCEs read from the CDB
- Throws:
IasCdbException- In case of error getting the IDs of the ASCEs
-
getPluginIds
- Specified by:
getPluginIdsin interfaceCdbReader- Returns:
- The IDs of all the plugins in the CDB
- Throws:
IasCdbException- In case of error getting the IDs of the plugins
-
getClientIds
- Specified by:
getClientIdsin interfaceCdbReader- Returns:
- The IDs of all the plugins in the CDB
- Throws:
IasCdbException- In case of error getting the IDs of the clients
-
getPlugin
Get the configuration of the plugin with the passed identifier.The configuration of the plugin can be read from a file or from the CDB. In both cases, the configuration is returned as #PluginConfigDao. This m,ethod returns the configuration from the CDB; reading from file is not implemented here.
- Specified by:
getPluginin interfaceCdbReader- Parameters:
id- The not null nor empty ID of the IAS plugin- Returns:
- The configuration of the plugin
- Throws:
IasCdbException- In case of error getting the configuration of the plugin
-
getClientConfig
Get the configuration of the client with the passed identifier. The configuration is passed as a string whose format depends on the client implementation.- Specified by:
getClientConfigin interfaceCdbReader- Parameters:
id- The not null nor empty ID of the IAS client- Returns:
- The configuration of the client
- Throws:
IasCdbException- In case of error getting the configuration of the client
-
getTemplateInstancesIasiosForAsce
public Collection<TemplateInstanceIasioDao> getTemplateInstancesIasiosForAsce(String id) throws IasCdbException Return the templated IASIOs in input to the given ASCE. These inputs are the one generated by a different template than that of the ASCE (@see #!@$)- Specified by:
getTemplateInstancesIasiosForAscein interfaceCdbReader- Parameters:
id- The notnullnor empty identifier of the ASCE- Returns:
- A set of template instance of IASIOs in input to the ASCE
- Throws:
IasCdbException- in case of error reading CDB or if the ASCE with the give identifier does not exist
-