Skip navigation links

Package org.apache.sis.metadata

Root package for various metadata implementations.

See: Description

Package org.apache.sis.metadata Description

Root package for various metadata implementations.
Many metadata standards exist, including Dublin core, ISO 19115 and the Image I/O metadata defined in javax​.imageio​.metadata. The SIS 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 keep in mind in the discussion below.
How Metadata are defined
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 SIS by the Metadata­Standard​.ISO_19115 constant. Other standards are defined as well, for example the Metadata­Standard​.ISO_19123 constant stands for the standards defined by the interfaces in the org​.opengis​.coverage 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 SIS in org​.apache​.sis​.metadata​.iso. The sub-packages hierarchy is the same, and the names of implementation classes are the name of the implemented interfaces prefixed with Abstract or Default.


How Metadata are handled
Metadata objects in SIS are mostly containers: they provide getter and setter methods for manipulating the values associated to properties (for example the title property of a Citation object), but provide few logic. The package org​.apache​.sis​.metadata​.iso and its sub-packages are the main examples of such containers.

In addition, the metadata modules provide support methods 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) every time their type is known at compile time, and fallback on the reflection technic when the type is known only at runtime.

Using Java reflection, a metadata can be viewed in many different ways:

How Metadata are marshalled
The ISO 19139 standard defines how ISO 19115 metadata shall be represented in XML. The SIS library supports XML marshalling and unmarshalling with JAXB annotations.

Only the implementation classes defined in the org​.apache​.sis​.metadata​.iso packages and sub-packages are annotated for JAXB marshalling. If a metadata is implemented by an other package (for example org​.apache​.sis​.metadata​.sql), then it shall be converted to an annotated class before to be marshalled. All SIS 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 Marshaller­Pool, otherwise some XML outputs may be incomplete (missing namespaces for instance). The XML class provides convenience methods for this purpose.


Defined in the sis-metadata module

Skip navigation links

Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.