Bio::Das::ProServer::Config - configuration parsing and hooks


$Revision: 687 $



Builds the ProServer configuration.


Configuration takes the following structure

  interface         = *    # interface to bind to ('*' for all)
  port              = 9000 # port to listen on
  ; response_* attributes for servers behind a reverse proxy:
  response_hostname =      # overriding hostname for responses
  response_port     =      # overriding port for responses
  response_protocol =      # overriding protocol (http/s) for responses
  response_baseuri  =      # overriding base-uri for responses
  maxclients        = 10
  pidfile           = 
  logfile           = 
  ensemblhome       =      # path to ensembl libs (for sharing across sources)
  oraclehome        =      # path to oracle libs  (for sharing across sources)
  bioperlhome       =      # path to bioperl libs (for sharing across sources)
  serverroot        =      # path to root directory (for stylesheets/coordinates)
  coordshome        =      # path to coordinate systems XML files
  styleshome        =      # path to stylesheet XML files
  http_proxy        =      # proxy for sources requiring web access
  maintainer        =      # email address
  strict_boundaries =      # whether to filter out-of-range segments
  logformat         = %i %t %r %s

  # then many of these with directives specific to each source
  adaptor        = adaptorpackage
  title          = Source Name
  description    = A description of The Source.
  stylesheetfile = /path/to/stylesheet.xml
  # e.g. for mysql:
  transport = dbi
  dbhost    = localhost
  dbport    = 3306
  dbuser    = proserverro
  dbpass    = password


new - Constructor

  my $oConfig = Bio::Das::ProServer::Config->new("/path/to/proserver.ini");

port - get accessor for configured port

  my $sPort = $oConfig->port();

maxclients - get/set accessor for configured maxclients

  my $sMaxClients = $oConfig->maxclients();

pidfile - get accessor for configured pidfile

  my $sPidFile = $oConfig->pidfile();

logfile - get accessor for configured logfile

  my $sLogFile = $oConfig->logfile();

logformat - get accessor for configured logformat

  my $sLogformat = $oConfig->logformat();

  Special variables:
  %i      Remote IP
  %h      Remote hostname
  %t      Local time (YYYY-MM-DDTHH:MM:SS)
  %r      Request URI
  %s      HTTP status code

host - get accessor for configured host

  my $sHost = $cfg->host();

  Examines 'interface' and 'hostname' settings in that order

response_hostname - get accessor for configured response_hostname

  Useful for setting the hostname in XML/HTML responses when behind a reverse-proxy.

  my $sResponse_Hostname = $cfg->response_hostname();

  Examines 'response_hostname', 'interface' and 'hostname' settings in that order

response_port - get accessor for configured response_port

  Useful for setting the port in XML/HTML responses when behind a reverse-proxy.

  my $sResponse_Port = $cfg->response_port();

  Examines 'response_port' and 'port' settings in that order

response_protocol - get accessor for configured response_protocol

  Useful for setting the protocol in XML/HTML responses when behind a reverse-proxy.

  my $sResponse_Protocol = $cfg->response_protocol();

response_baseuri - get accessor for configured response_baseuri

  Useful for setting the baseuri (i.e. preceeding /das) in XML/HTML responses when behind a reverse-proxy.

  my $sResponse_Baseuri = $cfg->response_baseuri();

server_url - helper method for constructing a fully-qualified URL for the server

  Useful for setting the full server URL in XML/HTML responses when behind a reverse-proxy.

  my $sServer_url = $cfg->server_url();

interface - get accessor configured interface

  my $sInterface = $cfg->interface();

adaptors - Build all known Bio::Das::ProServer::SourceAdaptors (including those Hydra-based)

  my @aAdaptors = $oConfig->adaptors();

  Note this can be an expensive call if lots of sources or large hydra sets are configured.

adaptor - Build a SourceAdaptor given a dsn (may be a hydra-based adaptor)

  my $oSourceAdaptor = $oConfig->adaptor($sWantedDSN);

knows - Is a requested dsn known about?

  my $bDSNIsKnown = $oConfig->knows($sWantedDSN);

das_version - Server-supported das version

  my $sVersion = $oConfig->das_version();

  By default 'DAS/1.53E';

server_version - Server release version

  my $sVersion = $oConfig->server_version();

  By default 'ProServer/2.7';

hydra_adaptor - Build a hydra-based SourceAdaptor given dsn and optional hydraname

  my $oAdaptor = $oConfig->hydra_adaptor($sWantedDSN, $sHydraName); # fast

  my $oAdaptor = $oConfig->hydra_adaptor($sWantedDSN); # slow, performs a full scan of any configured hydras

hydra - Build SourceHydra for a given dsn/hydraname

  my $oHydra = $oConfig->hydra($sHydraName);

log - log to STDERR with timestamp

  $oConfig->log('a message');






Roger Pettett <>.


Copyright (c) 2006 The Sanger Institute

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.