org.geotools.xml.gml
Class FCBuffer

Object
  extended by Thread
      extended by FCBuffer
All Implemented Interfaces:
Runnable, FeatureReader<SimpleFeatureType,SimpleFeature>
Direct Known Subclasses:
WFSFeatureReader

public class FCBuffer
extends Thread
implements FeatureReader<SimpleFeatureType,SimpleFeature>

Feature Buffer ... acts as a FeatureReader by making itself as a seperate thread prior starting execution with the SAX Parser.

Author:
dzwiers
Module:

Nested Class Summary
static class FCBuffer.StopException
          DOCUMENT ME!
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  SAXException exception
           
static int FINISH
          Last feature is in the buffer
protected  SimpleFeatureType ft
           
protected static Logger logger
          DOCUMENT ME!
protected  int state
          DOCUMENT ME!
static int STOP
          DOCUMENT ME!
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected FCBuffer(URI document, int capacity, int timeout, SimpleFeatureType ft)
           
 
Method Summary
protected  boolean addFeature(SimpleFeature f)
           Adds a feature to the buffer
 void close()
          Release the underlying resources associated with this stream.
 int getCapacity()
          DOCUMENT ME!
static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document, int capacity)
           The prefered method of using this class, this will return the Feature Reader for the document specified, using the specified buffer capacity.
static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document, int capacity, int timeout)
           
static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document, int capacity, int timeout, SimpleFeatureType ft)
           
static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document, int capacity, SimpleFeatureType ft)
           
 SimpleFeatureType getFeatureType()
          DOCUMENT ME!
 int getInternalState()
           
 int getSize()
          DOCUMENT ME!
 int getTimeout()
          DOCUMENT ME!
 boolean hasNext()
          Query whether this FeatureReader has another Feature.
protected  void initHints(XMLHandlerHints hints)
          Called before parsing the FeatureCollection.
 SimpleFeature next()
          Reads the next Feature in the FeatureReader.
 SimpleFeature peek()
           
 void resetTimer()
           
 void run()
           
 
Methods inherited from class Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FINISH

public static final int FINISH
Last feature is in the buffer

See Also:
Constant Field Values

STOP

public static final int STOP
DOCUMENT ME!

See Also:
Constant Field Values

logger

protected static Logger logger
DOCUMENT ME!


state

protected int state
DOCUMENT ME!


exception

protected SAXException exception

ft

protected SimpleFeatureType ft
Constructor Detail

FCBuffer

protected FCBuffer(URI document,
                   int capacity,
                   int timeout,
                   SimpleFeatureType ft)
Parameters:
document -
capacity -
timeout -
ft - Nullable
Method Detail

getSize

public int getSize()
DOCUMENT ME!

Returns:
The buffer size

getCapacity

public int getCapacity()
DOCUMENT ME!

Returns:
The buffer capacity

getTimeout

public int getTimeout()
DOCUMENT ME!

Returns:
The buffer capacity

addFeature

protected boolean addFeature(SimpleFeature f)

Adds a feature to the buffer

Parameters:
f - Feature to add
Returns:
false if unable to add the feature

getFeatureReader

public static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document,
                                                                              int capacity)
                                                                       throws SAXException

The prefered method of using this class, this will return the Feature Reader for the document specified, using the specified buffer capacity.

Parameters:
document - URL to parse
capacity -
Throws:
SAXException

getFeatureReader

public static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document,
                                                                              int capacity,
                                                                              SimpleFeatureType ft)
                                                                       throws SAXException
Throws:
SAXException

getFeatureReader

public static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document,
                                                                              int capacity,
                                                                              int timeout)
                                                                       throws SAXException
Throws:
SAXException

getFeatureReader

public static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document,
                                                                              int capacity,
                                                                              int timeout,
                                                                              SimpleFeatureType ft)
                                                                       throws SAXException
Throws:
SAXException

getFeatureType

public SimpleFeatureType getFeatureType()
DOCUMENT ME!

Specified by:
getFeatureType in interface FeatureReader<SimpleFeatureType,SimpleFeature>
Returns:
DOCUMENT ME!
See Also:
FeatureReader.getFeatureType()

next

public SimpleFeature next()
                   throws IOException,
                          NoSuchElementException
Description copied from interface: FeatureReader
Reads the next Feature in the FeatureReader.

Specified by:
next in interface FeatureReader<SimpleFeatureType,SimpleFeature>
Returns:
The next feature in the reader.
Throws:
IOException - If an error occurs reading the Feature.
NoSuchElementException - If there are no more Features in the Reader.
See Also:
FeatureReader.next()

peek

public SimpleFeature peek()
                   throws IOException,
                          NoSuchElementException
Throws:
IOException
NoSuchElementException
See Also:
FeatureReader.next()

hasNext

public boolean hasNext()
                throws IOException
Description copied from interface: FeatureReader
Query whether this FeatureReader has another Feature.

Specified by:
hasNext in interface FeatureReader<SimpleFeatureType,SimpleFeature>
Returns:
True if there are more Features to be read. In other words, true if calls to next would return a feature rather than throwing an exception.
Throws:
IOException - If an error occurs determining if there are more Features.
See Also:
FeatureReader.hasNext()

close

public void close()
Description copied from interface: FeatureReader
Release the underlying resources associated with this stream.

Specified by:
close in interface FeatureReader<SimpleFeatureType,SimpleFeature>
See Also:
FeatureReader.close()

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread
See Also:
Runnable.run()

initHints

protected void initHints(XMLHandlerHints hints)
Called before parsing the FeatureCollection. Subclasses may override to set their custom hints.


getInternalState

public int getInternalState()

resetTimer

public void resetTimer()


Copyright © 1996-2009 Geotools. All Rights Reserved.