public abstract class Machine extends Object
Modifier and Type | Field and Description |
---|---|
protected List<Application> |
applications
The list of the application on this machine.
|
protected File |
arcDatabaseFile
The inherited archive database file name.
|
protected File |
databaseFile
The inherited database file name.
|
protected String |
hostname
The name of this machine.
|
protected File |
inheritedSecurityPolicyFile
The inherited security.policy file.
|
protected File |
inheritedSlf4jConfigFile
The inherited SLF4J config file.
|
protected File |
jarFolder
The folder containing the external jar library files.
|
protected static org.slf4j.Logger |
log
the log, for logging stuff instead of displaying them directly.
|
protected File |
machineDirectory
The directory for this machine.
|
protected Parameters |
machineParameters
The machine parameters.
|
protected org.dom4j.Element |
machineRoot
The root-branch for this machine in the XML tree.
|
protected String |
netarchiveSuiteFileName
The name of the NetarchiveSuite.zip file.
|
protected String |
operatingSystem
The operating system on this machine: 'windows' or 'linux'.
|
protected boolean |
resetTempDir
Whether the temp dir should be cleaned.
|
protected String |
scriptExtension
The extension on the script files (specified by operating system).
|
protected XmlStructure |
settings
The settings, inherited from parent and overwritten.
|
protected String |
targetEncoding
The encoding to use when writing files.
|
Constructor and Description |
---|
Machine(org.dom4j.Element subTreeRoot,
XmlStructure parentSettings,
Parameters param,
String netarchiveSuiteSource,
File slf4JConfig,
File securityPolicy,
File dbFileName,
File archiveDbFileName,
boolean resetDir,
File externalJarFolder)
A machine is referring to an actual computer at a physical location, which can have independent applications from
the other machines at the same location.
|
Modifier and Type | Method and Description |
---|---|
protected abstract String |
changeFileDirPathForSecurity(String path)
Changes the file directory path to the format used in the security policy.
|
protected abstract void |
createApplicationKillScripts(File directory)
Creates the kill scripts for all the applications.
|
protected abstract void |
createApplicationStartScripts(File directory)
Creates the start scripts for all the applications.
|
protected abstract void |
createArchiveDatabaseKillScript(File dir)
Creates a script for killing the archive database on a given machine.
|
protected abstract void |
createArchiveDatabaseStartScript(File dir)
Creates a script for starting the archive database on a given machine.
|
protected abstract void |
createHarvestDatabaseKillScript(File dir)
Creates a script for killing the harvest database on a given machine.
|
protected abstract void |
createHarvestDatabaseStartScript(File dir)
Creates a script for starting the harvest database on a given machine.
|
protected abstract void |
createHarvestDatabaseUpdateScript(File machineDirectory)
create a harvestDatabaseUpdatescript in the given machineDirectory.
|
protected abstract void |
createInstallDirScript(File dir)
Function to create the script which installs the new directories.
|
protected void |
createJmxRemoteAccessFile(File directory)
Creates the jmxremote.password file, based on the settings.
|
protected void |
createJmxRemotePasswordFile(File directory)
Creates the jmxremote.password file, based on the settings.
|
protected abstract void |
createOSLocalKillAllScript(File directory)
This function creates the script to kill all applications on this machine.
|
protected abstract void |
createOSLocalStartAllScript(File directory)
This function creates the script to start all applications on this machine.
|
protected abstract void |
createRestartScript(File dir)
Creates a script for restating all the applications on a given machine.
|
protected void |
createSecurityPolicyFile(File directory)
Copy inherited securityPolicyFile to local directory.
|
protected void |
createSlf4jConfigFiles(File directory)
Creates a the SLF4J config file for every application.
|
protected abstract String |
getAppDirectories()
Creates the script for creating the application specified directories.
|
protected abstract String |
getConfDirPath()
The operation system specific path to the conf directory.
|
protected String |
getEnvironmentName()
For retrieving the environment name variable.
|
protected String |
getHeritrixLogin()
For finding the jmxUsernames and jmxPasswords under the harvest.harvesting.heritrix branch under in the settings.
|
protected String |
getHeritrixUsername()
For retrieving the Heritrix username for the jmxremote.access file.
|
protected abstract String |
getInstallDirPath()
The operation system specific path to the installation directory.
|
protected abstract String |
getJMXremoteFilesCommand()
This method does the following: Retrieves the path to the jmxremote.access and jmxremote.password files.
|
protected abstract String |
getLibDirPath()
The operation system specific path to the lib directory.
|
protected String |
getMonitorLogin()
For finding the jmxUsernames and jmxPasswords under the monitor branch in the settings.
|
protected String |
getMonitorUsername()
For retrieving the monitor username for the jmxremote.access file.
|
protected String |
getTargetEncoding() |
protected String |
machineUserLogin()
The string for accessing this machine through SSH.
|
protected String |
modifyLogProperties(String logProperties)
Make any OS-specific modifications to logging properties.
|
protected abstract String |
osGetClassPath(Application app)
Makes all the class paths into the operation system specific syntax, and puts them into a string where they are
separated by the operation system specific separator (':' for linux, ';' for windows).
|
protected abstract String |
osInstallArchiveDatabase()
Checks if a specific directory for the archive database is given in the settings, and thus if the archive
database should be installed on this machine.
|
protected abstract String |
osInstallDatabase()
Checks if a specific directory for the database is given in the settings, and thus if the database should be
installed on this machine.
|
protected abstract String |
osInstallExternalJarFiles()
This function makes the part of the install script for installing the external jar files from within the
jarFolder.
|
protected abstract String |
osInstallScript()
Creates the operation system specific installation script for this machine.
|
protected abstract String |
osInstallScriptCreateDir()
Creates the specified directories in the deploy-configuration file.
|
protected abstract String |
osKillScript()
Creates the operation system specific killing script for this machine.
|
protected abstract String |
osStartScript()
Creates the operation system specific starting script for this machine.
|
protected abstract String |
scriptCreateDir(String dir,
boolean clean)
This functions makes the script for creating the new directories.
|
void |
write(File parentDirectory)
Create the directory for the specific configurations of this machine and call the functions for creating all the
scripts in this directory.
|
String |
writeToGlobalInstallScript()
Make the script for installing this machine.
|
String |
writeToGlobalKillScript()
Make the script for killing this machine.
|
String |
writeToGlobalStartScript()
Make the script for starting this machine.
|
protected static final org.slf4j.Logger log
protected org.dom4j.Element machineRoot
protected XmlStructure settings
protected Parameters machineParameters
protected List<Application> applications
protected String operatingSystem
protected String scriptExtension
protected String netarchiveSuiteFileName
protected File inheritedSlf4jConfigFile
protected File inheritedSecurityPolicyFile
protected File databaseFile
protected File arcDatabaseFile
protected File machineDirectory
protected boolean resetTempDir
protected String targetEncoding
public Machine(org.dom4j.Element subTreeRoot, XmlStructure parentSettings, Parameters param, String netarchiveSuiteSource, File slf4JConfig, File securityPolicy, File dbFileName, File archiveDbFileName, boolean resetDir, File externalJarFolder) throws ArgumentNotValid
subTreeRoot
- The root of this instance in the XML document.parentSettings
- The setting inherited by the parent.param
- The machine parameters inherited by the parent.netarchiveSuiteSource
- The name of the NetarchiveSuite package file.securityPolicy
- The security policy file.dbFileName
- The name of the database file.archiveDbFileName
- The name of the archive database file.resetDir
- Whether the temporary directory should be reset.externalJarFolder
- The folder containing the external jar library files.ArgumentNotValid
- If one of the following arguments are null: subTreeRoot, parentSettings, param,
netarchiveSuiteSource, logProp, securityPolicy.public void write(File parentDirectory) throws ArgumentNotValid
parentDirectory
- The directory where to write the files.ArgumentNotValid
- If the parenteDirectory is null.public String writeToGlobalKillScript()
public String writeToGlobalInstallScript()
public String writeToGlobalStartScript()
protected void createSecurityPolicyFile(File directory) throws IOFailure
directory
- The local directory for this machine.IOFailure
- If an error occurred during the creation of the security policy file.protected void createSlf4jConfigFiles(File directory) throws IOFailure
directory
- The local directory for this machineIOFailure
- If an error occurred during the creationg of the log property file.protected String modifyLogProperties(String logProperties)
logProperties
- the contents of the logging properties file.protected void createJmxRemotePasswordFile(File directory) throws IOFailure
directory
- The local directory for this machineIOFailure
- If an error occurred during the creation of the jmx remote password file.protected void createJmxRemoteAccessFile(File directory) throws IOFailure
directory
- The local directory for this machineIOFailure
- If an error occurred during the creation of the jmx remote access file.protected String getMonitorLogin() throws IllegalState
IllegalState
- If there is a different amount of usernames and passwords, or if two application has
different values for their username or passwords (applications without values are ignored).protected String getMonitorUsername() throws IllegalState
IllegalState
- If different applications on the machine have different user names.protected String getHeritrixLogin() throws IllegalState
IllegalState
- If there is a different amount of usernames and passwords, or if two application has
different values for their username or passwords (applications without values are ignored).protected String getHeritrixUsername()
protected String machineUserLogin()
protected String getEnvironmentName()
protected abstract void createApplicationKillScripts(File directory)
directory
- The directory for this machine (use global variable?).protected abstract void createApplicationStartScripts(File directory)
directory
- The directory for this machine (use global variable?).protected abstract void createOSLocalStartAllScript(File directory)
directory
- The directory for this machine (use global variable?).protected abstract void createOSLocalKillAllScript(File directory)
directory
- The directory for this machine (use global variable?).protected abstract String getInstallDirPath()
protected abstract String getConfDirPath()
protected abstract String getLibDirPath()
protected abstract String osKillScript()
protected abstract String osInstallScript()
protected abstract String osInstallScriptCreateDir()
protected abstract String osStartScript()
protected abstract String osGetClassPath(Application app)
app
- The application which has the class paths.protected abstract String osInstallDatabase()
If no specific database is given as deploy argument (databaseFileName = null) then use the standard database extracted from NetarchiveSuite.zip. Else send the given new database to the standard database location.
Extract the database in the standard database location to the specified database directory.
protected abstract String osInstallArchiveDatabase()
If not specific database is given (adminDatabaseFileName = null) then use the default in the NetarchiveSuite.zip package. Else send the new archive database to the standard database location, and extract it to the given location.
protected abstract String osInstallExternalJarFiles()
protected abstract String scriptCreateDir(String dir, boolean clean)
Linux creates directories directly through ssh. Windows creates an install a script file for installing the directories, which has to be sent to the machine, then executed and finally deleted.
dir
- The name of the directory to create.clean
- Whether the directory should be cleaned\reset.createInstallDirScript(File)
protected abstract String getAppDirectories()
protected abstract String getJMXremoteFilesCommand()
protected abstract void createInstallDirScript(File dir)
dir
- The directory to put the fileprotected abstract void createRestartScript(File dir)
dir
- The directory where the script will be placed.protected abstract void createArchiveDatabaseStartScript(File dir)
dir
- The directory where the script will be placed.protected abstract void createArchiveDatabaseKillScript(File dir)
dir
- The directory where the script will be placed.protected abstract void createHarvestDatabaseStartScript(File dir)
dir
- The directory where the script will be placed.protected abstract void createHarvestDatabaseKillScript(File dir)
dir
- The directory where the script will be placed.protected abstract String changeFileDirPathForSecurity(String path)
path
- The current path.protected abstract void createHarvestDatabaseUpdateScript(File machineDirectory)
machineDirectory
- a given MachineDirectory.protected String getTargetEncoding()
Copyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.