source: gsdl/trunk/perllib/plugins/AbstractPlugin.pm@ 16388

Last change on this file since 16388 was 16388, checked in by kjdon, 16 years ago

global block pass: added in empty file_block_read method

  • Property svn:executable set to *
File size: 2.8 KB
Line 
1###########################################################################
2#
3# Base plugin for other plugins that don't inherit (directly or indirectly)
4# from BasePlugin
5#
6# A component of the Greenstone digital library software
7# from the New Zealand Digital Library Project at the
8# University of Waikato, New Zealand.
9#
10# Copyright (C) 2008 New Zealand Digital Library Project
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25#
26###########################################################################
27package AbstractPlugin;
28
29use PrintInfo;
30
31use strict;
32no strict 'subs';
33
34sub BEGIN {
35 @AbstractPlugin::ISA = ( 'PrintInfo' );
36}
37
38my $arguments = [];
39
40
41my $options = { 'name' => "AbstractPlugin",
42 'desc' => "{AbstractPlugin.desc}",
43 'abstract' => "yes",
44 'inherits' => "yes",
45 'args' => $arguments };
46
47
48sub new
49{
50 my $class = shift (@_);
51 my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
52 my $plugin_name = (defined $pluginlist->[0]) ? $pluginlist->[0] : $class;
53
54 if ($plugin_name eq $class) {
55 push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
56 push(@{$hashArgOptLists->{"OptList"}},$options);
57 }
58
59 my $self = new PrintInfo($pluginlist, $inputargs, $hashArgOptLists);
60
61
62 $self->{'num_processed'} = 0;
63 $self->{'num_not_processed'} = 0;
64 $self->{'num_blocked'} = 0;
65 $self->{'num_archives'} = 0;
66
67 return bless $self, $class;
68}
69
70
71# here are some more methods which we want at a lower level that BasePlugin.
72# but should we have a new class for these?
73# Rec and Arc plugs use these
74sub set_incremental {
75 my $self = shift(@_);
76 my ($incremental) = @_;
77
78 $self->{'incremental'} = $incremental;
79}
80
81sub init {
82 my $self = shift (@_);
83 my ($verbosity, $outhandle, $failhandle) = @_;
84
85 # verbosity is passed through from the processor
86 $self->{'verbosity'} = $verbosity;
87
88 # as are the outhandle and failhandle
89 $self->{'outhandle'} = $outhandle if defined $outhandle;
90 $self->{'failhandle'} = $failhandle;
91
92}
93
94sub begin {
95
96}
97
98sub end {
99
100}
101
102sub deinit {
103
104}
105
106sub compile_stats {
107
108}
109
110sub metadata_read {
111 return undef;
112}
113
114sub file_block_read {
115 return undef;
116}
117
Note: See TracBrowser for help on using the repository browser.