Package org.astrogrid.samp.hub
Class FacadeHubService
java.lang.Object
org.astrogrid.samp.hub.FacadeHubService
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
disconnectAll
(ProfileToken profileToken) Forcibly terminates any connections created by a previous call ofHubService.register(org.astrogrid.samp.hub.ProfileToken)
with a particularprofileToken
.boolean
Indicates whether this hub service is currently open for operations.register
(ProfileToken profileToken) Creates a new connection to this hub service, thereby initiating a new registered client.void
shutdown()
Tidies up any resources owned by this object.void
start()
No-op.
-
Constructor Details
-
FacadeHubService
Constructor.- Parameters:
profile
- defines the hub connection factory on which this service is based
-
-
Method Details
-
isHubRunning
public boolean isHubRunning()Description copied from interface:HubService
Indicates whether this hub service is currently open for operations.- Specified by:
isHubRunning
in interfaceHubService
- Returns:
- true iff called between
HubService.start()
andHubService.shutdown()
-
register
Description copied from interface:HubService
Creates 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
HubConnection
methods 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:
register
in 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
Description copied from interface:HubService
Forcibly 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:
disconnectAll
in interfaceHubService
- Parameters:
profileToken
- previous argument toregister
-
start
public void start()No-op.- Specified by:
start
in interfaceHubService
-
shutdown
public void shutdown()Description copied from interface:HubService
Tidies up any resources owned by this object. Should be called when no longer required.- Specified by:
shutdown
in interfaceHubService
-