Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.tm4j.topicmap.memory
Class TopicMapProviderImpl  view TopicMapProviderImpl download TopicMapProviderImpl.java

java.lang.Object
  extended byorg.tm4j.topicmap.TopicMapProviderBase
      extended byorg.tm4j.topicmap.memory.TopicMapProviderImpl
All Implemented Interfaces:
org.tm4j.topicmap.TopicMapProvider

public class TopicMapProviderImpl
extends org.tm4j.topicmap.TopicMapProviderBase
implements org.tm4j.topicmap.TopicMapProvider

An implementation of the TopicMapProvider interface which manages topic maps which exist as files accessible via URLs.

This implementation adds one additional member function to the TopicMapProvider interface, addTopicMap(String location) which is called by the associated Factory class to set up each of the topic maps managed by this class.

This class is a dumb implementation which attempts to retrieve and parse each topic map when it is added. Subsequent access are then directed to the cached, in-memory representations of the managed topic maps.

As a result of this implementation, this class is not suitable for managing a large number of file-based topic maps.


Field Summary
(package private)  org.tm4j.net.LocatorFactory m_locFactory
           
(package private)  java.util.Hashtable m_topicmaps
           
 
Fields inherited from class org.tm4j.topicmap.TopicMapProviderBase
m_parser
 
