Class Service

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Context context
      The context.
      private boolean enabled
      Indicates if the service has been enabled.
      private boolean started
      Indicates if the service was started.
    • Constructor Summary

      Constructors 
      Constructor Description
      Service()
      Constructor.
      Service​(boolean enabled)
      Constructor.
    • Field Detail

      • context

        private volatile Context context
        The context.
      • enabled

        private volatile boolean enabled
        Indicates if the service has been enabled.
      • started

        private volatile boolean started
        Indicates if the service was started.
    • Constructor Detail

      • Service

        public Service()
        Constructor. Enables the service by default.
      • Service

        public Service​(boolean enabled)
        Constructor.
        Parameters:
        enabled - True if the service has been enabled.
    • Method Detail

      • createInboundFilter

        public Filter createInboundFilter​(Context context)
        Create the filter that should be invoked for incoming calls.
        Parameters:
        context - The current context.
        Returns:
        The new filter or null.
      • createOutboundFilter

        public Filter createOutboundFilter​(Context context)
        Create the filter that should be invoked for outgoing calls.
        Parameters:
        context - The current context.
        Returns:
        The new filter or null.
        See Also:
        Context.getClientDispatcher()
      • getContext

        public Context getContext()
        Returns the context.
        Returns:
        The context.
      • isEnabled

        public boolean isEnabled()
        Indicates if the service should be enabled.
        Returns:
        True if the service should be enabled.
      • isStarted

        public boolean isStarted()
        Indicates if the service is started.
        Returns:
        True if the service is started.
      • isStopped

        public boolean isStopped()
        Indicates if the service is stopped.
        Returns:
        True if the service is stopped.
      • setContext

        public void setContext​(Context context)
        Sets the context.
        Parameters:
        context - The context.
      • setEnabled

        public void setEnabled​(boolean enabled)
        Indicates if the service should be enabled.
        Parameters:
        enabled - True if the service should be enabled.
      • start

        public void start()
                   throws java.lang.Exception
        Starts the Restlet.
        Throws:
        java.lang.Exception
      • stop

        public void stop()
                  throws java.lang.Exception
        Stops the Restlet.
        Throws:
        java.lang.Exception