Package net.ontopia.topicmaps.impl.basic
Class TopicMap
- java.lang.Object
-
- net.ontopia.topicmaps.impl.basic.TMObject
-
- net.ontopia.topicmaps.impl.basic.TopicMap
-
- All Implemented Interfaces:
Serializable
,ReifiableIF
,TMObjectIF
,TopicMapIF
,EventListenerIF
,EventManagerIF
public class TopicMap extends TMObject implements TopicMapIF, EventManagerIF
INTERNAL: The basic topic map implementation.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<AssociationIF>
assocs
protected CollectionFactoryIF
cfactory
protected Map<String,EventListenerIF[]>
listeners
protected TopicIF
reifier
protected UniqueSet<TopicIF>
scope
UniqueSet<TopicIF>
setpool
protected SubjectIdentityCache
sicache
protected Set<TopicIF>
topics
protected InMemoryTopicMapTransaction
txn
-
Fields inherited from class net.ontopia.topicmaps.impl.basic.TMObject
oid, parent, sources, topicmap
-
Fields inherited from interface net.ontopia.topicmaps.core.ReifiableIF
EVENT_SET_REIFIER
-
Fields inherited from interface net.ontopia.topicmaps.core.TMObjectIF
EVENT_ADD_ITEMIDENTIFIER, EVENT_REMOVE_ITEMIDENTIFIER, MSG_NULL_ARGUMENT
-
Fields inherited from interface net.ontopia.topicmaps.core.TopicMapIF
EVENT_ADD_ASSOCIATION, EVENT_ADD_TOPIC, EVENT_REMOVE_ASSOCIATION, EVENT_REMOVE_TOPIC
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAssociation(AssociationIF _association)
Adds an association to the set of associations.void
addListener(EventListenerIF listener, String event)
INTERNAL: Register the listener as a listener for the event.void
addTopic(TopicIF _topic)
Adds a topic to the set of topics.void
clear()
PUBLIC: Clears the topic map by removing all topics and associations.protected void
fireEvent(String event, Object new_value, Object old_value)
INTERNAL: Fires an event, so that listeners can be informed about the event.Collection<AssociationIF>
getAssociations()
PUBLIC: Gets all associations in this topic map.TopicMapBuilderIF
getBuilder()
PUBLIC: Gets a topic map builder for use with this transaction.Object
getIndex(String name)
PUBLIC: Gets an index by name.TMObjectIF
getObjectById(String object_id)
PUBLIC: Gets the topic map object that has the given object id, from this topic map.TMObjectIF
getObjectByItemIdentifier(LocatorIF locator)
PUBLIC: Gets the topic map object that has the given item identifier (given as a LocatorIF object), from this topic map.TopicIF
getReifier()
PUBLIC: Returns the topic that reifies this object.TopicMapStoreIF
getStore()
PUBLIC: Gets the store to which the topic map's transaction is connected.protected SubjectIdentityCache
getSubjectIdentityCache()
TopicIF
getTopicBySubjectIdentifier(LocatorIF locator)
PUBLIC: Gets the topic that has the specified subject identifier, given as a locator.TopicIF
getTopicBySubjectLocator(LocatorIF locator)
PUBLIC: Gets the topic in this topic map that represents the given addressable subject (locator given as a LocatorIF object).TopicMapIF
getTopicMap()
PUBLIC: Gets the topic map that this object belongs to.Collection<TopicIF>
getTopics()
PUBLIC: Gets all topics in this topic map.TopicMapTransactionIF
getTransaction()
void
processEvent(Object object, String event, Object new_value, Object old_value)
INTERNAL: A method that receives notification when an event has been triggered.void
remove()
PUBLIC: Removes the object from its parent.void
removeAssociation(AssociationIF _association)
Removes an associations from the set of associations.void
removeListener(EventListenerIF listener, String event)
INTERNAL: Unregister the listener as a listener for the event.void
removeTopic(TopicIF _topic)
Removes a topic from the set of topics.void
setReifier(TopicIF _reifier)
PUBLIC: Sets the reifier of this object.protected void
setSubjectIdentityCache(SubjectIdentityCache sicache)
String
toString()
-
Methods inherited from class net.ontopia.topicmaps.impl.basic.TMObject
addItemIdentifier, getItemIdentifiers, getObjectId, isConnected, isReadOnly, removeItemIdentifier
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.ontopia.topicmaps.core.TMObjectIF
addItemIdentifier, getItemIdentifiers, getObjectId, isReadOnly, removeItemIdentifier
-
-
-
-
Field Detail
-
txn
protected transient InMemoryTopicMapTransaction txn
-
cfactory
protected transient CollectionFactoryIF cfactory
-
sicache
protected transient SubjectIdentityCache sicache
-
reifier
protected TopicIF reifier
-
assocs
protected Set<AssociationIF> assocs
-
listeners
protected Map<String,EventListenerIF[]> listeners
-
-
Method Detail
-
getTopicMap
public TopicMapIF getTopicMap()
Description copied from interface:TMObjectIF
PUBLIC: Gets the topic map that this object belongs to. If the object has been removed from its topic map or not added to a topic map yet this will be null.- Specified by:
getTopicMap
in interfaceTMObjectIF
- Overrides:
getTopicMap
in classTMObject
- Returns:
- A topic map; an object implementing TopicMapIF.
-
getStore
public TopicMapStoreIF getStore()
Description copied from interface:TopicMapIF
PUBLIC: Gets the store to which the topic map's transaction is connected.- Specified by:
getStore
in interfaceTopicMapIF
-
getTransaction
public TopicMapTransactionIF getTransaction()
-
getBuilder
public TopicMapBuilderIF getBuilder()
Description copied from interface:TopicMapIF
PUBLIC: Gets a topic map builder for use with this transaction.- Specified by:
getBuilder
in interfaceTopicMapIF
- Returns:
- An object implementing TopicMapBuilderIF
-
getIndex
public Object getIndex(String name)
Description copied from interface:TopicMapIF
PUBLIC: Gets an index by name. An index is usually named by the IndexIF subinterface that it implements. All indexes are kept up-to-date at all times.- Specified by:
getIndex
in interfaceTopicMapIF
- Parameters:
name
- A string; the index name, i.e.g the interface that it implements.- Returns:
- An instance implementing the index interface.
-
getSubjectIdentityCache
protected SubjectIdentityCache getSubjectIdentityCache()
-
setSubjectIdentityCache
protected void setSubjectIdentityCache(SubjectIdentityCache sicache)
-
getTopics
public Collection<TopicIF> getTopics()
Description copied from interface:TopicMapIF
PUBLIC: Gets all topics in this topic map. No specific order is guaranteed.- Specified by:
getTopics
in interfaceTopicMapIF
- Returns:
- A collection of TopicIF objects.
-
addTopic
public void addTopic(TopicIF _topic)
Adds a topic to the set of topics.
-
removeTopic
public void removeTopic(TopicIF _topic)
Removes a topic from the set of topics.
-
getAssociations
public Collection<AssociationIF> getAssociations()
Description copied from interface:TopicMapIF
PUBLIC: Gets all associations in this topic map. No specific order is guaranteed.- Specified by:
getAssociations
in interfaceTopicMapIF
- Returns:
- A collection of AssociationIF objects.
-
addAssociation
public void addAssociation(AssociationIF _association)
Adds an association to the set of associations.
-
removeAssociation
public void removeAssociation(AssociationIF _association)
Removes an associations from the set of associations.
-
remove
public void remove()
Description copied from interface:TMObjectIF
PUBLIC: Removes the object from its parent.- Specified by:
remove
in interfaceTMObjectIF
-
clear
public void clear()
Description copied from interface:TopicMapIF
PUBLIC: Clears the topic map by removing all topics and associations.- Specified by:
clear
in interfaceTopicMapIF
-
getObjectById
public TMObjectIF getObjectById(String object_id)
Description copied from interface:TopicMapIF
PUBLIC: Gets the topic map object that has the given object id, from this topic map. If there is no object with that object id in this topic map, then null is returned.- Specified by:
getObjectById
in interfaceTopicMapIF
- Parameters:
object_id
- A string; the object id of the object to get.- Returns:
- A topic map object; an object implementing TMObjectIF.
-
getObjectByItemIdentifier
public TMObjectIF getObjectByItemIdentifier(LocatorIF locator)
Description copied from interface:TopicMapIF
PUBLIC: Gets the topic map object that has the given item identifier (given as a LocatorIF object), from this topic map. If there is no object with the given locator in this topic map, null is returned.- Specified by:
getObjectByItemIdentifier
in interfaceTopicMapIF
- Parameters:
locator
- The given locator; an object implementing LocatorIF.- Returns:
- A topic map object; an object implementing TMObjectIF.
-
getTopicBySubjectLocator
public TopicIF getTopicBySubjectLocator(LocatorIF locator)
Description copied from interface:TopicMapIF
PUBLIC: Gets the topic in this topic map that represents the given addressable subject (locator given as a LocatorIF object). If there is no topic that represents the given addressable subject in this topic map, null is returned.- Specified by:
getTopicBySubjectLocator
in interfaceTopicMapIF
- Parameters:
locator
- The given locator; an object implementing LocatorIF.- Returns:
- A topic; an object implementing TopicIF.
-
getTopicBySubjectIdentifier
public TopicIF getTopicBySubjectIdentifier(LocatorIF locator)
Description copied from interface:TopicMapIF
PUBLIC: Gets the topic that has the specified subject identifier, given as a locator. If there is no topic that has that subject identifier in this topic map, null is returned.- Specified by:
getTopicBySubjectIdentifier
in interfaceTopicMapIF
- Parameters:
locator
- The given locator; an object implementing LocatorIF.- Returns:
- A topic; an object implementing TopicIF.
-
getReifier
public TopicIF getReifier()
Description copied from interface:ReifiableIF
PUBLIC: Returns the topic that reifies this object.- Specified by:
getReifier
in interfaceReifiableIF
-
setReifier
public void setReifier(TopicIF _reifier)
Description copied from interface:ReifiableIF
PUBLIC: Sets the reifier of this object.- Specified by:
setReifier
in interfaceReifiableIF
-
fireEvent
protected void fireEvent(String event, Object new_value, Object old_value)
Description copied from class:TMObject
INTERNAL: Fires an event, so that listeners can be informed about the event. This method is typically called when the object id modified.
-
addListener
public void addListener(EventListenerIF listener, String event)
Description copied from interface:EventManagerIF
INTERNAL: Register the listener as a listener for the event.- Specified by:
addListener
in interfaceEventManagerIF
-
removeListener
public void removeListener(EventListenerIF listener, String event)
Description copied from interface:EventManagerIF
INTERNAL: Unregister the listener as a listener for the event.- Specified by:
removeListener
in interfaceEventManagerIF
-
processEvent
public void processEvent(Object object, String event, Object new_value, Object old_value)
Description copied from interface:EventListenerIF
INTERNAL: A method that receives notification when an event has been triggered.- Specified by:
processEvent
in interfaceEventListenerIF
-
-