|
JSR-043: JTAPI-1.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Send and receive messages on a messaging connection.
A NamedService represents a messaging connection between the Service supplier and the Service subscriber. The supplier creates one end of the connection using registerService(); the subscriber creates the other end using openNamedService(). When a subscriber opens the NamedService, the supplier gets an onServiceOpened() notification (eventID equals ev_ServiceOpened). That event contains a NamedService that represents the subscriber to the provider.
Either end of a message connection may send a Request or an Event to the other end. If a Request is received, it must be replied to using ServiceRequest.reply().
Either end may close the connection. The other party gets an onServiceClosed() notification (eventID equals ev_ServiceClosed).
Note: ServiceEvents are dispatched to the NamedServiceListener that is established when the NamedService is created.
Fields inherited from interface javax.telephony.media.messaging.MessageConstants |
e_NotFound, e_NotSupported, ev_Close, ev_OpenNamedService, ev_RegisterService, ev_ServiceClosed, ev_ServiceOpened, ev_UnregisterService, k_Error, k_EventData, k_Payload, k_Qualifier, k_ServiceName, k_Status, k_SubError, v_Null |
Fields inherited from interface javax.telephony.media.MediaConstants |
e_OK, q_Duration, q_Standard, q_Stop |
Method Summary | |
void |
addListener(java.util.EventListener listener)
Add a Listener for Events dispatched by this NamedService. |
Async_ServiceEvent |
async_close()
Async form of close. |
Async_ServiceEvent |
async_request(Symbol cmdID,
java.util.Dictionary payload)
Async form of request. |
void |
close()
Terminate messaging connection between Service and User. |
boolean |
isOpen()
Return true if this NamedService is open. |
void |
removeListener(java.util.EventListener listener)
Remove an EventListener from this NamedService. |
ServiceEvent |
request(Symbol cmdID,
java.util.Dictionary payload)
Send a request on this message connection, and wait for the reply. |
void |
sendEvent(Symbol eventID,
java.util.Dictionary payload)
Send a non-transactional event on this message connection. |
Method Detail |
public ServiceEvent request(Symbol cmdID, java.util.Dictionary payload) throws ServiceException
Maintains a transaction waiting for a reply. When the reply is returned, the transaction is done and Async_NamedServiceListener.onRequestDone is invoked
Note: If a reply is not expected, consider using sendEvent() instead.
Note:On the other end, request messages are delivered to NamedServiceLisetner.onServiceRequest
cmdID
- the event Symbol to identify the requestthe
- payload of the Request.ServiceClosedException
- if this service is closed.ServiceRequestException
- if request returns an Exceptionpublic Async_ServiceEvent async_request(Symbol cmdID, java.util.Dictionary payload) throws ServiceException
cmdID
- the event Symbol to identify the requestthe
- payload of the Request.ServiceClosedException
- if this service is closed.Async_NamedServiceListener
public void sendEvent(Symbol eventID, java.util.Dictionary payload) throws ServiceException
Note:This method does not wait for any reply.
Note:On the other end, event messages are delivered to NamedServiceLisetner.onServiceEvent
eventID
- the event Symbol to identify the eventthe
- payload of the Event.ServiceClosedException
- if this service is closed.public boolean isOpen()
A NamedService is open until it has been close by either end.
public void close()
public Async_ServiceEvent async_close()
public void addListener(java.util.EventListener listener)
To get asynchronous notification of ServiceEvents, addListener(NamedServiceListener)
Note: the NamedServiceListener specified when the NamedService is created is automatically added.
Note: This method accepts any java.util.EventListener but ServiceEvents are delivered only to a NamedServiceListener. Unless/until the MessagingService is extended (for example, by a JtapiPeer vendor) to create other classes of events, other Listeners are not invoked.
NamedServiceListener
,
Async_NamedServiceListener
public void removeListener(java.util.EventListener listener)
NamedServiceListener
,
Async_NamedServiceListener
|
JSR-043: JTAPI-1.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |