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

A ServiceFactory is used to create both client and server services. More...

Inherits Observable.

Public Member Functions

final void close ()
 Closes all currently openned services and disconnects from the Realm server. More...
 
final nService connectToService (final nServiceInfo serviceInfo) throws nBaseClientException, IOException
 Given an nServiceInfo object this constructs an nService object which can then be used to communicate with a remote service. More...
 
final nService connectToService (final nServiceInfo serviceInfo, final long timeout) throws nBaseClientException, IOException
 Connects to the given service defined in the nServiceInfo and will wait for the timeout specified for the remote service to respond. More...
 
final nServerService createEventService (final String name, final String description) throws nBaseClientException
 Given a name and a description, this call constructs a new event service and advertises the new service on the realm. More...
 
final nServerService createEventService (final String name, final String description, final long accessMask) throws nBaseClientException
 Given a name and a description, this call constructs a new event service and advertises the new service on the realm. More...
 
final nServerService createStreamService (final String name, final String description) throws nBaseClientException
 Given a name and a description, this call constructs a new stream service and advertises the new service on the realm. More...
 
final nServiceInfo findService (final String serviceName) throws nIllegalArgumentException
 Locates the information about the specified service. More...
 
final java.util.Enumeration getAllServices ()
 Returns an enumeration of all known services. More...
 
final boolean isConnected ()
 If the factory has a connection to the Realm Server or not. More...
 
 nServiceFactory (final nSession aSession) throws nBaseClientException
 Construct a P2P Service Factory re-using an existing nSession object. More...
 
 nServiceFactory (final nSessionAttributes sessionAttrib) throws nBaseClientException
 Contructs a P2P Service Factory instance on the realm specified by the session attributes. More...
 
 nServiceFactory (final nSessionAttributes sessionAttrib, final String username) throws nBaseClientException
 Contructs a P2P Service Factory instance on the realm specified by the session attributes. More...
 

Static Public Attributes

static final int nEventServiceType = 1
 Flag Indicating an Event Service. More...
 
static final int nStreamServiceType = 0
 Flag indicatiting a Stream Service. More...
 

Detailed Description

A ServiceFactory is used to create both client and server services.

Constructor & Destructor Documentation

com.pcbsys.nirvana.client.p2p.nServiceFactory.nServiceFactory ( final nSession  aSession) throws nBaseClientException

Construct a P2P Service Factory re-using an existing nSession object.

Parameters
aSessionthe session to re-use
Exceptions
nBaseClientExceptionthrown if there are any problems connecting to the services on the specific realm
com.pcbsys.nirvana.client.p2p.nServiceFactory.nServiceFactory ( final nSessionAttributes  sessionAttrib) throws nBaseClientException

Contructs a P2P Service Factory instance on the realm specified by the session attributes.

Parameters
sessionAttribThe SessionAttributes that reference the desired Realm
Exceptions
nBaseClientExceptionIf unable to communicate with the realm
com.pcbsys.nirvana.client.p2p.nServiceFactory.nServiceFactory ( final nSessionAttributes  sessionAttrib,
final String  username 
) throws nBaseClientException

Contructs a P2P Service Factory instance on the realm specified by the session attributes.

Parameters
sessionAttribThe SessionAttributes that reference the desired Realm
usernameThe username to supply to the realm server
Exceptions
nBaseClientExceptionIf unable to communicate with the realm

Member Function Documentation

final void com.pcbsys.nirvana.client.p2p.nServiceFactory.close ( )

Closes all currently openned services and disconnects from the Realm server.

This should be done as the last thing.

final nService com.pcbsys.nirvana.client.p2p.nServiceFactory.connectToService ( final nServiceInfo  serviceInfo) throws nBaseClientException, IOException

Given an nServiceInfo object this constructs an nService object which can then be used to communicate with a remote service.

Parameters
serviceInfoAn nServiceInfo that contains the information regarding the service to connect to
Returns
nService A Service object connected to the remote service
Exceptions
IOExceptionif unable to communicate with the remote service, see the message for further information
nBaseClientExceptionIf an exception occured locally, see the message for further information
final nService com.pcbsys.nirvana.client.p2p.nServiceFactory.connectToService ( final nServiceInfo  serviceInfo,
final long  timeout 
) throws nBaseClientException, IOException

Connects to the given service defined in the nServiceInfo and will wait for the timeout specified for the remote service to respond.

Parameters
serviceInfoAn nServiceInfo that contains the information regarding the service to connect to
timeoutA time in milliseconds to wait for the service to come on-line
Returns
nService A Service object connected to the remote service
Exceptions
IOExceptionif unable to communicate with the remote service, see the message for further information
nBaseClientExceptionIf an exception occured locally, see the message for further information
final nServerService com.pcbsys.nirvana.client.p2p.nServiceFactory.createEventService ( final String  name,
final String  description 
) throws nBaseClientException

Given a name and a description, this call constructs a new event service and advertises the new service on the realm.

Parameters
nameName of the service to create
descriptionA String detailing what this service is
Returns
Returns an nEventService
Exceptions
nBaseClientExceptionIf an exception occured locally, see the message for further information
See Also
nEventService
final nServerService com.pcbsys.nirvana.client.p2p.nServiceFactory.createEventService ( final String  name,
final String  description,
final long  accessMask 
) throws nBaseClientException

Given a name and a description, this call constructs a new event service and advertises the new service on the realm.

Parameters
nameName of the service to create
descriptionA String detailing what this service is
accessMaskThe long value representing the initial security mask for the service
Returns
Returns an nEventService
Exceptions
nBaseClientExceptionIf an exception occured locally, see the message for further information
See Also
nEventService
final nServerService com.pcbsys.nirvana.client.p2p.nServiceFactory.createStreamService ( final String  name,
final String  description 
) throws nBaseClientException

Given a name and a description, this call constructs a new stream service and advertises the new service on the realm.

Parameters
nameName of the service to create
descriptionA String detailing what this service is
Returns
Returns an nStreamService
Exceptions
nBaseClientExceptionIf an exception occured locally, see the message for further information
See Also
nStreamService
final nServiceInfo com.pcbsys.nirvana.client.p2p.nServiceFactory.findService ( final String  serviceName) throws nIllegalArgumentException

Locates the information about the specified service.

Parameters
serviceNameThe name of the service to find the nServiceInfo about
Returns
ServiceInfo
See Also
nServiceInfo
Exceptions
nIllegalArgumentExceptionif the service name is null or illegal
final java.util.Enumeration com.pcbsys.nirvana.client.p2p.nServiceFactory.getAllServices ( )

Returns an enumeration of all known services.

Returns
Returns an enumeration of all the services.
final boolean com.pcbsys.nirvana.client.p2p.nServiceFactory.isConnected ( )

If the factory has a connection to the Realm Server or not.

Returns
boolean indicating the connection status

Field Documentation

final int com.pcbsys.nirvana.client.p2p.nServiceFactory.nEventServiceType = 1
static

Flag Indicating an Event Service.

See Also
nEventService
final int com.pcbsys.nirvana.client.p2p.nServiceFactory.nStreamServiceType = 0
static

Flag indicatiting a Stream Service.

See Also
nStreamService