BioMart::Configuration Location
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
BioMart::Configuration::Location
Package variables
No package variables defined.
Inherit
BioMart::Root
Synopsis
Base Class for all BioMart location objects.
Description
Base Class for BioMart location objects defined within the registry XML
configguration
Methods
_buffer
No description
Code
_newDescriptionCode
addDatasetDescriptionCode
configureMessage
No description
Code
databaseDescriptionCode
databaseTypeDescriptionCode
datasetNumberDescriptionCode
defaultDescriptionCode
displayNameDescriptionCode
dsnDescriptionCode
getAllDatasetsDescriptionCode
getAllVisibleDatasetDisplayNamesDescriptionCode
getAllVisibleDatasetNamesDescriptionCode
getDatasetByNameDescriptionCode
hostDescriptionCode
includeDatasetsDescriptionCode
martUserDescriptionCode
nameDescriptionCode
passwordDescriptionCode
pathDescriptionCode
portDescriptionCode
proxyDescriptionCode
removeDatasetDescriptionCode
retrieveDatasetInfoDescriptionCode
schemaDescriptionCode
serverVirtualSchemaDescriptionCode
userDescriptionCode
visibleDescriptionCode
Methods description
_newcode    nextTop
  Usage      : my $location_obj = 
BioMart::Configuration::Location_implementation->new();
Description: create a new Location object
Returntype : BioMart::Configuration::Location
Exceptions : none
Caller : general
addDatasetcodeprevnextTop
  Usage      : usage
Description: Description
Returntype :
Exceptions : none
Caller : caller
databasecodeprevnextTop
  Usage      : my $database = $location->database; 
$location->database($newName);
Description: get/set for the database of the location
Returntype : scalar $database
Exceptions : none
Caller : caller
databaseTypecodeprevnextTop
  Usage      : my $databaseType = $location->databaseType; 
$location->name($databaseType);
Description: get/set for the databaseType of the location
Returntype : scalar $databaseType
Exceptions : none
Caller : caller
datasetNumbercodeprevnextTop
  Usage      : my $dsNo = $location->datasetNumber; $location->dsn($newNumber);
Description: get/set for the datasetNumber of the location
Returntype : scalar $datasetNumber
Exceptions : none
Caller : caller
defaultcodeprevnextTop
  Usage      : my $default = $location->default; $location->default($newName);
Description: get/set for the default of the location
Returntype : scalar $default
Exceptions : none
Caller : caller
displayNamecodeprevnextTop
  Usage      : my $displayName = $location->displayName; 
$location->displayName($newName);
Description: get/set for the displayName of the location
Returntype : scalar $displayName
Exceptions : none
Caller : caller
dsncodeprevnextTop
  Usage      : my $dsn = $location->dsn; $location->dsn($newName);
Description: get/set for the dsn of the location
Returntype : scalar $dsn
Exceptions : none
Caller : caller
getAllDatasetscodeprevnextTop
  Usage      : usage
Description: Description
Returntype :
Exceptions : none
Caller : caller
getAllVisibleDatasetDisplayNamescodeprevnextTop
  Usage      : usage
Description: Description
Returntype :
Exceptions : none
Caller : caller
getAllVisibleDatasetNamescodeprevnextTop
  Usage      : usage
Description: Description
Returntype :
Exceptions : none
Caller : caller
getDatasetByNamecodeprevnextTop
  Usage      : usage
Description: Description
Returntype :
Exceptions : none
Caller : caller
hostcodeprevnextTop
  Usage      : my $host = $location->host; $location->host($newName);
Description: get/set for the host of the location
Returntype : scalar $host
Exceptions : none
Caller : caller
includeDatasetscodeprevnextTop
  Usage      : my $includeDatasets = $location->includeDatasets; 
$location->includeDatasets($newName);
Description: get/set for the includeDatasets of the location
Returntype : scalar $includeDatasets
Exceptions : none
Caller : caller
martUsercodeprevnextTop
  Usage      : my $martUser = $location->martUser; 
$location->martUser($newName);
Description: get/set for the martUser of the location
Returntype : scalar $martUser
Exceptions : none
Caller : caller
namecodeprevnextTop
  Usage      : my $name = $location->name; $location->name($newName);
Description: get/set for the name of the location
Returntype : scalar $name
Exceptions : none
Caller : caller
passwordcodeprevnextTop
  Usage      : my $password = $location->password; 
$location->password($newName);
Description: get/set for the password of the location
Returntype : scalar $password
Exceptions : none
Caller : caller
pathcodeprevnextTop
  Usage      : my $path = $location->path; $location->path($newName);
Description: get/set for the path of the location
Returntype : scalar $path
Exceptions : none
Caller : caller
portcodeprevnextTop
  Usage      : my $port = $location->port; $location->port($newName);
