Difference between revisions of "GeoNetwork library"

From Gcube Wiki
Jump to: navigation, search
(Configuration)
(Default Configuration)
Line 114: Line 114:
 
====Default Configuration====
 
====Default Configuration====
 
By default, the library uses implementation of the class ''org.gcube.spatial.data.geonetwork.configuration.DefaultConfiguration''. This implementation is based on the [[ic-client]], and relies on the gCube information system in order to get the needed parameters to interact with geonetwork REST interface.
 
By default, the library uses implementation of the class ''org.gcube.spatial.data.geonetwork.configuration.DefaultConfiguration''. This implementation is based on the [[ic-client]], and relies on the gCube information system in order to get the needed parameters to interact with geonetwork REST interface.
The convention used by this implementation are the one stated in [[https://gcube.wiki.gcube-system.org/gcube/index.php/RuntimeResourceClassification#Geo_Network_Runtime_Resource GeoNetwork Runtime Resource Definition]].
+
The convention used by this implementation are the one stated in [https://gcube.wiki.gcube-system.org/gcube/index.php/RuntimeResourceClassification#Geo_Network_Runtime_Resource GeoNetwork Runtime Resource Definition].
  
 
==Example Code==
 
==Example Code==

Revision as of 16:21, 23 May 2013

A library to interact with GeoNetwork's REST Interface to publish/modify/delete and search for Metadata.The library is designed on top of geoserver-manager library, developed by GeoSolutions. Metadata objects managed by the library are compliant to standard specification ISO 19115:2003/19139. Default configuration of the library interacts exploits Featherweight Stack functionalities to discover geonetwork available in the infrastructure.

Module overview

The library is distributed as the artifact

<dependency>
  <groupId>org.gcube.spatial.data</groupId>
  <artifactId>geonetwork</artifactId>
  <version>...</version>
</dependency>


ISO 19115:2003 metadata compliance

Metadata objects used by the libraries implement GeoAPI interfaces, which are fully compliant to ISO 19115:2003/19139. Current implementation is based on GeoToolkit Metadata module.

Dependecies

The library declares these dependecies to external third parties artifacts

<dependency>
        <groupId>it.geosolutions</groupId>
	<artifactId>geonetwork-manager</artifactId>
	<version>1.1</version>
</dependency>
<dependency>
	<groupId>org.geotoolkit</groupId>
	<artifactId>geotk-metadata</artifactId>
	<version>3.20-geoapi-3.0</version>
</dependency>
<dependency>
	<groupId>org.w3c</groupId>
	<artifactId>dom</artifactId>
	<version>2.3.0-jaxb-1.0.6</version>
</dependency>
<dependency>
	<groupId>org.geotoolkit</groupId>
	<artifactId>geotk-referencing</artifactId>
	<version>3.20-geoapi-3.0</version>
</dependency>

Using the library

The library acts as a wrapper to the functionalities exposed by the geonetwork-manager library. The methods offered by the library are splitted in two different interfaces :

  • org.gcube.spatial.data.geonetwork.GeoNetworkReader : declares methods to access metadata stored in geonetwork
  • org.gcube.spatial.data.geonetwork.GeoNetworkPublisher : extends GeoNetworkReader, and declares methods to publish/update/delete metadata in geonetwork

The class org.gcube.spatial.data.geonetwork.GeoNetwork offers two static members to obtain implementations of the above interfaces :

  • public static GeoNetworkPublisher get() throws Exception : uses the current settings of ConfigurationManager to get a Configuration implementation.
  • public static GeoNetworkPublisher get(Configuration config) : uses the passed Configuration implementation.

See #Configuration to get more information.

Security

From version 2.0.0 the library refers to the guidelines stated in GeoNetwork administration in particular :

  • applications should publish their metadata in the current scope group
  • applications should publish as <SCOPE_PUBLIC_USER> metadata with scope visibility
  • applications should publish as <SCOPE_PRIVATE_USER> metadata with private (per user) visibility

Login

Unless the client calls the method public void login(LoginLevel level)throws AuthorizationException declared by GeoNetworkReader interface, all calls to geonetwork are sent without login thus :

  • queries return only public metadata
  • access to metadata with no public access will fail
  • methods which change the current geonetwork state will fail

The following LoginLevels are defined :

  • DEFAULT
  • SCOPE
  • PRIVATE

see #Configuration for details on how the related credentials are used.

Configuration

The geonetwork library relies on instances of org.gcube.spatial.data.geonetwork.configuration.Configuration interface in order to retrieve needed information to interact with geonetwork REST interface. The following snippets show how to set Configuration implementation to be used by the library :

Implicit Configuration

Using ConfigurationManager to set the class implementing Configuration. Every following instantiation of GeoNetworkReader will use a new object of the given Configuration implementing class.

//MyConfiguration must implement org.gcube.spatial.data.geonetwork.configuration.Configuration
ConfigurationManager.setConfiguration(MyConfiguration.class);
...
GeoNetworkReader    reader1=GeoNetwork.get();
...
GeoNetworkReader    reader2=GeoNetwork.get();
...
GeoNetworkPublisher publisher1=GeoNetwork.get();

Explicit Configuration

Explicit Configuration implementation declaration.

//MyConfiguration must implement org.gcube.spatial.data.geonetwork.configuration.Configuration
GeoNetworkReader    reader1=GeoNetwork.get(new MyConfiguration());
...
GeoNetworkReader    reader2=GeoNetwork.get(new MyConfiguration());
...
GeoNetworkPublisher publisher1=GeoNetwork.get(new MyConfiguration());

Default Configuration

By default, the library uses implementation of the class org.gcube.spatial.data.geonetwork.configuration.DefaultConfiguration. This implementation is based on the ic-client, and relies on the gCube information system in order to get the needed parameters to interact with geonetwork REST interface. The convention used by this implementation are the one stated in GeoNetwork Runtime Resource Definition.

Example Code