Developing a custom extractor module
About the abstract methods
The call sequence to the methods is always connect-extract-disconnect. However, it is perfectly correct to perform the connection and disconnection inside the extract method. There is no difference in the code run, and the separation between the three phases is only for code readability.
The following example shows an implementation of the extract method:
Getting information from a JDBC database
If you are connecting to a JDBC database, make sure that the JDBC driver file (.jar file) is stored in the <Installation_directory_of_Capacity_Optimization>/etl/libext directory on the ETL server that runs the ETL task.
If you are using a database other than Oracle or Microsoft SQL Server, you must explicitly specify the JDBC driver information when you are configuring the extractor. For more information, see Generic-Database-extractor-Java.
Editing the extractor code
Every new custom extractor module that you create in the ETL Development kit uses a code template that contains some auto-generated code pieces.
The following examples sequentially illustrate the initial code you need to write and the other operations you can perform on extractors.
Write the initial extractor code. Define the extractor, connect, extraction, and disconnect methods.
Connect to the database by using the connect method. Review the following example:
Prepare the output datasets. The extract method is used to perform the query and apply the business logic to the extracted data. Review the following example:
Implement an append operation. With parsers, the ETL automatically renames previously parsed files and calls the parse method to parse new files. In the case of an extractor, you need to do this manually.
The logical choice is to use the lastcounter parameter as the timestamp and save it in the DSStatus object.Update the lastcounter parameter to the final value of its ts variable ( the maximum timestamp value in the output dataset).
Implement the disconnect method to release (disconnect) the connection.