What: fcsu, an extensible command-line utility for working with Fedora storage.

Why: Due to Fedora's current web service API design, it can be tedious and time-consuming to make certain kinds of changes to a repository. This utility works at a lower level (but not too low) in order to allow efficient batch modifications that are either impossible or impractical when going through the public API.

What's the catch: fcsu is a very sharp tool and can be used to accidentally cause irreparable damage to your repository. It is always recommended that you test your changes against a backup copy rather than running modifications directly against your repository. In addition, certain types of changes you make with fcsu can necessitate a SQL or Resource Index rebuild.

A Few Examples

Once you configure it to point to your repository's data (see conf/config.properties), you can do things like the following. Note that by default there are two stores defined, 'legacy' and 'akubra', but you can define any number of them by adding a configuration file similar to the ones already found in conf/stores/.

Migrate from Fedora legacy storage to akubra-fs: (this can also be used to migrate from one akubra-based impl to another)

fcsu copy legacy akubra

List all objects whose pids match a given regular expression:

fcsu list store1 --pids=^demo:Smiley.*

For all objects, migrate DC, RELS-EXT, and RELS-INT datastreams from inline XML to managed content:

fcsu modify store1 --filter=inline-to-managed-xml --datastream-ids=DC,RELS-EXT,RELS-INT

For all objects in the hdl namespace, re-compute the size and sha1 checksum of all managed and inline datastreams, even if it's already defined:

fcsu modify store1 --filter=set-fixity --pids=^hdl:.* --algorithm=sha1 --force=true --control-groups=M,X

Make a complete copy of the repository but omit all AUDIT datastreams:

fcsu copy store1 store2 --filter=remove-datastreams --remove-datastream-ids=AUDIT

Want to Try It?

You can download the latest test build here. The fcsu shell script can be found in the bin directory after unpacking. Note: It should work in Windows, but the .bat file isn't written for that yet.

See the various filters, stores, and commands for examples of how the utility can be used and extended.

Any questions or comments? Let me know here or via email. Thanks!

  • No labels

1 Comment

  1. Hi Chis,

     

    That is great.

    But thinking more in lower level, is there any way to modify directly those user imported files (ie., html, image file, mp3 , etc...) in managed content?

    Are they stored in DB or files somewhere?

     

    Thanks,

    Jay