Constructor Summary
(package private) TopicMapProviderImpl()
           
 
Method Summary
 org.tm4j.topicmap.TopicMap addTopicMap(java.io.InputStream src, org.tm4j.net.Locator baseLocator, org.tm4j.topicmap.TopicMap existingTopicMap)
          Imports a topic map in XTM syntax into the data store managed by this TopicMapProvider
 org.tm4j.topicmap.TopicMap addTopicMap(java.io.InputStream src, org.tm4j.net.Locator baseLocator, org.tm4j.topicmap.TopicMap existingTopicMap, org.tm4j.topicmap.utils.TopicMapBuilder builder)
          Imports a topic map in XTM syntax into the data store managed by this TopicMapProvider using the specified builder to parse the input stream.
 org.tm4j.topicmap.TopicMap addTopicMap(java.io.InputStream src, java.net.URL baseURL, org.tm4j.topicmap.TopicMap existingTopicMap)
          Imports a topic map in XTM syntax into the data store managed by this TopicMapProvider
 org.tm4j.topicmap.TopicMap addTopicMap(java.lang.String src)
          A convenience function which attempts to determine if src is a URL or a local file name.
 void close()
          Closes the provider.
 org.tm4j.topicmap.TopicMap createTopicMap(org.tm4j.net.Locator baseLocator)
          Creates a new, empty topic map with the specified locator base.
 org.tm4j.net.LocatorFactory getLocatorFactory()
          Returns the object which may be used to create locator objects in the data store managed by this TopicMapProvider.
 org.tm4j.topicmap.TopicMap getTopicMap(org.tm4j.net.Locator baseLocator)
          Returns the topic map with the specified base URL Returns null if no such topic map is managed by this provider.
 org.tm4j.topicmap.TopicMap getTopicMap(java.lang.String baseURL)
          Returns the topic map with the specified base URL Returns null if no such topic map is managed by this provider.
 java.util.Collection getTopicMapBaseLocators()
          Imports a topic map into the data store, using the /** Returns a collection containing the base Locator of each of the topic maps provided by this TopicMapProvider.
 java.util.Collection getTopicMapBaseURLs()
          Returns a collection of the Locators representing the base addresses of all topic maps managed by this provider.
 void init(java.util.Properties props)
          Sets the runtime properties defined for this TopicMapProvider.
 void removeTopicMap(org.tm4j.topicmap.TopicMap tm)
          Removes the specified topic map from this Provider.
(package private)  void unregisterTopicMap(org.tm4j.net.Locator baseLoc)
           
 
Methods inherited from class org.tm4j.topicmap.TopicMapProviderBase
applyChangeListeners, applyDefaultVetoListeners, initialiseBuilder, isProvidedTopicMap, mergeTopicMap, readTopicMap, readTopicMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tm4j.topicmap.TopicMapProvider
mergeTopicMap
 

Field Detail

m_topicmaps

java.util.Hashtable m_topicmaps

m_locFactory

org.tm4j.net.LocatorFactory m_locFactory
Constructor Detail

TopicMapProviderImpl

TopicMapProviderImpl()
               throws org.tm4j.topicmap.TopicMapProviderException
Method Detail

init

public void init(java.util.Properties props)
          throws org.tm4j.topicmap.TopicMapProviderException
Description copied from interface: org.tm4j.topicmap.TopicMapProvider
Sets the runtime properties defined for this TopicMapProvider. This method will be invoked by the TopicMapProviderFactory when the TopicMapProvider is first created.

Specified by:
init in interface org.tm4j.topicmap.TopicMapProvider

close

public void close()
           throws org.tm4j.topicmap.TopicMapProviderException
Description copied from interface: org.tm4j.topicmap.TopicMapProvider
Closes the provider. After this call, all references to any topic maps or topic map objects provided by this Provider are invalidated. If the Provider has a connection to a persistant store such as a database, connections may be closed.

Specified by:
close in interface org.tm4j.topicmap.TopicMapProvider

getLocatorFactory

public org.tm4j.net.LocatorFactory getLocatorFactory()
Deprecated. From 0.8.0 use TopicMap.getFactory().

Description copied from interface: org.tm4j.topicmap.TopicMapProvider
Returns the object which may be used to create locator objects in the data store managed by this TopicMapProvider.

Specified by:
getLocatorFactory in interface org.tm4j.topicmap.TopicMapProvider

getTopicMap

public org.tm4j.topicmap.TopicMap getTopicMap(java.lang.String baseURL)
Returns the topic map with the specified base URL Returns null if no such topic map is managed by this provider. Note that a topic map's base URL and the source from which it was retrieved may differ as a result of processing the xml:base attribute in the XTM file.


getTopicMap

public org.tm4j.topicmap.TopicMap getTopicMap(org.tm4j.net.Locator baseLocator)
Returns the topic map with the specified base URL Returns null if no such topic map is managed by this provider. Note that a topic map's base URL and the source from which it was retrieved may differ as a result of processing the xml:base attribute in the XTM file.

Specified by:
getTopicMap in interface org.tm4j.topicmap.TopicMapProvider

getTopicMapBaseURLs

public java.util.Collection getTopicMapBaseURLs()
Returns a collection of the Locators representing the base addresses of all topic maps managed by this provider.


getTopicMapBaseLocators

public java.util.Collection getTopicMapBaseLocators()
Description copied from interface: org.tm4j.topicmap.TopicMapProvider
Imports a topic map into the data store, using the /** Returns a collection containing the base Locator of each of the topic maps provided by this TopicMapProvider.

Specified by:
getTopicMapBaseLocators in interface org.tm4j.topicmap.TopicMapProvider

addTopicMap

public org.tm4j.topicmap.TopicMap addTopicMap(java.io.InputStream src,
                                              java.net.URL baseURL,
                                              org.tm4j.topicmap.TopicMap existingTopicMap)
                                       throws org.tm4j.topicmap.TopicMapProviderException
Imports a topic map in XTM syntax into the data store managed by this TopicMapProvider


addTopicMap

public org.tm4j.topicmap.TopicMap addTopicMap(java.io.InputStream src,
                                              org.tm4j.net.Locator baseLocator,
                                              org.tm4j.topicmap.TopicMap existingTopicMap)
                                       throws org.tm4j.topicmap.TopicMapProviderException
Description copied from interface: org.tm4j.topicmap.TopicMapProvider
Imports a topic map in XTM syntax into the data store managed by this TopicMapProvider

Specified by:
addTopicMap in interface org.tm4j.topicmap.TopicMapProvider

addTopicMap

public org.tm4j.topicmap.TopicMap addTopicMap(java.io.InputStream src,
                                              org.tm4j.net.Locator baseLocator,
                                              org.tm4j.topicmap.TopicMap existingTopicMap,
                                              org.tm4j.topicmap.utils.TopicMapBuilder builder)
                                       throws org.tm4j.topicmap.TopicMapProviderException
Description copied from interface: org.tm4j.topicmap.TopicMapProvider
Imports a topic map in XTM syntax into the data store managed by this TopicMapProvider using the specified builder to parse the input stream.

Specified by:
addTopicMap in interface org.tm4j.topicmap.TopicMapProvider

addTopicMap

public org.tm4j.topicmap.TopicMap addTopicMap(java.lang.String src)
                                       throws org.tm4j.topicmap.TopicMapProviderException
A convenience function which attempts to determine if src is a URL or a local file name. In the former case, a connection is opened to the URL and in the latter case, the file is opened. The base URL assigned to the topic map is generated from the source name (either the specified URL or a file URL using the specified file name). This function always creates a new TopicMap (merging is not performed)


createTopicMap

public org.tm4j.topicmap.TopicMap createTopicMap(org.tm4j.net.Locator baseLocator)
                                          throws org.tm4j.topicmap.TopicMapProviderException
Creates a new, empty topic map with the specified locator base.

Specified by:
createTopicMap in interface org.tm4j.topicmap.TopicMapProvider

removeTopicMap

public void removeTopicMap(org.tm4j.topicmap.TopicMap tm)
                    throws org.tm4j.topicmap.TopicMapProviderException
Description copied from interface: org.tm4j.topicmap.TopicMapProvider
Removes the specified topic map from this Provider. If the provider is connected to a persistent store such as a database, this will remove all persistent records of the topic map. If stored in memory, all references to the topic map and its contained objects held by the provider will be freed.

Specified by:
removeTopicMap in interface org.tm4j.topicmap.TopicMapProvider

unregisterTopicMap

void unregisterTopicMap(org.tm4j.net.Locator baseLoc)