Class CurrentService

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getName()
      Retrieves the name of the current service.
      Service getService()
      Retrieves the current service.
      boolean process​(int cmd, Buffer buffer)
      Processes a service request.
      void set​(Service service, java.lang.String name, boolean start)
      Sets the current service and its name, and optionally starts the service.
      void start()
      Starts the current service.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • currentName

        private java.lang.String currentName
      • currentService

        private Service currentService
    • Constructor Detail

      • CurrentService

        protected CurrentService​(Session session)
        Creates a new CurrentService instance belonging to the given Session.
        Parameters:
        session - Session the instance belongs to
    • Method Detail

      • getName

        public java.lang.String getName()
        Retrieves the name of the current service.
        Returns:
        the name, or null if none is set
      • getService

        public Service getService()
        Retrieves the current service.
        Returns:
        the current service, or null if none is set
      • set

        public void set​(Service service,
                        java.lang.String name,
                        boolean start)
        Sets the current service and its name, and optionally starts the service.
        Parameters:
        service - Service to set
        name - Name of the service (the name of the ServiceFactory that created it)
        start - whether to start the service
      • start

        public void start()
        Starts the current service.
      • process

        public boolean process​(int cmd,
                               Buffer buffer)
                        throws java.lang.Exception
        Processes a service request.
        Parameters:
        cmd - the command
        buffer - the data received with the command
        Returns:
        true if a current service is set, false if no current service exists
        Throws:
        java.lang.Exception - when the current service fails