类 ServerController


  • public class ServerController
    extends Object
    Controls a MySQL server using Java RunTime methods
    • 字段详细资料

      • BASEDIR_KEY

        public static final String BASEDIR_KEY
        Where is the server installed?
        另请参阅:
        常量字段值
      • DATADIR_KEY

        public static final String DATADIR_KEY
        Where are the databases installed?
        另请参阅:
        常量字段值
      • DEFAULTS_FILE_KEY

        public static final String DEFAULTS_FILE_KEY
        Where is the config file located?
        另请参阅:
        常量字段值
      • EXECUTABLE_NAME_KEY

        public static final String EXECUTABLE_NAME_KEY
        What is the name of the executable to run?
        另请参阅:
        常量字段值
      • EXECUTABLE_PATH_KEY

        public static final String EXECUTABLE_PATH_KEY
        What is the path to the mysql server executable (if not standard?)
        另请参阅:
        常量字段值
    • 构造器详细资料

      • ServerController

        public ServerController​(String baseDir)
        Creates a ServerController with the directory for the MySQL server. The 'datadir' is set to the same directory.
        参数:
        baseDir - the base directory for the MySQL server.
      • ServerController

        public ServerController​(String basedir,
                                String datadir)
        Creates a server controller for the MySQL server with the given basedir and datadir.
        参数:
        basedir - the basedir to use when starting MySQL.
        datadir - the datadir to use when starting MySQL.
    • 方法详细资料

      • setBaseDir

        public void setBaseDir​(String baseDir)
        Sets the basedir to use when starting MySQL.
        参数:
        baseDir - the basedir to use when starting MySQL.
      • setDataDir

        public void setDataDir​(String dataDir)
        Sets the data to use when starting MySQL.
        参数:
        dataDir - the basedir to use when starting MySQL.
      • start

        public Process start()
                      throws IOException
        Starts the server, returning a java.lang.Process instance that represents the mysql server.
        返回:
        Process a java.lang.Process instance representing the mysql server process.
        抛出:
        IOException - if an error occurs while starting the mysql server.
      • stop

        public void stop​(boolean forceIfNecessary)
                  throws IOException
        Stops the server (if started)
        参数:
        forceIfNecessary - use forceStop if mysqladmin doesn't shut the server down
        抛出:
        IOException - if an error occurs while stopping the server
      • forceStop

        public void forceStop()
        Forcefully terminates the server process (if started).
      • getServerProps

        public Properties getServerProps()
        Returns the list of properties that will be used to start/control the server.
        返回:
        Properties the list of properties.