Package net.ontopia.topicmaps.entry
Class DefaultTopicMapSource
- java.lang.Object
-
- net.ontopia.topicmaps.entry.DefaultTopicMapSource
-
- All Implemented Interfaces:
AutoCloseable,TopicMapSourceIF
public class DefaultTopicMapSource extends Object implements TopicMapSourceIF
INTERNAL: A convenience class that that maintains an arbitrary collection of topic map references. References that are registered with the source gets its source overridden. When a reference is removed its source is set to null.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanhiddenprotected Stringidprotected Collection<TopicMapReferenceIF>refsprotected Stringtitle
-
Constructor Summary
Constructors Constructor Description DefaultTopicMapSource()DefaultTopicMapSource(Collection<TopicMapReferenceIF> refs)DefaultTopicMapSource(TopicMapReferenceIF reference)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddReference(TopicMapReferenceIF reference)INTERNAL: Adds the reference to the source and registers the source as the source of the reference.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.booleangetHidden()StringgetId()PUBLIC: Gets the id of the source.Collection<TopicMapReferenceIF>getReferences()PUBLIC: Returns an unmodifiable collection ofTopicMapReferenceIFs found by the topic map source.StringgetTitle()PUBLIC: Gets the title of the source.voidrefresh()PUBLIC: Refreshes the collection of references.voidremoveReference(TopicMapReferenceIF reference)INTERNAL: Removes the reference from the source and deregisters the source from the reference.voidsetHidden(boolean hidden)voidsetId(String id)PUBLIC: Sets the id of the source.voidsetTitle(String title)PUBLIC: Sets the title of the source.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
-
title
protected String title
-
hidden
protected boolean hidden
-
refs
protected Collection<TopicMapReferenceIF> refs
-
-
Constructor Detail
-
DefaultTopicMapSource
public DefaultTopicMapSource()
-
DefaultTopicMapSource
public DefaultTopicMapSource(Collection<TopicMapReferenceIF> refs)
-
DefaultTopicMapSource
public DefaultTopicMapSource(TopicMapReferenceIF reference)
-
-
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
-
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
-
addReference
public void addReference(TopicMapReferenceIF reference)
INTERNAL: Adds the reference to the source and registers the source as the source of the reference.- Since:
- 1.3.2
-
removeReference
public void removeReference(TopicMapReferenceIF reference)
INTERNAL: Removes the reference from the source and deregisters the source from the reference.- Since:
- 1.3.2
-
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
-
getHidden
public boolean getHidden()
-
setHidden
public void setHidden(boolean hidden)
-
-