Changeset 19052 for gsdl/trunk/perllib


Ignore:
Timestamp:
2009-04-19T19:26:14+12:00 (15 years ago)
Author:
davidb
Message:

Modifications to CONENTdmPlugin so its works with Kathy's new plugin restructuring. Still considered experimental.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/CONTENTdmPlugin.pm

    r18406 r19052  
    108108
    109109    my $parser = new XML::Parser('Style' => 'Stream',
    110                  'Pkg' => 'CONTENTdmPlugin',
     110                 'Pkg' => 'ReadXMLFile',
    111111                 'PluginObj' => $self,
    112                  'Handlers' => {'Char' => \&Char,
    113                         'XMLDecl' => \&XMLDecl,
    114                         'Entity' => \&Entity,
    115                         'Doctype' => \&Doctype,
    116                         'Default' => \&Default
     112                 'Handlers' => {'Char' => \&ReadXMLFile::Char,
     113                        'XMLDecl' => \&ReadXMLFile::XMLDecl,
     114                        'Entity'  => \&ReadXMLFile::Entity,
     115                        'Doctype' => \&ReadXMLFile::Doctype,
     116                        'Default' => \&ReadXMLFile::Default
    117117                        }); 
    118118    $self->{'parser'} = $parser;
     119
     120
    119121    $self->{'rdf_desc'} = undef;
    120122    $self->{'about_key'} = undef;
     
    134136
    135137    $self = bless $self, $class;
     138
     139# ***** no longer needed!
     140#    # This needs to be done after blss, to $self passed to XML::Parser
     141#    # can correctly resolve the right call-back methods during XML parsing
     142
     143
    136144    $self->load_secondary_plugins($class,$secondary_plugin_options,$hashArgOptLists);
    137145    return $self;
     
    232240    = &File::Basename::fileparse($txt_filename, "\\.[^\\.]+\$");
    233241
    234     my $txt_file = "$tailname.$suffix";
     242    my $txt_file = "$tailname$suffix";
    235243
    236244    return $txt_file;
     
    384392        my $transformed_xml = $self->apply_xslt($xslt,$input_filename);
    385393
     394        open(TOUT,">/tmp/tout.xml")
     395        || die "Unable to open /tmp/tout.xml: $!\n";
     396        print TOUT $transformed_xml;
     397        close(TOUT);
     398
     399
    386400        # feed transformed file (now in memory as string) into XML parser
    387401        $self->{'parser'}->parse($transformed_xml);
     
    513527    my $fakeimg_tmp_filename = &util::filename_cat($tmp_dirname, "empty.jpg");
    514528
    515     print STDERR "***** Setting up fake filename $fakeimg_filename -> $fakeimg_tmp_filename\n";
     529    print STDERR "***** No source image identified with item\n";
     530
     531    print STDERR "***** Using default \"no image available\" $fakeimg_filename -> $fakeimg_tmp_filename\n";
    516532
    517533    &util::soft_link($fakeimg_filename, $fakeimg_tmp_filename);
     
    565581    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
    566582
     583
    567584    $self->{'gli'} = $gli;
    568585    $self->{'file'} = $file;
     
    576593
    577594    $file =~ s/^[\/\\]+//; # $file often begins with / so we'll tidy it up
    578        
     595
    579596    # read() deviates at this point from ConvertBinaryFile
    580597    # Need to work with list of filename returned
     
    584601
    585602    $conv_filename_list = $self->tmp_area_convert_file($output_ext, $filename_full_path);
    586    
     603
    587604    if (scalar(@$conv_filename_list)==0) {
    588605    return -1;
     
    610627   
    611628    my $secondary_plugin = $secondary_plugins->{$plugin_name};
    612    
     629
    613630    # note: metadata is not carried on to the next level
    614631    my ($rv,$doc_obj)
     
    616633                            $block_hash, $metadata, $processor, $maxdocs, $total_count,
    617634                            $gli);
     635
     636    print STDERR "**** $conv_filename => returned rv = $rv\n";
    618637
    619638    if ((defined $rv) && ($rv>=0)) {
     
    638657    # do plugin specific processing of doc_obj
    639658    unless (defined ($self->process(undef, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli))) {
     659        print STDERR "***** process returned undef: $base_dir $file\n";
    640660        print STDERR "<ProcessingError n='$file'>\n" if ($gli);
    641661        return -1;
     
    660680sub process {
    661681
    662 }
     682    return 1;
     683}
     684
    663685# do we need this? sec pluginn process would have already been called as part of read_into_doc_obj??
    664686sub process_old {
     
    781803    my $self = shift(@_);
    782804    my ($expat) = @_;
    783 
    784805}
    785806
Note: See TracChangeset for help on using the changeset viewer.