public class MockPersistentPresenceOperationSet extends AbstractOperationSetPersistentPresence<MockProvider>
parentProvider
Constructor and Description |
---|
MockPersistentPresenceOperationSet(MockProvider provider) |
Modifier and Type | Method and Description |
---|---|
void |
addMockGroup(MockContactGroup contactGroup)
A Mock Provider method to use for fast filling of a contact list.
|
void |
addMockGroupAndFireEvent(MockContactGroup parent,
MockContactGroup contactGroup)
A Mock Provider method to use for fast filling of a contact list.
|
void |
changePresenceStatusForContact(MockContact contact,
MockStatusEnum newStatus)
Sets the presence status of contact to newStatus.
|
void |
createServerStoredContactGroup(ContactGroup parent,
java.lang.String groupName)
Creates a group with the specified name and parent in the server
stored contact list.
|
Contact |
createUnresolvedContact(java.lang.String address,
java.lang.String persistentData)
Creates and returns a unresolved contact from the specified
address and persistentData.
|
Contact |
createUnresolvedContact(java.lang.String address,
java.lang.String persistentData,
ContactGroup parent)
Creates and returns a unresolved contact from the specified
address and persistentData.
|
ContactGroup |
createUnresolvedContactGroup(java.lang.String groupUID,
java.lang.String persistentData,
ContactGroup parentGroup)
Creates and returns a unresolved contact group from the specified
address and persistentData.
|
MockContact |
createVolatileContact(java.lang.String id)
Creates a non persistent contact for the specified id.
|
Contact |
findContactByID(java.lang.String contactID)
Returns a reference to the contact with the specified ID in case we
have a subscription for it and null otherwise/
|
MockContactGroup |
findContactParent(MockContact mockContact)
Returns the group that is parent of the specified mockContact or null
if no parent was found.
|
MockContactGroup |
findGroupParent(MockContactGroup mockGroup)
Returns the group that is parent of the specified mockGroup or null
if no parent was found.
|
java.lang.String |
getCurrentStatusMessage()
Returns the status message that was last set through
setCurrentStatusMessage.
|
Contact |
getLocalContact()
Returns the protocol specific contact instance representing the local
user.
|
MockContactGroup |
getNonPersistentGroup()
Returns the volatile group that we use when creating volatile contacts.
|
PresenceStatus |
getPresenceStatus()
Returns a PresenceStatus instance representing the state this provider
is currently in.
|
ContactGroup |
getServerStoredContactListRoot()
Returns the root group of the server stored contact list.
|
java.util.Iterator<PresenceStatus> |
getSupportedStatusSet()
Returns the set of PresenceStatus objects that a user of this service
may request the provider to enter.
|
void |
moveContactToGroup(Contact contactToMove,
ContactGroup newParent)
Removes the specified contact from its current parent and places it
under newParent.
|
void |
publishPresenceStatus(PresenceStatus status,
java.lang.String statusMessage)
Requests the provider to enter into a status corresponding to the
specified paramters.
|
PresenceStatus |
queryContactStatus(java.lang.String contactIdentifier)
Get the PresenceStatus for a particular contact.
|
void |
removeServerStoredContactGroup(ContactGroup group)
Removes the specified group from the server stored contact list.
|
void |
renameServerStoredContactGroup(ContactGroup group,
java.lang.String newName)
Renames the specified group from the server stored contact list.
|
void |
setAuthorizationHandler(AuthorizationHandler handler)
Handler for incoming authorization requests.
|
void |
setStatusMessage(java.lang.String statusMessage)
Sets the specified status message.
|
void |
subscribe(ContactGroup parent,
java.lang.String contactIdentifier)
Persistently adds a subscription for the presence status of the
contact corresponding to the specified contactIdentifier and indicates
that it should be added to the specified group of the server stored
contact list.
|
void |
subscribe(java.lang.String contactIdentifier)
Adds a subscription for the presence status of the contact
corresponding to the specified contactIdentifier.
|
void |
unsubscribe(Contact contact)
Removes a subscription for the presence status of the specified
contact.
|
addContactPresenceStatusListener, addProviderPresenceStatusListener, addServerStoredGroupChangeListener, addSubscriptionListener, fireContactPresenceStatusChangeEvent, fireContactPresenceStatusChangeEvent, fireContactPresenceStatusChangeEvent, fireContactPropertyChangeEvent, fireProviderStatusChangeEvent, fireProviderStatusChangeEvent, fireProviderStatusMessageChangeEvent, fireServerStoredGroupEvent, fireSubscriptionEvent, fireSubscriptionEvent, fireSubscriptionMovedEvent, removeContactPresenceStatusListener, removeProviderPresenceStatusListener, removeServerStoredGroupChangeListener, removeSubscriptionListener, setDisplayName
public MockPersistentPresenceOperationSet(MockProvider provider)
public void createServerStoredContactGroup(ContactGroup parent, java.lang.String groupName)
parent
- the group where the new group should be createdgroupName
- the name of the new group to create.public void addMockGroup(MockContactGroup contactGroup)
contactGroup
- the group to addpublic void addMockGroupAndFireEvent(MockContactGroup parent, MockContactGroup contactGroup)
parent
- the group where contactGroup should be added.contactGroup
- the group to addpublic Contact findContactByID(java.lang.String contactID)
contactID
- a String identifier of the contact which we're
seeking a reference of.public void setStatusMessage(java.lang.String statusMessage)
statusMessage
- a String containing the new status message.public java.lang.String getCurrentStatusMessage()
public Contact getLocalContact()
getLocalContact
in class AbstractOperationSetPersistentPresence<MockProvider>
public PresenceStatus getPresenceStatus()
public ContactGroup getServerStoredContactListRoot()
public java.util.Iterator<PresenceStatus> getSupportedStatusSet()
public void moveContactToGroup(Contact contactToMove, ContactGroup newParent)
contactToMove
- the Contact to movenewParent
- the ContactGroup where Contact
would be placed.public void publishPresenceStatus(PresenceStatus status, java.lang.String statusMessage) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
status
- the PresenceStatus as returned by
getRequestableStatusSetstatusMessage
- the message that should be set as the reason to
enter that statusjava.lang.IllegalArgumentException
- if the status requested is not a
valid PresenceStatus supported by this provider.java.lang.IllegalStateException
- if the provider is not currently
registered.OperationFailedException
- with code NETWORK_FAILURE if
publishing the status fails due to a network error.public PresenceStatus queryContactStatus(java.lang.String contactIdentifier) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
contactIdentifier
- the identifier of the contact whose status
we're interested in.java.lang.IllegalArgumentException
- if contact is not a contact
known to the underlying protocol providerjava.lang.IllegalStateException
- if the underlying protocol provider is
not registered/signed on a public service.OperationFailedException
- with code NETWORK_FAILURE if
retrieving the status fails due to errors experienced during
network communicationpublic void changePresenceStatusForContact(MockContact contact, MockStatusEnum newStatus)
contact
- the MockContact whose status we'd like to set.newStatus
- the new status we'd like to set to contact.public MockContactGroup findGroupParent(MockContactGroup mockGroup)
mockGroup
- the group whose parent we're looking for.public MockContactGroup findContactParent(MockContact mockContact)
mockContact
- the contact whose parent we're looking for.public void removeServerStoredContactGroup(ContactGroup group) throws java.lang.IllegalArgumentException
group
- the group to remove.java.lang.IllegalArgumentException
- if group was not found in this
protocol's contact list.public void renameServerStoredContactGroup(ContactGroup group, java.lang.String newName)
group
- the group to rename.newName
- the new name of the group.public void setAuthorizationHandler(AuthorizationHandler handler)
handler
- an instance of an AuthorizationHandler for
authorization requests coming from other users requesting
permission add us to their contact list.public void subscribe(ContactGroup parent, java.lang.String contactIdentifier) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
parent
- the parent group of the server stored contact list
where the contact should be added. contactIdentifier
- the contact whose status updates we are
subscribing for.java.lang.IllegalArgumentException
- if contact or
parent are not a contact known to the underlying protocol
provider.java.lang.IllegalStateException
- if the underlying protocol provider is
not registered/signed on a public service.OperationFailedException
- with code NETWORK_FAILURE if
subscribing fails due to errors experienced during network
communicationpublic void subscribe(java.lang.String contactIdentifier) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
contactIdentifier
- the identifier of the contact whose status
updates we are subscribing for. java.lang.IllegalArgumentException
- if contact is not a contact
known to the underlying protocol providerjava.lang.IllegalStateException
- if the underlying protocol provider is
not registered/signed on a public service.OperationFailedException
- with code NETWORK_FAILURE if
subscribing fails due to errors experienced during network
communicationpublic void unsubscribe(Contact contact) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
contact
- the contact whose status updates we are unsubscribing
from.java.lang.IllegalArgumentException
- if contact is not a contact
known to the underlying protocol providerjava.lang.IllegalStateException
- if the underlying protocol provider is
not registered/signed on a public service.OperationFailedException
- with code NETWORK_FAILURE if
unsubscribing fails due to errors experienced during network
communicationpublic Contact createUnresolvedContact(java.lang.String address, java.lang.String persistentData)
address
- an identifier of the contact that we'll be creating.persistentData
- a String returned Contact's getPersistentData()
method during a previous run and that has been persistently stored
locally.public Contact createUnresolvedContact(java.lang.String address, java.lang.String persistentData, ContactGroup parent)
address
- an identifier of the contact that we'll be creating.persistentData
- a String returned Contact's getPersistentData()
method during a previous run and that has been persistently stored
locally.parent
- the group where the unresolved contact is
supposed to belong to.public ContactGroup createUnresolvedContactGroup(java.lang.String groupUID, java.lang.String persistentData, ContactGroup parentGroup)
groupUID
- an identifier, returned by ContactGroup's getGroupUID,
that the protocol provider may use in order to create the group.persistentData
- a String returned ContactGroups's getPersistentData()
method during a previous run and that has been persistently stored
locally.parentGroup
- the group under which the new group is to be created
or null if this is group directly underneath the root.public MockContact createVolatileContact(java.lang.String id)
id
- the address of the contact to create.public MockContactGroup getNonPersistentGroup()
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.