Description: get/set for the port of the location
Returntype : scalar $port
Exceptions : none
Caller : caller
proxycodeprevnextTop
  Usage      : my $proxy = $location->proxy; $location->proxy($newName);
Description: get/set for the proxy of the location
Returntype : scalar $proxy
Exceptions : none
Caller : caller
removeDatasetcodeprevnextTop
  Usage      : usage
Description: Description
Returntype :
Exceptions : none
Caller : caller
retrieveDatasetInfocodeprevnextTop
  Usage      : my $datasets_info = $location->retrieveDatasets;
Description: Retrieves the dataset informations for a Location object.
Returntype : SQL string
Exceptions : none
Caller : caller
schemacodeprevnextTop
  Usage      : my $schema = $location->schema; $location->schema($newName);
Description: get/set for the schema of the location
Returntype : scalar $schema
Exceptions : none
Caller : caller
serverVirtualSchemacodeprevnextTop
  Usage      : my $serverVirtualSchema = $location->serverVirtualSchema; 
$location->serverVirtualSchema($newName);
Description: get/set for the serverVirtualSchema of the location
Returntype : scalar $serverVirtualSchema
Exceptions : none
Caller : caller
usercodeprevnextTop
  Usage      : my $user = $location->user; $location->user($newName);
Description: get/set for the user of the location
Returntype : scalar $user
Exceptions : none
Caller : caller
visiblecodeprevnextTop
  Usage      :  my $visible = $filt->visible; $location->visible($visible);
Description: get/set the visible flag associated with this location
Returntype : scalar $visible
Exceptions : none
Caller : caller
Methods code
_bufferdescriptionprevnextTop
sub _buffer {
    my ($self,$param,$field)=@_;

    my $buffer=" ";
    if ($param>length($field)){
	for (my $i=0;$i<$param-length($field);$i++){
	    $buffer=$buffer.".";
	}
    } else {
	$buffer =" ... ";
    }
    
    $buffer=$buffer." ";
    return $buffer;
}




