Class Server


  • public class Server
    extends Object
    Represents a MARK server. It is composed of:
    • a webserver
    • an activation controller
    • a datastore (json-rpc server)
    • a monitor threat to save status
    • optionally: some data agents
    Author:
    Thibault Debatty
    • Constructor Detail

      • Server

        @Inject
        public Server​(ActivationController activation_controller,
                      DataSourcesController sources,
                      Datastore datastore,
                      Config config)
               throws Throwable
        Initialize a server with default configuration, dummy subject adapter, no data agents and no detection agents.
        Parameters:
        activation_controller -
        sources -
        datastore -
        config -
        Throws:
        Throwable - on any error
    • Method Detail

      • start

        public final void start()
                         throws MalformedURLException,
                                Exception
        Non-blocking start the datastore and data agents (sources) in separate threads. This method returns when the server and agents are started. You can use server.stop()
        Throws:
        MalformedURLException - if the URL specified by config is invalid
        Exception - if Jetty caused an exception
      • batch

        public final void batch()
                         throws Exception
        Run the server in batch mode.
        1. start the server
        2. wait for data sources to complete
        3. save resulting ranking lists
        4. stop the server
        Throws:
        Exception - if Jetty caused an exception
      • stop

        public final void stop()
                        throws Exception
        Stop the data agents, wait for all detection agents to complete and eventually stop the datastore.
        Throws:
        Exception - on any error
      • addDataAgentProfile

        public final void addDataAgentProfile​(DataAgentProfile profile)
        Allows to programmatically add a data agent to the server. Used for integration tests for example.
        Parameters:
        profile -