Package dk.netarkivet.deploy
Class ScriptConstants
- java.lang.Object
-
- dk.netarkivet.deploy.ScriptConstants
-
public final class ScriptConstants extends Object
This class contains constants and functions specific for creating the scripts and other files for the different machines and applications.
-
-
Field Summary
Fields Modifier and Type Field Description static String
JMXREMOTE_ACCESS_HEADER
The header for the jmxremote.access file.static String
JMXREMOTE_PASSWORD_HEADER
The header for the jxmremote.password file.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
doubleBackslashes(String path)
Changes a string into correct formatted style.static String
getLinuxPIDS(String totalName, String path, String id)
Creates the script for extracting the processes of a specific application, depending on the name of the application and the settings file.static String
replaceWindowsDirSeparators(String path)
Changes a string into correct formatted style.static String
writeDashLine()
Function for creating dash lines in scripts.static String
writeInstallMachineHeader(String login)
The header for the install all script for the machine.static String
writeKillMachineHeader(String login)
The header for the kill all script for the machine.static String
writeSecurityPolicyDirPermission(String dir)
For giving readonly permission to a directory in the security policy.static String
writeStartMachineHeader(String login)
The header for the start all script for the machine.
-
-
-
Field Detail
-
JMXREMOTE_PASSWORD_HEADER
public static final String JMXREMOTE_PASSWORD_HEADER
The header for the jxmremote.password file.- See Also:
- Constant Field Values
-
JMXREMOTE_ACCESS_HEADER
public static final String JMXREMOTE_ACCESS_HEADER
The header for the jmxremote.access file.- See Also:
- Constant Field Values
-
-
Method Detail
-
writeDashLine
public static String writeDashLine()
Function for creating dash lines in scripts.- Returns:
- A line of dashes.
-
writeKillMachineHeader
public static String writeKillMachineHeader(String login) throws ArgumentNotValid
The header for the kill all script for the machine.- Parameters:
login
- The login to the machine (username@machinename)- Returns:
- The echo header for killing a machine.
- Throws:
ArgumentNotValid
- If the login is null or the empty string.
-
writeStartMachineHeader
public static String writeStartMachineHeader(String login) throws ArgumentNotValid
The header for the start all script for the machine.- Parameters:
login
- The login to the machine (username@machinename)- Returns:
- The echo header for killing a machine.
- Throws:
ArgumentNotValid
- If the login is null or the empty string.
-
writeInstallMachineHeader
public static String writeInstallMachineHeader(String login) throws ArgumentNotValid
The header for the install all script for the machine.- Parameters:
login
- The login to the machine (username@machinename)- Returns:
- The echo header for killing a machine.
- Throws:
ArgumentNotValid
- If the login is null or the empty string.
-
doubleBackslashes
public static String doubleBackslashes(String path) throws ArgumentNotValid
Changes a string into correct formatted style. The '.vbs' script needs '\\' instead of '\', which is quite annoying when using regular expressions, since a final '\' in regular expressions is '\\\\', thus '\\' = '\\\\\\\\' (8).- Parameters:
path
- The directory path to change to appropriate format.- Returns:
- The formatted path.
- Throws:
ArgumentNotValid
- If the path is null or the empty string.
-
replaceWindowsDirSeparators
public static String replaceWindowsDirSeparators(String path) throws ArgumentNotValid
Changes a string into correct formatted style. The '.vbs' script needs '\\' instead of '\', which is quite annoying when using regular expressions, since a final '\' in regular expressions is '/', thus '\\' = '\\\\\\\\' (8).- Parameters:
path
- The directory path to change to appropriate format.- Returns:
- The formatted path.
- Throws:
ArgumentNotValid
- If the path is null or the empty string.
-
writeSecurityPolicyDirPermission
public static String writeSecurityPolicyDirPermission(String dir) throws ArgumentNotValid
For giving readonly permission to a directory in the security policy.- Parameters:
dir
- The path to the directory. This has to be formatted to have the correct directory separator: '${/}', instead of '/' or '\\' for Windows and Linux respectively.- Returns:
- The permission string.
- Throws:
ArgumentNotValid
- If the dir is null or the empty string.
-
getLinuxPIDS
public static String getLinuxPIDS(String totalName, String path, String id) throws ArgumentNotValid
Creates the script for extracting the processes of a specific application, depending on the name of the application and the settings file.- Parameters:
totalName
- The total name of the application.path
- The path to the directory of the settings file (conf-dir).id
- The identification of the application (name + instanceId).- Returns:
- The script for getting the list of running application.
- Throws:
ArgumentNotValid
- If the totalName, the path or the id is either null or the empty string.
-
-