Class TopicMapEvents


  • public class TopicMapEvents
    extends Object
    PUBLIC: Utility class for registering topic map life cycle events.

    There is currently only listener support for topics added or removed. The listeners will receive callbacks after the transaction has been committed. This means that the listeners will only see committed changes.

    Use the addTopicListener and removeTopicListener methods to register and unregister your listeners.

    Here is an example of how you can register a listener:

     TopicMapRepositoryIF rep = TopicMaps.getRepository();
     String topicmapId = "mytopicmap";
     TopicMapReferenceIF ref = repository.getReferenceByKey(topicmapId);
     TopicMapListenerIF myListener = new MyTopicListener();
     TopicMapEvents.addTopicListener(ref, myListener);
     

    Note that you should only register your listener once.

    Since:
    3.1
    • Method Detail

      • addTopicListener

        public static void addTopicListener​(TopicMapReferenceIF topicmapRef,
                                            TopicMapListenerIF listener)
        PUBLIC: Call this method to register a topic listener with a given topic map. The topic listener will receive callbacks on the objectAdded and objectRemoved when a transaction has been committed that has added topics to or removed topics from the given topic map.
      • removeTopicListener

        public static void removeTopicListener​(TopicMapReferenceIF topicmapRef,
                                               TopicMapListenerIF listener)
        PUBLIC: Call this method to unregister a topic listener with a given topic map. This is the opposite of calling addTopicListener.