|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.impl.contactlist.MetaContactListServiceImpl
public class MetaContactListServiceImpl
An implementation of the MetaContactListService that would connect to protocol service providers and build it s contact list accordingly basing itself on the contact list stored by the various protocol provider services and the contact list instance saved on the hard disk.
| Field Summary | |
|---|---|
static int |
CONTACT_LIST_MODIFICATION_TIMEOUT
The number of milliseconds to wait for confirmations of account modifications before deciding to drop. |
(package private) MetaContactGroupImpl |
rootMetaGroup
The root of the meta contact list. |
| Fields inherited from interface net.java.sip.communicator.service.contactlist.MetaContactListService |
|---|
PROVIDER_MASK_PROPERTY |
| Constructor Summary | |
|---|---|
MetaContactListServiceImpl()
Creates an instance of this class. |
|
| Method Summary | |
|---|---|
void |
addMetaContactListListener(MetaContactListListener listener)
Adds a listener for MetaContactListChangeEvents posted after the tree changes. |
void |
addNewContactToMetaContact(ProtocolProviderService provider,
MetaContact metaContact,
String contactID)
First makes the specified protocol provider create the contact as indicated by contactID, and then associates it to the _existing_ metaContact given as an argument. |
void |
addNewContactToMetaContact(ProtocolProviderService provider,
MetaContact metaContact,
String contactID,
boolean fireEvent)
First makes the specified protocol provider create the contact as indicated by contactID, and then associates it to the _existing_ metaContact given as an argument. |
void |
changeMetaContactAvatar(MetaContact metaContact,
Contact protoContact,
byte[] newAvatar)
Sets the avatar for metaContact to be newAvatar. |
void |
contactPresenceStatusChanged(ContactPresenceStatusChangeEvent evt)
Upon each status notification this method finds the corresponding meta contact and updates the ordering in its parent group. |
MetaContact |
createMetaContact(ProtocolProviderService provider,
MetaContactGroup metaContactGroup,
String contactID)
First makes the specified protocol provider create a contact corresponding to the specified contactID, then creates a new MetaContact which will encapsulate the newly created protocol specific contact. |
MetaContactGroup |
createMetaContactGroup(MetaContactGroup parent,
String groupName)
Creates a MetaContactGroup with the specified group name. |
Iterator<MetaContact> |
findAllMetaContactsForProvider(ProtocolProviderService protocolProvider)
Returns a list of all MetaContacts containing a protocol contact from the given ProtocolProviderService. |
Iterator<MetaContact> |
findAllMetaContactsForProvider(ProtocolProviderService protocolProvider,
MetaContactGroup metaContactGroup)
Returns a list of all MetaContacts contained in the given group and containing a protocol contact from the given ProtocolProviderService. |
MetaContact |
findMetaContactByContact(Contact contact)
Returns the MetaContact containing the specified contact or null if no such MetaContact was found. |
MetaContact |
findMetaContactByContact(String contactAddress,
String accountID)
Returns the MetaContact containing a contact with an address equal to contactAddress and with a source provider matching accountID, or null if no such MetaContact was found. |
MetaContact |
findMetaContactByMetaUID(String metaContactID)
Returns the MetaContact that corresponds to the specified metaContactID. |
MetaContactGroup |
findMetaContactGroupByContactGroup(ContactGroup contactGroup)
Returns the MetaContactGroup corresponding to the specified contactGroup or null if no such MetaContactGroup was found. |
MetaContactGroup |
findMetaContactGroupByMetaUID(String metaGroupID)
Returns the MetaContactGroup that corresponds to the specified metaGroupID. |
MetaContactGroup |
findParentMetaContactGroup(MetaContact child)
Returns the meta contact group that is a direct parent of the specified child. |
MetaContactGroup |
findParentMetaContactGroup(MetaContactGroup child)
Returns the meta contact group that is a direct parent of the specified child. |
(package private) void |
fireMetaContactEvent(MetaContactPropertyChangeEvent event)
Creates the corresponding MetaContactPropertyChangeEvent instance and notifies all MetaContactListListeners that a MetaContact has been modified. |
MetaContactGroup |
getRoot()
Returns the root MetaContactGroup in this contact list. |
(package private) ContactGroup |
loadStoredContactGroup(MetaContactGroupImpl containingMetaGroup,
String contactGroupUID,
ContactGroup parentProtoGroup,
String persistentData,
String accountID)
Creates a unresolved instance of the proto specific contact group according to the specified arguments and adds it to containingMetaContactGroup |
(package private) void |
loadStoredMetaContact(MetaContactGroupImpl parentGroup,
String metaUID,
String displayName,
Map<String,List<String>> details,
List<MclStorageManager.StoredProtoContactDescriptor> protoContacts,
String accountID)
The method is called from the storage manager whenever a new contact has been parsed and it has to be created. |
(package private) MetaContactGroupImpl |
loadStoredMetaContactGroup(MetaContactGroupImpl parentGroup,
String metaContactGroupUID,
String displayName)
The method is called from the storage manager whenever a new contact group has been parsed and it has to be created. |
void |
moveContact(Contact contact,
MetaContact newParentMetaContact)
Makes the specified contact a child of the newParent MetaContact. |
void |
moveContact(Contact contact,
MetaContactGroup newParentMetaGroup)
Makes the specified contact a child of the newParentMetaGroup MetaContactGroup. |
void |
moveMetaContact(MetaContact metaContact,
MetaContactGroup newMetaGroup)
Moves the specified MetaContact to newGroup. |
void |
purgeLocallyStoredContactListCopy()
Removes local resources storing copies of the meta contact list. |
void |
removeContact(Contact contact)
Deletes the specified contact from both the local contact list and (if applicable) the server stored contact list if supported by the corresponding protocol. |
void |
removeContactGroupFromMetaContactGroup(MetaContactGroupImpl metaContainer,
ContactGroup groupToRemove,
ProtocolProviderService sourceProvider)
Removes the protocol specific group from the specified meta contact group and removes from meta contacts all proto contacts that belong to the same provider as the group which is being removed. |
void |
removeMetaContact(MetaContact metaContact)
Removes the specified metaContact as well as all of its underlying contacts. |
void |
removeMetaContactGroup(MetaContactGroup groupToRemove)
Removes the specified meta contact group, all its corresponding protocol specific groups and all their children. |
void |
removeMetaContactListListener(MetaContactListListener listener)
Removes a listener previously added with addContactListListener. |
void |
renameMetaContact(MetaContact metaContact,
String newDisplayName)
Sets the display name for metaContact to be newName. |
void |
renameMetaContactGroup(MetaContactGroup group,
String newGroupName)
Renames the specified MetaContactGroup as indicated by the newName param. |
void |
serviceChanged(org.osgi.framework.ServiceEvent event)
Implements the ServiceListener method. |
void |
start(org.osgi.framework.BundleContext bc)
Starts this implementation of the MetaContactListService. |
void |
stop(org.osgi.framework.BundleContext bc)
Prepares the meta contact list service for shutdown. |
void |
supportedOperationSetsChanged(ContactCapabilitiesEvent event)
Notifies this listener that the list of the OperationSet capabilities of a Contact has changed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
final MetaContactGroupImpl rootMetaGroup
public static final int CONTACT_LIST_MODIFICATION_TIMEOUT
| Constructor Detail |
|---|
public MetaContactListServiceImpl()
| Method Detail |
|---|
public void start(org.osgi.framework.BundleContext bc)
2) The only provide non persistent implementations of OperationSetPresence, the meta contact list impl would create subscriptions for all local contacts in the corresponding protocol provider.
This implementation would also start listening for any newly registered protocol provider implementations and perform the same algorithm with them.
bc - the currently valid OSGI bundle context.public void stop(org.osgi.framework.BundleContext bc)
bc - the currently active bundle context.public void addMetaContactListListener(MetaContactListListener listener)
addMetaContactListListener in interface MetaContactListServicelistener - the listener to add
public void addNewContactToMetaContact(ProtocolProviderService provider,
MetaContact metaContact,
String contactID)
throws MetaContactListException
addNewContactToMetaContact in interface MetaContactListServiceprovider - the ProtocolProviderService that should create the contact
indicated by contactID.metaContact - the meta contact where that the newly created contact should
be associated to.contactID - the identifier of the contact that the specified provider
MetaContactListException - with an appropriate code if the operation fails for some
reason.
public void addNewContactToMetaContact(ProtocolProviderService provider,
MetaContact metaContact,
String contactID,
boolean fireEvent)
throws MetaContactListException
provider - the ProtocolProviderService that should create the contact
indicated by contactID.metaContact - the meta contact where that the newly created contact should
be associated to.contactID - the identifier of the contact that the specified providerfireEvent - specifies whether or not an even is to be fire at
the end of the method.Used when this method is called upon creation of a
new meta contact and not only a new contact.
MetaContactListException - with an appropriate code if the operation fails for some
reason.public MetaContactGroup findParentMetaContactGroup(MetaContactGroup child)
findParentMetaContactGroup in interface MetaContactListServicechild - the MetaContactGroup whose parent group we're
looking for. If no parent is found null is returned.
public MetaContactGroup findParentMetaContactGroup(MetaContact child)
findParentMetaContactGroup in interface MetaContactListServicechild - the MetaContact whose parent group we're looking
for.
IllegalArgumentException - if child is not an instance of
MetaContactImpl
public MetaContact createMetaContact(ProtocolProviderService provider,
MetaContactGroup metaContactGroup,
String contactID)
throws MetaContactListException
createMetaContact in interface MetaContactListServiceprovider - a ref to ProtocolProviderService instance which
will create the actual protocol specific contact.metaContactGroup - the MetaContactGroup where the newly created meta contact
should be stored.contactID - a protocol specific string identifier indicating the contact
the protocol provider should create.
MetaContactListException - with an appropriate code if the operation fails for some
reason.
public MetaContactGroup createMetaContactGroup(MetaContactGroup parent,
String groupName)
throws MetaContactListException
createMetaContactGroup in interface MetaContactListServiceparent - the meta contact group inside which the new child group must
be created.groupName - the name of the MetaContactGroup to create.
MetaContactListException - with an appropriate code if the operation fails for some
reason.
public void renameMetaContactGroup(MetaContactGroup group,
String newGroupName)
renameMetaContactGroup in interface MetaContactListServicegroup - the group to rename.newGroupName - the new name of the MetaContactGroup to
rename.public MetaContactGroup getRoot()
getRoot in interface MetaContactListService
public void renameMetaContact(MetaContact metaContact,
String newDisplayName)
throws IllegalArgumentException
renameMetaContact in interface MetaContactListServicemetaContact - the MetaContact that we are renamingnewDisplayName - a String containing the new display name
for metaContact.
IllegalArgumentException - if metaContact is not an
instance that belongs to the underlying implementation.
public void changeMetaContactAvatar(MetaContact metaContact,
Contact protoContact,
byte[] newAvatar)
throws IllegalArgumentException
metaContact - the MetaContact that change avatarprotoContact - the Contact> that change avatarnewAvatar - avatar image bytes
IllegalArgumentException - if metaContact is not an
instance that belongs to the underlying implementation.
public void moveContact(Contact contact,
MetaContactGroup newParentMetaGroup)
throws MetaContactListException
moveContact in interface MetaContactListServicecontact - the Contact to move to thenewParentMetaGroup - the MetaContactGroup where we'd like contact to be moved.
MetaContactListException - with an appropriate code if the
operation fails for some reason.
public void moveContact(Contact contact,
MetaContact newParentMetaContact)
throws MetaContactListException
moveContact in interface MetaContactListServicecontact - the Contact to move to thenewParentMetaContact - the MetaContact where we'd like contact to be moved.
MetaContactListException - with an appropriate code if the operation fails for some
reason.
public void moveMetaContact(MetaContact metaContact,
MetaContactGroup newMetaGroup)
throws MetaContactListException,
IllegalArgumentException
moveMetaContact in interface MetaContactListServicemetaContact - the MetaContact to move.newMetaGroup - the MetaContactGroup that should be the new parent
of contact.
MetaContactListException - with an appropriate code if the operation fails for some
reason.
IllegalArgumentException - if newMetaGroup or
metaCOntact do not come from this implementation.
public void removeContact(Contact contact)
throws MetaContactListException
removeContact in interface MetaContactListServicecontact - the contact to remove.
MetaContactListException - with an appropriate code if the
operation fails for some reason.public void removeMetaContactListListener(MetaContactListListener listener)
removeMetaContactListListener in interface MetaContactListServicelistener - the listener to remove
public void removeMetaContact(MetaContact metaContact)
throws MetaContactListException
removeMetaContact in interface MetaContactListServicemetaContact - the metaContact to remove.
MetaContactListException - with an appropriate code if the operation fails for some
reason.
public void removeMetaContactGroup(MetaContactGroup groupToRemove)
throws MetaContactListException
removeMetaContactGroup in interface MetaContactListServicegroupToRemove - the MetaContactGroup to have removed.
MetaContactListException - with an appropriate code if the operation fails for some
reason.
public void removeContactGroupFromMetaContactGroup(MetaContactGroupImpl metaContainer,
ContactGroup groupToRemove,
ProtocolProviderService sourceProvider)
metaContainer - the MetaContactGroup that we'd like to remove a
contact group from.groupToRemove - the ContactGroup that we'd like removed.sourceProvider - the ProtocolProvider that the contact group belongs
to.public void purgeLocallyStoredContactListCopy()
purgeLocallyStoredContactListCopy in interface MetaContactListServicepublic MetaContactGroup findMetaContactGroupByContactGroup(ContactGroup contactGroup)
findMetaContactGroupByContactGroup in interface MetaContactListServicecontactGroup - the protocol specific contactGroup that we're looking
for.
public MetaContact findMetaContactByContact(Contact contact)
findMetaContactByContact in interface MetaContactListServicecontact - the protocol specific contact that we're looking
for.
public MetaContact findMetaContactByContact(String contactAddress,
String accountID)
contactAddress - the address of the protocol specific
contact that we're looking for.accountID - the ID of the account that the contact we're looking for
must belong to.
public MetaContact findMetaContactByMetaUID(String metaContactID)
findMetaContactByMetaUID in interface MetaContactListServicemetaContactID - a String identifier of a meta contact.
public MetaContactGroup findMetaContactGroupByMetaUID(String metaGroupID)
findMetaContactGroupByMetaUID in interface MetaContactListServicemetaGroupID - a String identifier of a meta contact group.
public Iterator<MetaContact> findAllMetaContactsForProvider(ProtocolProviderService protocolProvider)
findAllMetaContactsForProvider in interface MetaContactListServiceprotocolProvider - the ProtocolProviderService whose
contacts we're looking for.
public Iterator<MetaContact> findAllMetaContactsForProvider(ProtocolProviderService protocolProvider,
MetaContactGroup metaContactGroup)
findAllMetaContactsForProvider in interface MetaContactListServiceprotocolProvider - the ProtocolProviderService whose
contacts we're looking for.metaContactGroup - the parent group.
public void serviceChanged(org.osgi.framework.ServiceEvent event)
serviceChanged in interface org.osgi.framework.ServiceListenerevent - The ServiceEvent object.void fireMetaContactEvent(MetaContactPropertyChangeEvent event)
event - the event to dispatch.public void contactPresenceStatusChanged(ContactPresenceStatusChangeEvent evt)
contactPresenceStatusChanged in interface ContactPresenceStatusListenerevt - the ContactPresenceStatusChangeEvent describing the status
change.
MetaContactGroupImpl loadStoredMetaContactGroup(MetaContactGroupImpl parentGroup,
String metaContactGroupUID,
String displayName)
parentGroup - the group that contains the meta contact group we're
about to load.metaContactGroupUID - the unique identifier of the meta contact
group.displayName - the name of the meta contact group.
ContactGroup loadStoredContactGroup(MetaContactGroupImpl containingMetaGroup,
String contactGroupUID,
ContactGroup parentProtoGroup,
String persistentData,
String accountID)
containingMetaGroup - the MetaContactGroupImpl where the
restored contact group should be added.contactGroupUID - the unique identifier of the group.parentProtoGroup - the identifier of the parent proto group.persistentData - the persistent data last returned by the contact
group.accountID - the ID of the account that the proto group belongs to.
void loadStoredMetaContact(MetaContactGroupImpl parentGroup,
String metaUID,
String displayName,
Map<String,List<String>> details,
List<MclStorageManager.StoredProtoContactDescriptor> protoContacts,
String accountID)
parentGroup - the group that contains the meta contact we're about
to load.metaUID - the unique identifier of the meta contact.displayName - the display name of the meta contact.details - the details for the contact to create.protoContacts - a list containing descriptors of proto contacts
encapsulated by the meta contact that we're about to create.accountID - the identifier of the account that the contacts
originate from.public void supportedOperationSetsChanged(ContactCapabilitiesEvent event)
supportedOperationSetsChanged in interface ContactCapabilitiesListenerevent - a ContactCapabilitiesEvent with ID
ContactCapabilitiesEvent.SUPPORTED_OPERATION_SETS_CHANGED which
specifies the Contact whose list of OperationSet
capabilities has changed
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||