1;
}
_newdescriptionprevnextTop
sub _new {
  my ($self, @param) = @_;
  $self->SUPER::_new(@param);
  $self->addParams(TITLES, @param);
  $self->attr('dsn', undef);
  $self->attr('datasets', { });
  $self->attr('datasetNumber', undef);
  $self->attr('visibleDatasetNames', []);
  $self->attr('visibleDatasetDisplayNames', []);
}
addDatasetdescriptionprevnextTop
sub addDataset {
  my ($self, $dataset) = @_;

  my $dataSetName = $dataset->name();
  my $dataSetHash = $self->get('datasets');

  my $dataSetEntry = $dataSetHash->{$dataSetName};
  if (defined $dataSetEntry) {
      BioMart::Exception::Configuration->throw("Can not add dataset '$dataSetName', already added");
  }
  $dataSetHash->{$dataSetName} = $dataset;
  
  if ($dataset->visible == 1){
      my $datasetNames = $self->get('visibleDatasetNames');
      my $datasetDisplayNames = $self->get('visibleDatasetDisplayNames');
      push @$datasetNames,$dataSetName;
      push @$datasetDisplayNames, $dataset->displayName();
      $self->set('visibleDatasetNames', $datasetNames);
      $self->set('visibleDatasetDisplayNames', $datasetDisplayNames);
  }
  $self->set('datasets', $dataSetHash);
}
configureMessagedescriptionprevnextTop
sub configureMessage {
    my ($self,$virtualSchema,$dataSetName,$type,$dsCounter)=@_;

    my $counter;
    if (defined $dsCounter){
    my $datasets=$self->datasetNumber;
    if (length ($dsCounter)==1){$dsCounter="00".$dsCounter;}
    if (length ($dsCounter)==2){$dsCounter="0".$dsCounter;}
    if (length ($datasets)==1){$datasets="00".$datasets;}
    if (length ($datasets)==2){$datasets="0".$datasets;}

	$counter=  $dsCounter."/".$datasets;
    } else
    {
	$counter="";
    }
   
    my $displayName;
    if (defined $self->displayName){
	$displayName=$self->displayName;
    } else {
	$displayName="";
    }

    my $param0=10;
    my $param1=50;
    my $param2=25;
    my $param3=30;
    my $param4=10;    

    my $buffer0 = $self->_buffer($param0,$counter);
    my $buffer1 = $self->_buffer($param1,$virtualSchema." ".$dataSetName);
    
    
    my	$buffer2 = $self->_buffer($param2,$displayName);

    my $buffer3 = $self->_buffer($param3,$self->host.":".$self->port);
    my $buffer4 = $self->_buffer($param4,$virtualSchema);
    
    print STDERR $virtualSchema.$buffer4.$displayName.$buffer2.$counter.$buffer0.$dataSetName.
	$buffer1."(".$type.") ".$self->host.":".$self->port.$buffer3;
}
databasedescriptionprevnextTop
sub database {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(DATABASE, $value);
  }
  return $self->getParam(DATABASE);
}
databaseTypedescriptionprevnextTop
sub databaseType {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(DATABASETYPE, $value);
  }
  return $self->getParam(DATABASETYPE);
}
datasetNumberdescriptionprevnextTop
sub datasetNumber {
  my ($self, $value) = @_;
  if ($value){
      $self->set('datasetNumber', $value);
  }
  return $self->get('datasetNumber');
}
defaultdescriptionprevnextTop
sub default {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(DEFAULT, $value);
  }
  return $self->getParam(DEFAULT);
}
displayNamedescriptionprevnextTop
sub displayName {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(DISPLAYNAME, $value);
  }
  return $self->getParam(DISPLAYNAME);
}
dsndescriptionprevnextTop
sub dsn {
  my ($self, $value) = @_;
  if ($value){
      $self->set('dsn', $value);
  }
  return $self->get('dsn');
}
getAllDatasetsdescriptionprevnextTop
sub getAllDatasets {
  my ($self, $visible ) = @_;

  my $datasetHash =  $self->get('datasets');
  my @datasets = values %{$datasetHash};
	if(!$visible)
	{
		return\@ datasets;
	}
	
	my $visibleDS;
	if ($visible == 1)
	{
		foreach my $vDS (@datasets)
		{
			if ($vDS->visible == 1)
			{
				push @{$visibleDS}, $vDS;
			}			
		}
		return $visibleDS;
	}
  #return $self->get('datasets');
}
getAllVisibleDatasetDisplayNamesdescriptionprevnextTop
sub getAllVisibleDatasetDisplayNames {
  my $self = shift;
  return $self->get('visibleDatasetDisplayNames');
}
getAllVisibleDatasetNamesdescriptionprevnextTop
sub getAllVisibleDatasetNames {
  my $self = shift;
  return $self->get('visibleDatasetNames');
}
getDatasetByNamedescriptionprevnextTop
sub getDatasetByName {
    my ($self,$dataSetName) = @_;
    my $dataSetHash = $self->get('datasets');
    my $dataSetEntry = $dataSetHash->{$dataSetName};
    return $dataSetEntry;
}
hostdescriptionprevnextTop
sub host {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(HOST, $value);
  }
  return $self->getParam(HOST);
}
includeDatasetsdescriptionprevnextTop
sub includeDatasets {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(INCLUDEDATASETS, $value);
  }
  return $self->getParam(INCLUDEDATASETS);
}
martUserdescriptionprevnextTop
sub martUser {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(MARTUSER, $value);
  }
  return $self->getParam(MARTUSER);
}
namedescriptionprevnextTop
sub name {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(NAME, $value);
  }
  return $self->getParam(NAME);
}
passworddescriptionprevnextTop
sub password {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(PASSWORD, $value);
  }
  return $self->getParam(PASSWORD);
}
pathdescriptionprevnextTop
sub path {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(PATH, $value);
  }
  return $self->getParam(PATH);
}
portdescriptionprevnextTop
sub port {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(PORT, $value);
  }
  return $self->getParam(PORT);
}
proxydescriptionprevnextTop
sub proxy {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(PROXY, $value);
  }
  return $self->getParam(PROXY);
}
removeDatasetdescriptionprevnextTop
sub removeDataset {
  my ($self,$dataset) = @_;
  my $datasets = $self->getAllDatasets;
  my $i = 0;
  foreach my $dset (@$datasets){
      if ($dset->name eq $dataset->name){
	  splice @$datasets,$i,1;
	  last;
      }
      $i++;
  }
}
retrieveDatasetInfodescriptionprevnextTop
sub retrieveDatasetInfo {
  my ($self,@param) = @_;

  if ($self->can("_retrieveDatasetInfo")) {
    return $self->_retrieveDatasetInfo(@param);
  }
  $self->unimplemented_method;
}
schemadescriptionprevnextTop
sub schema {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(SCHEMA, $value);
  }
  return $self->getParam(SCHEMA);
}
serverVirtualSchemadescriptionprevnextTop
sub serverVirtualSchema {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(SERVERVIRTUALSCHEMA, $value);
  }
  return $self->getParam(SERVERVIRTUALSCHEMA);
}
userdescriptionprevnextTop
sub user {
  my ($self, $value) = @_;
  if ($value){
      $self->setParam(USER, $value);
  }
  return $self->getParam(USER);
}
visibledescriptionprevnextTop
sub visible {
  my ($self,$visible) = @_;

  if ($visible) {
    $self->setParam(VISIBLE,$visible);
  }
  return $self->getParam(VISIBLE);
}
General documentation
AUTHOR - Damian SmedleyTop
CONTACTTop
This module is part of the BioMart project http://www.biomart.org
Questions can be posted to the mart-dev mailing list: mart-dev@ebi.ac.uk