Table of Contents

  1. Introduction
  2. fedora-dsinfo
  3. fedora-export
  4. fedora-find
  5. fedora-ingest
  6. fedora-ingest-demos
  7. fedora-convert-demos
  8. fedora-purge
  9. fedora-modify
  10. fedora-batch-build
  11. fedora-batch-ingest
  12. fedora-batch-buildingest
  13. fedora-validate-objects
  1. Introduction

    The Fedora client distribution comes with several command-line utilities that can be used to run some common operations without bringing up the GUI or writing your own SOAP client. A description and usage instructions for each follows.

    This guide assumes you have correctly installed the Fedora client distribution as per the install guide, including having set up your PATH and FEDORA_HOME appropriately. The command-line scripts are located in FEDORA_HOME/client/bin/. In Windows, these commands resolve to batch files (.bat); in Unix, they resolve to shell scripts (.sh).
  2. fedora-dsinfo

    fedora-dsinfo [hostname] [port-number] [user] [pass] [pid] [protocol]

    Where:
    Example:

    fedora-dsinfo localhost 8080 fedoraAdmin fedoraAdmin demo:5 http
    Displays key information about each of an object's datastreams.
  3. fedora-export

    fedora-export [HST:PRT] [USR] [PSS] [PID|FTYPS] [FORMAT] [ECONTEXT] [PATH] [PROTOCOL]

    Where:
    Examples:

    fedora-export example.com:80 fedoraAdmin fedoraAdmin demo:1 info:fedora/fedora-system:FOXML-1.1 migrate . http
    Exports demo:1 for migration in FOXML 1.1 format (from example.com:80 to the current directory).

    fedora-export example.com:80 fedoraAdmin fedoraAdmin DMO default default /tmp/fedoradump http
    Exports all objects in the default export format and context (from example.com:80 to directory /tmp/fedoradump).
  4. fedora-find

    fedora-find [hostname] [port-number] [fieldList] [searchString] [protocol]

    Where:
    Example:

    fedora-find localhost 8080 "pid fType title description" "fedora" http
    (shows the pid, Fedora object type, title, and description fields of each object that has the word fedora somewhere in it's indexed fields.)

    A simple way to search a repository's indexed fields. More advanced searches can be done with the web-based search interface at http://host:port/fedora/search, or the Admin GUI's search interface.
  5. fedora-ingest

    fedora-ingest f[ile] [PATH] [FORMAT] [THST:TPRT] [TUSR] [TPSS] [TPROTOCOL] [LOG]

    fedora-ingest d[ir] [PATH] [FORMAT] [FTYPS] [THST:TPRT] [TUSR] [TPSS] [TPROTOCOL] [LOG]

    fedora-ingest r[epos] [SHST:SPRT] [SUSR] [SPSS] [PID|FTYPS] [THST:TPRT] [TUSR] [TPSS] [SPROTOCOL] [TPROTOCOL] [LOG]

    Where:
    Examples:

    fedora-ingest f obj1.xml info:fedora/fedora-system:FOXML-1.1 myrepo.com:80 jane jpw http
    Ingests obj1.xml (encoded in foxml1.1 format) from the current directory into the repository at myrepo.com:80 as user 'jane' with password 'jpw'. The logmessage will be system-generated, indicating the source path+filename.

    fedora-ingest d c:\archive info:fedora/fedora-system:FOXML-1.0 M myrepo.com:80 jane janepw http ""
    Traverses entire directory structure of c:\archive, and ingests any file that looks like a behavior mechanism object (M). It assumes all files will be in the FOXML 1.0 format and will fail on ingests of files that are not of this format. All log messages will be the quoted string.

    fedora-ingest d c:\archive info:fedora/fedora-system:FOXML-1.0 ODM myrepo.com:80 jane janepw http "for jane"
    Same as above, but ingests all three types of objects (O,D,M).

    fedora-ingest r jrepo.com:8081 mike mpw demo:1 myrepo.com:80 jane jpw http http ""
    Ingests the object whose pid is 'demo:1' from the source repository 'srcrepo.com:8081' into the target repository 'myrepo.com:80'. The object will be exported from the source repository in the default export format configured at the source. All log messages will be empty.

    fedora-ingest r jrepo.com:8081 mike mpw O myrepo.com:80 jane jpw http http ""
    Same as above, but ingests all data objects (type O).
  6. fedora-ingest-demos

    fedora-ingest-demos [hostname] [port-number] [user] [pass] [protocol]

    Where:
    Example:

    fedora-ingest-demos localhost 8080 fedoraAdmin fedoraAdmin http
    A convenient script to ingest all included demo objects for a new Fedora installation. See the Demo guide for descriptions of these objects. Note: This script should not be run until you have ensured that the hostname and port numbers in the demo objects have been corrected (with the fedora-convert-demos script) to use the actual hostname and port of your Fedora server.
  7. fedora-convert-demos

    fedora-convert-demos [fromProtocol] [fromHostName] [fromPortNum] [toProtocol] [toHostName] [toHostNum] [fedoraHomeDir]

    Where:
    Example:

    fedora-convert-demos http localhost 8080 http www.fedora.info 80 c:\fedora-2.0
    Converts URLs in the demo objects from one protocol/host/port combination to another. After running this script with your repository's hostname, the demo objects can successfully be ingested.

    Background: The demo objects that come with the Fedora client have embedded URLs inside them that assume the server is running on a machine called localhost on port number 8080. Those URLs must be changed to reflect the actual host and port the server is running on. Rather than search through all the demo files and change the references by hand, you can just run this script. It is not necessary to run this script if you have already run fedora-ingest-demos succcessfully and wish to change the hostname and port of the Fedora server, as the demo objects are already in the repository and the references inside them will automatically be corrected by the server.
  8. fedora-purge

    fedora-purge [hostname:port] [user] [pass] [pid] [protocol] [logMessage]

    Where:
    Example:

    fedora-purge localhost 8080 fedoraAdmin fedoraAdmin demo:6 http "It was just a test object"
    Permanently removes an object from the repository.
  9. fedora-modify

    fedora-modify [hostname:port] [user] [password] [directives-filepath] [log-filepath] [protocol] [validate-only-option]*

    Where:
    The fedora-modify command line utility enables the running of the batch modify utility of the Administrator GUI client from the command line.
  10. fedora-batch-build

    fedora-batch-build [object-template-file] [object-specific-dir] [object-directory] [log-filepath] [log-format]

    Where:
    The fedora-batch-build command line utility enables the running of the batch build utility of the Administrator GUI client from the command line. The batch build utility creates a "batch" of Fedora objects based on the specified template file and the corresponding directory of object-specific files. Refer to the documentation on the Batch Utility for more details on how to use the batch build utility.
  11. fedora-batch-ingest

    fedora-batch-ingest [object-directory] [log-filepath] [log-format] [host:port] [user] [password] [protocol]

    Where:
    The fedora-batch-ingest command line utility enables the running of the batch ingest utility of the Administrator GUI client from the command line. The batch ingest utility ingests a "batch" of Fedora objects from the specified directory into the repository. Refer to the documentation on the Batch Utility for more details on how to use the batch ingest utility.
  12. fedora-batch-buildingest

    fedora-batch-buildingest [object-template-file] [object-specific-dir] [object-directory] [log-filepath] [log-format] [host:port] [user] [password] [protocol]

    Where:
    The fedora-batch-buildingest command line utility enables the running of the batch build & ingest utility of the Administrator GUI client from the command line. The batch build & ingest utility creates a "batch" of Fedora objects based on the specified template file and the corresponding directory of object-specific files and then ingests them into the repository. Refer to the documentation on the Batch Utility for more details on how to use the batch build & ingest utility.
  13. fedora-validate-objects

    fedora-validate-objects -serverurl [server-base-url] -username [user] -password [password] {-terms [terms] | -query [query] | -pidfile [path]} -logConfig [log4j-properties-file]

    Where:

    The fedora-validate-objects command line utility runs a validation task against a set of objects in the specified repository. Access to the repository is provided via the "-serverurl", "-username" and "-password" parameters. The set of objects is specified using either a "terms" phrase, a "query" sequence, or a "pidfile" (one of these is required, but more than one is not allowed). The "terms" and "query" parameters correspond to the strings used by the FindObjects method of API-A. The PID file is a plain text file containing one PID per line, ignoring blank lines and comment lines (lines that start with '#').

    The output of the validator can be controlled with the Log4J properties file. This can be used to suppress certain categories of messages or to restrict output by severity level.

    # In this example, messages regarding objects with no content model are disabled.
     
    # An appender for non-validator logging.
    log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
    log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
    log4j.appender.STDOUT.layout.ConversionPattern=%d{yyyy-MM-dd' 'HH:mm:ss.SSS} %p (%c) %m%n
    log4j.rootLogger=INFO, STDOUT
    
    # An appender for validator logging.
    log4j.appender.VALIDATOR=org.apache.log4j.ConsoleAppender
    log4j.appender.VALIDATOR.layout=org.apache.log4j.PatternLayout
    log4j.appender.VALIDATOR.layout.ConversionPattern=%p [%c] %m%n
    
    # The "root" of the Validator logging categories.
    log4j.logger.Validator=INFO, VALIDATOR
    log4j.additivity.Validator=false
    
    # Set some categories for special treatment.
    log4j.logger.Validator.NoContentModel=OFF