The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MOSES::MOBY::ServiceBase - a super-class for all BioMoby services

SYNOPSIS

 use base qw( MOSES::MOBY::ServiceBase )
 

DESCRIPTION

SUBROUTINES

prepare_output

Return a package (MOSES::MOBY::Package) that has the same number of jobs, with the same ids, as the given input (again an MOSES::MOBY::Package). Otherwise the returned package is empty.

Usually, there is no need to override this method. It is called by a service skeleton, once an input XML is parsed and before a service implementation class is called to process it.

An input argument (type MOSES::MOBY::Package contains all data coming from a client.

It throws an exception if input data package is corrupted.

process_all

A high-level processing, dealing with all jobs in the same time. It takes a full input package and for each its individual job it calls a subroutine process_it.

Override this method if you need access to all jobs in the same time. Otherwise (a usual case) override the process_it that deals with a job in time (a processessig on the job level).

There are two (positional) arguments (both of type MOSES::MOBY::Package):

The first one contains all data coming from a client (a requset), the second is an (almost) empty package that has to be filled, and that later will go back to the same client (a response). So far, the output package has already the ame number of jobs as the input package, and the jobs have already the same IDs.

It does not throw any exception on its own but it calls one or more times (depending on the number of jobs in the input package) the process_it and that baby can throw an exception.

process_it

A job-level processing: This is the main method to be overriden by a service provider!. Here all the business logic belongs to.

This method is called once for each job in a client request. A job is a BioMoby query (in a client request), or a result of one query (in a service response). There can be more queries (jobs) in one network request to a BioMoby service. If a network request contains more jobs, also the corresponding service response must contain the same number of jobs.

Note that here, in MOSES::MOBY::Service::ServiceBase, this method does nothing. Which means it leaves the output job empty, as it was given here (having only its job's ID filled in). Consequence is that if you do not override this method in a sub-class, the client will get back the same number of jobs as her request had, but they will be empty. Which may be good just for testing but not really what a client expects (I guess).

There are three mandatory arguments:

request

An argument of type MOSES::MOBY::Job contain data coming from one client's job

response

An argument of type MOSES::MOBY::Job is an empty job (except its ID that is already filled in - because it must correspond with the same ID in the 'input-job'). The task of this method is to fill it with a response.

context

An argument of type MOSES::MOBY::Package is a package that will be, at the end, delivered to the client; it is here not to be filled - that is taken care of by some other methods - but you may use it to see how other (previous) jobs have been made, and also to add things to the package envelope (e.g. service notes).

    You are free to throw an exception (TBD: example here). However, if you do so the complete processing of the whole client request is considered failed. After such exception the client will not get any data back (only an error message).

    If you wish just to indicate that only this particular job failed you have to add an exception to the context parameter. (TBD: example here) - and do not throw any exception.

finish_output

Finalize (and return) an already filled package (MOSES::MOBY::Package) in order to be sent as a web service response. The implementation depends on the underlying message protocol (such as SOAP). Having it separated here shields the service providers - but you can still override this method and do something fancy instead. Just remember: whatever this method returns it will be sent back to the client.

An input argument type MOBY:;package) contains a response.

as_uni_string

Convert given $value (the only argument) into Unicode and wrap it as a BioMoby string (type MOSES::MOBY::Data::String).

create_parser

 # create_parser:
 #    my $parser = $self->create_parser
 #      ( lowestKnownDataTypes => { language => 'Regex' },
 #        loadDataTypes        => [ qw( Regex simple_key_value_pair ) ] );

log_request

 # should be called when a request from a client comes; it returns
 # information about the current call (request) that can be used in a
 # log entry

AUTHORS, COPYRIGHT, DISCLAIMER

 Martin Senger (martin.senger [at] gmail [dot] com)
 Edward Kawas (edward.kawas [at] gmail [dot] com)

Copyright (c) 2006 Martin Senger, Edward Kawas. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This software is provided "as is" without warranty of any kind.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 234:

You forgot a '=back' before '=head2'

You forgot a '=back' before '=head2'