uk.ac.starlink.gbin
Class GbinMetadataReader

java.lang.Object
  extended by uk.ac.starlink.gbin.GbinMetadataReader

public class GbinMetadataReader
extends Object

Provides methods for extracting metadata from a GBIN file.

Since:
13 Aug 2014

Method Summary
static GbinMeta attemptReadMetadata(Object gbinReaderObj)
          Attempts to read a metadata object from a GbinReader object.
static String convertNameToArchiveFormat(String gbinName)
          Converts a java-type name to an archive-type (SQL-friendly) name.
static String getGaiaTableName(Class<?> objClazz)
          Returns the "official" table name for a GBIN file containing objects of a given class.
static GaiaTableMetadata getTableMetadata(String gaiaTableName)
          Returns a metadata object containing information about an "official" known Gaia table.
static void main(String[] args)
          Attempts to read metadata from the GBIN file named on the command line and writes the description to stdout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

attemptReadMetadata

public static GbinMeta attemptReadMetadata(Object gbinReaderObj)
                                    throws Throwable
Attempts to read a metadata object from a GbinReader object.

NOTE: this method is effectively destructive: if you read metadata from a GbinReader you cannot then go on to read data records from it.

A wide range of exceptions and errors may be thrown by this method, since it involves reflection all sorts of things can go wrong.

Parameters:
gbinReaderObj - object implementing gaia.cu1.tools.dal.gbin.GbinReader
Returns:
metadata if possible
Throws:
Throwable

getGaiaTableName

public static String getGaiaTableName(Class<?> objClazz)
Returns the "official" table name for a GBIN file containing objects of a given class.

Parameters:
objClazz - class of the objects that form the records of a GBIN file
Returns:
gaia table name, or null if not known
See Also:
getTableMetadata(java.lang.String)

convertNameToArchiveFormat

public static String convertNameToArchiveFormat(String gbinName)
Converts a java-type name to an archive-type (SQL-friendly) name.

Parameters:
gbinName - java-type name
Returns:
archive-type name

getTableMetadata

public static GaiaTableMetadata getTableMetadata(String gaiaTableName)
Returns a metadata object containing information about an "official" known Gaia table. The table name may be obtained by calling getGaiaTableName(java.lang.Class). The returned metadata is extracted from datamodel classes on the classpath, by an instance of gaia.cu9.tools.documentationexport.MetadataReader.

Parameters:
gaiaTableName - "official" gaia table name
Returns:
metadata object, or null if table name not known

main

public static void main(String[] args)
                 throws Throwable
Attempts to read metadata from the GBIN file named on the command line and writes the description to stdout.

Throws:
Throwable

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.