package APE::OutputControllerFactory::ExoApeOutputControllerFactory;

use base 'APE::OutputControllerFactory';

$APE::OutputControllerFactory::ExoApeOutputControllerFactory::VERSION = '0.1';

use strict;
use warnings;

use APE::OutputControllerFactory::ConcreteOutputController::DefaultExoApeOutputController;

use constant TRUE  => 1;
use constant FALSE => 0;

{
    my %_attributes = ();


    my %object; 
    

    foreach my $attName (keys(%_attributes)) {
	no strict 'refs';
	*{__PACKAGE__ . "::get\u$attName"} = sub { $object{ $_[0] }->{$attName} }
    }


    #################################################################
    ## Initialise the objects private attributes. The argument is
    ## deleted as it is found, initialised and set.
    #################################################################
    sub _init {	
	my ($self,%args) = @_;
	foreach my $attName (keys(%args)) {
	    if(exists($_attributes{$attName})) { 
		$object{ $self }->{$attName} = delete $args{$attName};
	    }
	}   
	return $self->SUPER::_init(%args);
    }

    

    #################################################################
    ## Implemented abstract method from base class. This method creates
    ## a description object depending on the process id and returns it.
    #################################################################
    sub getInstance {
	my ($self,%args) = @_;
	%args = $self->SUPER::validateInstanceRequest(%args);
	my $processId = delete $args{processId};
	warn "*** '$self' returning the default ExoApeOutputController for ppid '$processId'";
	## Return the default OutputController object.
	return new APE::OutputControllerFactory::ConcreteOutputController::DefaultExoApeOutputController
	    (%args);
    }
}

1;
