Package org.astrogrid.samp.hub

# Class FacadeHubService

java.lang.Object
org.astrogrid.samp.hub.FacadeHubService

All Implemented Interfaces:
  `HubService`

public class FacadeHubService extends 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

Modifier and Type
Method
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`.
`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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### FacadeHubService

public FacadeHubService(ClientProfile profile)
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 interface `HubService`
Returns:
  true iff called between `HubService.start()` and `HubService.shutdown()`

### register

public HubConnection register(ProfileToken profileToken) throws SampException
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 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.

Specified by:
  `register` in interface `HubService`
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: `HubService`
Forcibly terminates any connections created by a previous call of `HubService.register(org.astrogrid.samp.hub.ProfileToken)` with a particular `profileToken`. Any necessary hub events will be sent.

Specified by:
  `disconnectAll` in interface `HubService`
Parameters:
  `profileToken` - previous argument to `register`

### start

public void start()
No-op.

Specified by:
  `start` in interface `HubService`

### 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 interface `HubService`