Developing a Writer WritersTo create a writer plugin implement the ProductWriterPlugIn interface. public interface ProductWriterPlugIn extends ProductIOPlugIn { /** * Returns an array containing the classes that represent valid output types for this writer. * Instances of the classes returned in this array are valid objects for the setOutput method of the * ProductWriter interface (the method will not throw an InvalidArgumentException in this case). * * @return an array containing valid output types, never null */ Class[] getOutputTypes(); /** * Creates an instance of the actual product writer class. This method should never return null. * * @return a new writer instance, never null */ ProductWriter createWriterInstance(); } The writer plugin should create a new instance of your reader in createWriterInstance(). To create a writer implementation, extend the AbstractProductWriter. In writeProductNodesImpl(), write your data files. WriteBandRasterData() writes raster data from the given in-memory source buffer into the data sink specified by the given source band and region. 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 installto 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 WriterWriter implementations are published via the Java service provider interface (SPI). A JAR publishes its writers in the resource file META-INF/services/org.esa.beam.framework.dataio.ProductWriterPlugIn. In this file add your writer SPI eg: org.esa.beam.dataio.geotiff.GeoTiffProductWriterPlugIn 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>exportGeoTIFFProduct</id> <class>org.esa.beam.dataio.geotiff.GeoTiffExportAction</class> <formatName>GeoTIFF</formatName> <useAllFileFilter>true</useAllFileFilter> <mnemonic>O</mnemonic> <text>Export GeoTIFF Product...</text> <shortDescr>Export a GeoTIFF data product or subset.</shortDescr> <description>Export a GeoTIFF data product or product subset.</description> <helpId>exportGeoTIFFProduct</helpId> </action> |