com.pcbsys.nirvana.client.p2p.nEventService Class Reference

This class implements the end point of an Event based P2P connection. More...

Inheritance diagram for com.pcbsys.nirvana.client.p2p.nEventService:
com.pcbsys.nirvana.client.p2p.nService com.pcbsys.nirvana.client.Observable

Public Member Functions

void close ()
 Closes the service and informs the remote service that it has been closed. More...
 
void deregisterListener (nEventServiceListener listener)
 Removes the registered nEventServiceListener from this service. More...
 
nOutOfBandService getOutOfBandService ()
 This function returns an nOutOfBandService. More...
 
nConsumeEvent read ()
 Waits for a new nConsumeEvent to be received from the remote service. More...
 
nConsumeEvent read (long timeout)
 Waits for a new nConsumeEvent to be received from the remote service or the timeout to be reached. More...
 
void registerListener (nEventServiceListener listener)
 Registers an nEventServiceListener with this class. More...
 
void write (nConsumeEvent evt)
 Writes an nConsumeEvent to the remote P2P service. More...
 
- Public Member Functions inherited from com.pcbsys.nirvana.client.p2p.nService
void close ()
 Closes the service and informs the remote service that it has been closed. More...
 
nServiceInfo getServiceInfo ()
 Returns the description of the service connected to. More...
 
nServiceStateListener getStateListener ()
 Return the state listener associated with this service More...
 
bool isClosed ()
 Returns a flag indicating if the service has been closed with the More...
 
bool isConnected ()
 Returns whether the service is physically connected to the realm More...
 
void setStateListener (nServiceStateListener listener)
 Set the listener that will receive callbacks for state changes to the service More...
 
- Public Member Functions inherited from com.pcbsys.nirvana.client.Observable
void addObserver (IObserver o)
 Adds an observer to the set of observers for this object, provided that it is not the same as some observer already in the set. More...
 
int countObservers ()
 Returns the number of observers of this Observable object. More...
 
void deleteObserver (IObserver o)
 Deletes an observer from the set of observers of this object. More...
 
void deleteObservers ()
 Clears the observer list so that this object no longer has any observers. More...
 
bool hasChanged ()
 Tests if this object has changed. More...
 
void notifyObservers ()
 If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed. More...
 
void notifyObservers (Object arg)
 If this object has changed, as indicated by the More...
 
 Observable ()
 Construct an Observable with zero Observers. More...
 

Additional Inherited Members

- Protected Member Functions inherited from com.pcbsys.nirvana.client.Observable
void clearChanged ()
 Indicates that this object has no longer changed, or that it has already notified all of its observers of its most recent change, so that the hasChanged method will now return false. More...
 
void setChanged ()
 Marks this Observable object as having been changed; the hasChanged method will now return true. More...
 

Detailed Description

This class implements the end point of an Event based P2P connection.

It allows the user to send and receive nConsumeEvents.

nStreamService

Member Function Documentation

void com.pcbsys.nirvana.client.p2p.nEventService.close ( )

Closes the service and informs the remote service that it has been closed.

Exceptions
Exceptionif unable to perform the close. See the message for further information
void com.pcbsys.nirvana.client.p2p.nEventService.deregisterListener ( nEventServiceListener  listener)

Removes the registered nEventServiceListener from this service.

When all listeners are removed then the read() method can then be called

Parameters
listenerAn Instance of an nEventServiceListener that is to be removed
Exceptions
Exceptionif Service is closed or listener is null
nOutOfBandService com.pcbsys.nirvana.client.p2p.nEventService.getOutOfBandService ( )

This function returns an nOutOfBandService.

An out of band (OOB) service can be used to pass flow/control information between the remote P2P service

Returns
A new nOutOfBandService object
nConsumeEvent com.pcbsys.nirvana.client.p2p.nEventService.read ( )

Waits for a new nConsumeEvent to be received from the remote service.

Returns
nConsumeEvent An event written by the remote service
Exceptions
Exceptionif the lower streams have an error, See the message or more information
nConsumeEvent com.pcbsys.nirvana.client.p2p.nEventService.read ( long  timeout)

Waits for a new nConsumeEvent to be received from the remote service or the timeout to be reached.

Parameters
timeoutThe number of milliseconds to wait for an event to be received
Returns
nConsumeEvent An event written by the remote service
Exceptions
Exceptionif the lower streams have an error, See the message or more information
void com.pcbsys.nirvana.client.p2p.nEventService.registerListener ( nEventServiceListener  listener)

Registers an nEventServiceListener with this class.

This nEventServiceListener will be called whenever there is a new event received

Once this is called then this will preclude the use of the read() method

Parameters
listenerAn Instance of an nEventServiceListener that is to be used
Exceptions
Exceptionif Service is closed or listener is null
void com.pcbsys.nirvana.client.p2p.nEventService.write ( nConsumeEvent  evt)

Writes an nConsumeEvent to the remote P2P service.

Parameters
evtAn nConsumeEvent to send to the remote P2P service
Exceptions
Exceptionif the lower streams have an error, See the message or more information