Index: trunk/ippToPsps/perl/checkOdmStatus.pl
===================================================================
--- trunk/ippToPsps/perl/checkOdmStatus.pl	(revision 29093)
+++ trunk/ippToPsps/perl/checkOdmStatus.pl	(revision 29094)
@@ -5,6 +5,4 @@
 
 use LWP::UserAgent;
-use IPC::Cmd 0.36 qw( can_run run );
-use IPC::Cmd 0.36 qw( can_run run );
 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
 use XML::LibXML;
@@ -12,4 +10,5 @@
 use ippToPsps::IppToPspsDb;
 use ippToPsps::Datastore;
+use ippToPsps::BatchManager;
 
 my $singleBatch = undef;
@@ -61,4 +60,5 @@
 my $datastore = new ippToPsps::Datastore($product, 0, 0);
 my $ippToPspsDb = new ippToPsps::IppToPspsDb("ippToPsps", "ippdb01", "ipp", "ipp", $verbose, $save_temps);
+my $batchManager = new ippToPsps::BatchManager($ippToPspsDb, $filePath, $verbose, $save_temps);
 my $odmUrl = "http://web01.psps.ifa.hawaii.edu/a01/OdmWebService/OdmWebService.asmx/GetBatchStatus";
 my $ua = LWP::UserAgent->new;
@@ -102,5 +102,5 @@
         $numBatchesToCheck++;
 
-        my $batchName = getBatchName($batchId);
+        my $batchName = $batchManager->getBatchName($batchId);
 
         # if not merged then update by polling ODM for status
@@ -119,13 +119,8 @@
             }
         }
-
         # if merged and already removed from datastore then delete files
         if (defined $filePath && $merged && $deleted) {
 
-            print "$command\n";
-            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-                run(command => $command, verbose => $verbose);
-            if (!$success) {print "* Unable to run: $command\n";}
-            else {$numDeleted++;}
+            if($batchManager->deleteBatch($batchId)) {$numDeleted++;}
         }
 
@@ -152,15 +147,4 @@
 ########################################################################################
 # 
-# Returns batch name from batch_id TODO needs to be a batch class
-# 
-########################################################################################
-sub getBatchName {
-    my ($batchId) = @_;
-
-    return sprintf("B%08d", $batchId);
-}
-
-########################################################################################
-# 
 # Check a single batch
 # 
