Class Configuration<T extends Configuration<T>>

    • Constructor Detail

      • Configuration

        protected Configuration​(org.wildfly.core.launcher.CommandBuilder commandBuilder)
    • Method Detail

      • create

        public static StandaloneConfiguration create​(org.wildfly.core.launcher.StandaloneCommandBuilder commandBuilder)
        Creates a standalone configuration to launch a standalone server.
        Parameters:
        commandBuilder - the standalone command builder used to launch the server
        Returns:
        a new standalone configuration
      • create

        public static StandaloneConfiguration create​(org.wildfly.core.launcher.BootableJarCommandBuilder commandBuilder)
        Creates a standalone configuration to launch a standalone server via the bootable JAR.
        Parameters:
        commandBuilder - the bootable JAR command builder used to launch the server
        Returns:
        a new standalone configuration
      • create

        public static DomainConfiguration create​(org.wildfly.core.launcher.DomainCommandBuilder commandBuilder)
        Creates a domain configuration to launch a domain server
        Parameters:
        commandBuilder - the domain command builder used to launch the server
        Returns:
        a new domain configuration
      • client

        public T client​(org.jboss.as.controller.client.ModelControllerClient client)
        Sets the client to use for the server manager.

        If the the server manager is closed, the client will also be closed.

        Parameters:
        client - the client to use to communicate with the server
        Returns:
        this configuration
      • client

        protected org.jboss.as.controller.client.ModelControllerClient client()
        The client set on the configuration or a new client.
        Returns:
        the client to use
      • managementAddress

        public T managementAddress​(String managementAddress)
        The management address to use for the client if the client has not been set.
        Parameters:
        managementAddress - the management address, default is localhost
        Returns:
        this configuration
      • managementAddress

        protected String managementAddress()
        The management address set or 127.0.0.1 if not set.
        Returns:
        the management address
      • managementPort

        public T managementPort​(int managementPort)
        The management port to use for the client if the client has not been set.
        Parameters:
        managementPort - the management port, default is 9990
        Returns:
        this configuration
      • managementPort

        protected int managementPort()
        The management port or 9990 if set to 0 or less.
        Returns:
        the management port
      • shutdownOnClose

        public T shutdownOnClose​(boolean shutdownOnClose)
        When set to true the server will be shutdown when the server manager is closed.
        Parameters:
        shutdownOnClose - true to shutdown the server when the server manager is closed
        Returns:
        this configuration
      • shutdownOnClose

        protected boolean shutdownOnClose()
        Indicates if the server should be shutdown when the ServerManager is closed.
        Returns:
        true to shutdown the server when the is closed
      • redirectErrorStream

        public T redirectErrorStream​(boolean redirectErrorStream)
        Set to true if the error stream should be redirected to the output stream.
        Parameters:
        redirectErrorStream - true to merge the error stream into the output stream, otherwise false to keep the streams separate
        Returns:
        the Configuration
      • redirectOutput

        public T redirectOutput​(File file)
        Redirects the output of the process to a file.
        Parameters:
        file - the file to redirect the output to
        Returns:
        the Configuration
        See Also:
        ProcessBuilder.Redirect.to(java.io.File)
      • redirectOutput

        public T redirectOutput​(Path path)
        Redirects the output of the process to a file.
        Parameters:
        path - the path to redirect the output to
        Returns:
        the Configuration
        See Also:
        ProcessBuilder.Redirect.to(java.io.File)
      • consumeStdout

        protected boolean consumeStdout()
        Checks if the output stream (stdout) needs to be consumed.
        Returns:
        true if the output stream should be consumed, otherwise false
      • redirectError

        public T redirectError​(File file)
        Redirects the error stream of the process to a file.
        Parameters:
        file - the file to redirect the error stream to
        Returns:
        the Configuration
        See Also:
        ProcessBuilder.Redirect.to(java.io.File)
      • consumeStderr

        protected boolean consumeStderr()
        Checks if the error stream (stderr) needs to be consumed.
        Returns:
        true if the error stream should be consumed, otherwise false
      • directory

        public T directory​(Path path)
        Sets the working directory for the process created.
        Parameters:
        path - the path to the working directory
        Returns:
        the Configuration
        See Also:
        ProcessBuilder.directory(java.io.File)
      • addEnvironmentVariable

        public T addEnvironmentVariable​(String key,
                                        String value)
        Adds an environment variable to the process being created. If the key or value is null, the environment variable will not be added.
        Parameters:
        key - they key for the variable
        value - the value for the variable
        Returns:
        the Configuration
        See Also:
        ProcessBuilder.environment()
      • addEnvironmentVariables

        public T addEnvironmentVariables​(Map<String,​String> env)
        Adds the environment variables to the process being created. Note that null keys or values will not be added.
        Parameters:
        env - the environment variables to add
        Returns:
        the Configuration
        See Also:
        ProcessBuilder.environment()
      • commandBuilder

        protected org.wildfly.core.launcher.CommandBuilder commandBuilder()
        The command builder used to create the launcher.
        Returns:
        the command builder
      • launcher

        protected org.wildfly.core.launcher.Launcher launcher()
        A configured launcher for create the server process.
        Returns:
        the configured launcher
      • launchType

        protected abstract Configuration.LaunchType launchType()
        The type of the server to launch.
        Returns:
        the type of the server
      • self

        protected abstract T self()
        This instance.
        Returns:
        this instance