Index: /trunk/ippToPsps/perl/ippToPsps/Datastore.pm
===================================================================
--- /trunk/ippToPsps/perl/ippToPsps/Datastore.pm	(revision 28883)
+++ /trunk/ippToPsps/perl/ippToPsps/Datastore.pm	(revision 28883)
@@ -0,0 +1,88 @@
+#!/usr/bin/perl -w
+
+package ippToPsps::Datastore;
+
+use warnings;
+use strict;
+
+use File::Temp qw(tempfile);
+use IPC::Cmd 0.36 qw( can_run run );
+
+###########################################################################
+#
+# Constructor
+#
+###########################################################################
+sub new {
+
+    my $class = shift;
+    my $self = {
+        _product => shift,
+        _verbose => shift,
+        _save_temps => shift,
+    };
+
+    $self->{_dsreg} = can_run('dsreg') or (warn "* WARNING: Can't find 'dsreg' program");
+
+    bless $self, $class;
+    return $self;
+}
+
+#######################################################################################
+#
+# Register item with datastore
+#
+########################################################################################
+sub register {
+    my ($self, $name, $path, $file, $type, $fileType) = @_;
+
+    my ($tempFile, $tempName) = tempfile( "/tmp/Datastore_dsregList.XXXX", UNLINK => !$self->{_save_temps});
+
+    print $tempFile $file . '|||' . $fileType . "\n";
+
+    # build dsreg command command
+    my $command  = "$self->{_dsreg}";
+    $command .= " --add $name";
+    $command .= " --copy";
+    $command .= " --datapath $path";
+    $command .= " --type $type";
+    $command .= " --product $self->{_product}";
+    $command .= " --list $tempName";
+
+    # run command
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $self->{_verbose});
+
+    if (!$success) { print "* Unable to publish $file to datastore\n" and return 0 };
+
+    print "* Successfully published $file to datastore\n";
+
+    close($tempFile);
+
+    return 1;
+}
+
+#######################################################################################
+#
+# Remove item from datastore
+#
+########################################################################################
+sub remove {
+    my ($self, $name) = @_;
+
+    # build dsreg command command
+    my $command  = "$self->{_dsreg}";
+    $command .= " --del $name";
+    $command .= " --product $self->{_product}";
+
+    # run command                                           
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $self->{_verbose});          
+
+    if (!$success) { print "* Unable to remove $name from datastore\n" and return 0 }; 
+
+    print "* Successfully removed $name from datastore\n";
+
+    return 1;
+}
+1;
