org.tm4j.topicmap
Interface TopicMapManager


public interface TopicMapManager

This interface is implemented by classes which provide aggregation services for TopicMapProviders. One or more TopicMapProviders may be registered with the TopicMapManager under a given id and applications may then access any of the TopicMaps handled by these TopicMapProviders.

Author:
Kal Ahmed (kal@techquila.com), Harald Kuhn, harald_kuhn at users.sourceforge.net

Method Summary
 TopicMap addTopicMap(TopicMapSource source, java.lang.String providerId)
          Adds a TopicMap from the given source to the given Provider
 TopicMap copyTopicMap(TopicMap map, java.lang.String providerId)
          Creates a copy of the TopicMap inside the given provider
 void deregisterProvider(java.lang.String id)
          Closes the Provider with the specified id
 void dropTopicMap(TopicMap map)
          Removes the TopicMap from the Manager and the underlaying Provider
 TopicMapProvider getProvider(java.lang.String id)
          Returns the Provider with the specified id or throws a TopicMapProviderException if this id does not exist
 java.util.Map getProviders()
          Returns a Map containing all registered Providers with their ids as the keys
 TopicMap getTopicMap(Locator baseLoc)
          Gets the TopicMap generated from the resource specified by locator
 java.util.Collection getTopicMapBaseLocators()
          Gets a collection of the base locator of all of the topic maps currently available through the registered TopicMapProviders.
 java.util.Collection getTopicMaps()
          Gets a collection of all of the topic maps which are currently available through the registered TopicMapProviders
 void mergeTopicMaps(TopicMap one, TopicMap second)
          Merges the two TopicMaps
 void moveTopicMap(TopicMap map, java.lang.String providerId)
          Moves the TopicMap into the given Provider
 TopicMapProvider registerProvider(java.lang.String id, java.lang.String providerFactoryClassName, java.util.Properties props)
          Registers a new provider with the manager.
 void storeTopicMap(java.io.File file, TopicMap map)
          Stores the TopicMap into the given File This method is a shortcut for using the TopicMapSerializer
 

Method Detail

getTopicMap

public TopicMap getTopicMap(Locator baseLoc)
                     throws TopicMapProviderException
Gets the TopicMap generated from the resource specified by locator

Parameters:
baseLoc - The base locator of the topic map resource to be retrieved.
Returns:
the TopicMap object with the specified base locator or null if no such topic map can be found.
Throws:
TopicMapProviderException - if the underlying TopicMapProvider implementation throws an error while accessing the specified topic map.

getTopicMaps

public java.util.Collection getTopicMaps()
                                  throws TopicMapProviderException
Gets a collection of all of the topic maps which are currently available through the registered TopicMapProviders

Throws:
TopicMapProviderException - if one of the underlying TopicMapProvider implementations throws an error while accessing the list of managed topic maps.

getTopicMapBaseLocators

public java.util.Collection getTopicMapBaseLocators()
Gets a collection of the base locator of all of the topic maps currently available through the registered TopicMapProviders.

Returns:
An unmodifiable Collection of Locator objects

storeTopicMap

public void storeTopicMap(java.io.File file,
                          TopicMap map)
                   throws TopicMapProcessingException
Stores the TopicMap into the given File This method is a shortcut for using the TopicMapSerializer

Parameters:
file - the File the TopicMap is stored into
map - the TopicMap to be stored
Throws:
TopicMapProcessingException

mergeTopicMaps

public void mergeTopicMaps(TopicMap one,
                           TopicMap second)
                    throws TopicMapProviderException
Merges the two TopicMaps

Parameters:
one - the TopicMap into which another TM is merged
Throws:
TopicMapProviderException

dropTopicMap

public void dropTopicMap(TopicMap map)
                  throws TopicMapProviderException
Removes the TopicMap from the Manager and the underlaying Provider

Parameters:
map - the TopicMap to be removed
Throws:
TopicMapProviderException

addTopicMap

public TopicMap addTopicMap(TopicMapSource source,
                            java.lang.String providerId)
                     throws TopicMapProviderException
Adds a TopicMap from the given source to the given Provider

Parameters:
source -
providerId -
Returns:
the new TopicMap
Throws:
TopicMapProviderException

copyTopicMap

public TopicMap copyTopicMap(TopicMap map,
                             java.lang.String providerId)
                      throws TopicMapProviderException
Creates a copy of the TopicMap inside the given provider

Parameters:
map - the TopicMap to copy
providerId - the id of the TopicMapProvider where the copy will be created
Returns:
the new copy of the TopicMap
Throws:
TopicMapProviderException

moveTopicMap

public void moveTopicMap(TopicMap map,
                         java.lang.String providerId)
                  throws TopicMapProviderException
Moves the TopicMap into the given Provider

Parameters:
map -
providerId -
Throws:
TopicMapProviderException

registerProvider

public TopicMapProvider registerProvider(java.lang.String id,
                                         java.lang.String providerFactoryClassName,
                                         java.util.Properties props)
                                  throws TopicMapProviderException
Registers a new provider with the manager.

Parameters:
id - the id of the new Provider to be registered under
providerFactoryClassName - The name of the TopicMapProviderFactory class which will create the new TopicMapProvider.
props - The properties to be used to construct the new TopicMapProvider
Returns:
The registered TopicMapProvider implementation
Throws:
TopicMapProviderException

deregisterProvider

public void deregisterProvider(java.lang.String id)
                        throws TopicMapProviderException
Closes the Provider with the specified id

Parameters:
id - the id of the provider to be closed
Throws:
TopicMapProviderException - a TopicMapProviderException if the id does not exist or in case of Problems with closing the Provider

getProvider

public TopicMapProvider getProvider(java.lang.String id)
                             throws TopicMapProviderException
Returns the Provider with the specified id or throws a TopicMapProviderException if this id does not exist

Parameters:
id - the unique Id of the Provider
Returns:
the TopicMapProvider registered for this Id
Throws:
TopicMapProviderException - thrown if no provider is registered for this id

getProviders

public java.util.Map getProviders()
Returns a Map containing all registered Providers with their ids as the keys

Returns:
a Map containing the Providers as values and the ids as keys