public class FacadeHubService extends java.lang.Object implements HubService
| Modifier and Type | Class and Description |
|---|---|
private static class |
FacadeHubService.FacadeHubConnection
Utility HubConnection class which allows hub event notifications
to be sent to clients.
|
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map |
connectionMap_ |
private static java.util.logging.Logger |
logger_ |
private ClientProfile |
profile_ |
| Constructor and Description |
|---|
FacadeHubService(ClientProfile profile)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
disconnectAll(ProfileToken profileToken)
Forcibly terminates any connections created by a previous call of
HubService.register(org.astrogrid.samp.hub.ProfileToken)
with a particular profileToken. |
private void |
hubEvent(Message msg)
Sends a given message by notification, as if from the hub,
to all the clients which have registered through this service.
|
boolean |
isHubRunning()
Indicates whether this hub service is currently open for operations.
|
HubConnection |
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.
|
private final ClientProfile profile_
private final java.util.Map connectionMap_
private static final java.util.logging.Logger logger_
public FacadeHubService(ClientProfile profile)
profile - defines the hub connection factory on which this
service is basedpublic boolean isHubRunning()
HubServiceisHubRunning in interface HubServiceHubService.start() and HubService.shutdown()public HubConnection register(ProfileToken profileToken) throws SampException
HubServiceIt 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
throw SampException, however, implementations may
throw unchecked exceptions if that is more convenient;
users of the connection should be prepared to catch these if
they occur.
register in interface HubServiceprofileToken - identifier for the profile acting as gatekeeper
for this connectionSampExceptionpublic void disconnectAll(ProfileToken profileToken)
HubServiceHubService.register(org.astrogrid.samp.hub.ProfileToken)
with a particular profileToken.
Any necessary hub events will be sent.disconnectAll in interface HubServiceprofileToken - previous argument to registerpublic void start()
start in interface HubServicepublic void shutdown()
HubServiceshutdown in interface HubServiceprivate void hubEvent(Message msg)
msg - message to send