public class MclStorageManager extends java.lang.Object implements MetaContactListListener
The load / resolve strategy that we use when storing contact lists is roughly the following:
1) The MetaContactListService is started.
2) If no file exists for the meta contact list, create one.
3) We receive an OSGI event telling us that a new ProtocolProviderService is
registered or we simply retrieve one that was already in the bundle
4) We look through the contact list file and load groups and contacts
belonging to this new provider. Unresolved proto groups and contacts will be
created for every one of them.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
MclStorageManager.StoredProtoContactDescriptor
Contains details parsed out of the contact list xml file, necessary for
creating unresolved contacts.
|
Constructor and Description |
---|
MclStorageManager() |
Modifier and Type | Method and Description |
---|---|
void |
childContactsReordered(MetaContactGroupEvent evt)
We simply ignore - we're not interested in this kind of events.
|
(package private) void |
extractContactsForAccount(java.lang.String accountID)
Parses the contact list file and calls corresponding "add" methods
belonging to mclServiceImpl for every meta contact and meta
contact group stored in the (contactlist.xml) file that correspond to a
provider caring the specified accountID.
|
(package private) boolean |
isStarted()
Determines whether the storage manager has been properly started or in
other words that it has successfully found and read the xml contact list
file.
|
void |
metaContactAdded(MetaContactEvent evt)
Indicates that a MetaContact has been successfully added to the
MetaContact list.
|
void |
metaContactAvatarUpdated(MetaContactAvatarUpdateEvent evt)
Indicates that a new avatar is available for a MetaContact.
|
void |
metaContactGroupAdded(MetaContactGroupEvent evt)
Creates XML nodes for the source metacontact group, its child meta
contacts and associated protogroups and adds them to the xml contact
list.
|
void |
metaContactGroupModified(MetaContactGroupEvent evt)
Determines the exact type of the change and acts accordingly by either
updating group name or .
|
void |
metaContactGroupRemoved(MetaContactGroupEvent evt)
Removes the corresponding node from the xml document.
|
void |
metaContactModified(MetaContactModifiedEvent evt)
Indicates that a MetaContact has been modified.
|
void |
metaContactMoved(MetaContactMovedEvent evt)
Moves the corresponding node from its old parent to the node
corresponding to the new parent meta group.
|
void |
metaContactRemoved(MetaContactEvent evt)
Removes the corresponding node from the xml document.
|
void |
metaContactRenamed(MetaContactRenamedEvent evt)
Changes the display name attribute of the specified meta contact node.
|
void |
protoContactAdded(ProtoContactEvent evt)
Indicates that a protocol specific Contact instance has been
added to the list of protocol specific buddies in this
MetaContact
|
void |
protoContactModified(ProtoContactEvent evt)
Updates the data stored for the contact that caused this event.
|
void |
protoContactMoved(ProtoContactEvent evt)
Indicates that a protocol specific Contact instance has been
moved from within one MetaContact to another.
|
void |
protoContactRemoved(ProtoContactEvent evt)
Removes the corresponding node from the xml contact list.
|
(package private) void |
removeContactListFile()
Removes the file where we store contact lists.
|
(package private) void |
start(org.osgi.framework.BundleContext bc,
MetaContactListServiceImpl mclServImpl)
Initializes the storage manager and makes it do initial load and parsing
of the contact list file.
|
void |
stop()
Prepares the storage manager for shutdown.
|
void |
storeContactListAndStopStorageManager()
Stops the storage manager and performs a final write
|
boolean isStarted()
public void stop()
void start(org.osgi.framework.BundleContext bc, MetaContactListServiceImpl mclServImpl) throws java.io.IOException, org.jitsi.util.xml.XMLException
bc
- a reference to the currently valid OSGI BundleContextmclServImpl
- a reference to the currently valid instance of the
MetaContactListServiceImpl that we could use to pass
parsed contacts and contact groups.java.io.IOException
- if the contact list file specified file does not
exist and could not be created.org.jitsi.util.xml.XMLException
- if there is a problem with the file syntax.public void storeContactListAndStopStorageManager()
void extractContactsForAccount(java.lang.String accountID) throws org.jitsi.util.xml.XMLException
accountID
- the identifier of the account whose contacts we're
interested in.org.jitsi.util.xml.XMLException
- if a problem occurs while parsing contact list
contents.public void metaContactAdded(MetaContactEvent evt)
metaContactAdded
in interface MetaContactListListener
evt
- the MetaContactListEvent containing the corresponding contactpublic void metaContactGroupAdded(MetaContactGroupEvent evt)
metaContactGroupAdded
in interface MetaContactListListener
evt
- the MetaContactListEvent containing the corresponding contactpublic void metaContactGroupRemoved(MetaContactGroupEvent evt)
metaContactGroupRemoved
in interface MetaContactListListener
evt
- the MetaContactGroupEvent containing the corresponding contactpublic void metaContactMoved(MetaContactMovedEvent evt)
metaContactMoved
in interface MetaContactListListener
evt
- the MetaContactListEvent containing the corresponding contactpublic void metaContactRemoved(MetaContactEvent evt)
metaContactRemoved
in interface MetaContactListListener
evt
- the MetaContactListEvent containing the corresponding contactpublic void metaContactRenamed(MetaContactRenamedEvent evt)
metaContactRenamed
in interface MetaContactListListener
evt
- the MetaContactListEvent containing the corresponding contactpublic void protoContactModified(ProtoContactEvent evt)
protoContactModified
in interface MetaContactListListener
evt
- the MetaContactListEvent containing the corresponding contactpublic void metaContactModified(MetaContactModifiedEvent evt)
metaContactModified
in interface MetaContactListListener
evt
- the MetaContactModifiedEvent containing the corresponding
contactpublic void protoContactRemoved(ProtoContactEvent evt)
protoContactRemoved
in interface MetaContactListListener
evt
- a reference to the corresponding ProtoContactEventpublic void childContactsReordered(MetaContactGroupEvent evt)
childContactsReordered
in interface MetaContactListListener
evt
- the MetaContactGroupEvent containing details of this
event.public void metaContactGroupModified(MetaContactGroupEvent evt)
metaContactGroupModified
in interface MetaContactListListener
evt
- the MetaContactListEvent containing the corresponding contactpublic void protoContactAdded(ProtoContactEvent evt)
protoContactAdded
in interface MetaContactListListener
evt
- a reference to the corresponding ProtoContactEventpublic void protoContactMoved(ProtoContactEvent evt)
protoContactMoved
in interface MetaContactListListener
evt
- a reference to the ProtoContactMovedEvent instance.void removeContactListFile()
public void metaContactAvatarUpdated(MetaContactAvatarUpdateEvent evt)
metaContactAvatarUpdated
in interface MetaContactListListener
evt
- the MetaContactAvatarUpdateEvent containing details
of this event
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.