Package org.astrogrid.samp.hub
Class FacadeHubService
- java.lang.Object
-
- org.astrogrid.samp.hub.FacadeHubService
-
- All Implemented Interfaces:
HubService
public class FacadeHubService extends java.lang.Object implements HubService
HubService that provides hub functionality by accessing an existing hub service. The existing hub service is defined by a supplied ClientProfile object.- Since:
- 1 Feb 2011
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description FacadeHubService(ClientProfile profile)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisconnectAll(ProfileToken profileToken)Forcibly terminates any connections created by a previous call ofHubService.register(org.astrogrid.samp.hub.ProfileToken)with a particularprofileToken.booleanisHubRunning()Indicates whether this hub service is currently open for operations.HubConnectionregister(ProfileToken profileToken)Creates a new connection to this hub service, thereby initiating a new registered client.voidshutdown()Tidies up any resources owned by this object.voidstart()No-op.
-
-
-
Constructor Detail
-
FacadeHubService
public FacadeHubService(ClientProfile profile)
Constructor.- Parameters:
profile- defines the hub connection factory on which this service is based
-
-
Method Detail
-
isHubRunning
public boolean isHubRunning()
Description copied from interface:HubServiceIndicates whether this hub service is currently open for operations.- Specified by:
isHubRunningin interfaceHubService- Returns:
- true iff called between
HubService.start()andHubService.shutdown()
-
register
public HubConnection register(ProfileToken profileToken) throws SampException
Description copied from interface:HubServiceCreates a new connection to this hub service, thereby initiating a new registered client.It is the responsibility of the returned connection, not the user of that connection, to broadcast the various
samp.hub.event.*notifications at the appropriate times.Most of the
HubConnectionmethods are declared to throwSampException, however, implementations may throw unchecked exceptions if that is more convenient; users of the connection should be prepared to catch these if they occur.- Specified by:
registerin interfaceHubService- Parameters:
profileToken- identifier for the profile acting as gatekeeper for this connection- Returns:
- new hub connection representing registration of a new client
- Throws:
SampException
-
disconnectAll
public void disconnectAll(ProfileToken profileToken)
Description copied from interface:HubServiceForcibly terminates any connections created by a previous call ofHubService.register(org.astrogrid.samp.hub.ProfileToken)with a particularprofileToken. Any necessary hub events will be sent.- Specified by:
disconnectAllin interfaceHubService- Parameters:
profileToken- previous argument toregister
-
start
public void start()
No-op.- Specified by:
startin interfaceHubService
-
shutdown
public void shutdown()
Description copied from interface:HubServiceTidies up any resources owned by this object. Should be called when no longer required.- Specified by:
shutdownin interfaceHubService
-
-