Index: trunk/ippToPsps/perl/ippToPsps/InitBatch.pm
===================================================================
--- trunk/ippToPsps/perl/ippToPsps/InitBatch.pm	(revision 29188)
+++ trunk/ippToPsps/perl/ippToPsps/InitBatch.pm	(revision 29188)
@@ -0,0 +1,78 @@
+#!/usr/bin/perl -w
+
+package ippToPsps::InitBatch;
+
+use warnings;
+use strict;
+use File::Basename;
+use File::Temp qw(tempfile);
+use XML::LibXML;
+
+use ippToPsps::Batch;
+our @ISA = qw(ippToPsps::Batch);    # inherits from Batch class
+
+###########################################################################
+#
+# Constructor (overrides superclass)
+#
+###########################################################################
+sub new {
+    my ($class) = @_;
+
+    # Call the constructor of the parent class
+    my $self = $class->SUPER::create(
+            "IN",      # type 
+            $_[1],     # camera
+            undef,     # gpc1Db
+            $_[2],     # ippToPspsDb
+            $_[3],     # path
+            $_[4],     # datastore
+            0,         # expId
+            "NULL",    # expName
+            undef,     # dvoDb
+            undef,     # dvoPath
+            "ThreePi", # distGroup
+            $_[5],     # dontTarball
+            $_[6],     # verbose
+            $_[7]);    # save_temps
+
+    bless $self, $class;
+    return $self;
+}
+
+#######################################################################################
+# 
+# No input file necessary for IN batches 
+#
+#######################################################################################
+sub createInputFileList {
+    my ($self) = @_;
+
+    return "NULL";
+}
+
+#######################################################################################
+#
+# No results from IN batch creation, but updates Db
+#
+#######################################################################################
+sub parseResults {
+    my ($self, $resultsFilePath) = @_;
+
+    my($filename, $minObjId, $maxObjId, $totalDetections);
+
+    # read results of FITS creation from XML file
+    my $parser = XML::LibXML->new;
+    my $doc = $parser->parse_file($resultsFilePath);
+    $filename = $doc->findvalue('//filename');
+
+    # write results to database
+    $self->{_ippToPspsDb}->setAsProcessed($self->{_batchId}, $self->{_expId}, -1, -1, -1);
+
+    # write batch manifest
+    if (!$self->writeManifest($filename, -1, -1)) {return 0;}
+
+    return 1;
+}
+1;
+
Index: trunk/ippToPsps/perl/makeDetections.pl
===================================================================
--- trunk/ippToPsps/perl/makeDetections.pl	(revision 29188)
+++ trunk/ippToPsps/perl/makeDetections.pl	(revision 29188)
@@ -0,0 +1,143 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use File::Basename;
+
+# local classes
+use ippToPsps::Gpc1Db;
+use ippToPsps::IppToPspsDb;
+use ippToPsps::Datastore;
+use ippToPsps::DetectionBatch;
+
+# globals
+my $camera = undef;
+my $dvoDb = undef;
+my $dvoPath = undef;
+my $verbose = undef;
+my $save_temps = undef; 
+my $output = undef;
+my $singleExpId = undef;
+my $datastoreProduct = undef;
+my $force = undef;
+my $dontTarball = undef;
+my $datastore = undef;
+
+# get user args
+GetOptions(
+        'camera|c' => \$camera,
+        'output|o=s' => \$output,
+        'dvodb|d=s' => \$dvoDb,
+        'dvolocation|l=s' => \$dvoPath,
+        'expid|e=s' => \$singleExpId,
+        'product|p=s' => \$datastoreProduct,
+        'verbose|v' => \$verbose,
+        'save_temps|t' => \$save_temps,
+        'force|f' => \$force,
+        'tarnzip|z' => \$dontTarball,
+        );
+
+my $quit = 0;
+print "\n*******************************************************************************\n";
+print "* \n";
+if (@ARGV) {
+    $quit=1;
+    print "* UNKNKOWN: option                          @ARGV\n";
+}
+if (!defined $output) {
+    $quit=1;
+    print "* REQUIRED: need to provide an output path  -o <path>\n";
+}
+if (!defined $dvoDb) {
+    $quit=1;
+    print "* REQUIRED: need to provide a DVO Db        -d <dvoDb>\n";
+}
+if (!defined $dvoPath) {
+    $quit=1;
+    print "* REQUIRED: need to provide a DVO location  -l <dvoLocation>\n";
+}
+if (!defined $camera) {
+    $camera = "GPC1";
+    print "* OPTIONAL: select a camera                 -c                   (default = $camera)\n";
+}
+if (!defined $singleExpId) {
+    $singleExpId = -1;
+    print "* OPTIONAL: a single exposure ID            -e <expID>           (default = none)\n";
+}
+if (!defined $datastoreProduct) {
+
+    print "* OPTIONAL: datastore product               -p <product>         (default = none, i.e. data will not be published)\n";
+}
+if (!defined $verbose) {
+    $verbose = 0;
+    print "* OPTIONAL: run in verbose mode             -v                   (default = $verbose)\n";
+}
+if (!defined $save_temps) {
+    $save_temps = 0;
+    print "* OPTIONAL: keep temp files                 -t                   (default = $save_temps)\n";
+}
+if (!defined $force) {
+    $force = 0;
+    print "* OPTIONAL: force if already processed      -f                   (default = $force)\n";
+}
+if (!defined $dontTarball) {
+    $dontTarball = 0;
+    print "* OPTIONAL: don't tar and zip output        -z                   (default = $dontTarball)\n";
+}
+print "*\n*******************************************************************************\n";
+
+if ($quit) { exit; }
+
+
+my $gpc1Db = new ippToPsps::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser", $verbose, $save_temps);
+my $ippToPspsDb = new ippToPsps::IppToPspsDb("ippToPsps", "ippdb01", "ipp", "ipp", $verbose, $save_temps);
+if ($datastoreProduct) {$datastore = new ippToPsps::Datastore($datastoreProduct, $verbose, $save_temps);}
+
+my $exposures;
+
+my $query;
+# get single exposure
+if ($singleExpId != -1) {
+
+    if (!$gpc1Db->getSingleExposureFromDvoDb($dvoDb, $singleExpId, \$exposures)) {exit;}
+}
+# get all exposures in this DVO Db
+else {
+
+    if (!$gpc1Db->getExposureListFromDvoDb($dvoDb, \$exposures)) {exit;}
+}
+
+my $exposure;
+foreach $exposure ( @{$exposures} ) {
+    my ($expId, $expName, $distGroup) = @{$exposure};
+
+
+    if ($ippToPspsDb->isExposureAlreadyProcessed($expId)) {
+
+        if ($force) {print "* Already processed '$expId', but forcing....\n";}
+        else {
+
+            print "* Exposure ID '$expId' has already been processed, skipping\n";
+            next
+        };
+    }
+
+
+    my $detectionBatch = new ippToPsps::DetectionBatch(
+            $camera, 
+            $gpc1Db, 
+            $ippToPspsDb, 
+            $output, 
+            $datastore, 
+            $expId,
+            $expName,
+            $dvoDb,
+            $dvoPath,
+            $distGroup,
+            $dontTarball,
+            $verbose, 
+            $save_temps);
+
+}
Index: trunk/ippToPsps/perl/makeInit.pl
===================================================================
--- trunk/ippToPsps/perl/makeInit.pl	(revision 29188)
+++ trunk/ippToPsps/perl/makeInit.pl	(revision 29188)
@@ -0,0 +1,78 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+
+# local classes
+use ippToPsps::IppToPspsDb;
+use ippToPsps::Datastore;
+use ippToPsps::InitBatch;
+
+# globals
+my $camera = undef;
+my $verbose = undef;
+my $save_temps = undef; 
+my $output = undef;
+my $datastoreProduct = undef;
+my $dontTarball = undef;
+my $datastore = undef;
+
+# get user args
+GetOptions(
+        'camera|c' => \$camera,
+        'output|o=s' => \$output,
+        'product|p=s' => \$datastoreProduct,
+        'verbose|v' => \$verbose,
+        'save_temps|t' => \$save_temps,
+        'tarnzip|z' => \$dontTarball,
+        );
+
+my $quit = 0;
+print "\n*******************************************************************************\n";
+print "* \n";
+if (@ARGV) {
+    $quit=1;
+    print "* UNKNKOWN: option                          @ARGV\n";
+}
+if (!defined $output) {
+    $quit=1;
+    print "* REQUIRED: need to provide an output path  -o <path>\n";
+}
+if (!defined $camera) {
+    $camera = "GPC1";
+    print "* OPTIONAL: select a camera                 -c                   (default = $camera)\n";
+}
+if (!defined $datastoreProduct) {
+
+    print "* OPTIONAL: datastore product               -p <product>         (default = none, i.e. data will not be published)\n";
+}
+if (!defined $verbose) {
+    $verbose = 0;
+    print "* OPTIONAL: run in verbose mode             -v                   (default = $verbose)\n";
+}
+if (!defined $save_temps) {
+    $save_temps = 0;
+    print "* OPTIONAL: keep temp files                 -t                   (default = $save_temps)\n";
+}
+if (!defined $dontTarball) {
+    $dontTarball = 0;
+    print "* OPTIONAL: don't tar and zip output        -z                   (default = $dontTarball)\n";
+}
+print "*\n*******************************************************************************\n";
+
+if ($quit) { exit; }
+
+my $ippToPspsDb = new ippToPsps::IppToPspsDb("ippToPsps", "ippdb01", "ipp", "ipp", $verbose, $save_temps);
+if ($datastoreProduct) {$datastore = new ippToPsps::Datastore($datastoreProduct, $verbose, $save_temps);}
+
+my $initBatch = new ippToPsps::InitBatch(
+        $camera, 
+        $ippToPspsDb, 
+        $output, 
+        $datastore, 
+        $dontTarball,
+        $verbose, 
+        $save_temps);
+
