NAME

OME::Analysis::Handler - the superclass of all analysis handlers

Back to Top


SYNOPSIS

        use OME::Analysis::Handler;
        my $handler = OME::Analysis::Handler->new($mex);

Back to Top


OVERVIEW

Analysis handlers serve several purposed in the OME analysis engine. First, they provide a means of factoring common functionality out of several analysis modules. This is used chiefly for the language independence of the analysis engine -- which are written in the same external language will usually share an analysis handler.

Second, analysis handlers define the ``glue'' code between the analysis engine and the analysis modules. In the case of an external module, it is the handler which is responsible for loading and executing the external module. The handler also defines how data is passed between the OME database and the external module.

Back to Top


ANALYSIS HANDLER INTERFACE

Analysis handlers are simply Perl classes written to the interface defined by this class. Since Perl is not a strongly-typed language, analysis handler classes are not required to be direct subclasses of OME::Analysis::Handler. However, this class provides several helper methods which make it unlikely that it is ever worth the effort of writing an analysis handler from scratch.

Back to Top


METHODS

new

        my $handler = OME::Analysis::Handler->new($mex);

Creates a new instance of the analysis handler. Subclass constructors must call this as part of their construction code. The helper methods used to create new attributes for the module results will not work without the variables assigned by this method.

Session and Factory

        my $session = $handler->Session();
        my $factory = $handler->Factory();

Returns the OME database session associated with the handler, and the factory associated with that session, respectively. These are used internally to control access to the OME database.

getFormalInput and getFormalOutput

        my $input = $handler->getFormalInput($input_name);
        my $output = $handler->getFormalOutput($output_name);

These methods can be used to access the formal inputs and outputs of the module being executed. They are referred to by name.

getInputAttributes

        my $input_array = $handler->getInputAttributes($which,$criteria);

Returns the attributes passed in as actual inputs for the specified formal input. The method call used must match the granularity of the formal input specified, otherwise an error is raised. The actual inputs are returned as a list of Attribute objects of the attribute type corresponding to the formal input. The values of each attribute can be accessed (but not changed) via methods of the same name as the column in question.

newAttributes

        my $attribute = $handler->
            newAttributes([$semantic_type,$data]...);
        # or
        my $attribute = $handler->
            newAttributes([$formal_output_name,$data]...);
        # or
        my $attribute = $handler->
            newAttributes([$formal_output,$data]...);

Creates a set of new attributes as outputs of the current module. The formal output or attribute type and attribute data is specified for each attribute to be created. The data is specified by a hash mapping attribute column names to values. The target of the attributes must be specified in the data hashes.

Any attributes created via this method will automatically be returned to the analysis engine when the collectFeatureOutputs, collectImageOutputs, and collectDatasetOutputs methods are called. Subclasses need not reimplement this functionality.

If more than one attribute is specified in the call to newAttributes, then the attributes in question will be stored in a single row in each of the data tables. If two attributes refer to the same column in a data table, then the values in each attribute must be the same. If not, an error is raised and no attributes are created.

validateAndProcessExecutionInstructions


        # get $handler_class
        eval( 'use $handler_class' );
        die "Couldn't load handler '$handler_class' for module ".$module->name."\n$@"
                if $@;
        my $processed_execution_instructions = $handler_class->
                validateAndProcessExecutionInstructions( $module, $executionInstructionsXML );

Virtual function to be overriden by specific handler classes that use <ExecutionInstructions>. Should confess the error if one is found in $executionInstructionsXML (a DOM tree of the module's execution instructions).

Return undef if no changes were made to the execution instructions.

__check_output_location

        my ( $formal_output, $semantic_element ) = 
                $self->__check_output_location( $module, $output_location);

Utility function for validateAndProcessExecutionInstructions Verfiy that an output location actually exists. Will confess (die with a stacktrace), if an output location is invalid for a module (i.e. references something that doesn't exist).

Back to Top


AUTHOR

Douglas Creager (dcreager@alum.mit.edu)

Back to Top


SEE ALSO

OME::Analysis::Engine

Back to Top