Package net.ontopia.topicmaps.impl.rdbms
Class RDBMSTopicMapSource
- java.lang.Object
-
- net.ontopia.topicmaps.impl.rdbms.RDBMSTopicMapSource
-
- All Implemented Interfaces:
AutoCloseable,TopicMapSourceIF
public class RDBMSTopicMapSource extends Object implements TopicMapSourceIF
PUBLIC: A topic map source that holds the list of all topic map references accessible by a rdbms session.
-
-
Field Summary
Fields Modifier and Type Field Description protected LocatorIFbase_addressprotected booleanhiddenprotected Stringidprotected Map<String,String>propertiesprotected Stringpropfileprotected Stringqueryfileprotected Map<String,TopicMapReferenceIF>refmapprotected RDBMSStoragestorageprotected booleansupportsCreateprotected booleansupportsDeleteprotected Stringtitleprotected StringtopicListeners
-
Constructor Summary
Constructors Constructor Description RDBMSTopicMapSource()PUBLIC: Creates an rdbms topic map source.RDBMSTopicMapSource(String propfile)INTERNAL: Creates an rdbms topic map source with the database property file set.RDBMSTopicMapSource(Map<String,String> properties)INTERNAL: Creates an rdbms topic map source with the specified database properties.
-
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.protected RDBMSStoragecreateStorage()TopicMapReferenceIFcreateTopicMap(String name, String baseAddress)PUBLIC: Creates a new topic map in the underlying source and returns a reference to the created topic map.protected RDBMSTopicMapReferencecreateTopicMapReference(String referenceId, String title, RDBMSStorage storage, long topicmapId, LocatorIF baseAddress)StringgetBaseAddress()PUBLIC: Gets the base address of the topic maps retrieved from the source.booleangetHidden()StringgetId()PUBLIC: Gets the id of the source.RDBMSMetricsIFgetMetrics()PUBLIC: provides access to theRDBMSStorage.getMetrics().StringgetPropertyFile()PUBLIC: Gets the database property file containing configuration parameters for accessing the rdbms database.StringgetQueryfile()PUBLIC: returns the additional SQL query file set bysetQueryfile(java.lang.String).protected StringgetReferenceId(String baseAdress, String title, long topicmap_id)Collection<TopicMapReferenceIF>getReferences()PUBLIC: Returns an unmodifiable collection ofTopicMapReferenceIFs found by the topic map source.booleangetSupportsCreate()booleangetSupportsDelete()StringgetTitle()PUBLIC: Gets the title of the source.StringgetTopicListeners()voidrefresh()PUBLIC: Refreshes the collection of references.voidsetBaseAddress(String base_address)PUBLIC: Sets the base address of the topic maps retrieved from the source.voidsetHidden(boolean hidden)voidsetId(String id)PUBLIC: Sets the id of the source.voidsetPropertyFile(String propfile)PUBLIC: Sets the database property file containing configuration parameters for accessing the rdbms database.voidsetQueryfile(String queryfile)PUBLIC: Sets an additional SQL queries file to be loaded.voidsetSupportsCreate(boolean supportsCreate)voidsetSupportsDelete(boolean supportsDelete)voidsetTitle(String title)PUBLIC: Sets the title of the source.voidsetTopicListeners(String topicListeners)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
-
supportsCreate
protected boolean supportsCreate
-
supportsDelete
protected boolean supportsDelete
-
base_address
protected LocatorIF base_address
-
hidden
protected boolean hidden
-
id
protected String id
-
title
protected String title
-
propfile
protected String propfile
-
queryfile
protected String queryfile
-
topicListeners
protected String topicListeners
-
refmap
protected Map<String,TopicMapReferenceIF> refmap
-
storage
protected RDBMSStorage storage
-
-
Constructor Detail
-
RDBMSTopicMapSource
public RDBMSTopicMapSource()
PUBLIC: Creates an rdbms topic map source. Use the setter methods to provide the instance with the properties it needs.If the property file has not been given the 'net.ontopia.topicmaps.impl.rdbms.PropertyFile' system properties will be used.
-
RDBMSTopicMapSource
public RDBMSTopicMapSource(String propfile)
INTERNAL: Creates an rdbms topic map source with the database property file set.
-
-
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
-
getBaseAddress
public String getBaseAddress()
PUBLIC: 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)
PUBLIC: Sets the base address of the topic maps retrieved from the source. The notation is assumed to be 'URI'.
-
getPropertyFile
public String getPropertyFile()
PUBLIC: Gets the database property file containing configuration parameters for accessing the rdbms database.
-
setPropertyFile
public void setPropertyFile(String propfile)
PUBLIC: Sets the database property file containing configuration parameters for accessing the rdbms database. The propfile given with first be attempted loaded from the file system. If it does not exist on the file system it will be loaded from the classpath. If the access must be explicit then the property file name can be prefixed by 'file:' or 'classpath:'.
-
setQueryfile
public void setQueryfile(String queryfile)
PUBLIC: Sets an additional SQL queries file to be loaded. Can be used to override or extend the SQL query set used by Ontopia. Warning: overriding queries should only be done by experts.- Parameters:
queryfile- The file to load. Will be passed toStreamUtils.getInputStream(java.lang.String)- Since:
- 5.4.0
-
getQueryfile
public String getQueryfile()
PUBLIC: returns the additional SQL query file set bysetQueryfile(java.lang.String).- Returns:
- The query file set.
- Since:
- 5.4.0
-
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
-
createStorage
protected RDBMSStorage createStorage() throws IOException
- Throws:
IOException
-
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
-
getMetrics
public RDBMSMetricsIF getMetrics()
PUBLIC: provides access to theRDBMSStorage.getMetrics(). Returns null if no storage was created yet.- Returns:
- an
RDBMSMetricsIFinstance that provides storage metrics.
-
createTopicMapReference
protected RDBMSTopicMapReference createTopicMapReference(String referenceId, String title, RDBMSStorage storage, long topicmapId, LocatorIF baseAddress)
-
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
-
getSupportsCreate
public boolean getSupportsCreate()
-
setSupportsCreate
public void setSupportsCreate(boolean supportsCreate)
-
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
-
getSupportsDelete
public boolean getSupportsDelete()
-
setSupportsDelete
public void setSupportsDelete(boolean supportsDelete)
-
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)
-
getTopicListeners
public String getTopicListeners()
-
setTopicListeners
public void setTopicListeners(String topicListeners)
-
-