Index: main/trunk/greenstone2/perllib/plugins/ISISPlugin.pm
===================================================================
--- main/trunk/greenstone2/perllib/plugins/ISISPlugin.pm	(revision 24546)
+++ main/trunk/greenstone2/perllib/plugins/ISISPlugin.pm	(revision 24547)
@@ -30,4 +30,5 @@
 use multiread;
 use SplitTextFile;
+use MetadataRead;
 
 use strict;
@@ -35,6 +36,7 @@
 
 # ISISPlugin is a sub-class of SplitTextFile.
+# methods with identical signatures take precedence in the order given in the ISA list.
 sub BEGIN {
-    @ISISPlugin::ISA = ('SplitTextFile');
+    @ISISPlugin::ISA = ('MetadataRead', 'SplitTextFile');
 }
 
Index: main/trunk/greenstone2/perllib/plugins/MARCPlugin.pm
===================================================================
--- main/trunk/greenstone2/perllib/plugins/MARCPlugin.pm	(revision 24546)
+++ main/trunk/greenstone2/perllib/plugins/MARCPlugin.pm	(revision 24547)
@@ -28,4 +28,5 @@
 
 use SplitTextFile;
+use MetadataRead;
 
 use unicode;
@@ -36,6 +37,11 @@
 no strict 'refs'; # allow filehandles to be variables and viceversa
 
+# methods defined in superclasses that have the same signature take
+# precedence in the order given in the ISA list. We want MetaPlugins to
+# call MetadataRead's can_process_this_file_for_metadata(), rather than
+# calling BasePlugin's version of the same method, so list inherited 
+# superclasses in this order.
 sub BEGIN {
-    @MARCPlugin::ISA = ('SplitTextFile');
+    @MARCPlugin::ISA = ('MetadataRead', 'SplitTextFile'); 
     unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
 }
@@ -84,5 +90,8 @@
     push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
     push(@{$hashArgOptLists->{"OptList"}},$options);
-
+ 
+	# this does nothing yet, but if member vars are ever added
+	# to MetadataRead, will need to do this anyway:
+	#new MetadataRead($pluginlist, $inputargs, $hashArgOptLists);
     my $self = new SplitTextFile($pluginlist, $inputargs, $hashArgOptLists);
 
Index: main/trunk/greenstone2/perllib/plugins/MARCXMLPlugin.pm
===================================================================
--- main/trunk/greenstone2/perllib/plugins/MARCXMLPlugin.pm	(revision 24546)
+++ main/trunk/greenstone2/perllib/plugins/MARCXMLPlugin.pm	(revision 24547)
@@ -32,4 +32,5 @@
 use ReadXMLFile;
 use ReadTextFile;
+use MetadataRead;
 use marcmapping;
 
@@ -37,6 +38,7 @@
 no strict 'refs'; # allow filehandles to be variables and viceversa
 
+# methods with identical signatures take precedence in the order given in the ISA list.
 sub BEGIN {
-    @MARCXMLPlugin::ISA = ('ReadXMLFile', 'ReadTextFile');
+    @MARCXMLPlugin::ISA = ('MetadataRead', 'ReadXMLFile', 'ReadTextFile');
 }
 
Index: main/trunk/greenstone2/perllib/plugins/MetadataCSVPlugin.pm
===================================================================
--- main/trunk/greenstone2/perllib/plugins/MetadataCSVPlugin.pm	(revision 24546)
+++ main/trunk/greenstone2/perllib/plugins/MetadataCSVPlugin.pm	(revision 24547)
@@ -29,4 +29,6 @@
 
 use BasePlugin;
+use MetadataRead;
+
 use strict;
 no strict 'refs';
@@ -34,6 +36,7 @@
 
 
+# methods with identical signatures take precedence in the order given in the ISA list.
 sub BEGIN {
-    @MetadataCSVPlugin::ISA = ('BasePlugin');
+    @MetadataCSVPlugin::ISA = ('MetadataRead', 'BasePlugin');
 }
 
Index: main/trunk/greenstone2/perllib/plugins/MetadataRead.pm
===================================================================
--- main/trunk/greenstone2/perllib/plugins/MetadataRead.pm	(revision 24547)
+++ main/trunk/greenstone2/perllib/plugins/MetadataRead.pm	(revision 24547)
@@ -0,0 +1,83 @@
+###########################################################################
+#
+# MetadataRead - like a Java interface that defines that a subclass is
+# a Plugin that extracts Metadata
+#
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the 
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 2008 New Zealand Digital Library Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+package MetadataRead;
+
+use PrintInfo;
+use strict;
+
+# MetadataRead is an abstract superclass that does not inherit from anything else.
+# It exists solely to define the can_process_this_file_for_metadata() method in
+# such a way that those MetadataPlugins that inherit from MetadataRead don't need 
+# to define this method and will always process the files associated with them for 
+# metadata and other plugins in the pipeline won't be passed these files anymore.
+
+# MetadataRead defines method can_process_this_file_for_metadata() with identical
+# signature to BasePlugin. (MetadataRead doesn't inherit from BasePlugin, so it's
+# not 'overriding' it.) Subclasses of MetadataRead that want to use this method 
+# definition can override their inherited BasePlugin version of the method by 
+# listing MetadataRead as the *first* superclass they inherit from in the ISA list.
+# This is the way Perl resolves conflicting method definitions.
+
+my $arguments = [];
+
+my $options = { 'name'     => "MetadataRead",
+		'desc'     => "{MetadataRead.desc}",
+		'abstract' => "yes",
+		'inherits' => "yes",
+		'args'     => $arguments };
+
+
+sub new {
+    my ($class) = shift (@_);
+    my ($pluginlist,$inputargs,$hashArgOptLists,$auxiliary) = @_;
+    push(@$pluginlist, $class);
+
+    push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
+    push(@{$hashArgOptLists->{"OptList"}},$options);
+
+	# Like PrintInfo, MetadataRead has no superclass,
+	# so $self is intialised to an empty array.
+	my $self = {};
+    return bless $self, $class;
+
+}
+
+# MetadataPlugins that inherit from MetadataRead will by default
+# process all the metadata in files whose extensions match. 
+# Override this method in a subclass to return undef if other 
+# files should also be allowed to process the metadata therafter.
+sub can_process_this_file_for_metadata {
+    my $self = shift(@_);
+
+#	print STDERR "********* MetadataRead::can_process_this_file_for_metadata() called.\n";
+	
+    return $self->can_process_this_file(@_);
+}
+
+
+1;
Index: main/trunk/greenstone2/perllib/plugins/OAIPlugin.pm
===================================================================
--- main/trunk/greenstone2/perllib/plugins/OAIPlugin.pm	(revision 24546)
+++ main/trunk/greenstone2/perllib/plugins/OAIPlugin.pm	(revision 24547)
@@ -36,7 +36,9 @@
 use ReadTextFile; # needed for subroutine textcat_get_language_encoding
 use metadatautil;
-
+use MetadataRead;
+
+# methods with identical signatures take precedence in the order given in the ISA list.
 sub BEGIN {
-    @OAIPlugin::ISA = ('ReadXMLFile', 'ReadTextFile');
+    @OAIPlugin::ISA = ('MetadataRead', 'ReadXMLFile', 'ReadTextFile');
 }
 
@@ -183,10 +185,4 @@
 	$self->{'metadata_xml'} .= $_;
     }
-}
-
-sub can_process_this_file_for_metadata {
-    my $self = shift(@_);
-
-    return $self->can_process_this_file(@_);
 }
 
