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

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

Inherits java::util::Observable.


Public Member Functions

final void close ()
 Closes all currently openned services and disconnects from the Realm server.
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.
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.
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.
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.
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.
final nServiceInfo findService (final String serviceName) throws nIllegalArgumentException
 Locates the information about the specified service.
final java.util.Enumeration getAllServices ()
 Returns an enumeration of all known services.
final boolean isConnected ()
 If the factory has a connection to the Realm Server or not.
 nServiceFactory (final nSessionAttributes sessionAttrib, final String username) throws nBaseClientException
 Contructs a P2P Service Factory instance on the realm specified by the session attributes.
 nServiceFactory (final nSessionAttributes sessionAttrib) throws nBaseClientException
 Contructs a P2P Service Factory instance on the realm specified by the session attributes.
 nServiceFactory (final nSession aSession) throws nBaseClientException
 Construct a P2P Service Factory re-using an existing nSession object.

Static Public Attributes

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

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:
aSession the session to re-use
Exceptions:
nBaseClientException thrown 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:
sessionAttrib The SessionAttributes that reference the desired Realm
Exceptions:
nBaseClientException If 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:
sessionAttrib The SessionAttributes that reference the desired Realm
username The username to supply to the realm server
Exceptions:
nBaseClientException If 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,
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:
serviceInfo An nServiceInfo that contains the information regarding the service to connect to
timeout A time in milliseconds to wait for the service to come on-line
Returns:
nService A Service object connected to the remote service
Exceptions:
IOException if unable to communicate with the remote service, see the message for further information
nBaseClientException If an exception occured locally, see the message for further information

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:
serviceInfo An nServiceInfo that contains the information regarding the service to connect to
Returns:
nService A Service object connected to the remote service
Exceptions:
IOException if unable to communicate with the remote service, see the message for further information
nBaseClientException If 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,
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:
name Name of the service to create
description A String detailing what this service is
accessMask The long value representing the initial security mask for the service
Returns:
Returns an nEventService
Exceptions:
nBaseClientException If 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 
) throws nBaseClientException

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

Parameters:
name Name of the service to create
description A String detailing what this service is
Returns:
Returns an nEventService
Exceptions:
nBaseClientException If 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:
name Name of the service to create
description A String detailing what this service is
Returns:
Returns an nStreamService
Exceptions:
nBaseClientException If 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:
serviceName The name of the service to find the nServiceInfo about
Returns:
ServiceInfo
See also:
nServiceInfo
Exceptions:
nIllegalArgumentException if 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

Flag Indicating an Event Service.

See also:
nEventService

Flag indicatiting a Stream Service.

See also:
nStreamService

Share this page with others:
Tell Your Tweets Facebook It! Add to Delicious Reddit! Digg It! Stumble Upon Add to Your Faves Mixx it
Follow Us:
Keep up with my-Channels on Twitter Become a fan on Facebook LinkedIn Profile Recent Highlights RSS Feed