Class OroServer

  • All Implemented Interfaces:
    IServiceProvider

    public class OroServer
    extends java.lang.Object
    implements IServiceProvider
    OroServer is the application entry point. It initializes and starts the various services, connectors and background tasks, as set up in the oro-server configuration file.

    OroServer does mainly two things:

    1. It registers and connects a set of services (presumably related to robotic cognition) to a socket interface,
    2. It runs in the background several tasks related to robotic cognition.

    Features

    Most services are related to access and management of a cognitive storage backend. The main storage backend is an ontology, as implemented in the OpenRobotsOntology class. This class exposes a set of RPC services (and hence implement the IServiceProvider interface).
    However, other services can be registred (like stats() that returns statistics on the server itself).

    Amongst the tasks that are run in background, we can list:

    Others are under developpement, including a "curiosity" module, a cognitive conflict detection and resolution module.

    Getting access to the server

    The communication with the server relies on standard TCP/IP sockets. The ASCII protocole we use is documented here: SocketConnector.

    Configuration

    OroServer has a main function which expect a configuration file.
    For the server, the following options are currently available:

    • port = [port number over 4000]: the port on which the server should starts and listen.

    See OpenRobotsOntology(Properties) for others options, specific to the ontologies. Have a look at the config file itself for more details.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean BLINGBLING  
      static java.lang.String DEFAULT_CONF
      The default configuration file (set to "etc/oro-server/oro.conf").
      static java.lang.String DEFAULT_LANGUAGE
      Defines the standard language used in particular for labels retrieval.
      This field can be set up in the configuration file with the language option.
      Expected values are ISO 2 characters language codes.
      static boolean DEMO_MODE  
      static java.util.Set<java.lang.Class> discardedTypeFromServiceArgs
      This set holds the types that should not be exposed to oro-server clients but are required by some RPC methods (for instance to retrieve the context when the query was received).
      static boolean HAS_A_TTY  
      static java.util.Date SERVER_START_TIME  
      static java.util.Properties ServerParameters  
      static VerboseLevel VERBOSITY  
      static java.lang.String VERSION  
    • Constructor Summary

      Constructors 
      Constructor Description
      OroServer​(java.lang.String confFile)  
    • Field Detail

      • DEFAULT_CONF

        public static final java.lang.String DEFAULT_CONF
        The default configuration file (set to "etc/oro-server/oro.conf").
        See Also:
        Constant Field Values
      • DEFAULT_LANGUAGE

        public static java.lang.String DEFAULT_LANGUAGE
        Defines the standard language used in particular for labels retrieval.
        This field can be set up in the configuration file with the language option.
        Expected values are ISO 2 characters language codes.
      • HAS_A_TTY

        public static boolean HAS_A_TTY
      • DEMO_MODE

        public static boolean DEMO_MODE
      • ServerParameters

        public static java.util.Properties ServerParameters
      • BLINGBLING

        public static boolean BLINGBLING
      • SERVER_START_TIME

        public static final java.util.Date SERVER_START_TIME
      • discardedTypeFromServiceArgs

        public static final java.util.Set<java.lang.Class> discardedTypeFromServiceArgs
        This set holds the types that should not be exposed to oro-server clients but are required by some RPC methods (for instance to retrieve the context when the query was received). TODO: This is more like a workaround...
    • Constructor Detail

      • OroServer

        public OroServer​(java.lang.String confFile)
    • Method Detail

      • addNewServiceProviders

        public void addNewServiceProviders​(IServiceProvider provider)
      • pushRequest

        public void pushRequest​(Request r)
      • stats

        @RPCMethod(category="administration",
                   desc="returns some statistics on the server")
        public java.util.Map<java.lang.String,​java.lang.String> stats()
        Returns several statistics on the server. Returned values:
        • the server version
        • the hostname where the server runs
        • server uptime
        • the current amount of classes in the ontology
        • the current amount of instances in the ontology
        • the current amount of client connected to the server
        Returns:
        a map containing the statistics (pairs name/value)
      • size

        public long size()
      • help

        @RPCMethod(desc="returns a human-friendly list of available methods with their signatures and short descriptions.")
        public java.lang.String help()
      • listMethods

        @RPCMethod(category="administration",
                   desc="returns the list of available methods with their signatures and short descriptions as a map.")
        public java.util.Map<java.lang.String,​java.lang.String> listMethods()
      • listSimpleMethods

        @RPCMethod(category="administration",
                   desc="returns a raw list of available methods.")
        public java.util.Set<java.lang.String> listSimpleMethods()
      • makeHtmlDoc

        @RPCMethod(category="administration",
                   desc="returns a list of available methods in HTML format for inclusion in documentation.")
        public java.lang.String makeHtmlDoc()
      • formatParameters

        public static java.lang.String formatParameters​(java.lang.reflect.Method m)
        Formats in a human-readable way the parameters of a method. This method skips all the parameters whose type belongs to discardedTypeFromServiceArgs
        Parameters:
        m - The method
        Returns:
        the in-parenthesis list of the method's parameters
      • nbExposedParameters

        public static int nbExposedParameters​(java.lang.reflect.Method m)
      • getConfiguration

        public static java.util.Properties getConfiguration​(java.lang.String configFileURI)
        Read a configuration file and return to corresponding "Properties" object. The configuration file contains the path to the ontology to be loaded and several options regarding the server configuration.
        Parameters:
        configFileURI - The path and filename of the configuration file.
        Returns:
        A Java.util.Properties instance containing the application configuration.