gov.nasa.pds.tools.dict.parser
Class DictionaryParser

java.lang.Object
  extended by gov.nasa.pds.tools.dict.parser.DictionaryParser

public class DictionaryParser
extends Object

This class provides the means to parse a PDS compliant data dictionary. The Dictionary created can be used for validation purposes or just to examine the contents programmatically. To parse a dictionary use the following:

Dictionary dictionary = DictionaryParser.parse(new URL(""));

If you wanted to turn of aliases the alternative parse method could be used:

Dictionary dictionary = DictionaryParser.parse(new URL(""), false);

Version:
$Revision: 7374 $
Author:
pramirez, jagander

Field Summary
protected static DictIdentifier ALIAS_LIST_ID
           
protected static DictIdentifier DATA_TYPE_ID
           
protected static DictIdentifier DESCRIPTION_ID
           
protected static DictIdentifier ELEMENT_ALIASES_ID
           
protected static DictIdentifier ELEMENT_DEFINITION_ID
           
protected static DictIdentifier GENERIC_OBJECT_ID
           
protected static DictIdentifier MAX_LENGTH_ID
           
protected static DictIdentifier MAXIMUM_ID
           
protected static DictIdentifier MIN_LENGTH_ID
           
protected static DictIdentifier MINIMUM_ID
           
protected static DictIdentifier NAME_ID
           
protected static DictIdentifier OBJECT_ALIASES_ID
           
protected static DictIdentifier OBJECT_TYPE_ID
           
protected static DictIdentifier OPTIONAL_ELEMENTS_ID
           
protected static DictIdentifier OPTIONAL_OBJECTS_ID
           
protected static DictIdentifier REQUIRED_ELEMENTS_ID
           
protected static DictIdentifier REQUIRED_OBJECTS_ID
           
protected static DictIdentifier SPECIFIC_OBJECT_ID
           
protected static DictIdentifier STATUS_TYPE_ID
           
protected static DictIdentifier UNIT_LIST_ID
           
protected static DictIdentifier UNIT_SEQUENCE_ID
           
protected static DictIdentifier UNITS_ID
           
protected static DictIdentifier VALUE_TYPE_ID
           
protected static DictIdentifier VALUES_ID
           
 
Constructor Summary
DictionaryParser()
           
 
Method Summary
static void main(String[] args)
           
static Dictionary parse(File file)
           
static Dictionary parse(File file, boolean aliasing)
           
static Dictionary parse(File file, boolean aliasing, boolean storeProblems)
           
static Dictionary parse(InputStream input, Dictionary dictionary, boolean aliasing, boolean storeProblems)
          Parses a URL that is compliant with the PDS Data Dictionary document and formulates a Dictionary with a flag to indicated whether aliases should be read in.
static Dictionary parse(URL url)
          Parses a URL that is compliant with the PDS Data Dictionary document and formulates a Dictionary with aliases turned off.
static Dictionary parse(URL url, boolean aliasing)
           
static Dictionary parse(URL url, boolean aliasing, boolean storeProblems)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OBJECT_TYPE_ID

protected static final DictIdentifier OBJECT_TYPE_ID

DESCRIPTION_ID

protected static final DictIdentifier DESCRIPTION_ID

STATUS_TYPE_ID

protected static final DictIdentifier STATUS_TYPE_ID

REQUIRED_OBJECTS_ID

protected static final DictIdentifier REQUIRED_OBJECTS_ID

OPTIONAL_OBJECTS_ID

protected static final DictIdentifier OPTIONAL_OBJECTS_ID

REQUIRED_ELEMENTS_ID

protected static final DictIdentifier REQUIRED_ELEMENTS_ID

OPTIONAL_ELEMENTS_ID

protected static final DictIdentifier OPTIONAL_ELEMENTS_ID

NAME_ID

protected static final DictIdentifier NAME_ID

DATA_TYPE_ID

protected static final DictIdentifier DATA_TYPE_ID

UNITS_ID

protected static final DictIdentifier UNITS_ID

MIN_LENGTH_ID

protected static final DictIdentifier MIN_LENGTH_ID

MAX_LENGTH_ID

protected static final DictIdentifier MAX_LENGTH_ID

VALUES_ID

protected static final DictIdentifier VALUES_ID

VALUE_TYPE_ID

protected static final DictIdentifier VALUE_TYPE_ID

MINIMUM_ID

protected static final DictIdentifier MINIMUM_ID

MAXIMUM_ID

protected static final DictIdentifier MAXIMUM_ID

UNIT_SEQUENCE_ID

protected static final DictIdentifier UNIT_SEQUENCE_ID

OBJECT_ALIASES_ID

protected static final DictIdentifier OBJECT_ALIASES_ID

ELEMENT_ALIASES_ID

protected static final DictIdentifier ELEMENT_ALIASES_ID

ALIAS_LIST_ID

protected static final DictIdentifier ALIAS_LIST_ID

UNIT_LIST_ID

protected static final DictIdentifier UNIT_LIST_ID

GENERIC_OBJECT_ID

protected static final DictIdentifier GENERIC_OBJECT_ID

SPECIFIC_OBJECT_ID

protected static final DictIdentifier SPECIFIC_OBJECT_ID

ELEMENT_DEFINITION_ID

protected static final DictIdentifier ELEMENT_DEFINITION_ID
Constructor Detail

DictionaryParser

public DictionaryParser()
Method Detail

parse

public static Dictionary parse(URL url)
                        throws LabelParserException,
                               IOException
Parses a URL that is compliant with the PDS Data Dictionary document and formulates a Dictionary with aliases turned off.

Parameters:
url - points to the location of the dictionary
Returns:
a data dictionary with element, group, and object definitions
Throws:
LabelParserException - thrown when dictionary can not be parsed correctly
IOException - thrown when dictionary can not be accessed

parse

public static Dictionary parse(URL url,
                               boolean aliasing)
                        throws LabelParserException,
                               IOException
Throws:
LabelParserException
IOException

parse

public static Dictionary parse(URL url,
                               boolean aliasing,
                               boolean storeProblems)
                        throws LabelParserException,
                               IOException
Throws:
LabelParserException
IOException

parse

public static Dictionary parse(File file)
                        throws LabelParserException,
                               IOException
Throws:
LabelParserException
IOException

parse

public static Dictionary parse(File file,
                               boolean aliasing)
                        throws LabelParserException,
                               IOException
Throws:
LabelParserException
IOException

parse

public static Dictionary parse(File file,
                               boolean aliasing,
                               boolean storeProblems)
                        throws LabelParserException,
                               IOException
Throws:
LabelParserException
IOException

parse

public static Dictionary parse(InputStream input,
                               Dictionary dictionary,
                               boolean aliasing,
                               boolean storeProblems)
                        throws LabelParserException,
                               IOException
Parses a URL that is compliant with the PDS Data Dictionary document and formulates a Dictionary with a flag to indicated whether aliases should be read in.

Parameters:
input - input stream to dictionary
aliasing - indicates if aliases should be read in
Returns:
a data dictionary with element, group, and object definitions
Throws:
LabelParserException - thrown when dictionary can not be parsed correctly
IOException - thrown when dictionary can not be accessed

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2005-2011 Planetary Data System. All Rights Reserved.