Code that transforms a specific document type in a T-Engine generally implements the Transformer interface. In addition to the transform method, extractMetadata and embedMetadata methods will be called depending on the target media type. The implementing class is called from the transformImpl method of the controller class.
defaultvoidtransform(String transformName, String sourceMimetype, String targetMimetype, Map<String, String> transformOptions, File sourceFile, File targetFile)throws Exception { } defaultvoidextractMetadata(String transformName, String sourceMimetype, String targetMimetype, Map<String, String> transformOptions, File sourceFile, File targetFile) throws Exception { } defaultvoidembedMetadata(String transformName, String sourceMimetype, String targetMimetype, Map<String, String> transformOptions, File sourceFile, File targetFile) throws Exception { }
It is typical for the extractMetadata method to call another extractMetadata method on a sub class of AbstractMetadataExtractor as this class provides the bulk of the functionality needed to configure metadata extraction or embedding.
publicvoidextractMetadata(String transformName, String sourceMimetype, String targetMimetype, Map<String, String> transformOptions, File sourceFile, File targetFile)throws Exception { AbstractMetadataExtractor extractor = ... extractor.extractMetadata(sourceMimetype, transformOptions, sourceFile, targetFile); } // Similar code for embedMetadata