Minimize Create Reader

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

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

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

Minimize Resources

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