Group of modules related to handling metadata. This group contains the core of metadata classes (in geotk-metadata) and various extensions. See the "Modules" links on the left side for information about each individual component.
Many metadata standards exist, including Dublin core, ISO 19115 and the Image I/O metadata defined in javax.imageio.metadata. The Geotk implementation focuses on ISO 19115 (including its ISO 19115-2 extension), but the classes are designed in a way that allow the usage of different standards. This genericity goal should be keept in mind in the discussion below.
A metadata standard is defined by a set of Java interfaces belonging to a specific package and its sub-packages. For example the ISO 19115 standard is defined by the GeoAPI interfaces defined in the org.opengis.metadata package and sub-packages. That standard is identified in Geotk by the MetadataStandard.ISO_19115 constant. Other standards are defined as well, for example the MetadataStandard.ISO_19119 constant stands for the standards defined by the interfaces in the org.opengis.service package and sub-packages.
For each interface, the collection of declared getter methods defines its properties (or attributes). If a @UML annotation is attached to the getter method, the identifier declared in that annotation is taken as the property name. This is typically the name defined by the International Standard from which the interface is derived. Otherwise (if there is no @UML annotation) the property name is inferred from the method name like what the Java Beans framework does.
The implementation classes, if they exist, are defined in different packages than the interfaces. For example the ISO 19115 interfaces, declared in org.opengis.metadata, are implemented by Geotk in org.geotoolkit.metadata.iso. The subpackages hierarchy is the same, and the names of implementation classes are the name of the implemented interfaces prefixed with Abstract or Default.
Notes:
Metadata objects in Geotk are mostly containers: they provide getter and setter methods for manipulating the values associated to properties (for example the title properties of an Citation object), but provide few logic. The package org.geotoolkit.metadata.iso and its sub-packages are the main examples of such containers.
In addition, the metadata modules provide support classes for handling the metadata objects through Java Reflection. This is an approach similar to Java Beans, in that users are encouraged to use directly the API of Plain Old Java objects (actually interfaces) everytime their type is known at compile time, and fallback on the support classes when the type is known only at runtime.
Using Java reflection, a metadata can be viewed in many different ways:
The MetadataStandard class provides various methods returning a view of an arbitrary metadata implementation as a java.util.Map, where the key are the property names and the values are the return values of getter methods. The map is writable if the underlying metadata implementation has setter methods, otherwise attempts to set a value throw an UnsupportedOperationException.
The ISO 19115-2 standard defines metadata for gridded data, which are good candidates for Image I/O metadata with spatial data. The org.geotoolkit.image.io.metadata package provides a framework for converting an ISO metadata like ImageDescription into an IIOMetadata object, and conversely.
The metadata are organized as a tree. For example the Citation metadata contains one or many ResponsibleParty elements, each of them containing a Contact element, which contains a Telephone element, etc. For each node, there is many information that can be displayed in columns:
The current Geotk library provides an indirect way to view metadata in such tree table: create an IIOMetadata view from the metadata, then create a TreeTableModel view from the IIOMetadata. A more direct way may be provided in a future version.
It is possible to etablish the following mapping between metadata and a SQL database:
Using Java reflection, it is possible to generate implementations of the metadata interfaces where each call to a getter method is translated into a SQL query for the above database.
The ISO 19139 standard defines how ISO 19115 metadata shall be represented in XML. The Geotk library supports XML marshalling and unmarshalling with JAXB annotations.
Only the implementation classes defined in the org.geotoolkit.metadata.iso packages are annotated for JAXB marshalling. If a metadata is implemented by an other package (for example org.geotoolkit.metadata.sql), then it shall be converted to an annotated class before to be marshalled. All Geotk annotated classes provide a copy constructor for this purpose. A shallow copy is sufficient; JAXB adapters will convert the elements on-the-fly when needed.
The annotated classes can be given to a JAXB Marshaller. For best results, it shall be a marshaller obtained from the org.geotoolkit.xml.MarshallerPool, otherwise some XML outputs may be incomplete (missing namespaces for instance).