org.eclipse.ohf.stem.definitions.adapters.spatial.geo
Class PlatformLatLongDataProvider

java.lang.Object
  extended by org.eclipse.ohf.stem.definitions.adapters.spatial.geo.PlatformLatLongDataProvider
All Implemented Interfaces:
LatLongDataProvider

public class PlatformLatLongDataProvider
extends java.lang.Object
implements LatLongDataProvider

This class interprets a URI that specifies a file of (i.e., "platform") lat/long data in some format (currently GML).

See Also:
InlineLatLongDataProvider, LatLongProviderAdapter

Nested Class Summary
 class PlatformLatLongDataProvider.GMLDecoder
          This class is a SAX Handler used to process the contents of a GML file specifying latitude/longitude data.
 
Field Summary
 boolean isSampling
          If true then the latitude/longitude points will be sampled and some will be discarded to reduce their number.
static java.lang.String PLATFORM_SCHEME
          This is the scheme for a "platform" data URI that specifies a file that contains lat/long data.
 boolean reportIOExceptions
          If true then I/O Exceptions are logged, otherwise they are ignored.
 int sampleFrequency
          This is the frequency at which the latitude/longitude data points will be sampled.
static java.lang.String SAX_PARSER1
          The class name of the first SAX XML parser to attempt to create if the default cannot be found.
static java.lang.String SAX_PARSER2
          The class name of the second SAX XML parser to attempt to create if the default cannot be found.
 boolean useLowerResolutionLatLongData
          If true then the path to the GML file will be modified to point to a smaller GML file that has a lower resolution.
 
Constructor Summary
PlatformLatLongDataProvider()
          Constructor
 
Method Summary
 java.util.Set<java.lang.String> getIds(org.eclipse.emf.common.util.URI fileURI)
           
 java.util.Set<java.lang.String> getIdsNoWait(org.eclipse.emf.common.util.URI fileURI)
          This method is just like getIds(URI) except that it will return an empty set if the data referenced by the URI has not been read yet.
 LatLong getLatLong(org.eclipse.emf.common.util.URI latlongFileURI)
           
 LatLong getLatLongNoWait(org.eclipse.emf.common.util.URI latlongFileURI)
          This method is just like getLatLong(URI) except that it will immediately return an "empty" LatLong instance if the data for the URI has not been retrieved.
static org.xml.sax.XMLReader getSAXParser()
          Try to create a SAX Parser.
static void parseInputStream(java.io.BufferedReader in, org.xml.sax.helpers.DefaultHandler handler)
          Parse the specified input character stream using the specified Handler.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAX_PARSER1

public static final java.lang.String SAX_PARSER1
The class name of the first SAX XML parser to attempt to create if the default cannot be found. Value: org.apache.xerces.parsers.SAXParser

See Also:
Constant Field Values

SAX_PARSER2

public static final java.lang.String SAX_PARSER2
The class name of the second SAX XML parser to attempt to create if the default cannot be found. Value: org.apache.crimson.parser.XMLReaderImpl

See Also:
Constant Field Values

PLATFORM_SCHEME

public static final java.lang.String PLATFORM_SCHEME
This is the scheme for a "platform" data URI that specifies a file that contains lat/long data.

See Also:
Constant Field Values

isSampling

public boolean isSampling
If true then the latitude/longitude points will be sampled and some will be discarded to reduce their number.


sampleFrequency

public int sampleFrequency
This is the frequency at which the latitude/longitude data points will be sampled. A value of "1" means every point will be included, a value of "2" means that every 2nd point will be included. The first and last data points are always included.


reportIOExceptions

public boolean reportIOExceptions
If true then I/O Exceptions are logged, otherwise they are ignored.


useLowerResolutionLatLongData

public boolean useLowerResolutionLatLongData
If true then the path to the GML file will be modified to point to a smaller GML file that has a lower resolution.

Constructor Detail

PlatformLatLongDataProvider

public PlatformLatLongDataProvider()
Constructor

Method Detail

getLatLong

public LatLong getLatLong(org.eclipse.emf.common.util.URI latlongFileURI)
Specified by:
getLatLong in interface LatLongDataProvider
Parameters:
latlongFileURI -
Returns:
the lat/long values

getLatLongNoWait

public LatLong getLatLongNoWait(org.eclipse.emf.common.util.URI latlongFileURI)
This method is just like getLatLong(URI) except that it will immediately return an "empty" LatLong instance if the data for the URI has not been retrieved. It will also start a seperate job to retrieve that data and will return it when that job completes successfully.

Specified by:
getLatLongNoWait in interface LatLongDataProvider
Parameters:
latlongFileURI -
Returns:
the lat/long values

getIds

public java.util.Set<java.lang.String> getIds(org.eclipse.emf.common.util.URI fileURI)
Parameters:
fileURI - the uri of a file of latitude/longitude data
Returns:
the identifiers of the latitude/longitude data in the file

getIdsNoWait

public java.util.Set<java.lang.String> getIdsNoWait(org.eclipse.emf.common.util.URI fileURI)
This method is just like getIds(URI) except that it will return an empty set if the data referenced by the URI has not been read yet. It will then cause a seperate job to start that will read that data. A subsequent call, after that job completes successfully, would return a set of ids.

Parameters:
fileURI - the uri of a file of latitude/longitude data
Returns:
the identifiers of the latitude/longitude data in the file

getSAXParser

public static org.xml.sax.XMLReader getSAXParser()
Try to create a SAX Parser. The method first attempts to create the default parser. The class name of this parser is assigned to the property "org.xml.sax.driver". This value is defined on the command line that starts the Java interpreter java -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser If it is not successful in finding this parser, it will attempt to create an instance of org.apache.xerces.parsers.SAXParser, if that fails, it will try the parser "org.apache.crimson.parser.XMLReaderImpl. If that fails, it will throw a SimulationException reporting the inability to create a SAX XML Parser.

Returns:
a SAXParser

parseInputStream

public static void parseInputStream(java.io.BufferedReader in,
                                    org.xml.sax.helpers.DefaultHandler handler)
Parse the specified input character stream using the specified Handler. Where the output is stored depends on the handler

Parameters:
in - BufferedReader to read the XML from.
handler - The class that will handle the parsing