Tools in the Common Module
Contents
logback.xml disabling logs to stdout:
Currently our tools have by-default log entries written to stdout. To disable this create a logback.xml with the following content
<configuration> <statusListener class="ch.qos.logback.core.status.NopStatusListener" /> <root level="OFF"/> </configuration>
and refer to this file with
-Dlogback.configurationFile=/path/to/logback.xml
dk.netarkivet.common.tools.ArcMerge (deprecated)
This tool takes as input several arcfiles, and inserts all the records of the input arcfiles into a single arcfile. This arcfile is currently dumped to stdout, but can of course be redirected to a file. Deprecated because it only handles ARCfiles. use JWAT-tools instead.
Usage
export CLASSPATH=/path/to/installdir/lib/netarchivesuite-common-core.jar export LOG=-Dlogback.configurationFile=/path/to/logback.xml java $LOG dk.netarkivet.common.tools.ArcMerge arcfile1.arc arcfile2.arc > resulting.arc
dk.netarkivet.common.tools.ArcWrap (deprecated)
This tool takes an input file, an URI for this file, and a mime-type for this file, and creates an ARC-file with only one ARCRecord, which has the input file as contents, and with the given mimetype and URI. The ARCfile is written to stdout, but can of course be redirected to a file. Deprecated because it only generates ARC-files
usage
export CLASSPATH=/path/to/installdir/lib/netarchivesuite-common-core.jar export LOG=-Dlogback.configurationFile=/path/to/logback.xml java $LOG dk.netarkivet.common.tools.ArcWrap input_file uri mime-type > myarchive.arc
dk.netarkivet.common.tools.ArchiveExtractCDX
This tool generates CDX-entries for all records in the given (W)ARC-files, and prints the CDX'es to stdout, but can of course be redirected to a file like we show below.
usage
export CLASSPATH=/path/to/installdir/lib/netarchivesuite-common-core.jar export LOG=-Dlogback.configurationFile=/path/to/logback.xml java $LOG dk.netarkivet.common.tools.ArchiveExtractCDX [arcfile]+ > output.cdx
dk.netarkivet.common.tools.WriteBytesToFile
This tool makes large files primarily for testing purposes. The tool needs two arguments, the number of bytes that must be written (nbytes), and the name of the file to write to. The number of bytes must be > chunksize (currently 10000000), otherwise 0 bytes will be written to the file.
usage
export CLASSPATH=/path/to/installdir/lib/netarchivesuite-common-core.jar export LOG=-Dlogback.configurationFile=/path/to/logback.xml java $LOG dk.netarkivet.common.tools.WriteBytesToFile nbytes filename
dk.netarkivet.common.tools.FTPValidator
This tests, if it is possible to communicate with the FTP server mentioned in the settings from the given server.
The following settings are tested by this validator:
<settings> <common> <environmentName>QUICKSTART</environmentName> <applicationInstanceId>high_8082</applicationInstanceId> <remoteFile> <class>dk.netarkivet.common.distribute.ExtendedFTPRemoteFile</class> <serverPort>21</serverPort> <retries>3</retries> <datatimeout>10800</datatimeout> <serverName>localhost</serverName> <userName>test</userName> <userPassword>test123</userPassword> </remoteFile> ..
usage
export INSTALLDIR=/fullpath/to/installdir export CLASSPATH=/path/to/installdir/lib/netarchivesuite-common-core.jar export OPTs=-Ddk.netarkivet.settings.file=$INSTALLDIR/conf/settings_GUIApplication.xml ## Either of the following possibilities may be chosen ## --------------------------------------------------- ## Test FTP-server configuration in the settingsfile pointed to by the OPTS line java $OPTS dk.netarkivet.common.tools.FTPValidator ## Test FTP-server configuration in the settingsfile given as an argument java dk.netarkivet.common.tools.FTPValidator /full/path/to/settingsfile ## Test FTP-server without using a settings file ## e.g FTPValidator localhost 22 test test123 java dk.netarkivet.common.tools.FTPValidator ftpHost ftpPort ftpUser ftpPasswd
After running the FTPValidator, it will either write test fail or test succeeded.
dk.netarkivet.common.tools.MailValidator
This program tests if Netarchivesuite is able to send notification mails from the server.
The following settings are tested by this validator:
<settings> <common> .... <mail> <server>post.mydomain.org</server> </mail><notifications> <class>dk.netarkivet.common.utils.EMailNotifications</class> <receiver>test@mydomain.org</receiver> <sender>test@mydomain.org</sender> </notifications>.. </common>
usage
export INSTALLDIR=/fullpath/to/installdir export CLASSPATH=/path/to/installdir/lib/netarchivesuite-common-core.jar export OPTs=-Ddk.netarkivet.settings.file=$INSTALLDIR/conf/settings_GUIApplication.xml ## Either of the following possibilities may be chosen ## --------------------------------------------------- ## Test Mail configuration in the settingsfile pointed to by the OPTS line java $OPTS dk.netarkivet.common.tools.MailValidator ## Test Mail configuration in the settingsfile given as argument java dk.netarkivet.common.tools.MailValidator /full/path/to/settingsfile
This program will try to send a notification to the mail-address given in the settings.
If successful it will write Test-Mail now sent successfully to address 'X' using 'Y' as mailserver, and 'Z' as sender