package ReceiveACDS; use strict; use English; use Carp; use vars qw(@ISA $VERSION $name $author $date $version @instList $numberOfStreams); @ISA = qw(Module); use ModuleResources; # Declare identity, version, author, date, etc. $name = __PACKAGE__; $VERSION = '1.09'; $version = $VERSION; $author="Richard West/Dean Hinshaw"; $date="2006-07-05"; # # ChangeLog # ========= # # Version 1.09 - 2006-07-05 (DJF) # ------------ # # + Changed numberOfStreams to use standerdized function. # # Version 1.08 - 2005-12-10 (DJF) # ------------ # # + Now returns ignored if ACDSDTS flag is ignored. # # Version 1.07 - 2004-03-04 (DJF) # ------------ # # + Use new receive function to get response from receive spool # # Version 1.06 - 2002-02-20 (DJF) # ------------ # # + Added a findFile for database catalogue product entries as a condition on the newFile # This is to accomodate the creation of an empty catalogue index by obssumm # # Version 1.05 - 2001-03-16 (DH) # ------------ # # + Print out version number in performAction() for # tracking purposes. # # Version 1.04 - 2001-01-09 (DH) # ------------ # # + Add ingore option in evaluateRules # # Version 1.03 - 2000-12-20 (DH) # ------------ # # + Set instrument to 'cat' for ACDS products # # # Version 1.02 - 2000-12-19 (DH) # ------------ # # + Add ingesting of other keywords besides FILE and CONTENT # # Version 1.01 - 2000-12-18 (DH) # ------------ # # + First production version. # # Declare list of instruments this module is interested in @instList=qw(all); # Number of streams sub numberOfStreams { return 1; } # Rules method sub evaluateRules { return ignore() if ( ignored(module => 'SendACDS', stream => 1) || ignored(module => 'ACDSDTS', stream => 1) ) ; ; start() if complete(module => 'ACDSDTS', stream => 1); } # Action method sub performAction { info("Module version number: $version"); # Name of ACDS keywords file my @lines=readASCIIFile(name => "intermediate/ACDS_KEYWORDS.TXT"); # Loop over every entry in the keywords file my ($file,$data); foreach my $line (@lines) { my ($key,$value)=split(/\s*=\s*/,$line,2); if($key eq "FILE") { $file=$value; $$data{$file}{'name'}=$value; } elsif ( $key=~/(CONTENT|FORMAT|CATNAME)/ ) { $$data{$file}{lc $key}=$value; } elsif( $key=~/PLT_(RA|DEC|ID|ORG)/ ) { $$data{$file}{lc "plate_$1"}=$value; } elsif( $key=~/PLT_FILT/ ) { $$data{$file}{'plate_filter'}=$value; } elsif( $key=~/SRCNUM/ ) { $$data{$file}{'src_num'}=$value; } } # Fill in missing keywords # Create database entries for newly received files foreach my $file (values %$data) { my @dummy=findFile(class => 'product', instrument => 'cat', %$file); # Spook the module name because these files must belong to the sending module # Otherwise we will have problems on a resend if (!@dummy) { my $dummy=newFile(class => 'product' ,instrument => 'cat' , module => 'SendACDS' ,%$file ); } } return success(); } 1;