Changeset 15872 for gsdl/trunk/perllib/plugins/DSpacePlugin.pm
- Timestamp:
- 2008-06-05T09:29:32+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/DSpacePlugin.pm
r15865 r15872 2 2 ########################################################################### 3 3 # 4 # DSpacePlug .pm -- plugin for import thecollection from DSpace4 # DSpacePlugin.pm -- plugin for importing a collection from DSpace 5 5 # 6 6 # A component of the Greenstone digital library software … … 8 8 # University of Waikato, New Zealand. 9 9 # 10 # Copyright (C) 1999New Zealand Digital Library Project10 # Copyright (C) 2004 New Zealand Digital Library Project 11 11 # 12 12 # This program is free software; you can redistribute it and/or modify … … 26 26 ########################################################################### 27 27 28 # DSpace Plug - 10/2004 29 # 30 # 28 31 29 # This plugin takes "contents" and dublin_core.xml file, which contain 32 30 # Metadata and lists of associated files for a particular document … … 47 45 # 48 46 49 package DSpacePlug ;50 51 use Bas Plug;47 package DSpacePlugin; 48 49 use BasePlugin; 52 50 use plugin; 53 #use ghtml;54 51 use XMLParser; 55 52 use strict; … … 57 54 58 55 sub BEGIN { 59 @DSpacePlug ::ISA = ('BasPlug');56 @DSpacePlugin::ISA = ('BasePlugin'); 60 57 } 61 58 62 59 my $arguments = 63 60 [ { 'name' => "process_exp", 64 'desc' => "{Bas Plug.process_exp}",61 'desc' => "{BasePlugin.process_exp}", 65 62 'type' => "string", 66 63 'deft' => &get_default_process_exp(), 67 64 'reqd' => "no" }, 68 65 { 'name' => "only_first_doc", 69 'desc' => "{DSpacePlug .only_first_doc}",66 'desc' => "{DSpacePlugin.only_first_doc}", 70 67 'type' => "flag", 71 68 'reqd' => "no" }, 72 69 { 'name' => "first_inorder_ext", 73 'desc' => "{DSpacePlug .first_inorder_ext}",70 'desc' => "{DSpacePlugin.first_inorder_ext}", 74 71 'type' => "string", 75 72 'reqd' => "no" }, 76 73 { 'name' => "first_inorder_mime", 77 'desc' => "{DSpacePlug .first_inorder_mime}",74 'desc' => "{DSpacePlugin.first_inorder_mime}", 78 75 'type' => "flag", 79 76 'reqd' => "no" }, 80 77 { 'name' => "block_exp", 81 'desc' => "{Bas Plug.block_exp}",78 'desc' => "{BasePlugin.block_exp}", 82 79 'type' => "regexp", 83 80 'deft' => &get_default_block_exp(), … … 85 82 86 83 87 my $options = { 'name' => "DSpacePlug ",88 'desc' => "{DSpacePlug .desc}",84 my $options = { 'name' => "DSpacePlugin", 85 'desc' => "{DSpacePlugin.desc}", 89 86 'inherits' => "yes", 90 87 'abstract' => "no", … … 104 101 push(@$pluginlist, $class); 105 102 106 if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});} 107 if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)}; 108 109 $self = new BasPlug($pluginlist, $inputargs, $hashArgOptLists); 110 103 push(@{$hashArgOptLists->{"ArgList"}},@{$arguments}); 104 push(@{$hashArgOptLists->{"OptList"}},$options); 105 106 $self = new BasePlugin($pluginlist, $inputargs, $hashArgOptLists); 107 108 if ($self->{'info_only'}) { 109 # don't worry about creating the XML parser as all we want is the 110 # list of plugin options 111 return bless $self, $class; 112 } 113 111 114 #create XML::Parser object for parsing dublin_core.xml files 112 115 my $parser = new XML::Parser('Style' => 'Stream', … … 252 255 } 253 256 254 print $outhandle "DSpacePlug : extracting metadata from $file\n"257 print $outhandle "DSpacePlugin: extracting metadata from $file\n" 255 258 if $self->{'verbosity'} > 1; 256 259 … … 262 265 263 266 if ($@) { 264 die "DSpacePlug : ERROR $filename is not a well formed dublin_core.xml file ($@)\n";267 die "DSpacePlugin: ERROR $filename is not a well formed dublin_core.xml file ($@)\n"; 265 268 } 266 269 … … 287 290 288 291 # Temporarily store associate file info in metadata table 289 # This will be removed in 'extra_metadata' in Bas Plugand used292 # This will be removed in 'extra_metadata' in BasePlugin and used 290 293 # to perform the actual file association (once the doc obj has 291 294 # been formed … … 313 316 314 317 315 # The DSpacePlug read() function. This function does all the right things 316 # to make general options work for a given plugin. It calls the process() 317 # function which does all the work specific to a plugin (like the old 318 # read functions used to do). Most plugins should define their own 319 # process() function and let this read() function keep control. 320 # 321 # DSpace overrides read() because there is no need to read the actual 322 # text of the file in, because the contents of the file is not text... 323 # 324 # Return number of files processed, undef if can't process 325 # Note that $base_dir might be "" and that $file might 326 # include directories 327 318 # The DSpacePlugin read() function. We are not actually reading any documents 319 # here, just blocking ones that have been processed by metadata read. 320 # 321 # Returns 0 for a file its blocking, undef for any other 328 322 sub read { 329 323 my $self = shift (@_); … … 340 334 return 0 if (defined $self->{'extra_blocks'}->{$filename}); 341 335 return undef; 342 }343 344 # do plugin specific processing of doc_obj345 sub process {346 my $self = shift (@_);347 my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj) = @_;348 my $outhandle = $self->{'outhandle'};349 350 return 1;351 336 } 352 337
Note:
See TracChangeset
for help on using the changeset viewer.