source: gsdl/trunk/bin/script/export.pl@ 14935

Last change on this file since 14935 was 14935, checked in by davidb, 16 years ago

export.pl script updated to be more consistent with its import.pl counterpart, i.e. support for -incremental and -manifest; also modificed to use plugouts FedoraMETSPlugout and GreenstoneMETSPlugout, rather than this being controlled through a -version option for METSPlugout.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 19.8 KB
RevLine 
[8879]1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# export.pl --
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) 1999 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###########################################################################
27
28
29# This program will export a particular collection into a specific Format (e.g. METS or DSpace)
30# Author: Chi-Yu Huang Date: 08-10-2004
31
32package export;
33
34BEGIN {
35 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
36 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
37 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
38 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
39 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugins");
[12333]40 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugouts");
[8879]41 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/classify");
42}
43
[10340]44use strict;
45no strict 'refs'; # allow filehandles to be variables and vice versa
46no strict 'subs'; # allow barewords (eg STDERR) as function arguments
47
[10162]48use arcinfo;
[8879]49use colcfg;
50use plugin;
[12333]51use plugout;
[14935]52use manifest;
[8879]53use util;
[10417]54use scriptutil;
[8879]55use FileHandle;
[14935]56use gsprintf 'gsprintf';
[8879]57use printusage;
[10340]58use parse2;
[8879]59
[10340]60
[8879]61my $oidtype_list =
62 [ { 'name' => "hash",
[12691]63 'desc' => "{import.OIDtype.hash}" },
[14935]64 { 'name' => "assigned",
65 'desc' => "{import.OIDtype.assigned}" },
[8879]66 { 'name' => "incremental",
[12691]67 'desc' => "{import.OIDtype.incremental}" },
68 { 'name' => "dirname",
69 'desc' => "{import.OIDtype.dirname}" } ];
[8879]70
71#** define to use the METS format or DSpace format
72my $saveas_list =
73 [ { 'name' => "DSpace",
74 'desc' => "{export.saveas.DSpace}" },
[14935]75 { 'name' => "GreenstoneMETS",
76 'desc' => "{export.saveas.GreenstoneMETS}"},
77 { 'name' => "FedoraMETS",
78 'desc' => "{export.saveas.FedoraMETS}"},
[12333]79 { 'name' => "GA",
80 'desc' => "{export.saveas.GA}"},
81 { 'name' => "MARCXML",
82 'desc' => "{export.saveas.MARCXML}"}
83 ];
[8879]84
85
86# Possible attributes for each argument
87# name: The name of the argument
88# desc: A description (or more likely a reference to a description) for this argument
[12361]89# type: The type of control used to represent the argument. Options include: string, int, flag, regexp, metadata, language, enum etc
[8879]90# reqd: Is this argument required?
91# hiddengli: Is this argument hidden in GLI?
92# modegli: The lowest detail mode this argument is visible at in GLI
93
[14935]94my $saveas_argument =
[9233]95 { 'name' => "saveas",
96 'desc' => "{export.saveas}",
97 'type' => "enum",
98 'list' => $saveas_list,
99 'deft' => "METS",
100 'reqd' => "no",
101 'modegli' => "3" };
102
103
[8879]104my $arguments =
[10340]105 [
106 $saveas_argument,
107 { 'name' => "exportdir",
[8879]108 'desc' => "{export.exportdir}",
109 'type' => "string",
110 'reqd' => "no",
111 'hiddengli' => "yes" },
[10340]112 { 'name' => "importdir",
113 'desc' => "{import.importdir}",
114 'type' => "string",
115 'reqd' => "no",
116 'hiddengli' => "yes" },
[14925]117 { 'name' => "site",
118 'desc' => "{import.site}",
119 'type' => "string",
120 'deft' => "",
121 'reqd' => "no",
122 'hiddengli' => "yes" },
[8879]123 { 'name' => "collectdir",
124 'desc' => "{export.collectdir}",
125 'type' => "string",
[14925]126 # parsearg left "" as default
127 #'deft' => &util::filename_cat ($ENV{'GSDLHOME'}, "collect"),
[14935]128 'deft' => "",
129 'reqd' => "no",
130 'hiddengli' => "yes" },
131 { 'name' => "manifest",
132 'desc' => "{import.manifest}",
133 'type' => "string",
134 'deft' => "",
135 'reqd' => "no",
[8879]136 'hiddengli' => "yes" },
[9233]137 { 'name' => "listall",
[12691]138 'desc' => "{export.listall}",
[9233]139 'type' => "flag",
140 'reqd' => "no" },
[8879]141 { 'name' => "debug",
142 'desc' => "{export.debug}",
143 'type' => "flag",
144 'reqd' => "no",
145 'hiddengli' => "yes" },
146 { 'name' => "faillog",
147 'desc' => "{export.faillog}",
148 'type' => "string",
[10340]149 'deft' => "",
[8879]150 'reqd' => "no",
151 'modegli' => "4" },
[14935]152 { 'name' => "incremental",
153 'desc' => "{import.incremental}",
154 'type' => "flag",
155 'hiddengli' => "yes" },
[8879]156 { 'name' => "keepold",
157 'desc' => "{export.keepold}",
158 'type' => "flag",
159 'reqd' => "no",
[14935]160 'hiddengli' => "yes" },
[10340]161 { 'name' => "removeold",
162 'desc' => "{export.removeold}",
163 'type' => "flag",
164 'reqd' => "no",
165 'modegli' => "3" },
[8879]166 { 'name' => "language",
167 'desc' => "{scripts.language}",
168 'type' => "string",
169 'reqd' => "no",
170 'modegli' => "4" },
171 { 'name' => "maxdocs",
172 'desc' => "{export.maxdocs}",
173 'type' => "int",
174 'reqd' => "no",
175 'range' => "1,",
176 'modegli' => "1" },
[12691]177 { 'name' => "OIDtype",
178 'desc' => "{import.OIDtype}",
179 'type' => "enum",
180 'list' => $oidtype_list,
181 # parsearg left "" as default
182 #'deft' => "hash",
183 'reqd' => "no",
184 'modegli' => "3" },
185 { 'name' => "OIDmetadata",
186 'desc' => "{import.OIDmetadata}",
187 'type' => "metadata",
188 'deft' => "dc.Identifier",
189 'reqd' => "no",
190 'modegli' => "3" },
[8879]191 { 'name' => "out",
192 'desc' => "{export.out}",
193 'type' => "string",
194 'deft' => "STDERR",
195 'reqd' => "no",
196 'hiddengli' => "yes" },
[9951]197 { 'name' => "statsfile",
198 'desc' => "{export.statsfile}",
199 'type' => "string",
200 'deft' => "STDERR",
201 'reqd' => "no",
202 'hiddengli' => "yes" },
[12333]203 { 'name' => "xsltfile",
204 'desc' => "{BasPlugout.xslt_file}",
205 'type' => "string",
206 'reqd' => "no",
207 'hiddengli' => "yes" },
208 { 'name' => "xslt_txt",
209 'desc' => "{METSPlugout.xslt_txt}",
210 'type' => "string",
211 'reqd' => "no",
212 'hiddengli' => "no" },
213 { 'name' => "xslt_mets",
214 'desc' => "{METSPlugout.xslt_mets}",
215 'type' => "string",
216 'reqd' => "no",
217 'hiddengli' => "no" },
[14935]218 { 'name' => "fedora_namespace",
219 'desc' => "{FedoraMETSPlugout.fedora_namespace}",
220 'type' => "string",
221 'deft' => "greenstone",
222 'reqd' => "no",
223 'hiddengli' => "no" },
[12598]224 { 'name' => "mapping_file",
225 'desc' => "{MARCXMLPlugout.mapping_file}",
226 'type' => "string",
227 'reqd' => "no",
228 'hiddengli' => "no" },
[12333]229 { 'name' => "group_marc",
230 'desc' => "{MARCXMLPlugout.group}",
231 'type' => "flag",
232 'reqd' => "no",
233 'hiddengli' => "no" },
[8879]234 { 'name' => "verbosity",
235 'desc' => "{export.verbosity}",
236 'type' => "int",
237 'range' => "0,3",
238 'deft' => "2",
239 'reqd' => "no",
[10340]240 'modegli' => "4" },
241 { 'name' => "gli",
242 'desc' => "",
243 'type' => "flag",
244 'reqd' => "no",
245 'hiddengli' => "yes" },
246 { 'name' => "xml",
247 'desc' => "{scripts.xml}",
248 'type' => "flag",
249 'reqd' => "no",
250 'hiddengli' => "yes" }
251 ];
[8879]252
253my $options = { 'name' => "export.pl",
254 'desc' => "{export.desc}",
255 'args' => $arguments };
256
[9233]257my $listall_options = { 'name' => "export.pl",
258 'desc' => "{export.desc}",
259 'args' => [ $saveas_argument ] };
260
[14935]261#sub gsprintf
262#{
263# return &gsprintf::gsprintf(@_);
264#}
265
266
267sub store_collectionmeta
[8879]268{
[14935]269 my ($collectionmeta,$field,$doc_obj) = @_;
270
271 my $section = $doc_obj->get_top_section();
272
273 my $field_hash = $collectionmeta->{$field};
274
275 foreach my $k (keys %$field_hash)
276 {
277 my $val = $field_hash->{$k};
278
279
280### print STDERR "*** $k = $field_hash->{$k}\n";
281
282 my $md_label = "ex.$field";
283
284
285 if ($k =~ m/^\[l=(.*?)\]$/)
286 {
287
288 my $md_suffix = $1;
289 $md_label .= "^$md_suffix";
290 }
291
292
293 $doc_obj->add_utf8_metadata($section,$md_label, $val);
294
295 if (($md_label eq "ex.collectionname^en") || ($md_label eq "ex.collectionname"))
296 {
297 $doc_obj->add_utf8_metadata($section,"dc.Title", $val);
298 }
299
300 }
[8879]301}
302
303
304&main();
305
306sub main {
[10340]307 # params
[14935]308 my ($language, $verbosity, $debug,
309 $importdir, $manifest, $incremental, $keepold,
310 $exportdir, $site, $listall,
311 $removeold, $saveas,
312 $OIDtype, $OIDmetadata,
313 $out, $faillog, $collectdir, $gli,
314 $gs_mode, $collectcfg,
315 $maxdocs, $statsfile,
316 $mapping_file,
317 $xsltfile,
318 $xslt_mets, $xslt_txt, $fedora_namespace, $group_marc);
319
[8879]320 my $xml = 0;
[10340]321
322 # other vars
[14935]323 my ($configfilename, $collection,
324 $export_info_filename, $export_info,
325 $processor, $pluginfo);
326
[8879]327 my $service = "export";
328
[10340]329 my $hashParsingResult = {};
330 # general options available to all plugins
331 my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options");
[12545]332
333 # If parse returns -1 then something has gone wrong
334 if ($intArgLeftinAfterParsing == -1)
335 {
336 &PrintUsage::print_txt_usage($options, "{export.params}");
337 die "\n";
338 }
339
[10340]340 foreach my $strVariable (keys %$hashParsingResult)
341 {
342 eval "\$$strVariable = \$hashParsingResult->{\"\$strVariable\"}";
[8879]343 }
344
[10340]345
346 # these are options used by other things - we just set default values
347 # undef means will be set from config file if there
348 my $gzip = undef;
349 my $groupsize = 1;
[12691]350 #my $OIDtype = undef;
[10340]351 my $sortmeta = undef;
[9233]352
[9235]353 my $explicit_exportdir = (defined $exportdir) ? 1 : 0;
354
[10417]355 # save these command line settings. don't want config file settings in one
356 # coll used for other colls
357 # does this apply to other vars???
358 my $global_removeold = $removeold;
359 my $global_keepold = $keepold;
[8879]360 # If $language has been specified, load the appropriate resource bundle
361 # (Otherwise, the default resource bundle will be loaded automatically)
362 if ($language) {
363 &gsprintf::load_language_specific_resource_bundle($language);
364 }
365
[9233]366 if ($listall) {
367 if ($xml) {
368 &PrintUsage::print_xml_usage($listall_options);
369 }
370 else
371 {
372 &PrintUsage::print_txt_usage($listall_options,"{export.params}");
373 }
374 die "\n";
375 }
376 elsif ($xml) {
[8879]377 &PrintUsage::print_xml_usage($options);
378 die "\n";
379 }
380
[12545]381 # can have more than one collection name,
382 # if the first extra option is -h, then output the help
383 if (scalar(@ARGV) == 0 || (@ARGV && $ARGV[0] =~ /^\-+h/)) {
[10340]384 &PrintUsage::print_txt_usage($options, "{export.params}");
385 die "\n";
386 }
387
[8879]388 if ($gli) { # the gli wants strings to be in UTF-8
389 &gsprintf::output_strings_in_UTF8;
390 }
391 my $close_out = 0;
392 if ($out !~ /^(STDERR|STDOUT)$/i) {
393 open (OUT, ">$out") ||
394 (&gsprintf(STDERR, "{common.cannot_open_output_file}\n", $out) && die);
395 $out = 'export::OUT';
396 $close_out = 1;
397 }
398 $out->autoflush(1);
399
[9233]400 while (scalar(@ARGV)>0) {
401 my $collect_name = shift @ARGV;
402 $ENV{'GSDLCOLLECTION'} = $collect_name;
[8879]403
[9233]404 eval {
405 # get and check the collection name
[14925]406 if (($collection = &colcfg::use_collection($site, $collect_name, $collectdir)) eq "") {
[9233]407 &PrintUsage::print_txt_usage($options, "{export.params}");
408 die "\n";
409 }
[12358]410 # add collection's perllib dir into include path in
411 # case we have collection specific modules
412 unshift (@INC, "$ENV{'GSDLCOLLECTDIR'}/perllib");
413
[9233]414 if ($faillog eq "") {
415 $faillog = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "etc", "fail.log");
416 }
417 open (FAILLOG, ">$faillog") ||
418 (&gsprintf(STDERR, "{export.cannot_open_fail_log}\n", $faillog) && die);
419 my $faillogname = $faillog;
420 $faillog = 'export::FAILLOG';
421 $faillog->autoflush(1);
422
423 # check sortmeta
424 $sortmeta = undef unless defined $sortmeta && $sortmeta =~ /\S/;
425 if (defined $sortmeta && $groupsize > 1) {
426 &gsprintf($out, "{export.cannot_sort}\n\n");
427 $sortmeta = undef;
428 }
429
430 # get the list of plugins for this collection and set any options that
431 # were specified in the collect.cfg (all export.pl options except
432 # -collectdir, -out and -faillog may be specified in the collect.cfg (these
433 # options must be known before we read the collect.cfg))
434 my $plugins = [];
435 my @global_opts = ();
[14935]436
[14925]437 # Read in the collection configuration file.
438 ($configfilename, $gs_mode) = &colcfg::get_collect_cfg_name($out);
[14935]439
[14925]440 if ($gs_mode eq "gs2") {
441 $collectcfg = &colcfg::read_collect_cfg ($configfilename);
442 } elsif ($gs_mode eq "gs3") {
443 $collectcfg = &colcfg::read_collection_cfg_xml ($configfilename);
[10417]444 }
[14925]445
[14935]446 if (defined $collectcfg->{'importdir'} && $importdir eq "") {
447 $importdir = $collectcfg->{'importdir'};
448 }
449 if (defined $collectcfg->{'exportdir'} && $exportdir eq "") {
450 $exportdir = $collectcfg->{'exportdir'};
451 }
452
453 # fill in the default import and export directories if none
454 # were supplied, turn all \ into / and remove trailing /
455 $importdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq "";
456 $importdir =~ s/[\\\/]+/\//g;
457 $importdir =~ s/\/$//;
458 if (!-e $importdir) {
459 &gsprintf($out, "{import.no_import_dir}\n\n", $importdir);
460 die "\n";
461 }
462
463 $exportdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "export") if $exportdir eq "";
464 $exportdir =~ s/[\\\/]+/\//g;
465 $exportdir =~ s/\/$//;
466
[10417]467 if (defined $collectcfg->{'plugin'}) {
468 $plugins = $collectcfg->{'plugin'};
469 }
470
471 if ($verbosity !~ /\d+/) {
472 if (defined $collectcfg->{'verbosity'} && $collectcfg->{'verbosity'} =~ /\d+/) {
473 $verbosity = $collectcfg->{'verbosity'};
474 } else {
475 $verbosity = 2; # the default
[9233]476 }
[10417]477 }
478
479 if (defined $collectcfg->{'gzip'} && !$gzip) {
480 if ($collectcfg->{'gzip'} =~ /^true$/i) {
481 $gzip = 1;
[9233]482 }
[10417]483 }
484 if ($maxdocs !~ /\-?\d+/) {
485 if (defined $collectcfg->{'maxdocs'} && $collectcfg->{'maxdocs'} =~ /\-?\d+/) {
486 $maxdocs = $collectcfg->{'maxdocs'};
487 } else {
488 $maxdocs = -1; # the default
[9233]489 }
[10417]490 }
491 if ($groupsize == 1) {
492 if (defined $collectcfg->{'groupsize'} && $collectcfg->{'groupsize'} =~ /\d+/) {
493 $groupsize = $collectcfg->{'groupsize'};
[9233]494 }
[10417]495 }
[12691]496 if (!defined $OIDtype || ($OIDtype !~ /^(hash|incremental|assigned|dirname)$/)) {
[10417]497 if (defined $collectcfg->{'OIDtype'} && $collectcfg->{'OIDtype'} =~ /^(hash|incremental)$/) {
498 $OIDtype = $collectcfg->{'OIDtype'};
499 } else {
500 $OIDtype = "hash"; # the default
[9233]501 }
[8879]502 }
[10417]503 if (defined $collectcfg->{'sortmeta'} && $sortmeta eq "") {
504 $sortmeta = $collectcfg->{'sortmeta'};
505 }
506 if (defined $collectcfg->{'debug'} && $collectcfg->{'debug'} =~ /^true$/i) {
507 $debug = 1;
508 }
509 if (defined $collectcfg->{'gli'} && $collectcfg->{'gli'} =~ /^true$/i) {
510 $gli = 1;
511 }
[9233]512
[10417]513 # global plugin stuff
514 if (defined $collectcfg->{'separate_cjk'}&& $collectcfg->{'separate_cjk'} =~ /^true$/i) {
515 push @global_opts, "-separate_cjk";
516 }
517
[12965]518 ($removeold, $keepold) = &scriptutil::check_removeold_and_keepold($global_removeold, $global_keepold, 0, "export", $collectcfg);
[10417]519
[9233]520 $gli = 0 unless defined $gli;
521
522 print STDERR "<export>\n" if $gli;
523
524 # fill in the default import and export directories if none
525 # were supplied, turn all \ into / and remove trailing /
526 $importdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq "";
527 $importdir =~ s/[\\\/]+/\//g;
528 $importdir =~ s/\/$//;
529 $exportdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "export") if $exportdir eq "";
530 $exportdir =~ s/[\\\/]+/\//g;
531 $exportdir =~ s/\/$//;
532
533 # load all the plugins
534 $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillog, \@global_opts);
535
536 if (scalar(@$pluginfo) == 0) {
537 &gsprintf($out, "{import.no_plugins_loaded}\n");
538 die "\n";
[8879]539 }
[9233]540
541 # remove the old contents of the export directory if needed
542 if ($removeold && -e $exportdir) {
543 &gsprintf($out, "{export.removing_export}\n");
544 &util::rm_r ($exportdir);
[8879]545 }
[9233]546
547 # read the export information file
[13169]548
549 # Export to DSpace Archive format or METs format
550 # If saveas=DSpace, a "contents" file will be created, otherwise "export.inf"
[9233]551
[13169]552 # the plugouts should be doing this!!
553 if ($saveas eq "DSpace"){
554 $export_info_filename = &util::filename_cat ($exportdir, "contents");
[14935]555 } elsif ($saveas =~ m/^.*METS$/ || $saveas eq "GA" || $saveas eq "MARC" ) {
[13169]556 $export_info_filename = &util::filename_cat ($exportdir, "export.inf");
557 }
558
559 $export_info = new arcinfo();
560 $export_info -> load_info ($export_info_filename);
561
[14733]562 my ($plugout);
563 if (defined $collectcfg->{'plugout'}) {
564 $plugout = $collectcfg->{'plugout'};
565 }
566 else{
[14935]567 if ($saveas !~ /^(GA|.*METS|DSpace|MARCXML)$/) {
[14733]568 push @$plugout,"GAPlugout";
[9233]569 }
[14733]570 else{
571 push @$plugout,$saveas."Plugout";
572 }
[8879]573 }
[14733]574
575 my $plugout_name = $plugout->[0];
[9233]576
[14733]577 push @$plugout,("-output_info",$export_info) if (defined $export_info);
578 push @$plugout,("-verbosity",$verbosity) if (defined $verbosity);
579 push @$plugout,("-debug") if ($debug);
580 push @$plugout,("-gzip_output",$gzip) if (defined $gzip);
581 push @$plugout,("-group_size",$groupsize) if (defined $groupsize);
582 push @$plugout,("-output_handle",$out) if (defined $out);
583 push @$plugout,("-xslt_file",$xsltfile) if (defined $xsltfile);
[14935]584 push @$plugout,("-group") if ($group_marc && $plugout_name =~ m/^MARCXMLPlugout$/);
585 push @$plugout,("-mapping_file",$mapping_file) if (defined $mapping_file && $plugout_name =~ m/^MARCXMLPlugout$/);
586 push @$plugout,("-xslt_mets",$xslt_mets) if (defined $xslt_mets && $plugout_name =~ m/^.*METSPlugout$/);
587 push @$plugout,("-xslt_txt",$xslt_txt) if (defined $xslt_txt && $plugout_name =~ m/^.*METSPlugout$/);
588 push @$plugout,("-fedora_namespace",$fedora_namespace) if (defined $fedora_namespace && $plugout_name eq "FedoraMETSPlugout");
589
[14733]590 $processor = &plugout::load_plugout($plugout);
[13169]591
592 $processor->setoutputdir ($exportdir);
593
594 $processor->set_sortmeta ($sortmeta) if defined $sortmeta;
595 $processor->set_OIDtype ($OIDtype, $OIDmetadata);
596
[9233]597 &plugin::begin($pluginfo, $importdir, $processor, $maxdocs);
598
599 # process the import directory
[9854]600 &plugin::read ($pluginfo, $importdir, "", {}, $processor, $maxdocs,0, $gli);
[14935]601
602 if ($saveas eq "FedoraMETS")
603 {
604 # create collection "doc obj" for Fedora that contains
605 # collection-level metadata
606
607 my $doc_obj = new doc($configfilename,"nonindexed_doc");
608 $doc_obj->set_OID("collection");
609
610 my $col_name = undef;
611 my $col_meta = $collectcfg->{'collectionmeta'};
612 if (defined $col_meta)
613 {
614 store_collectionmeta($col_meta,"collectionname",$doc_obj);
615 store_collectionmeta($col_meta,"collectioextra",$doc_obj);
616
617 }
618
619 $processor->process($doc_obj);
620 }
[9233]621
622 &plugin::end($pluginfo, $processor);
[10162]623
624 &plugin::deinit($pluginfo, $processor);
[9233]625
626 # write out the export information file
[13169]627 $processor->close_file_output() if $groupsize > 1;
628 $processor->close_group_output() if $processor->is_group();
[14935]629 if ($saveas =~ m/^.*METS$/) {
[13169]630 $export_info->save_info($export_info_filename);
[8879]631 }
[9233]632
[9951]633 # write out export stats
634 my $close_stats = 0;
635 if ($statsfile !~ /^(STDERR|STDOUT)$/i) {
636 if (open (STATS, ">$statsfile")) {
637 $statsfile = 'import::STATS';
638 $close_stats = 1;
639 } else {
640 &gsprintf($out, "{import.cannot_open_stats_file}", $statsfile);
641 &gsprintf($out, "{import.stats_backup}\n");
642 $statsfile = 'STDERR';
643 }
644 }
645
646 &gsprintf($out, "\n");
647 &gsprintf($out, "*********************************************\n");
648
649 &plugin::write_stats($pluginfo, $statsfile, $faillogname, $gli);
650 if ($close_stats) {
651 close STATS;
652 }
653
654 &gsprintf($out, "*********************************************\n");
655
656 close OUT if $close_out;
657
[9233]658 close FAILLOG;
659 };
[8879]660
[9951]661 if ($@) {
662 print STDERR $@;
663 }
664
[9233]665## $ENV{'GSDLCOLLECTION'} = undef;
666 $importdir = "";
[9235]667 $removeold = 0 if ($explicit_exportdir);
[9233]668
[10340]669 } # while processing ARGV
[9233]670
[8879]671 &gsprintf($out, "\n");
672 &gsprintf($out, "*********************************************\n");
[9951]673 &gsprintf($out, "* {export.complete}\n");
674 &gsprintf($out, "*********************************************\n");
[8879]675
676}
Note: See TracBrowser for help on using the repository browser.