Retrieve presence from mysql db


I have succesfully created a plugin to store the presence status stanza and user info in mysql db.

My problem is that when the i restart the openfire, even though the db keeps the data, i have not find a way to retrieve it and set/publish the present status stored in the db.

Can anyone point out what methods should i use from java perspective to retrieve the presence status from my db tables and set it?

Any help will be highly appreciated.