<commit_before>/* $Id$
 * $Revision$
 * $Date$
 * $Author$
 *
 * The Netarchive Suite - Software to harvest and preserve websites
 * Copyright 2004-2012 The Royal Danish Library, the Danish State and
 * University Library, the National Library of France and the Austrian
 * National Library.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
 *   USA
 */
package dk.netarkivet.deploy;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;

import org.archive.crawler.Heritrix;
import org.dom4j.Element;

import dk.netarkivet.common.exceptions.IOFailure;

/**
 * A LinuxMachine is the instance of the abstract machine class, which runs 
 * the operating system Linux or another Unix dependent operation system.
 * This class only contains the operating system specific functions.
 */
public class LinuxMachine extends Machine {
    /**
     * The constructor. 
     * Starts by initialising the parent abstract class, then sets the 
     * operating system dependent variables.
     * 
     * @param subTreeRoot The XML root element.
     * @param parentSettings The Settings to be inherited from the 
     * PhysicalLocation, where this machine is placed.
     * @param param The machine parameters to be inherited from the 
     * PhysicalLocation.
     * @param netarchiveSuiteSource The name of the NetarchiveSuite package 
     * file. Must end with '.zip'.
     * @param logProp The logging property file, to be copied into 
     * machine directory.
     * @param securityPolicy The security policy file, to be copied into
     * machine directory.
     * @param dbFile The name of the database file.
     * @param arcdbFile The name of the archive file.
     * @param resetDir Whether the temporary directory should be reset.
     * @param externalJarFolder The folder containing the external jar 
     * library files.
     */
    public LinuxMachine(Element subTreeRoot, XmlStructure parentSettings, 
            Parameters param, String netarchiveSuiteSource,
            File logProp, File securityPolicy, File dbFile,
            File arcdbFile, boolean resetDir, File externalJarFolder) {
        super(subTreeRoot, parentSettings, param, netarchiveSuiteSource,
                logProp, securityPolicy, dbFile, arcdbFile, resetDir,
                externalJarFolder);
        // set operating system
        operatingSystem = Constants.OPERATING_SYSTEM_LINUX_ATTRIBUTE;
        scriptExtension = Constants.SCRIPT_EXTENSION_LINUX;
    }

    @Override
    protected String osInstallScript() {
        StringBuilder res = new StringBuilder();
        // echo copying null.zip to:kb-test-adm-001.kb.dk
        res.append(ScriptConstants.ECHO_COPYING + Constants.SPACE);
        res.append(netarchiveSuiteFileName);
        res.append(Constants.SPACE + ScriptConstants.TO + Constants.COLON);
        res.append(name);
        res.append(Constants.NEWLINE);
        // scp null.zip dev@kb-test-adm-001.kb.dk:/home/dev
        res.append(ScriptConstants.SCP + Constants.SPACE);
        res.append(netarchiveSuiteFileName);
        res.append(Constants.SPACE);
        res.append(machineUserLogin());
        res.append(Constants.COLON);
        res.append(machineParameters.getInstallDirValue());
        res.append(Constants.NEWLINE);
        // echo deleting kb-test-adm-001.kb.dk:/home/dev/TEST/lib
        res.append(ScriptConstants.ECHO_DELETING + Constants.SPACE);
        res.append(machineUserLogin());
        res.append(Constants.COLON);
        res.append(getInstallDirPath() + getLocalLibDirPath());
        res.append(Constants.NEWLINE);
        // ssh dev@kb-test-adm-001.kb.dk rm -rf /home/dev/TEST/lib
        res.append(ScriptConstants.SSH + Constants.SPACE);
        res.append(machineUserLogin());<commit_msg>Follow up for NAS-2094. Added svn-keywords property for TwitterDecidingScope<commit_after>/* $Id$
 * $Revision$
 * $Date$
 * $Author$
 *
 * The Netarchive Suite - Software to harvest and preserve websites
 * Copyright 2004-2012 The Royal Danish Library, the Danish State and
 * University Library, the National Library of France and the Austrian
 * National Library.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
 *   USA
 */
package dk.netarkivet.deploy;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;

import org.archive.crawler.Heritrix;
import org.dom4j.Element;

import dk.netarkivet.common.exceptions.IOFailure;

/**
 * A LinuxMachine is the instance of the abstract machine class, which runs 
 * the operating system Linux or another Unix dependent operation system.
 * This class only contains the operating system specific functions.
 */
public class LinuxMachine extends Machine {
    /**
     * The constructor. 
     * Starts by initialising the parent abstract class, then sets the 
     * operating system dependent variables.
     * 
     * @param subTreeRoot The XML root element.
     * @param parentSettings The Settings to be inherited from the 
     * PhysicalLocation, where this machine is placed.
     * @param param The machine parameters to be inherited from the 
     * PhysicalLocation.
     * @param netarchiveSuiteSource The name of the NetarchiveSuite package 
     * file. Must end with '.zip'.
     * @param logProp The logging property file, to be copied into 
     * machine directory.
     * @param securityPolicy The security policy file, to be copied into
     * machine directory.
     * @param dbFile The name of the database file.
     * @param arcdbFile The name of the archive file.
     * @param resetDir Whether the temporary directory should be reset.
     * @param externalJarFolder The folder containing the external jar 
     * library files.
     */
    public LinuxMachine(Element subTreeRoot, XmlStructure parentSettings, 
            Parameters param, String netarchiveSuiteSource,
            File logProp, File securityPolicy, File dbFile,
            File arcdbFile, boolean resetDir, File externalJarFolder) {
        super(subTreeRoot, parentSettings, param, netarchiveSuiteSource,
                logProp, securityPolicy, dbFile, arcdbFile, resetDir,
                externalJarFolder);
        // set operating system
        operatingSystem = Constants.OPERATING_SYSTEM_LINUX_ATTRIBUTE;
        scriptExtension = Constants.SCRIPT_EXTENSION_LINUX;
    }

    @Override
    protected String osInstallScript() {
        StringBuilder res = new StringBuilder();
        // echo copying null.zip to:kb-test-adm-001.kb.dk
        res.append(ScriptConstants.ECHO_COPYING + Constants.SPACE);
        res.append(netarchiveSuiteFileName);
        res.append(Constants.SPACE + ScriptConstants.TO + Constants.COLON);
        res.append(name);
        res.append(Constants.NEWLINE);
        // scp null.zip dev@kb-test-adm-001.kb.dk:/home/dev
        res.append(ScriptConstants.SCP + Constants.SPACE);
        res.append(netarchiveSuiteFileName);
        res.append(Constants.SPACE);
        res.append(machineUserLogin());
        res.append(Constants.COLON);
        res.append(machineParameters.getInstallDirValue());
        res.append(Constants.NEWLINE);
        // echo deleting dev@kb-test-adm-001.kb.dk:/home/dev/TEST/lib
        res.append(ScriptConstants.ECHO_DELETING + Constants.SPACE);
        res.append(machineUserLogin());
        res.append(Constants.COLON);
        res.append(getInstallDirPath() + getLocalLibDirPath());
        res.append(Constants.NEWLINE);
        // ssh dev@kb-test-adm-001.kb.dk rm -rf /home/dev/TEST/lib
        res.append(ScriptConstants.SSH + Constants.SPACE);
        res.append(machineUserLogin());
{'fraction_non_alphanumeric': 0.0796608278478188, 'fraction_numerical': 0.008033024656922905, 'mean_word_length': 3.15, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 5, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1679118', 'n_tokens_mistral': 2424, 'n_tokens_neox': 2326, 'n_words': 825}