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

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

#include <nServiceFactory.h>


Public Member Functions

void close ()
 Closes all currently openned services and disconnects from the Realm server.
nServiceconnectToService (nServiceInfo *pServiceInfo, long timeout=-1)
 Given an nServiceInfo object this constructs an nService object which can then be used to communicate with a remote service.
nServerServicecreateEventService (const std::string &name, const std::string &description, long accessMask=-1)
 Given a name and a description, this call constructs a new event service and advertises the new service on the realm.
nServerServicecreateStreamService (const std::string &name, const std::string &description, long accessMask=-1)
 Given a name and a description, this call constructs a new stream service and advertises the new service on the realm.
nServiceInfofindService (const std::string &serviceName)
 Locates the information about the specified service.
std::list< nServiceInfo * > * getAllServices (long timeout)
 Returns a list of all known services.
std::list< nServiceInfo * > * getAllServices ()
 Returns a list of all known services.
bool isConnected ()
 If the factory has a connection to the Realm Server or not.
 nServiceFactory (nSession *pSession)
 Construct a P2P Service Factory re-using an existing nSession object.
 nServiceFactory (nSessionAttributes *pSessionAttrib, const std::string &username="")
 Contructs a P2P Service Factory instance on the realm specified by the session attributes.

Detailed Description

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

Constructor & Destructor Documentation

com.pcbsys.nirvana.client.p2p.nServiceFactory.nServiceFactory ( nSessionAttributes pSessionAttrib,
const std::string &  username = "" 
)

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

Parameters:
*pSessionAttrib 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

com.pcbsys.nirvana.client.p2p.nServiceFactory.nServiceFactory ( nSession pSession  ) 

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

Parameters:
*pSession the session to re-use
Exceptions:
nBaseClientException thrown if there are any problems connecting to the services on the specific realm


Member Function Documentation

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.

nService* com.pcbsys.nirvana.client.p2p.nServiceFactory.connectToService ( nServiceInfo pServiceInfo,
long  timeout = -1 
)

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

Parameters:
*pServiceInfo An nServiceInfo that contains the information regarding the service to connect to
timeout Maximum time in milliseconds to attempt to connect to the service
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

nServerService* com.pcbsys.nirvana.client.p2p.nServiceFactory.createEventService ( const std::string &  name,
const std::string &  description,
long  accessMask = -1 
)

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 default acl permissions for the service
Returns:
Returns an nEventService
Exceptions:
nBaseClientException If an exception occured locally, see the message for further information
See also:
nEventService

nServerService* com.pcbsys.nirvana.client.p2p.nServiceFactory.createStreamService ( const std::string &  name,
const std::string &  description,
long  accessMask = -1 
)

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
accessMask the default acl permissions for the service
Returns:
Returns an nStreamService
Exceptions:
nBaseClientException If an exception occured locally, see the message for further information
See also:
nStreamService

nServiceInfo* com.pcbsys.nirvana.client.p2p.nServiceFactory.findService ( const std::string &  serviceName  ) 

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

std::list<nServiceInfo*>* com.pcbsys.nirvana.client.p2p.nServiceFactory.getAllServices ( long  timeout  ) 

Returns a list of all known services.

Returns:
Returns a list of all the services.
Parameters:
timeout Time to wait before first service arrives.

std::list<nServiceInfo*>* com.pcbsys.nirvana.client.p2p.nServiceFactory.getAllServices (  ) 

Returns a list of all known services.

Returns:
Returns a list of all the services.

bool com.pcbsys.nirvana.client.p2p.nServiceFactory.isConnected (  ) 

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

Returns:
bool indicating the connection status