|
SIP Communicator: 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.service.protocol.AbstractOperationSetPersistentPresence<ProtocolProviderServiceSipImpl>
net.java.sip.communicator.impl.protocol.sip.OperationSetPresenceSipImpl
public class OperationSetPresenceSipImpl
Sip presence implementation (SIMPLE). Compliant with rfc3261, rfc3265, rfc3856, rfc3863, rfc4480 and rfc3903
| Field Summary |
|---|
| Fields inherited from class net.java.sip.communicator.service.protocol.AbstractOperationSetPersistentPresence |
|---|
parentProvider |
| Constructor Summary | |
|---|---|
OperationSetPresenceSipImpl(ProtocolProviderServiceSipImpl provider,
boolean presenceEnabled,
boolean forceP2PMode,
int pollingPeriod,
int subscriptionExpiration)
Creates an instance of this operation set keeping a reference to the specified parent provider. |
|
| Method Summary | |
|---|---|
void |
addServerStoredGroupChangeListener(ServerStoredGroupListener listener)
Registers a listener that would receive events upong changes in server stored groups. |
(package private) String |
convertDocument(Document document)
Convert a xml document |
(package private) Document |
convertDocument(String document)
Convert a xml document |
(package private) Document |
createDocument()
Returns a new valid xml document. |
void |
createServerStoredContactGroup(ContactGroup parentGroup,
String groupName)
Creates a group with the specified name and parent in the server stored contact list. |
Contact |
createUnresolvedContact(String address,
String persistentData)
Creates and returns a unresolved contact from the specified address and persistentData. |
Contact |
createUnresolvedContact(String contactId,
String persistentData,
ContactGroup parent)
Creates and returns a unresolved contact from the specified address and persistentData. |
ContactGroup |
createUnresolvedContactGroup(String groupUID,
String persistentData,
ContactGroup parentGroup)
Creates and returns a unresolved contact group from the specified address and persistentData. |
ContactSipImpl |
createVolatileContact(javax.sip.address.Address contactAddress)
Creates a non persistent contact for the specified address. |
ContactSipImpl |
findContactByID(String contactID)
Returns a ContactSipImpl with a specific ID in case we have
a subscription for it and null otherwise. |
void |
fireProviderMsgStatusChangeEvent(String oldValue)
Notifies all registered listeners of the new event. |
void |
forcePollContact(ContactSipImpl contact)
Forces the poll of a contact to update its current state. |
String |
getCurrentStatusMessage()
Returns the status message that was confirmed by the server |
ContactSipImpl |
getLocalContactForDst(javax.sip.address.Address destination)
Returns the protocol specific contact instance representing the local user. |
ContactSipImpl |
getLocalContactForDst(ContactSipImpl destination)
Returns the protocol specific contact instance representing the local user. |
byte[] |
getPidfPresenceStatus(ContactSipImpl contact)
Converts the PresenceStatus of contact into a PIDF document. |
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. |
Iterator<PresenceStatus> |
getSupportedStatusSet()
Returns the set of PresenceStatus objects that a user of this service may request the provider to enter. |
static boolean |
isEquals(URI uri1,
URI uri2)
Checks whether to URIs are equal with safe null check. |
void |
moveContactToGroup(Contact contactToMove,
ContactGroup newParent)
Removes the specified contact from its current parent and places it under newParent. |
boolean |
processDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent)
Called when a dialog is terminated |
boolean |
processIOException(javax.sip.IOExceptionEvent exceptionEvent)
Called when an IO error occurs |
boolean |
processRequest(javax.sip.RequestEvent requestEvent)
Process a request from a distant contact |
boolean |
processResponse(javax.sip.ResponseEvent responseEvent)
Analyzes the incoming responseEvent and then forwards it to the proper event handler. |
boolean |
processTimeout(javax.sip.TimeoutEvent timeoutEvent)
Called when a timeout occur |
boolean |
processTransactionTerminated(javax.sip.TransactionTerminatedEvent transactionTerminatedEvent)
Called when a transaction is terminated |
void |
publishPresenceStatus(PresenceStatus status,
String statusMsg)
Requests the provider to enter into a status corresponding to the specified parameters. |
PresenceStatus |
queryContactStatus(String contactIdentifier)
Get the PresenceStatus for a particular contact. |
void |
registrationStateChanged(RegistrationStateChangeEvent evt)
The method is called by a ProtocolProvider implementation whenever a change in the registration state of the corresponding provider had occurred. |
void |
removeServerStoredContactGroup(ContactGroup group)
Removes the specified group from the server stored contact list. |
void |
removeServerStoredGroupChangeListener(ServerStoredGroupListener listener)
Removes the specified group change listener so that it won't receive any further events. |
void |
renameServerStoredContactGroup(ContactGroup group,
String newName)
Renames the specified group from the server stored contact list. |
(package private) ContactSipImpl |
resolveContactID(String contactID)
Tries to find a ContactSipImpl which is identified either by
a specific contactID or by a derivation of it. |
void |
setAuthorizationHandler(AuthorizationHandler handler)
Handler for incoming authorization requests. |
void |
setPidfPresenceStatus(String presenceDoc)
Sets the contact's presence status using the PIDF document provided. |
void |
subscribe(ContactGroup parentGroup,
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(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. |
void |
unsubscribeToAllContact()
Unsubscribe to every contact. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OperationSetPresenceSipImpl(ProtocolProviderServiceSipImpl provider,
boolean presenceEnabled,
boolean forceP2PMode,
int pollingPeriod,
int subscriptionExpiration)
provider - the ProtocolProviderServiceSipImpl instance that
created us.presenceEnabled - if we are activated or if we don't have to
handle the presence informations for contactsforceP2PMode - if we should start in the p2p mode directlypollingPeriod - the period between two poll for offline contactssubscriptionExpiration - the default subscription expiration value
to use| Method Detail |
|---|
public void addServerStoredGroupChangeListener(ServerStoredGroupListener listener)
addServerStoredGroupChangeListener in interface OperationSetPersistentPresenceaddServerStoredGroupChangeListener in class AbstractOperationSetPersistentPresence<ProtocolProviderServiceSipImpl>listener - a ServerStoredGroupChangeListener impl that would receive
events upong group changes.public void removeServerStoredGroupChangeListener(ServerStoredGroupListener listener)
removeServerStoredGroupChangeListener in interface OperationSetPersistentPresenceremoveServerStoredGroupChangeListener in class AbstractOperationSetPersistentPresence<ProtocolProviderServiceSipImpl>listener - the ServerStoredGroupChangeListener to removepublic PresenceStatus getPresenceStatus()
getPresenceStatus in interface OperationSetPresencepublic ContactGroup getServerStoredContactListRoot()
getServerStoredContactListRoot in interface OperationSetPersistentPresence
public void createServerStoredContactGroup(ContactGroup parentGroup,
String groupName)
throws OperationFailedException
createServerStoredContactGroup in interface OperationSetPersistentPresenceparentGroup - the group where the new group should be createdgroupName - the name of the new group to create.
OperationFailedException - with code NETWORK_FAILURE if creating
the group fails because of a network error.
public ContactGroup createUnresolvedContactGroup(String groupUID,
String persistentData,
ContactGroup parentGroup)
createUnresolvedContactGroup in interface OperationSetPersistentPresencegroupUID - 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 void renameServerStoredContactGroup(ContactGroup group,
String newName)
renameServerStoredContactGroup in interface OperationSetPersistentPresencegroup - the group to rename.newName - the new name of the group.
public void moveContactToGroup(Contact contactToMove,
ContactGroup newParent)
moveContactToGroup in interface OperationSetPersistentPresencecontactToMove - the Contact to movenewParent - the ContactGroup where Contact
would be placed.public void removeServerStoredContactGroup(ContactGroup group)
removeServerStoredContactGroup in interface OperationSetPersistentPresencegroup - the group to remove.
IllegalArgumentException - if group was not found in this
protocol's contact list.
public void publishPresenceStatus(PresenceStatus status,
String statusMsg)
throws IllegalArgumentException,
IllegalStateException,
OperationFailedException
publishPresenceStatus in interface OperationSetPresencestatus - the PresenceStatus as returned by
getRequestableStatusSetstatusMsg - the message that should be set as the reason to
enter that status
IllegalArgumentException - if the status requested is not a
valid PresenceStatus supported by this provider.
IllegalStateException - if the provider is not currently
registered.
OperationFailedException - with code NETWORK_FAILURE if
publishing the status fails due to a network error.public void fireProviderMsgStatusChangeEvent(String oldValue)
oldValue - the presence status we were in before the change.public Iterator<PresenceStatus> getSupportedStatusSet()
getSupportedStatusSet in interface OperationSetPresence
public PresenceStatus queryContactStatus(String contactIdentifier)
throws IllegalArgumentException,
IllegalStateException,
OperationFailedException
queryContactStatus in interface OperationSetPresencecontactIdentifier - the identifier of the contact whose status
we're interested in.
IllegalArgumentException - if contact is not a contact
known to the underlying protocol provider
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 communication
public void subscribe(String contactIdentifier)
throws IllegalArgumentException,
IllegalStateException,
OperationFailedException
subscribe in interface OperationSetPersistentPresencesubscribe in interface OperationSetPresencecontactIdentifier - the identifier of the contact whose status
updates we are subscribing for.
IllegalArgumentException - if contact is not a contact
known to the underlying protocol provider
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
communication
public void subscribe(ContactGroup parentGroup,
String contactIdentifier)
throws IllegalArgumentException,
IllegalStateException,
OperationFailedException
subscribe in interface OperationSetPersistentPresenceparentGroup - 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.
IllegalArgumentException - if contact or
parent are not a contact known to the underlying protocol
provider.
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
communication
public void unsubscribe(Contact contact)
throws IllegalArgumentException,
IllegalStateException,
OperationFailedException
unsubscribe in interface OperationSetPersistentPresenceunsubscribe in interface OperationSetPresencecontact - the contact whose status updates we are unsubscribing
from.
OperationFailedException - with code NETWORK_FAILURE if
unsubscribing fails due to errors experienced during network
communication
IllegalArgumentException - if contact is not a contact
known to the underlying protocol provider
IllegalStateException - if the underlying protocol provider is not
registered/signed on a public service.public boolean processResponse(javax.sip.ResponseEvent responseEvent)
processResponse in interface MethodProcessorresponseEvent - the responseEvent that we received
ProtocolProviderService.
public boolean processRequest(javax.sip.RequestEvent requestEvent)
processRequest in interface MethodProcessorrequestEvent - the RequestEvent containing the newly
received request.
public boolean processDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent)
processDialogTerminated in interface MethodProcessordialogTerminatedEvent - DialogTerminatedEvent
public boolean processIOException(javax.sip.IOExceptionEvent exceptionEvent)
processIOException in interface MethodProcessorexceptionEvent - IOExceptionEvent
public boolean processTransactionTerminated(javax.sip.TransactionTerminatedEvent transactionTerminatedEvent)
processTransactionTerminated in interface MethodProcessortransactionTerminatedEvent - TransactionTerminatedEvent
public boolean processTimeout(javax.sip.TimeoutEvent timeoutEvent)
processTimeout in interface MethodProcessortimeoutEvent - TimeoutEvent
public ContactSipImpl findContactByID(String contactID)
ContactSipImpl with a specific ID in case we have
a subscription for it and null otherwise.
findContactByID in interface OperationSetPresencecontactID - a String identifier of the contact which is to be retrieved
ContactSipImpl with the specified
contactID or null if we don't have a
subscription for the specified identifierpublic ContactSipImpl getLocalContactForDst(ContactSipImpl destination)
destination - the destination that we would be sending our contact
information to.
public ContactSipImpl getLocalContactForDst(javax.sip.address.Address destination)
destination - the destination that we would be sending our contact
information to.
public void setAuthorizationHandler(AuthorizationHandler handler)
setAuthorizationHandler in interface OperationSetPresencehandler - an instance of an AuthorizationHandler for
authorization requests coming from other users requesting
permission add us to their contact list.public String getCurrentStatusMessage()
getCurrentStatusMessage in interface OperationSetPresence
public Contact createUnresolvedContact(String address,
String persistentData)
createUnresolvedContact in interface OperationSetPresenceaddress - 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(String contactId,
String persistentData,
ContactGroup parent)
createUnresolvedContact in interface OperationSetPersistentPresencecontactId - 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 ContactSipImpl createVolatileContact(javax.sip.address.Address contactAddress)
contactAddress - the address of the volatile contact we'd like to
create.
ContactSipImpl resolveContactID(String contactID)
ContactSipImpl which is identified either by
a specific contactID or by a derivation of it.
contactID - the identifier of the ContactSipImpl to retrieve
either by directly using it or by deriving it
ContactSipImpl which is identified either by the
specified contactID or by a derivation of itDocument createDocument()
String convertDocument(Document document)
document - the document to convert
Document convertDocument(String document)
document - the document as a String
public byte[] getPidfPresenceStatus(ContactSipImpl contact)
contact - The contact which interest us
public void setPidfPresenceStatus(String presenceDoc)
presenceDoc - the pidf document to use
public static boolean isEquals(URI uri1,
URI uri2)
uri1 - to be compared.uri2 - to be compared.
public void forcePollContact(ContactSipImpl contact)
contact - the contact to pollpublic void unsubscribeToAllContact()
public void registrationStateChanged(RegistrationStateChangeEvent evt)
registrationStateChanged in interface RegistrationStateChangeListenerevt - ProviderStatusChangeEvent the event describing the status
change.
|
SIP Communicator: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||