root/gs3-extensions/pharos-imageis/trunk/perllib/plugins/PharosImagePlugin.pm @ 21316

Revision 21316, 2.9 KB (checked in by kjdon, 11 years ago)

mods to remove_one

Line 
1###########################################################################
2#
3# PharosImagePlugin - an ImagePlugin that can also do pharos related tasks.
4#
5# A component of the Greenstone digital library software
6# from the New Zealand Digital Library Project at the
7# University of Waikato, New Zealand.
8#
9# Copyright (C) 2008 New Zealand Digital Library Project
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24#
25###########################################################################
26package PharosImagePlugin;
27
28use ImagePlugin;
29use PharosImageIndexer;
30
31use strict;
32no strict 'refs'; # allow filehandles to be variables and viceversa
33
34use gsprintf 'gsprintf';
35
36BEGIN {
37    @PharosImagePlugin::ISA = ('ImagePlugin', 'PharosImageIndexer');
38}
39
40my $arguments = [
41         ];
42
43my $options = { 'name' => "PharosImagePlugin",
44        'desc' => "{PharosImagePlugin.desc}",
45        'abstract' => "no",
46        'inherits' => "yes",
47        'args' => $arguments };
48
49sub new {
50    my ($class) = shift (@_);
51    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
52    push(@$pluginlist, $class);
53
54    push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
55    push(@{$hashArgOptLists->{"OptList"}},$options);
56
57    new PharosImageIndexer($pluginlist, $inputargs, $hashArgOptLists);
58    my $self = new ImagePlugin($pluginlist, $inputargs, $hashArgOptLists);
59
60
61    return bless $self, $class;
62
63}
64
65# needs to be called after BasePlugin init, so that outhandle is set up.
66sub init {
67    my $self = shift(@_);
68    my ($verbosity, $outhandle, $failhandle) = @_;
69
70    $self->SUPER::init(@_);
71    $self->PharosImageIndexer::init();
72
73}
74
75sub remove_all {
76    my $self = shift (@_);
77    my ($pluginfo, $base_dir, $processor, $maxdocs) = @_;
78   
79    $self->SUPER::remove_all(@_);
80    $self->PharosImageIndexer::remove_all(@_);
81   
82}
83
84sub remove_one {
85    my $self = shift (@_);
86    my ($file, $oids, $archivedir) = @_;
87    return undef if (!$self->can_process_this_file($file));
88   
89    $self->PharosImageIndexer::remove_one(@_);
90    return $self->SUPER::remove_one(@_);
91   
92   
93}
94
95sub post_process_doc_obj {
96    my $self = shift (@_);
97    # options??
98    my ($pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
99    $self->pharos_index_image(&util::filename_cat($base_dir, $file), $doc_obj);
100}
101
102
103
1041; 
Note: See TracBrowser for help on using the browser.