net.ontopia.topicmaps.impl.utils
Class AbstractTopicMapReader

java.lang.Object
  extended by net.ontopia.topicmaps.impl.utils.AbstractTopicMapReader
All Implemented Interfaces:
TopicMapImporterIF, TopicMapReaderIF
Direct Known Subclasses:
CTMTopicMapReader, JTMTopicMapReader, LTMTopicMapReader

public abstract class AbstractTopicMapReader
extends java.lang.Object
implements TopicMapReaderIF, TopicMapImporterIF

INTERNAL: Common abstract superclass for topic map readers.


Field Summary
protected  LocatorIF base_address
           
protected  org.xml.sax.InputSource source
           
protected  TopicMapStoreFactoryIF store_factory
           
 
Constructor Summary
AbstractTopicMapReader()
           
 
Method Summary
 LocatorIF getBaseAddress()
          PUBLIC: Gets the top level base address of the input source.
 org.xml.sax.InputSource getInputSource()
          PUBLIC: Gets the SAX input source used by the reader.
 TopicMapStoreFactoryIF getStoreFactory()
          PUBLIC: Gets the store factory which will be used to create stores.
 void importInto(TopicMapIF topicmap)
          PUBLIC: Imports an implicitly designated topic map into the given topic map.
static java.io.Reader makeReader(org.xml.sax.InputSource source, EncodingSnifferIF sniffer)
          INTERNAL: Creates a correctly configured Reader from a SAX InputSource object.
static java.io.Reader makeReader(java.io.InputStream stream, java.lang.String encoding, EncodingSnifferIF sniffer)
           
 TopicMapIF read()
          PUBLIC: Reads the next topic map available from some implicit, implementation dependent source.
protected abstract  TopicMapIF read(TopicMapStoreFactoryIF store_factory)
           
 java.util.Collection<TopicMapIF> readAll()
          PUBLIC: Reads all the topic map available from some implicit, implementation dependent source.
protected  java.util.Collection<TopicMapIF> readAll(TopicMapStoreFactoryIF store_factory)
           
 void setBaseAddress(LocatorIF base_address)
          PUBLIC: Sets the top level base address of the input source.
 void setInputSource(org.xml.sax.InputSource source)
          PUBLIC: Sets the SAX input source used by the reader.
 void setStoreFactory(TopicMapStoreFactoryIF store_factory)
          PUBLIC: Sets the store factory which will be used to create stores.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected org.xml.sax.InputSource source

base_address

protected LocatorIF base_address

store_factory

protected TopicMapStoreFactoryIF store_factory
Constructor Detail

AbstractTopicMapReader

public AbstractTopicMapReader()
Method Detail

getInputSource

public org.xml.sax.InputSource getInputSource()
PUBLIC: Gets the SAX input source used by the reader.


setInputSource

public void setInputSource(org.xml.sax.InputSource source)
PUBLIC: Sets the SAX input source used by the reader.


getBaseAddress

public LocatorIF getBaseAddress()
PUBLIC: Gets the top level base address of the input source.


setBaseAddress

public void setBaseAddress(LocatorIF base_address)
PUBLIC: Sets the top level base address of the input source.

The top level base address is used to resolve relative addresses during input source processing. This property need not be set if the input source specifies the base address.


getStoreFactory

public TopicMapStoreFactoryIF getStoreFactory()
PUBLIC: Gets the store factory which will be used to create stores.


setStoreFactory

public void setStoreFactory(TopicMapStoreFactoryIF store_factory)
PUBLIC: Sets the store factory which will be used to create stores.

Default: InMemoryStoreFactory

Parameters:
store_factory - The store factory to use. If the parameter is null the default store factory will be used.

read

public TopicMapIF read()
                throws java.io.IOException
Description copied from interface: TopicMapReaderIF
PUBLIC: Reads the next topic map available from some implicit, implementation dependent source.

A topic map source may contain multiple topic maps. The read method returns the next topic map that is available from that source. null is returned when there are no more topic maps available. In a sense this is iterator-like behaviour.

Specified by:
read in interface TopicMapReaderIF
Returns:
The next topic map read from the source; an object implementing TopicMapIF. null is returned when there are no more topic maps available from the source.
Throws:
java.io.IOException - Thrown if reading the source fails.

readAll

public java.util.Collection<TopicMapIF> readAll()
                                         throws java.io.IOException
Description copied from interface: TopicMapReaderIF
PUBLIC: Reads all the topic map available from some implicit, implementation dependent source.

A topic map source may contain multiple topic maps. The readAll method returns a collection contain all the topic maps available from the source.

Specified by:
readAll in interface TopicMapReaderIF
Returns:
A collection containing all the topic maps read from the source; objects implementing TopicMapIF.
Throws:
java.io.IOException - Thrown if reading the source fails.

readAll

protected java.util.Collection<TopicMapIF> readAll(TopicMapStoreFactoryIF store_factory)
                                            throws java.io.IOException
Throws:
java.io.IOException

read

protected abstract TopicMapIF read(TopicMapStoreFactoryIF store_factory)
                            throws java.io.IOException
Throws:
java.io.IOException

importInto

public void importInto(TopicMapIF topicmap)
                throws java.io.IOException
Description copied from interface: TopicMapImporterIF
PUBLIC: Imports an implicitly designated topic map into the given topic map.

Specified by:
importInto in interface TopicMapImporterIF
Parameters:
topicmap - The topic map into which the import will be done; an object implementing TopicMapIF.
Throws:
java.io.IOException

makeReader

public static java.io.Reader makeReader(org.xml.sax.InputSource source,
                                        EncodingSnifferIF sniffer)
                                 throws java.io.IOException
INTERNAL: Creates a correctly configured Reader from a SAX InputSource object.

Throws:
java.io.IOException

makeReader

public static java.io.Reader makeReader(java.io.InputStream stream,
                                        java.lang.String encoding,
                                        EncodingSnifferIF sniffer)
                                 throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2000-2012 Ontopia.