Class 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
    • Field Detail

      • connectionMap_

        private final java.util.Map connectionMap_
      • logger_

        private static final java.util.logging.Logger logger_
    • Constructor Detail

      • FacadeHubService

        public FacadeHubService​(ClientProfile profile)
        Constructor.
        Parameters:
        profile - defines the hub connection factory on which this service is based
    • Method Detail

      • 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
      • 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
      • hubEvent

        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.
        Parameters:
        msg - message to send