public class ServerController
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BASEDIR_KEY
Where is the server installed?
|
static java.lang.String |
DATADIR_KEY
Where are the databases installed?
|
static java.lang.String |
DEFAULTS_FILE_KEY
Where is the config file located?
|
static java.lang.String |
EXECUTABLE_NAME_KEY
What is the name of the executable to run?
|
static java.lang.String |
EXECUTABLE_PATH_KEY
What is the path to the mysql server executable (if not standard?)
|
Constructor and Description |
---|
ServerController(java.lang.String baseDir)
Creates a ServerController with the directory for the MySQL server.
|
ServerController(java.lang.String basedir,
java.lang.String datadir)
Creates a server controller for the MySQL server with the given basedir
and datadir.
|
Modifier and Type | Method and Description |
---|---|
void |
forceStop()
Forcefully terminates the server process (if started).
|
java.util.Properties |
getServerProps()
Returns the list of properties that will be used to start/control the
server.
|
void |
setBaseDir(java.lang.String baseDir)
Sets the basedir to use when starting MySQL.
|
void |
setDataDir(java.lang.String dataDir)
Sets the data to use when starting MySQL.
|
java.lang.Process |
start()
Starts the server, returning a java.lang.Process instance that represents
the mysql server.
|
void |
stop(boolean forceIfNecessary)
Stops the server (if started)
|
public static final java.lang.String BASEDIR_KEY
public static final java.lang.String DATADIR_KEY
public static final java.lang.String DEFAULTS_FILE_KEY
public static final java.lang.String EXECUTABLE_NAME_KEY
public static final java.lang.String EXECUTABLE_PATH_KEY
public ServerController(java.lang.String baseDir)
baseDir
- the base directory for the MySQL server.public ServerController(java.lang.String basedir, java.lang.String datadir)
basedir
- the basedir to use when starting MySQL.datadir
- the datadir to use when starting MySQL.public void setBaseDir(java.lang.String baseDir)
baseDir
- the basedir to use when starting MySQL.public void setDataDir(java.lang.String dataDir)
dataDir
- the basedir to use when starting MySQL.public java.lang.Process start() throws java.io.IOException
java.io.IOException
- if an error occurs while starting the mysql server.public void stop(boolean forceIfNecessary) throws java.io.IOException
forceIfNecessary
- use forceStop if mysqladmin doesn't shut the server downjava.io.IOException
- if an error occurs while stopping the serverpublic void forceStop()
public java.util.Properties getServerProps()