Changeset 27299

Show
Ignore:
Timestamp:
06.05.2013 14:59:03 (6 years ago)
Author:
jmt12
Message:

Extending manifest parsing with the idea of a manifest having a version number as an attribute on the <Manifest> element. Mainfest version 2 is expected to be followed verbatim - i.e. disable global file scan and metadata search

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/manifest.pm

    r23485 r27299  
    2525########################################################################### 
    2626 
    27  
    2827package manifest; 
    2928 
     
    4140 
    4241    $self = {} ; 
    43  
     42    # we can now mark a manifest with a version number 
     43    $self->{'version'} = 1; 
    4444    $self->{'index'} = {}; 
    4545    $self->{'reindex'} = {}; 
     
    6464    return bless $self, $class; 
    6565} 
     66 
     67# /** @function get_version() 
     68#  */ 
     69sub get_version 
     70{ 
     71  my $self = shift(@_); 
     72  return $self->{'version'}; 
     73} 
     74# /** get_version() **/ 
    6675 
    6776sub parse 
     
    134143    my $self = shift(@_); 
    135144    my ($expat, $element) = @_; 
     145    my $attributes = \%_; 
    136146 
    137147    if (($element eq "Filename") || ($element eq "OID")) 
     
    139149    $self->{'item-val'} = ""; 
    140150    } 
    141     elsif ($element eq "Manifest") { 
     151    elsif ($element eq "Manifest") 
     152    { 
     153      if (defined $attributes->{'version'}) 
     154      { 
     155        $self->{'version'} = $attributes->{'version'}; 
     156      } 
    142157    } 
    143158    else 
     
    148163        print STDERR "         Unrecognized element $element nested inside " . $self->{'file-type'} . ".\n"; 
    149164    } 
    150     else { 
     165    else 
     166        { 
    151167        my $filetype = lc($element); 
    152168        $self->{'file-type'} = $filetype; 
    153         if (!defined $self->{$filetype}) { 
     169        if (!defined $self->{$filetype}) 
     170            { 
    154171        print STDERR "Warning: <$element> is not one of the registered tags for manifest format.\n"; 
    155172        }