Package io.jsondb.events
Class CollectionFileChangeAdapter
- java.lang.Object
-
- io.jsondb.events.CollectionFileChangeAdapter
-
- All Implemented Interfaces:
CollectionFileChangeListener,java.util.EventListener
public abstract class CollectionFileChangeAdapter extends java.lang.Object implements CollectionFileChangeListener
An abstract adapter class for receiving Collection File Change events. The methods in this class are empty. This class exists as convenience for creating listener objects. Extend this class to create a Collection File Change listener and override only the methods for the events of interest. (If you implement the CollectionFileChangeListener interface, you have to define all of the methods in it. This abstract class defines null methods for them all, so you can only have to define methods for events you care about.)
-
-
Constructor Summary
Constructors Constructor Description CollectionFileChangeAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollectionFileAdded(java.lang.String collectionName)Invoked when a new file is detected which has a corresponding identified collection.voidcollectionFileDeleted(java.lang.String collectionName)Invoked when a file which has a corresponding identified collection is deleted Deleting files in the background is a dangerous operation after such a operation if the database is reloaded that data will be permanently lost.voidcollectionFileModified(java.lang.String collectionName)Invoked when a file which has a corresponding identified collection is modified by program other than this one.
-
-
-
Method Detail
-
collectionFileAdded
public void collectionFileAdded(java.lang.String collectionName)
Description copied from interface:CollectionFileChangeListenerInvoked when a new file is detected which has a corresponding identified collection. A identified collection is that for which the package scan found a POJO with the @Document annotation. This also means that such a identified collection did not have a corresponding collection file before. New files which do not have corresponding identified collection are ignored.- Specified by:
collectionFileAddedin interfaceCollectionFileChangeListener- Parameters:
collectionName- the name of the collection for which a file was detected.
-
collectionFileDeleted
public void collectionFileDeleted(java.lang.String collectionName)
Description copied from interface:CollectionFileChangeListenerInvoked when a file which has a corresponding identified collection is deleted Deleting files in the background is a dangerous operation after such a operation if the database is reloaded that data will be permanently lost. However if any operation that modifies the database is done then it will automatically recreate the file.- Specified by:
collectionFileDeletedin interfaceCollectionFileChangeListener- Parameters:
collectionName- the name of the collection for which a file was deleted.
-
collectionFileModified
public void collectionFileModified(java.lang.String collectionName)
Description copied from interface:CollectionFileChangeListenerInvoked when a file which has a corresponding identified collection is modified by program other than this one. Ideally you might want to reload the database on receiving this event. If you ignore and change to the database happens due to a insert of update or any other Database mutating operation the file will be overwritten with the in memory state.- Specified by:
collectionFileModifiedin interfaceCollectionFileChangeListener- Parameters:
collectionName- the name of the collection whose corresponding file was modified.
-
-