|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tm4j.topicmap.utils.XTMBuilder
Implementation of the TopicMapBuilder interface which supports the parsing of topic map information from XML files conforming to the XTM 1.0 DTD and specification.
Properties supported by this implementation are:
Field Summary | |
static java.lang.String |
DEFAULT_BASE_URL
|
protected org.apache.xml.resolver.tools.CatalogResolver |
m_catalogResolver
|
static java.lang.String |
OPTION_FAIL_ON_VETO
A convenience constant defining the property name http://www.tm4j.org/tm4j/xtmbuilder/failonveto If this property is set to true, then the parser will throw an exception if a PropertyVetoException prevents the creation or update of a TopicMapObject. |
static java.lang.String |
OPTION_FULL_XML_BASE
A constant defining the property name http://www.tm4j.org/tm4j/xtmbuilder/fullxmlbase If this property is set to true, then xml:base attributes will be honoured wherever they appear in the XTM file If this property is set to false, then only the xml:base attribute on the root topicMap element will be honoured. |
static java.lang.String |
OPTION_USE_DEFAULT_CATALOG
A constant defining the property http://www.tm4j.org/tm4j/xtmbuilder/usedefaultcatalog. |
static java.lang.String |
OPTION_VALIDATION
A convenience constant defining the property name http://www.tm4j.org/tm4j/xtmbuilder/validation If this property is true, the builder will attempt to locate and use a validating XML parser. |
Fields inherited from interface org.tm4j.topicmap.utils.TopicMapHandler |
REFTYPE_RESOURCE, REFTYPE_SUBJECTINDICATOR, REFTYPE_TOPIC |
Fields inherited from interface org.tm4j.topicmap.utils.TopicMapBuilder |
OPTION_ADDED_THEMES |
Constructor Summary | |
XTMBuilder()
Creates an unitialised XTMBuilder for later initialisation by a call to the build() method. |
|
XTMBuilder(TopicMap baseTM)
Creates an XTMBuilder using the provided TopicMap, which is used to obtain the TopicMapFactory and LocatorFactory. |
|
XTMBuilder(TopicMapFactory factory,
LocatorFactory locFactory)
Creates an XTMBuilder using the provided TopicMapFactory and LocatorFactory. |
|
XTMBuilder(TopicMap baseTM,
Locator mergeMapLocator)
Creates an XTMBuilder using the provided TopicMap, which is used to obtain the TopicMapFactory and LocatorFactory. |
Method Summary | |
protected void |
addThemes(ScopedObject sco)
|
protected java.lang.String |
assignID(Locator loc)
|
protected java.lang.String |
assignID(Locator loc,
java.lang.String id)
|
protected java.lang.String |
assignID(java.lang.String elementID)
|
void |
baseNameString(java.lang.String id,
java.lang.String value)
Indicates a base name string event. |
void |
build(org.xml.sax.InputSource src,
Locator srcLoc,
TopicMap tm)
|
void |
build(java.io.InputStream src,
Locator srcLoc,
TopicMap tm)
Build topic map constructs from the specified source stream. |
void |
build(java.io.InputStream source,
Locator base,
TopicMap existing,
Topic[] addedThemes)
Build topic map constructs from the specified source stream. |
void |
build(java.io.InputStream src,
Locator srcLoc,
TopicMap tm,
TopicMapProvider provider)
Build topic map constructs from the specified source stream. |
void |
build(java.io.InputStream src,
Locator srcLoc,
TopicMap tm,
TopicMapProvider provider,
Topic[] addedThemes)
|
void |
build(java.io.InputStream src,
TopicMap tm,
TopicMapProvider provider)
|
void |
build(java.io.Reader src,
Locator srcLoc,
TopicMap tm)
Build topic map constructs from the specified Reader. |
void |
build(java.io.Reader source,
Locator base,
TopicMap existing,
Topic[] addedThemes)
|
void |
build(java.io.Reader src,
Locator srcLoc,
TopicMap tm,
TopicMapProvider provider)
Build topic map constructs from the specified Reader. |
void |
build(java.io.Reader source,
Locator base,
TopicMap existing,
TopicMapProvider provider,
Topic[] addedThemes)
|
void |
endAssociation()
Indicates the end of an association event. |
void |
endBaseName()
Indicates the end of a topic base name event. |
void |
endInstanceOf()
Indicates the end of an instanceOf event. |
void |
endMember()
Indicates the end of an association member event. |
void |
endMergeMap()
Indicates the end of a mergeMap event. |
void |
endOccurrence()
Indicates the end of an occurrence event. |
void |
endParameters()
Indicates the end of a variant parameters event. |
void |
endRoleSpec()
Indicates the end of an association role specification event. |
void |
endScope()
Indicates the end of a scope event. |
void |
endSubjectIdentity()
Indicates the end of a subject identity event. |
void |
endTopic()
Indicates the start of a topic event. |
void |
endTopicMap()
Indicates the end of a topic map event. |
void |
endVariant()
Indicates the end of a base name variant event. |
void |
endVariantName()
Indicates the end of a variant name event. |
protected java.lang.String |
expandID(java.lang.String id)
|
protected Locator |
expandRef(Locator loc,
Locator baseLoc)
|
protected java.lang.String |
expandRef(java.lang.String ref)
|
protected java.lang.String |
expandResourceID(java.lang.String id)
|
java.lang.String |
generateID()
|
org.apache.xml.resolver.tools.CatalogResolver |
getCatalogResolver()
Return the CatalogResolver used by this XTMBuilder, null if not available. |
Topic |
getTopicBySourceLocator(Locator resourceLocator)
|
Topic |
getTopicBySubject(Locator resource)
|
Topic |
getTopicBySubjectIndicator(java.lang.String indicator)
|
TopicMap |
getTopicMap()
Return the TopicMap built by this XTMBuilder. |
protected void |
init()
|
boolean |
isSupportedProperty(java.lang.String propertyName)
Determines whether or not a specific property is supported by the TopicMapBuilder implementation. |
protected int |
peekPurpose()
|
protected int |
popPurpose()
|
protected void |
pushPurpose(int purpose)
|
void |
ref(java.lang.String id,
int refType,
Locator refValue,
Locator base)
Indicates a reference event. |
void |
ref(java.lang.String id,
int refType,
java.lang.String refValue,
java.lang.String xmlBase)
Indicates a reference event. |
void |
reportWarning(java.lang.String msg)
|
void |
resourceData(java.lang.String id,
java.lang.String data)
Indicates a resource data event. |
protected Locator |
resourceLocatorForID(java.lang.String id)
|
protected void |
scopeClassInstanceAssociation(Topic classTopic,
Topic instTopic)
|
void |
setAddedThemes(Topic[] addedThemes)
Sets the collection of Topics to be added to the scope of every Association, Occurrence and BaseName built by this class. |
void |
setProperty(java.lang.String propertyName,
java.lang.Object value)
Set a configuration property for the builder which will be applied to the processing of subsequent invocations of the build()
method. |
protected void |
setResourceID(TopicMapObject tmo,
java.lang.String id)
|
void |
setResourceURL(java.net.URL url)
Deprecated. From 0.6.0 use setSourceLocator(org.tm4j.net.Locator) instead. |
void |
setSourceLocator(Locator loc)
Set the Locator of the built TopicMap to loc. |
void |
startAssociation(java.lang.String id)
Indicates the start of an association event. |
void |
startBaseName(java.lang.String id)
Indicates the start of a topic base name event. |
void |
startInstanceOf(java.lang.String id)
Indicates the start of an instanceOf event. |
void |
startMember(java.lang.String id)
Indicates the start of an association member event. |
void |
startMergeMap(java.lang.String id,
java.lang.String mergeMapURI,
java.lang.String base)
Indicates the start of a mergeMap event. |
void |
startOccurrence(java.lang.String id)
Indicates the start of an occurrence event. |
void |
startParameters(java.lang.String id)
Indicates the start of a variant parameters event. |
void |
startRoleSpec(java.lang.String id)
Indicates the start of an association role specification event. |
void |
startScope(java.lang.String id)
Indicates the start of a scope event. |
void |
startSubjectIdentity(java.lang.String id)
Indicates the start of a subject identity event. |
void |
startTopic(java.lang.String id)
Indicates the start of a topic event. |
void |
startTopicMap(java.lang.String id,
java.lang.String xmlBase)
Indicates the start of a topic map event. |
void |
startVariant(java.lang.String id)
Indicates the start of a base name variant event. |
void |
startVariantName(java.lang.String id)
Indicates the start of a variant name event. |
void |
variantName(java.lang.String id,
java.lang.String value)
Indicates a variant name event. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String OPTION_VALIDATION
false
public static final java.lang.String OPTION_FAIL_ON_VETO
true
public static final java.lang.String DEFAULT_BASE_URL
public static final java.lang.String OPTION_FULL_XML_BASE
false
, matching the XTM 1.0 specification.
public static final java.lang.String OPTION_USE_DEFAULT_CATALOG
protected org.apache.xml.resolver.tools.CatalogResolver m_catalogResolver
Constructor Detail |
public XTMBuilder()
public XTMBuilder(TopicMapFactory factory, LocatorFactory locFactory)
public XTMBuilder(TopicMap baseTM)
public XTMBuilder(TopicMap baseTM, Locator mergeMapLocator)
Method Detail |
protected void init()
public boolean isSupportedProperty(java.lang.String propertyName)
TopicMapBuilder
isSupportedProperty
in interface TopicMapBuilder
propertyName
- the name of the property to check for support.
true
if the property is supported and false
otherwise.public void setProperty(java.lang.String propertyName, java.lang.Object value) throws BuilderPropertyNotRecognizedException, BuilderPropertyInvalidException
TopicMapBuilder
build()
method. A typical use of this method will be to set parser options prior
to parsing the input stream.
setProperty
in interface TopicMapBuilder
propertyName
- the name of the property to be set. See inidividual
implementation classes for details of which properties
are recognized by each implementation.value
- the value to be applied to the property.
BuilderPropertyInvalidException
- if value
falls outside
the supported range of values for the specified property.
BuilderPropertyNotRecognizedException
- if propertyName
specifies a property which is not supported by the
TopicMapBuilder implementation.public void build(java.io.InputStream src, TopicMap tm, TopicMapProvider provider) throws java.io.IOException, LocatorFactoryException, TopicMapProcessingException, java.beans.PropertyVetoException, TopicMapProviderException
java.io.IOException
LocatorFactoryException
TopicMapProcessingException
java.beans.PropertyVetoException
TopicMapProviderException
public void build(java.io.InputStream src, Locator srcLoc, TopicMap tm, TopicMapProvider provider) throws java.io.IOException, LocatorFactoryException, java.beans.PropertyVetoException, TopicMapProcessingException, TopicMapProviderException
TopicMapBuilder
build
in interface TopicMapBuilder
src
- the source stream to be parsed.srcLoc
- the base address of the source being parsedtm
- the topic map for parsed objects to be added to.provider
- the provider to be used for retrieving any merged topic maps.
java.io.IOException
LocatorFactoryException
java.beans.PropertyVetoException
TopicMapProcessingException
TopicMapProviderException
public void build(java.io.Reader src, Locator srcLoc, TopicMap tm, TopicMapProvider provider) throws java.io.IOException, LocatorFactoryException, java.beans.PropertyVetoException, TopicMapProcessingException, TopicMapProviderException
TopicMapBuilder
build
in interface TopicMapBuilder
src
- the Reader to be parsed.srcLoc
- the base address of the source being parsedtm
- the topic map for parsed objects to be added to.provider
- the provider to be used for retrieving any merged topic maps.
java.io.IOException
LocatorFactoryException
java.beans.PropertyVetoException
TopicMapProcessingException
TopicMapProviderException
public void build(java.io.InputStream src, Locator srcLoc, TopicMap tm) throws java.io.IOException, LocatorFactoryException, TopicMapProcessingException, java.beans.PropertyVetoException, TopicMapProviderException
TopicMapBuilder
build
in interface TopicMapBuilder
src
- the source stream to be parsed.srcLoc
- the base address of the source being parsedtm
- the topic map for parsed objects to be added to.
java.io.IOException
LocatorFactoryException
TopicMapProcessingException
java.beans.PropertyVetoException
TopicMapProviderException
public void build(java.io.Reader src, Locator srcLoc, TopicMap tm) throws java.io.IOException, LocatorFactoryException, TopicMapProcessingException, java.beans.PropertyVetoException, TopicMapProviderException
TopicMapBuilder
build
in interface TopicMapBuilder
src
- the Reader to be parsed.srcLoc
- the base address of the source being parsedtm
- the topic map for parsed objects to be added to.
java.io.IOException
LocatorFactoryException
TopicMapProcessingException
java.beans.PropertyVetoException
TopicMapProviderException
public void build(org.xml.sax.InputSource src, Locator srcLoc, TopicMap tm) throws java.io.IOException, LocatorFactoryException, java.beans.PropertyVetoException, TopicMapProcessingException, TopicMapProviderException
java.io.IOException
LocatorFactoryException
java.beans.PropertyVetoException
TopicMapProcessingException
TopicMapProviderException
public TopicMap getTopicMap()
public org.apache.xml.resolver.tools.CatalogResolver getCatalogResolver()
public void setSourceLocator(Locator loc)
public void setResourceURL(java.net.URL url)
setSourceLocator(org.tm4j.net.Locator)
instead.
public void startTopicMap(java.lang.String id, java.lang.String xmlBase) throws TopicMapProcessingException
startTopicMap
in interface TopicMapHandler
TopicMapProcessingException
public void endTopicMap() throws TopicMapProcessingException
endTopicMap
in interface TopicMapHandler
TopicMapProcessingException
public void startTopic(java.lang.String id) throws TopicMapProcessingException
startTopic
in interface TopicMapHandler
TopicMapProcessingException
public void endTopic() throws TopicMapProcessingException
endTopic
in interface TopicMapHandler
TopicMapProcessingException
protected void pushPurpose(int purpose)
protected int peekPurpose()
protected int popPurpose()
public void startInstanceOf(java.lang.String id) throws TopicMapProcessingException
startInstanceOf
in interface TopicMapHandler
TopicMapProcessingException
public void endInstanceOf() throws TopicMapProcessingException
endInstanceOf
in interface TopicMapHandler
TopicMapProcessingException
public void startSubjectIdentity(java.lang.String id) throws TopicMapProcessingException
startSubjectIdentity
in interface TopicMapHandler
TopicMapProcessingException
public void endSubjectIdentity() throws TopicMapProcessingException
endSubjectIdentity
in interface TopicMapHandler
TopicMapProcessingException
public void startBaseName(java.lang.String id) throws TopicMapProcessingException
startBaseName
in interface TopicMapHandler
TopicMapProcessingException
public void endBaseName() throws TopicMapProcessingException
endBaseName
in interface TopicMapHandler
TopicMapProcessingException
public void startOccurrence(java.lang.String id) throws TopicMapProcessingException
startOccurrence
in interface TopicMapHandler
TopicMapProcessingException
public void endOccurrence() throws TopicMapProcessingException
endOccurrence
in interface TopicMapHandler
TopicMapProcessingException
public void startAssociation(java.lang.String id) throws TopicMapProcessingException
startAssociation
in interface TopicMapHandler
TopicMapProcessingException
public void endAssociation() throws TopicMapProcessingException
endAssociation
in interface TopicMapHandler
TopicMapProcessingException
public void startMember(java.lang.String id) throws TopicMapProcessingException
startMember
in interface TopicMapHandler
TopicMapProcessingException
public void endMember() throws TopicMapProcessingException
endMember
in interface TopicMapHandler
TopicMapProcessingException
public void startRoleSpec(java.lang.String id) throws TopicMapProcessingException
startRoleSpec
in interface TopicMapHandler
TopicMapProcessingException
public void endRoleSpec() throws TopicMapProcessingException
endRoleSpec
in interface TopicMapHandler
TopicMapProcessingException
public void startMergeMap(java.lang.String id, java.lang.String mergeMapURI, java.lang.String base) throws TopicMapProcessingException
startMergeMap
in interface TopicMapHandler
TopicMapProcessingException
public void endMergeMap() throws TopicMapProcessingException
endMergeMap
in interface TopicMapHandler
TopicMapProcessingException
public void ref(java.lang.String id, int refType, java.lang.String refValue, java.lang.String xmlBase) throws TopicMapProcessingException
ref
in interface TopicMapHandler
TopicMapProcessingException
public void ref(java.lang.String id, int refType, Locator refValue, Locator base) throws TopicMapProcessingException, LocatorFactoryException
id
- the value of the id attribute on the referencing elementrefType
- the type of referencerefValue
- the referenced addressbase
- the base locator currently in force.
TopicMapProcessingException
LocatorFactoryException
public void resourceData(java.lang.String id, java.lang.String data) throws TopicMapProcessingException
resourceData
in interface TopicMapHandler
TopicMapProcessingException
public void startScope(java.lang.String id) throws TopicMapProcessingException
startScope
in interface TopicMapHandler
TopicMapProcessingException
public void endScope() throws TopicMapProcessingException
endScope
in interface TopicMapHandler
TopicMapProcessingException
public void baseNameString(java.lang.String id, java.lang.String value) throws TopicMapProcessingException
baseNameString
in interface TopicMapHandler
TopicMapProcessingException
public void startVariant(java.lang.String id) throws TopicMapProcessingException
startVariant
in interface TopicMapHandler
TopicMapProcessingException
public void endVariant() throws TopicMapProcessingException
endVariant
in interface TopicMapHandler
TopicMapProcessingException
public void startParameters(java.lang.String id) throws TopicMapProcessingException
startParameters
in interface TopicMapHandler
TopicMapProcessingException
public void endParameters() throws TopicMapProcessingException
endParameters
in interface TopicMapHandler
TopicMapProcessingException
public void startVariantName(java.lang.String id) throws TopicMapProcessingException
startVariantName
in interface TopicMapHandler
TopicMapProcessingException
public void endVariantName() throws TopicMapProcessingException
endVariantName
in interface TopicMapHandler
TopicMapProcessingException
public void variantName(java.lang.String id, java.lang.String value) throws TopicMapProcessingException
TopicMapProcessingException
protected java.lang.String assignID(Locator loc, java.lang.String id)
protected java.lang.String assignID(Locator loc)
protected java.lang.String assignID(java.lang.String elementID)
protected void setResourceID(TopicMapObject tmo, java.lang.String id) throws DuplicateResourceLocatorException
DuplicateResourceLocatorException
protected Locator resourceLocatorForID(java.lang.String id)
protected java.lang.String expandResourceID(java.lang.String id)
protected java.lang.String expandID(java.lang.String id)
protected java.lang.String expandRef(java.lang.String ref) throws TopicMapProcessingException
TopicMapProcessingException
protected Locator expandRef(Locator loc, Locator baseLoc) throws TopicMapProcessingException
TopicMapProcessingException
public Topic getTopicBySourceLocator(Locator resourceLocator) throws TopicMapProcessingException
TopicMapProcessingException
public Topic getTopicBySubject(Locator resource) throws TopicMapProcessingException
TopicMapProcessingException
public Topic getTopicBySubjectIndicator(java.lang.String indicator) throws TopicMapProcessingException, LocatorFactoryException
TopicMapProcessingException
LocatorFactoryException
protected void addThemes(ScopedObject sco) throws TopicMapProcessingException
TopicMapProcessingException
protected void scopeClassInstanceAssociation(Topic classTopic, Topic instTopic) throws TopicMapProcessingException
TopicMapProcessingException
public void reportWarning(java.lang.String msg)
public java.lang.String generateID()
public void build(java.io.InputStream source, Locator base, TopicMap existing, Topic[] addedThemes) throws java.io.IOException, LocatorFactoryException, TopicMapProcessingException, java.beans.PropertyVetoException, TopicMapProviderException
TopicMapBuilder
build
in interface TopicMapBuilder
source
- the source stream to be parsed.base
- the base address of the source being parsedexisting
- the topic map for parsed objects to be added to.
java.io.IOException
LocatorFactoryException
TopicMapProcessingException
java.beans.PropertyVetoException
TopicMapProviderException
public void build(java.io.Reader source, Locator base, TopicMap existing, Topic[] addedThemes) throws java.io.IOException, LocatorFactoryException, TopicMapProcessingException, java.beans.PropertyVetoException, TopicMapProviderException
build
in interface TopicMapBuilder
source
- base
- existing
- addedThemes
-
java.io.IOException
LocatorFactoryException
TopicMapProcessingException
java.beans.PropertyVetoException
TopicMapProviderException
public void setAddedThemes(Topic[] addedThemes)
addedThemes
- an array of the Topics to be added.
The topics in this array may be from the TopicMap
instance being populated by the builder or from
another TopicMap. Any Topic from another TopicMap
will first be copied into the TopicMap being
populated by the builder. The copy will be a
shallow copy (only unscoped names, subject address
and subject indicators are copied).public void build(java.io.InputStream src, Locator srcLoc, TopicMap tm, TopicMapProvider provider, Topic[] addedThemes) throws java.io.IOException, LocatorFactoryException, TopicMapProcessingException, java.beans.PropertyVetoException, TopicMapProviderException
build
in interface TopicMapBuilder
java.io.IOException
LocatorFactoryException
TopicMapProcessingException
java.beans.PropertyVetoException
TopicMapProviderException
public void build(java.io.Reader source, Locator base, TopicMap existing, TopicMapProvider provider, Topic[] addedThemes) throws java.io.IOException, LocatorFactoryException, TopicMapProcessingException, java.beans.PropertyVetoException, TopicMapProviderException
build
in interface TopicMapBuilder
java.io.IOException
LocatorFactoryException
TopicMapProcessingException
java.beans.PropertyVetoException
TopicMapProviderException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |