@Override public synchronized void clear() throws IOException { // naive implementation that gets a store and clears it TopicMapStoreIF store = null; try { store = createStore(false); store.getTopicMap().clear(); } finally { if (store != null && store.isOpen()) store.close(); } }
@Override public void delete(boolean force) throws NotRemovableException { // Do nothing except closing the store, since we do not know how // to delete the topic map here. Implementations have to implement // deletion themselves. TopicMapIF tm = getTopicMap(); if (!force) { // If we're not forcing, complain if the topic map contains any data. if (!tm.getTopics().isEmpty()) throw new NotRemovableException("Cannot delete topic map when it contains topics."); if (!tm.getAssociations().isEmpty()) throw new NotRemovableException("Cannot delete topic map when it contains associations."); } // Remove all the objects from the topic map tm.clear(); close(); deleted = true; }
private void clearTopicMap(TopicMapIF tm) throws Exception { // Remove all the objects from the topic map tm.clear(); Assert.assertTrue("Not all topics was deleted", tm.getTopics().isEmpty()); Assert.assertTrue("Not all associations was deleted", tm.getAssociations().isEmpty()); }
topicmap.clear();