CatDV/PresSTORE Updates for CatDV 9.0

For a full overview of getting CatDV working with PresSTORE Archive, click here.  This article discusses updates due to changes in CatDV 9.0.

After doing some work with CatDV 9.0, I discovered that the XML schema has changed slightly.  The changes are actually just a more verbose XML output and adding some additional sub-fields to the USERxX elements.  In CatDV 8.x XML, these were actually fields and therefore returned the contents.  CatDV 8.0 XML looks something like this:

...
<USER1>This is some description info</USER1>
<USER2>This is another metadata value</USER2>
...

And so on and so forth.  Because of this, we were able to use generic calls to return these values in our “catdv-xml.pl” script, which looked like this:

...
$md1value = $data->{CLIP}->{USER1}; #This returns the value for field USER1
$md2value = $data->{CLIP}->{USER2}; #This returns the value for field USER2
...

Because these were simply elements in the XML array, values were actually returned.  In CatDV 9.0, the <USER> field is no longer a simple element, but instead an array that has subcategories.  In CatDV 9.0, the same XML file looks like this:

...
<USER1 name="CatDV USER1 Description">This is the USER1 value</USER1>
<USER2 name="CatDV USER2 Description">This is the USER2 value</USER2>
...

Unfortunately, our original code now breaks because when we ask just for {USER1}, we no longer return a text string, but instead a hash that relates to the values of the array that USER1 has become.  Fixing this is actually very simple.  We just need to be more explicit in our definition of what we want for the $md1value.  We would do this by adding the “contents” element to our XML request like follows:

...
$md1value = $data->{CLIP}->{USER1}->{content}; #This returns the value for field USER1
$md2value = $data->{CLIP}->{USER2}->{content}; #This returns the value for field USER2
...

We added in the “contents” container as it is synonymous with the elements encapsulated in the <USER1> field.  Because this information is valid for both elements and arrays, this code change should not effect anyone using CatDV 8.0 at all.

I have also made several improvements to the “aw-queue.pl” script.  These editions include the following:

1) Using sockets for all communication so that aw-queue can run on any system with nsdchat installed, not just the PresSTORE server itself.
2) Created variables for the CatDV index on the CLI, so if there are multiple archive indexes in a facility they can be called by multiple launchd jobs without duplicating the aw-queue script file
3) More logging information

If you were using the previous script set, make sure you open aw-queue.pl and input usernames/passwords/hostnames for your systems to allow sockets to work.

Also, you will have to add an additional value (the Archive Index you are restoring from) to your launchd scripts.  It would look simply like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Disabled</key>
	<true/>
	<key>Label</key>
	<string>org.provideotech.aw-queue-restore</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/aw-scripts/aw-queue.pl</string>
		<string>/usr/local/catdv-presstore/restore-queue.txt</string>
		<string>restore</string>
		<string>10001</string>
		<string>ArchiveIndex</string>
	</array>
	<key>StartInterval</key>
	<integer>600</integer>
</dict>
</plist>

Note the additional line after the archive plan. This is the name of the Archive Index in PresSTORE that the job is being run against.

I have updated the files for download to reflect these changes.  You can grab them here: here

2 thoughts on “CatDV/PresSTORE Updates for CatDV 9.0

  1. I’ve been testing the above against CAT DV 9.0.1 and I’ve had to change the above.
    A dump of the xml shows the following for user fields:
    ‘USER14’ => {
    ‘content’ => ‘Firework01’,
    ‘name’ => ‘User 14’
    }
    so to get to the content you have to use:
    md1value = $data->{CLIP}->{USER14}->{content};
    not {contents}

    For standard values line Notes, you have to use:
    md1value = $data->{CLIP}->{NOTES};

    It seems that the content element in the array has to be referenced explicitly.

Leave a Reply to David WhiteCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.