################################################################## 
## Class Name: DefaultInputControllerFactory                    ##
##                                                              ##
## Description: This is the default input controller factory    ##
##              class that is created by the AtomicProcessCont- ##
##              -ainer class if no specialised ICFM object is   ##
##              passed to it. This concrete input controller    ##
##              factory instantiates and returns a new default  ##
##              concrete intput controller class.               ##
##                                                              ##
## Arguments: None.                                             ##
##                                                              ##
##################################################################
package APE::InputControllerFactory::DefaultInputControllerFactory;

use base 'APE::InputControllerFactory';

$APE::InputControllerFactory::DefaultInputControllerFactory::VERSION = '0.1';

use strict;
use warnings;

use APE::InputControllerFactory::ConcreteInputController::DefaultInputController;

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) = @_;
	## Validate the instance arguments.
	%args = $self->SUPER::validateInstanceRequest(%args);
	my $processId = delete $args{parentProcessId};
	warn "*** '$self' returning the default InputController ".
            "for ppid '$processId'";
	## Return an instance of the default concrete input controller object.
	return new APE::InputControllerFactory::ConcreteInputController::DefaultInputController
	    (%args);
    }
}

1;
