Changeset 1134

Show
Ignore:
Timestamp:
01/28/08 16:33:00 (9 months ago)
Author:
kindlund
Message:

Updated Database API to reflect Ruby API updates.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/trunk/lib/HoneyClient/Manager/Database.pm

    r1129 r1134  
    213213 
    214214####################################################################### 
     215# Private Methods Implemented                                         # 
     216####################################################################### 
     217 
     218# XXX: Comment this. 
     219sub _AUTOLOAD { 
     220    my $obj = shift; 
     221    my $obj_yaml = YAML::freeze(Data::Structure::Util::unbless($obj)); 
     222    my $name = $AUTOLOAD; 
     223    $name =~  s/.*://; 
     224 
     225    # Perform the RPC call. 
     226    # XXX: Externalize this URL. 
     227    my $xmlrpc = XML::RPC->new('http://172.16.164.103:3000/hc_database/api'); 
     228    my $ret = $xmlrpc->call($name,$obj_yaml); 
     229 
     230    # Error checking. 
     231    if ((ref($ret) eq "HASH") && (exists($ret->{faultCode}))) { 
     232        # XXX: Log this error. 
     233        Carp::croak("Error: " . $ret->{faultString}); 
     234    } 
     235 
     236    return $ret; 
     237} 
     238 
     239 
     240####################################################################### 
    215241# Public Methods Implemented                                          # 
    216242####################################################################### 
    217243 
     244# XXX: Need to comment this further. 
    218245# Helper function designed to programmatically call the Hive web service, 
    219246# based upon arbitrary inputs given. 
     
    223250# 
    224251# ... will contact the Hive web service using the "foo" function name 
    225 # and supply the hashtable reference, specified by $bar. 
     252# and supply the arguments, specified by $bar. 
    226253# 
    227254# Note: Errors generated by the web service call will be propagated back 
     
    231258# Outputs: the returned data from the web service 
    232259sub AUTOLOAD { 
    233     my $obj = shift; 
    234     my $obj_yaml = YAML::freeze(Data::Structure::Util::unbless($obj)); 
    235     my $name = $AUTOLOAD; 
    236     $name =~  s/.*://; 
    237  
    238     # Perform the RPC call. 
    239     # XXX: Externalize this URL. 
    240     my $xmlrpc = XML::RPC->new('http://172.16.164.103:3000/hc_database/api'); 
    241     my $ret = $xmlrpc->call($name,$obj_yaml); 
    242  
    243     # Error checking. 
    244     if ((ref($ret) eq "HASH") && (exists($ret->{faultCode}))) { 
    245         # XXX: Log this error. 
    246         Carp::croak("Error: " . $ret->{faultString}); 
    247     } 
    248  
    249     return $ret; 
     260    return _AUTOLOAD(shift); 
     261
     262 
     263# XXX: Need to comment this further. 
     264sub get_queue_urls { 
     265    $AUTOLOAD = "Database::get_queue_urls"; 
     266    # Results from this call are YAML-encoded; need to deserialize them. 
     267    return YAML::thaw(_AUTOLOAD(shift)); 
    250268} 
    251269