Developing a Reader ReadersTo create a reader plugin implement the ProductReaderPlugIn interface.
public interface ProductReaderPlugIn extends ProductIOPlugIn { /** * Gets the qualification of the product reader to decode a given input object. * * @param input the input object * @return the decode qualification */ DecodeQualification getDecodeQualification(Object input); /** * Returns an array containing the classes that represent valid input types for this reader. * Intances of the classes returned in this array are valid objects for the setInput method of the * ProductReader</code> interface (the method will not throw an InvalidArgumentException in this case). * * @return an array containing valid input types, never null */ Class[] getInputTypes(); /** * Creates an instance of the actual product reader class. This method should never return null. * * @return a new reader instance, never null */ ProductReader createReaderInstance(); }
The reader plugin should create a new instance of your reader in createReaderInstance(). To create a reader implementation, extend the AbstractProductReader. In readProductNodesImpl(), read your data files and create a new Product object. In readBandRasterDataImpl() fill the destination buffer with band data for the requested rectangular area. Maven DataIO ArchetypeThe Maven 2 Archetype Plugin for NEST data I/O modules is used to create archetypes for NEST data I/O modules.
A Maven Archetype is a template toolkit for generating a new module package. By using the Maven Archetype you can create a module structure easily and get started adding your code to the module.
A DataIO Archetype will generate a product reader and writer within the same package.
Before beginning, make sure that you have built the NEST source code and do a maven install to ensure that all dependencies are in the repository.
From the command line type the following from the NEST source code root folder.:
where
Please also refer to the documentation of the Maven 2 Archetype Plugin. Example
Publishing a ReaderReader implementations are published via the Java service provider interface (SPI). A JAR publishes its readers in the resource file META-INF/services/ org.esa.beam.framework.dataio.ProductReaderPlugIn. In this file add your reader SPI eg: org.esa.nest.dataio.radarsat2.Radarsat2ProductReaderPlugIn Adding Menu Item ActionsIn the modules.xml file found in the resources folder of the package, add an Action to create a menu item in the DAT. State the class of the Action to be called and the text to show in the menu item. <action> <id>importRadarsat2Product</id> <class>org.esa.beam.visat.actions.ProductImportAction</class> <formatName>Radarsat 2</formatName> <shortDescr>Import a Radarsat2 data product or product subset.</shortDescr> <description>Import a Radarsat2 data product or product subset.</description> <largeIcon>icons/Import24.gif</largeIcon> <placeAfter>importRadarsatProduct</placeAfter> <helpId>importRadarsat2Product</helpId> </action> |