Class ConsoleSession

  • All Implemented Interfaces:
    org.osgi.framework.ServiceFactory<java.lang.Object>

    public abstract class ConsoleSession
    extends java.lang.Object
    implements org.osgi.framework.ServiceFactory<java.lang.Object>
    A console session service provides the input and output to a single console session. The input will be used by the console to read in console commands. The output will be used to print the results of console commands.

    The console session must be registered as an OSGi service in order to be associated with a console instance. The console implementation will discover any console session services and will create a new console instance using the console session for input and output. When a session is closed then the console session service will be unregistered and the console instance will terminate and be disposed of. The console instance will also terminate if the console session service is unregistered for any reason.

    Since:
    3.6
    • Constructor Summary

      Constructors 
      Constructor Description
      ConsoleSession()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Called by the console implementation to free resources associated with this console session.
      protected abstract void doClose()
      Called by the close() method to free resources associated with this console session.
      abstract java.io.InputStream getInput()
      Returns the input for this console session.
      abstract java.io.OutputStream getOutput()
      Returns the output for this console session.
      java.lang.Object getService​(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration<java.lang.Object> registration)  
      void ungetService​(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration<java.lang.Object> registration, java.lang.Object service)  
      • Methods inherited from class java.lang.Object

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

      • ConsoleSession

        public ConsoleSession()
    • Method Detail

      • close

        public final void close()
        Called by the console implementation to free resources associated with this console session. This method will result in the console session service being unregistered from the service registry.
        Restriction:
        This method is not intended to be referenced by clients.
      • doClose

        protected abstract void doClose()
        Called by the close() method to free resources associated with this console session. For example, closing the streams associated with the input and output for this session.
        Restriction:
        This method is not intended to be referenced by clients.
      • getInput

        public abstract java.io.InputStream getInput()
        Returns the input for this console session. This input will be used to read console commands from the user of the session.
        Returns:
        the input for this console session
        Restriction:
        This method is not intended to be referenced by clients.
      • getOutput

        public abstract java.io.OutputStream getOutput()
        Returns the output for this console session. This output will be used to write the results of console commands.
        Returns:
        the output for this console session.
        Restriction:
        This method is not intended to be referenced by clients.
      • getService

        public final java.lang.Object getService​(org.osgi.framework.Bundle bundle,
                                                 org.osgi.framework.ServiceRegistration<java.lang.Object> registration)
        Specified by:
        getService in interface org.osgi.framework.ServiceFactory<java.lang.Object>
        Restriction:
        This method is not intended to be referenced by clients.
      • ungetService

        public final void ungetService​(org.osgi.framework.Bundle bundle,
                                       org.osgi.framework.ServiceRegistration<java.lang.Object> registration,
                                       java.lang.Object service)
        Specified by:
        ungetService in interface org.osgi.framework.ServiceFactory<java.lang.Object>
        Restriction:
        This method is not intended to be referenced by clients.