###############################################################################
#
# parallelmgppbuilder.pm -- extends the MGBuilder object to support parallel
# building by generating a 'recipe' for indexing
#
# A component of the Greenstone digital library software from the New Zealand
# Digital Library Project at the University of Waikato, New Zealand.
#
# Copyright (C) 2013 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.
#
###############################################################################

# @author Unknown, Waikato DL Research group
# @author John Thompson [jmt12], Waikato DL Research group

package parallelmgppbuilder;

use mgppbuilder;
use parallelmgbuilder;
use strict;

sub BEGIN
{
  @parallelmgppbuilder::ISA = ('mgppbuilder', 'parallelmgbuilder');
}

# /** @function new()
#  */
sub new
{
  my $class = shift(@_);
  my $self = new mgppbuilder(@_);
  return bless($self, $class);
}
# /** new() **/

# /** @function prepareIndexRecipe()
#  * The three main 'modes' in MGPP builds are completely independent
#  * @param $self
#  * @param $collection
#  * @param $recipe a reference to an array of recipe 'steps'
#  * @author jmt12
#  */
sub prepareIndexRecipe
{
  my ($self, $collection, $recipe) = @_;
  my $outhandle = $self->{'outhandle'};
  my $verbosity = $self->{'verbosity'};
  # 1. Compressing the text
  push(@{$recipe}, {'command'=>'buildcol.pl -keepold -verbosity ' . $verbosity . ' -mode compress_text ' . $collection});
  # 2. Build the indexes
  push(@{$recipe}, {'command'=>'buildcol.pl -keepold -verbosity ' . $verbosity . ' -mode build_index ' . $collection});
  # 3. Info database building
  push(@{$recipe}, {'command'=>'buildcol.pl -keepold -verbosity ' . $verbosity . ' -mode infodb ' . $collection});
  # Complete!
}
# /** prepareIndexRecipe() **/

1;


