Minimize Create Writer

This is an example how to create a writer plugin implementing the ProductWriterPlugIn interface. 
N.B.: Please be aware that classes' name could be modified along the time.

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 Archetype

The 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.:

 

mvn archetype:create

-DarchetypeGroupId=org.esa.nest.maven

-DarchetypeArtifactId=maven-nest-dataio-archetype

-DarchetypeVersion=1.0

-DgroupId=myGroupId

-DartifactId=myArtifactId

-Dversion=myVersion

-DpackageName=myPackageName

where

  • myGroupId will become the groupId of the generated POM
  • myArtifactId will become the artifactId of the generated POM and the NEST module's symbolicName.
  • myVersion will become the version of the generated POM and NEST module. Defaults to 1.0-SNAPSHOT.
  • myPackageName will become the source package name. Defaults to the value of myGroupId
    .

Please also refer to the documentation of the Maven 2 Archetype Plugin.

Example

mvn archetype:create
-DarchetypeGroupId=org.esa.nest.maven
-DarchetypeArtifactId=maven-nest-dataio-archetype
-DarchetypeVersion=1.0
-DgroupId=org.esa.nest -DartifactId=nest-sar-io

Publishing a Writer

Writer 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 Actions

In 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>

Minimize Resources

The European Space Agency is making NEST available free of charge to the user community