MiG InfoCom MiG Calendar DBConnect Guide User Manual

Page 18

Advertising
background image

MiG InfoCom AB

Monitoring the Database Queue

DBConnect uses a background thread to communicate with the
database. This ensures that there will be no lags or lockups of the
user interface when information is persisted to the database. There
are multiple ways you as the developer can interact with this queue.
You can check the length of the queue, wait for it to flush, shut it down
as well as check its contents.

DataSynchronizer

is in many ways the focal point of DBConnect

while it is running. Through that class you can monitor the database
queue including starting and stopping it.

You can also add a listener on the database queue that will be notified
every time the queue count is changed.

View the

DataSynchronizer

JavaDoc for details on how to use

this class.

Filtering What to Synchronize

Since you might want to have activities/categories in your memory,
and thus the depositories, that you want to exclude from DBConnect
you can create and set a

CRUDSFilter

that filters which object to

do Create, Read, Update, Delete and Synchronize on respectively.
You create the filter by sub classing

CRUDSFilter

and implement

the single abstract method

accept(Object o, int

operation)

.

View the CRUDSFilter JavaDoc for details on how to use this class.

Polling and Setting Auto-poll Interval

The

DataSynchronizer

can check the database for changes

(polling) automatically every X milliseconds.

View the

DataSynchronizer

JavaDoc for details on how to use

this class.

Auto Write

This is a property of the

DataSynchronizer

. It is used to turn on

and off the automatic monitoring of changes to activities/categories. If
this property is set to

false

DBConnect will not pick up changes and

they will thus not be handled and persisted.

View the

DataSynchronizer

JavaDoc for details on how to use

this class.

Managing Shutdown and Flushing

You can flush the database queue and wait for it to finish, optionally a

DBConnect Guide

Page 18 / 25

Advertising