Package net.ontopia.topicmaps.entry
Class ResourceTopicMapSource
- java.lang.Object
-
- net.ontopia.topicmaps.entry.ResourceTopicMapSource
-
- All Implemented Interfaces:
AutoCloseable,TopicMapSourceIF
public class ResourceTopicMapSource extends Object implements TopicMapSourceIF
INTERNAL: TopicMapSourceIF that can reference individual topic map documents that contained in the classpath and can be loaded by a ClassLoader. The properties id, title, resourceName, and syntax are the most commonly used.- Since:
- 5.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResourceTopicMapSource.REF_TYPE
-
Field Summary
Fields Modifier and Type Field Description protected LocatorIFbase_addressprotected booleanduplicate_suppressionprotected booleanhiddenprotected Stringidprotected ExternalReferenceHandlerIFref_handlerprotected ResourceTopicMapSource.REF_TYPEref_typeprotected Stringrefidprotected Collection<TopicMapReferenceIF>reflistprotected StringresourceNameprotected Stringsyntaxprotected Stringtitleprotected booleanvalidate
-
Constructor Summary
Constructors Constructor Description ResourceTopicMapSource()INTERNAL: Create a new emptyTopicMapSourceIFinstance.ResourceTopicMapSource(String resourceName)INTERNAL: Create a newTopicMapSourceIFinstance that references a resource that can be located in the classpath.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()PUBLIC: Closes the source by releasing references it holds to e.g.TopicMapReferenceIFcreateTopicMap(String name, String baseAddress)PUBLIC: Creates a new topic map in the underlying source and returns a reference to the created topic map.LocatorIFgetBase()INTERNAL: Gets the base locator of the topic maps retrieved from the source.StringgetBaseAddress()INTERNAL: Gets the base address of the topic maps retrieved from the source.booleangetDuplicateSuppression()INTERNAL: Gets the duplicate suppression flag.ExternalReferenceHandlerIFgetExternalReferenceHandler()INTERNAL: Gets the external reference handler.StringgetId()PUBLIC: Gets the id of the source.StringgetReferenceId()INTERNAL: Gets the id of the topic map reference for this topic map source.Collection<TopicMapReferenceIF>getReferences()PUBLIC: Returns an unmodifiable collection ofTopicMapReferenceIFs found by the topic map source.StringgetResourceName()INTERNAL: Gets the resource name of the source topic map.StringgetSyntax()INTERNAL: Returns the syntax of the document.StringgetTitle()PUBLIC: Gets the title of the source.booleangetValidation()INTERNAL: Returns true if validation is on, false otherwise.voidrefresh()PUBLIC: Refreshes the collection of references.voidsetBase(LocatorIF base_address)INTERNAL: Sets the base locator of the topic maps retrieved from the source.voidsetBaseAddress(String base_address)INTERNAL: Sets the base address of the topic maps retrieved from the source.voidsetDuplicateSuppression(boolean duplicate_suppression)INTERNAL: Sets the duplicate suppression flag.voidsetExternalReferenceHandler(ExternalReferenceHandlerIF ref_handler)INTERNAL: Sets the external reference handler.voidsetId(String id)PUBLIC: Sets the id of the source.voidsetReferenceId(String refid)INTERNAL: Sets the id of the topic map reference for this topic map source.voidsetResourceName(String resourceName)INTERNAL: Sets the resource name of the source topic map.voidsetSyntax(String syntax)INTERNAL: Specifies the syntax of the document.voidsetTitle(String title)PUBLIC: Sets the title of the source.voidsetValidation(boolean validate)INTERNAL: Turn validation of XTM documents according to DTD on or off.booleansupportsCreate()PUBLIC: Returns true if the source supports creating new topic maps with the createTopicMap.booleansupportsDelete()PUBLIC: Returns true if the source supports deleting topic map with the TopicMapReferenceIF.delete() method.
-
-
-
Field Detail
-
id
protected String id
-
refid
protected String refid
-
title
protected String title
-
resourceName
protected String resourceName
-
ref_type
protected ResourceTopicMapSource.REF_TYPE ref_type
-
syntax
protected String syntax
-
hidden
protected boolean hidden
-
base_address
protected LocatorIF base_address
-
duplicate_suppression
protected boolean duplicate_suppression
-
validate
protected boolean validate
-
ref_handler
protected ExternalReferenceHandlerIF ref_handler
-
reflist
protected Collection<TopicMapReferenceIF> reflist
-
-
Constructor Detail
-
ResourceTopicMapSource
public ResourceTopicMapSource()
INTERNAL: Create a new emptyTopicMapSourceIFinstance.
-
ResourceTopicMapSource
public ResourceTopicMapSource(String resourceName)
INTERNAL: Create a newTopicMapSourceIFinstance that references a resource that can be located in the classpath. An example for a valid resource name is 'net/ontopia/topicmaps/examples/ItalianOpera.ltm'.- Parameters:
resourceName- the name of the topic map resource.
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:TopicMapSourceIFPUBLIC: Gets the id of the source.- Specified by:
getIdin interfaceTopicMapSourceIF
-
setId
public void setId(String id)
Description copied from interface:TopicMapSourceIFPUBLIC: Sets the id of the source. Note that this method is intended for use when the source is used in a TopicMapRepositoryIF. The source should throw anUnsupportedOperationExceptionif it does not support setting the id.- Specified by:
setIdin interfaceTopicMapSourceIF
-
getTitle
public String getTitle()
Description copied from interface:TopicMapSourceIFPUBLIC: Gets the title of the source.- Specified by:
getTitlein interfaceTopicMapSourceIF
-
setTitle
public void setTitle(String title)
Description copied from interface:TopicMapSourceIFPUBLIC: Sets the title of the source.- Specified by:
setTitlein interfaceTopicMapSourceIF
-
getReferenceId
public String getReferenceId()
INTERNAL: Gets the id of the topic map reference for this topic map source.
-
setReferenceId
public void setReferenceId(String refid)
INTERNAL: Sets the id of the topic map reference for this topic map source.
-
getSyntax
public String getSyntax()
INTERNAL: Returns the syntax of the document.
-
setSyntax
public void setSyntax(String syntax)
INTERNAL: Specifies the syntax of the document. This property will be used to ensure that the topic map syntax is correctly recognized. The supported syntaxes are 'XTM', 'LTM', 'RDF' and 'N3'. If the syntax is not specified the class will attempt to guess it by looking at the address suffix.
-
getResourceName
public String getResourceName()
INTERNAL: Gets the resource name of the source topic map.
-
setResourceName
public void setResourceName(String resourceName)
INTERNAL: Sets the resource name of the source topic map.
-
getBase
public LocatorIF getBase()
INTERNAL: Gets the base locator of the topic maps retrieved from the source.
-
setBase
public void setBase(LocatorIF base_address)
INTERNAL: Sets the base locator of the topic maps retrieved from the source.
-
getBaseAddress
public String getBaseAddress()
INTERNAL: Gets the base address of the topic maps retrieved from the source. The notation is assumed to be 'URI'.
-
setBaseAddress
public void setBaseAddress(String base_address)
INTERNAL: Sets the base address of the topic maps retrieved from the source. The notation is assumed to be 'URI'.
-
getDuplicateSuppression
public boolean getDuplicateSuppression()
INTERNAL: Gets the duplicate suppression flag. If the flag is true duplicate suppression is to be performed when loading the topic maps.
-
setDuplicateSuppression
public void setDuplicateSuppression(boolean duplicate_suppression)
INTERNAL: Sets the duplicate suppression flag. If the flag is true duplicate suppression is to be performed when loading the topic maps.
-
setValidation
public void setValidation(boolean validate)
INTERNAL: Turn validation of XTM documents according to DTD on or off. The validation checks if the documents read follow the DTD, and will abort import if they do not.- Parameters:
validate- Will validate if true, will not if false.
-
getValidation
public boolean getValidation()
INTERNAL: Returns true if validation is on, false otherwise.
-
setExternalReferenceHandler
public void setExternalReferenceHandler(ExternalReferenceHandlerIF ref_handler)
INTERNAL: Sets the external reference handler.
-
getExternalReferenceHandler
public ExternalReferenceHandlerIF getExternalReferenceHandler()
INTERNAL: Gets the external reference handler. The reference handler will receive notifications on references to external topics and topic maps.
-
getReferences
public Collection<TopicMapReferenceIF> getReferences()
Description copied from interface:TopicMapSourceIFPUBLIC: Returns an unmodifiable collection ofTopicMapReferenceIFs found by the topic map source.- Specified by:
getReferencesin interfaceTopicMapSourceIF
-
refresh
public void refresh()
Description copied from interface:TopicMapSourceIFPUBLIC: Refreshes the collection of references. This lets the source look at its underlying data source to reflect any changes made since the last refresh.- Specified by:
refreshin interfaceTopicMapSourceIF
-
close
public void close()
Description copied from interface:TopicMapSourceIFPUBLIC: Closes the source by releasing references it holds to e.g. database or file system objects.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceTopicMapSourceIF
-
supportsCreate
public boolean supportsCreate()
Description copied from interface:TopicMapSourceIFPUBLIC: Returns true if the source supports creating new topic maps with the createTopicMap.- Specified by:
supportsCreatein interfaceTopicMapSourceIF
-
supportsDelete
public boolean supportsDelete()
Description copied from interface:TopicMapSourceIFPUBLIC: Returns true if the source supports deleting topic map with the TopicMapReferenceIF.delete() method.- Specified by:
supportsDeletein interfaceTopicMapSourceIF
-
createTopicMap
public TopicMapReferenceIF createTopicMap(String name, String baseAddress)
Description copied from interface:TopicMapSourceIFPUBLIC: Creates a new topic map in the underlying source and returns a reference to the created topic map. The method takes a name and the base address for the topic map to create.- Specified by:
createTopicMapin interfaceTopicMapSourceIF
-
-