Bio-KBase

 view release on metacpan or  search on metacpan

lib/Bio/KBase/InvocationService/Service.pm  view on Meta::CPAN

package Bio::KBase::InvocationService::Service;

use Data::Dumper;
use Moose;

extends 'RPC::Any::Server::JSONRPC::PSGI';

has 'instance_dispatch' => (is => 'ro', isa => 'HashRef');
has 'user_auth' => (is => 'ro', isa => 'UserAuth');
has 'valid_methods' => (is => 'ro', isa => 'HashRef', lazy => 1,
			builder => '_build_valid_methods');

our $CallContext;

our %return_counts = (
        'start_session' => 1,
        'valid_session' => 1,
        'list_files' => 2,
        'remove_files' => 0,
        'rename_file' => 0,
        'copy' => 0,
        'make_directory' => 0,
        'remove_directory' => 0,
        'change_directory' => 0,
        'put_file' => 0,
        'get_file' => 1,
        'run_pipeline' => 2,
        'exit_session' => 0,
        'valid_commands' => 1,
        'get_tutorial_text' => 3,
);

sub _build_valid_methods
{
    my($self) = @_;
    my $methods = {
        'start_session' => 1,
        'valid_session' => 1,
        'list_files' => 1,
        'remove_files' => 1,
        'rename_file' => 1,
        'copy' => 1,
        'make_directory' => 1,
        'remove_directory' => 1,
        'change_directory' => 1,
        'put_file' => 1,
        'get_file' => 1,
        'run_pipeline' => 1,
        'exit_session' => 1,
        'valid_commands' => 1,
        'get_tutorial_text' => 1,
    };
    return $methods;
}

sub call_method {
    my ($self, $data, $method_info) = @_;
    my ($module, $method) = @$method_info{qw(module method)};
    
    my $ctx = Bio::KBase::InvocationService::ServiceContext->new(client_ip => $self->_plack_req->address);
    
    my $args = $data->{arguments};

        # Service InvocationService does not require authentication.
        
    my $new_isa = $self->get_package_isa($module);
    no strict 'refs';
    local @{"${module}::ISA"} = @$new_isa;
    local $CallContext = $ctx;
    my @result;



( run in 1.988 second using v1.01-cache-2.11-cpan-437f7b0c052 )