Class Server.Builder

  • Enclosing class:
    Server

    public static class Server.Builder
    extends Object
    Builder for creating embedded server instance. Builder can be used to configure the logger, the verbosity and the embedded file system which acts as a virtual file system to the embedded server instance.
    • Constructor Detail

      • Builder

        public Builder​(String id)
        Creates an unconfigured instance. The habitat will be obtained by scanning the inhabitants files using this class's classloader
        Parameters:
        id - the server name
    • Method Detail

      • logger

        public Server.Builder logger​(boolean enabled)
        Enables or disables the logger for this server
        Parameters:
        enabled - true to enable, false to disable
        Returns:
        this instance
      • logFile

        public Server.Builder logFile​(File f)
        Sets the log file location
        Parameters:
        f - a valid file location
        Returns:
        this instance
      • verbose

        public Server.Builder verbose​(boolean b)
        Turns on of off the verbose flag.
        Parameters:
        b - true to turn on, false to turn off
        Returns:
        this instance
      • jmxPort

        public Server.Builder jmxPort​(int portNumber)
        Set the jmx port number. Also enables the jmx connector. This applies only when the default configuration is being used.
        Parameters:
        portNumber - jmx port number.
        Returns:
        this instance
      • embeddedFileSystem

        public Server.Builder embeddedFileSystem​(EmbeddedFileSystem fileSystem)
        Sets the embedded file system for the application server, used to locate important files or directories used through the server lifetime.
        Parameters:
        fileSystem - a virtual filesystem
        Returns:
        this instance
      • build

        public Server build()
        Uses this builder's name to create or return an existing embedded server instance. The embedded server will be using the configured parameters of this builder. If no embedded file system is used, the embedded instance will use a temporary instance root with a default basic configuration. That temporary instance root will be deleted once the server is shutdown.
        Returns:
        the configured server instance
      • build

        public Server build​(Properties properties)
        Uses this builder's name to create or return an existing embedded server instance. The embedded server will be using the configured parameters of this builder. If no embedded file system is used, the embedded instance will use a temporary instance root with a default basic configuration. That temporary instance root will be deleted once the server is shutdown.
        Parameters:
        properties - extra creation properties
        Returns:
        the configured server instance