org.ceryle.tm
Class TopicMapImporter

java.lang.Object
  extended by org.ceryle.tm.TopicMapImporter

public class TopicMapImporter
extends Object

Defines a simple importer for providing a TM4J TopicMap from either an LTM or XTM source, using the memory backend.

Since:
JDK1.3
Version:
$Id: TopicMapImporter.java,v 3.2 2007-06-15 12:09:33 altheim Exp $
Author:
Murray Altheim
See Also:
TopicMap, TopicMapProvider

Field Summary
static String defaultCatalogPath
          The default relative pathname for the XML Catalog file.
static String idPrefix
          IDGenerator prefix for all auto-created IDs.
static String PROVIDER_CLASS
          The classname for the provider, the TM4J memory provider backend.
static boolean useCatalogResolver
          When true (the default), uses an XML Catalog resolver for entity resolution.
static boolean useCeryleLTMProcessor
          When true, uses Ceryle's LTM processor rather than TM4J's.
 
Constructor Summary
TopicMapImporter()
          Default constructor.
TopicMapImporter(IDGenerator idg)
          Constructor with a pre-supplied IDGenerator idg.
 
Method Summary
 void clear()
          Clears the TopicMapImporter, removing any previously-processed TopicMap objects from its TopicMapProvider.
 org.apache.xml.resolver.tools.CatalogResolver getCatalogResolver()
          Returns the CatalogResolver if useCatalogResolver is true, otherwise null.
 org.tmapi.core.TopicMap getTMAPITopicMap(Locator locator)
          Returns a TMAPI TopicMap provided with the Locator locator.
 TopicMap getTopicMap(Locator locator)
          Returns a TopicMap provided its source Locator locator.
 TopicMap getTopicMap(TypedInputSource source)
          Returns a TopicMap provided a TypedInputSource source indicating its source location.
protected  org.tmapi.core.TopicMapSystem getTopicMapSystem()
           
 boolean removeTopicMap(Locator loc)
          Permanently removes the TopicMap having the base locator loc from the provider.
 Locator returnLocator(String uri)
          Returns a Locator whose address is uri, and is not associated with any TopicMap object.
 void setCatalogResolver(org.apache.xml.resolver.tools.CatalogResolver resolver)
          Sets the CatalogResolver used by this TopicMapImporter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROVIDER_CLASS

public static String PROVIDER_CLASS
The classname for the provider, the TM4J memory provider backend.


idPrefix

public static String idPrefix
IDGenerator prefix for all auto-created IDs.


useCatalogResolver

public static boolean useCatalogResolver
When true (the default), uses an XML Catalog resolver for entity resolution.


useCeryleLTMProcessor

public static boolean useCeryleLTMProcessor
When true, uses Ceryle's LTM processor rather than TM4J's. Default true.


defaultCatalogPath

public static String defaultCatalogPath
The default relative pathname for the XML Catalog file. The default value is "resource/ceryle.xcat".

Constructor Detail

TopicMapImporter

public TopicMapImporter()
                 throws TopicMapException
Default constructor.

Throws:
TopicMapException - if unable to create the provider

TopicMapImporter

public TopicMapImporter(IDGenerator idg)
                 throws TopicMapException
Constructor with a pre-supplied IDGenerator idg.

Throws:
TopicMapException - if unable to create the provider
Method Detail

getTopicMap

public TopicMap getTopicMap(Locator locator)
                     throws TopicMapException
Returns a TopicMap provided its source Locator locator.

Throws:
TopicMapException
See Also:
getTopicMap(TypedInputSource)

getTopicMap

public TopicMap getTopicMap(TypedInputSource source)
                     throws TopicMapException
Returns a TopicMap provided a TypedInputSource source indicating its source location.

If the TopicMap is already available from the provider, it is returned. Otherwise, parses a Topic Map document (in XTM or LTM notation), returning the TopicMap object.

Throws:
TopicMapException
See Also:
getTopicMap(Locator)

removeTopicMap

public boolean removeTopicMap(Locator loc)
                       throws TopicMapException
Permanently removes the TopicMap having the base locator loc from the provider.

Returns:
true if the TopicMap was removed.
Throws:
TopicMapException

clear

public void clear()
Clears the TopicMapImporter, removing any previously-processed TopicMap objects from its TopicMapProvider. If an error occurs while clearing the TopicMapProvider, it is closed, nullified, and garbage collection is suggested.


returnLocator

public Locator returnLocator(String uri)
                      throws TopicMapException
Returns a Locator whose address is uri, and is not associated with any TopicMap object.

Parameters:
uri - the String used as the locator address
Throws:
TopicMapException

getTMAPITopicMap

public org.tmapi.core.TopicMap getTMAPITopicMap(Locator locator)
                                         throws TopicMapException
Returns a TMAPI TopicMap provided with the Locator locator. This will return an existing TopicMap from the provider, otherwise a new TopicMap is created from the provided source.

Throws:
TopicMapException

getTopicMapSystem

protected org.tmapi.core.TopicMapSystem getTopicMapSystem()

getCatalogResolver

public org.apache.xml.resolver.tools.CatalogResolver getCatalogResolver()
Returns the CatalogResolver if useCatalogResolver is true, otherwise null.


setCatalogResolver

public void setCatalogResolver(org.apache.xml.resolver.tools.CatalogResolver resolver)
Sets the CatalogResolver used by this TopicMapImporter. If not set, the default resolver will be used (if useCatalogResolver is true).



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.