org.geotools.metadata.sql
Class MetadataSource

Object
  extended by MetadataSource

public class MetadataSource
extends Object

A connection to a metadata database. The metadata database can be created using one of the scripts suggested in GeoAPI, for example create.sql. Then, in order to get for example a telephone number, the following code may be used.

 import org.opengis.metadata.citation.Telephone;
 ...
 Connection     connection = ...
 MetadataSource source     = new MetadataSource(connection);
 Telephone      telephone  = (Telephone) source.getEntry(Telephone.class, id);
 
where id is the primary key value for the desired record in the CI_Telephone table.

Since:
2.1
Author:
Touraïvane, Olivier Kartotaroeno (Institut de Recherche pour le Développement), Martin Desruisseaux (IRD)
Module:

Constructor Summary
MetadataSource(Connection connection)
          Creates a new metadata source.
 
Method Summary
 void close()
          Close all connections used in this object.
 Object getEntry(Class type, String identifier)
          Returns an implementation of the specified metadata interface filled with the data referenced by the specified identifier.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataSource

public MetadataSource(Connection connection)
Creates a new metadata source.

Parameters:
connection - The connection to the database.
Method Detail

getEntry

public Object getEntry(Class type,
                       String identifier)
                throws SQLException
Returns an implementation of the specified metadata interface filled with the data referenced by the specified identifier. Alternatively, this method can also returns a CodeList element.

Parameters:
type - The interface to implement (e.g. Citation), or the CodeList.
identifier - The identifier used in order to locate the record for the metadata entity to be created. This is usually the primary key of the record to search for.
Returns:
An implementation of the required interface, or the code list element.
Throws:
SQLException - if a SQL query failed.

close

public void close()
           throws SQLException
Close all connections used in this object.

Throws:
SQLException


Copyright © 1996-2009 Geotools. All Rights Reserved.