Default Listeners

By default, the org.tm4j.topicmap.TopicMapProvider interface implementations will register at least one java.beans.VetoableChangeListener with each newly created TopicMap object. This listener is implemented by the class org.tm4j.topicmap.utils.XTMTypeInstanceValidator and it ensures that changes made to the topic map do not violate the constraints imposed on type-instance associations as defined in XTM 1.0 Annex F. In particular, this validator will ensure that:

Note

In certain circumstances, these restrictions make it impossible to update a class-instances association (e.g. consider creating a class-instance association from scratch, one of the class or instance roles must be added first). However, this is easy to get round. Remember that the restrictions only apply to associations typed as class-instance. To create such an association from scratch, first add the roles, then set the type. To update an association safely, first unset the type (set the type to null), then do the update then set the type again.

Overriding The Default Listeners

To prevent the TopicMapProvider from applying the default listeners to all newly created topic maps, simply set the property tm4j.noDefaultListeners to "yes" in the Properties object passed to the createTopicMapProvider method of the TopicMapProviderFactory.

Turning Off Event Notification

For the relational database backend only, it is now possible to disable all event notifications. This can lead to an improvement in application performance, at the expense of losing the notification feature. To disable event notification, the TopicMapProvider for the backend must be initialised with the property event.notification set to the value 'false'.

Note

Disabling event notification will also disable the default listeners, meaning that there is no longer validation of the constraints imposed by XTM 1.0 Annex F on type-instance associations (see the section called “Default Listeners” for more details).