Package net.ontopia.topicmaps.impl.utils
Class AbstractTopicMapReader
- java.lang.Object
-
- net.ontopia.topicmaps.impl.utils.AbstractTopicMapReader
-
- All Implemented Interfaces:
TopicMapReaderIF
- Direct Known Subclasses:
CTMTopicMapReader
,JTMTopicMapReader
,LTMTopicMapReader
public abstract class AbstractTopicMapReader extends Object implements TopicMapReaderIF
INTERNAL: Common abstract superclass for topic map readers.
-
-
Field Summary
Fields Modifier and Type Field Description protected LocatorIF
base_address
protected Reader
reader
protected TopicMapStoreFactoryIF
store_factory
protected InputStream
stream
protected URL
url
-
Constructor Summary
Constructors Constructor Description AbstractTopicMapReader(File file)
AbstractTopicMapReader(InputStream stream, LocatorIF base_address)
AbstractTopicMapReader(Reader reader, LocatorIF base_address)
AbstractTopicMapReader(URL url)
AbstractTopicMapReader(URL url, LocatorIF base_address)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description LocatorIF
getBaseAddress()
PUBLIC: Gets the top level base address of the input source.Reader
getReader()
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 Reader
makeReader(InputStream stream, String encoding, EncodingSnifferIF sniffer)
protected Reader
makeReader(String encoding, EncodingSnifferIF sniffer)
static Reader
makeReader(LocatorIF locator, EncodingSnifferIF sniffer)
TopicMapIF
read()
PUBLIC: Reads the next topic map available from some implicit, implementation dependent source.protected abstract TopicMapIF
read(TopicMapStoreFactoryIF store_factory)
Collection<TopicMapIF>
readAll()
PUBLIC: Reads all the topic map available from some implicit, implementation dependent source.protected Collection<TopicMapIF>
readAll(TopicMapStoreFactoryIF store_factory)
void
setAdditionalProperties(Map<String,Object> properties)
Default implemenentation does not accept any additional propertiesvoid
setBaseAddress(LocatorIF base_address)
PUBLIC: Sets the top level base address of the input source.void
setReader(Reader reader)
void
setStoreFactory(TopicMapStoreFactoryIF store_factory)
PUBLIC: Sets the store factory which will be used to create stores.
-
-
-
Field Detail
-
url
protected URL url
-
reader
protected Reader reader
-
stream
protected InputStream stream
-
base_address
protected LocatorIF base_address
-
store_factory
protected TopicMapStoreFactoryIF store_factory
-
-
Constructor Detail
-
AbstractTopicMapReader
public AbstractTopicMapReader(URL url) throws MalformedURLException
- Throws:
MalformedURLException
-
AbstractTopicMapReader
public AbstractTopicMapReader(InputStream stream, LocatorIF base_address)
-
AbstractTopicMapReader
public AbstractTopicMapReader(File file) throws MalformedURLException
- Throws:
MalformedURLException
-
-
Method Detail
-
getReader
public Reader getReader()
-
setReader
public void setReader(Reader 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 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 interfaceTopicMapReaderIF
- 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:
IOException
- Thrown if reading the source fails.
-
readAll
public Collection<TopicMapIF> readAll() throws 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 interfaceTopicMapReaderIF
- Returns:
- A collection containing all the topic maps read from the source; objects implementing TopicMapIF.
- Throws:
IOException
- Thrown if reading the source fails.
-
readAll
protected Collection<TopicMapIF> readAll(TopicMapStoreFactoryIF store_factory) throws IOException
- Throws:
IOException
-
read
protected abstract TopicMapIF read(TopicMapStoreFactoryIF store_factory) throws IOException
- Throws:
IOException
-
setAdditionalProperties
public void setAdditionalProperties(Map<String,Object> properties)
Default implemenentation does not accept any additional properties- Specified by:
setAdditionalProperties
in interfaceTopicMapReaderIF
- Parameters:
properties
-
-
importInto
public void importInto(TopicMapIF topicmap) throws IOException
Description copied from interface:TopicMapReaderIF
PUBLIC: Imports an implicitly designated topic map into the given topic map.- Specified by:
importInto
in interfaceTopicMapReaderIF
- Parameters:
topicmap
- The topic map into which the import will be done; an object implementing TopicMapIF.- Throws:
IOException
-
makeReader
public static Reader makeReader(InputStream stream, String encoding, EncodingSnifferIF sniffer) throws IOException
- Throws:
IOException
-
makeReader
public static Reader makeReader(LocatorIF locator, EncodingSnifferIF sniffer) throws IOException
- Throws:
IOException
-
makeReader
protected Reader makeReader(String encoding, EncodingSnifferIF sniffer) throws IOException
- Throws:
IOException
-
-