5 |
* @author Andreas Motl <andreas.motl@ilo.de> |
* @author Andreas Motl <andreas.motl@ilo.de> |
6 |
* @package org.netfrag.glib |
* @package org.netfrag.glib |
7 |
* @name DesignPattern::RemoteProxy |
* @name DesignPattern::RemoteProxy |
|
* @filesource |
|
8 |
* |
* |
9 |
* |
* |
10 |
|
*/ |
11 |
|
|
12 |
|
|
13 |
|
/** |
14 |
* <b>Cvs-Log:</b> |
* <b>Cvs-Log:</b> |
15 |
* |
* |
16 |
* <pre> |
* <pre> |
18 |
* $Id$ |
* $Id$ |
19 |
* ------------------------------------------------------------------------- |
* ------------------------------------------------------------------------- |
20 |
* $Log$ |
* $Log$ |
21 |
|
* Revision 1.10 2003/03/28 03:05:54 joko |
22 |
|
* more fancy debugging-output |
23 |
|
* |
24 |
|
* Revision 1.9 2003/03/10 23:05:25 joko |
25 |
|
* + fixed metadata for phpDocumentor |
26 |
|
* |
27 |
|
* Revision 1.8 2003/03/10 22:31:56 joko |
28 |
|
* + fixed metadata for phpDocumentor |
29 |
|
* |
30 |
* Revision 1.7 2003/03/09 15:51:44 joko |
* Revision 1.7 2003/03/09 15:51:44 joko |
31 |
* + additional metadata for Autodia |
* + additional metadata for Autodia |
32 |
* |
* |
479 |
logp(get_class($this) . "->_loadRemote: argument 'guid' requires 'classname'", PEAR_LOG_WARNING); |
logp(get_class($this) . "->_loadRemote: argument 'guid' requires 'classname'", PEAR_LOG_WARNING); |
480 |
return; |
return; |
481 |
} |
} |
482 |
|
logp(get_class($this) . "->_loadRemote: getObjectByGuid", PEAR_LOG_DEBUG); |
483 |
$args = array( guid => $this->objectId, classname => $this->meta[classname] ); |
$args = array( guid => $this->objectId, classname => $this->meta[classname] ); |
484 |
$result = $this->backend->send('getObjectByGuid', $args ); |
$result = $this->backend->send('getObjectByGuid', $args ); |
485 |
|
|
488 |
logp(get_class($this) . "->_loadRemote: argument 'oid' requires valid objectId", PEAR_LOG_WARNING); |
logp(get_class($this) . "->_loadRemote: argument 'oid' requires valid objectId", PEAR_LOG_WARNING); |
489 |
return; |
return; |
490 |
} |
} |
491 |
|
logp(get_class($this) . "->_loadRemote: getObject", PEAR_LOG_DEBUG); |
492 |
$result = $this->backend->send('getObject', $this->objectId); |
$result = $this->backend->send('getObject', $this->objectId); |
493 |
|
|
494 |
} elseif ($this->meta[key]) { |
} elseif ($this->meta[key]) { |
502 |
return; |
return; |
503 |
} |
} |
504 |
*/ |
*/ |
505 |
|
//logp(get_class($this) . "->_loadRemote: $this->meta[command](" . join(' ', $this->meta[query]) . ")", PEAR_LOG_DEBUG); |
506 |
|
//print Dumper(array($this->meta[command], $this->meta[query])); |
507 |
$result = $this->backend->send($this->meta[command], $this->meta[query]); |
$result = $this->backend->send($this->meta[command], $this->meta[query]); |
508 |
|
|
509 |
} |
} |
510 |
|
|
511 |
|
//print "result: " . dumpVar($result) . "<br>"; |
512 |
|
|
513 |
|
$status = $this->backend->getStatus(); |
514 |
|
//print Dumper($status); |
515 |
|
|
516 |
|
$style = html_style("text/css", '.caption { color: yellow }'); |
517 |
|
|
518 |
if ($result) { |
$statusbox = html_div(); |
519 |
//print "result: " . dumpVar($result) . "<br>"; |
$statusbox->set_style('background: #558856; border: 2px black groove; width:640px; padding:10px; margin:40px;'); |
520 |
if (count($result) == 0) { return; } |
$statusbox->add( html_b("Connected:"), $status[connected], html_br() ); |
521 |
|
$statusbox->add( html_span('caption', "Connected:"), $status[connected], html_br() ); |
522 |
|
foreach ($status[errors] as $error) { |
523 |
|
$statusbox->add( html_span('caption', "Error[$error[code]]:"), $error[message], html_br() ); |
524 |
|
} |
525 |
|
|
526 |
|
if (is_array($result)) { |
527 |
|
$good = 1; |
528 |
|
} else { |
529 |
|
$message = get_class($this) . "->_loadRemote: Error while trying to talk to remote side. Please check wire, socket or api."; |
530 |
|
$statusbox->add( $message, html_br() ); |
531 |
|
logp($message, PEAR_LOG_CRIT); |
532 |
|
} |
533 |
|
|
534 |
|
if ($good && sizeof($result)) { |
535 |
|
|
536 |
// FIXME: this is dangerous! |
// FIXME: this is dangerous! |
537 |
if ($_GET[debug]) { |
if ($_GET[debug]) { |
544 |
$this->_saveProxy(); |
$this->_saveProxy(); |
545 |
//print "oid: $this->objectId<br>"; |
//print "oid: $this->objectId<br>"; |
546 |
$this->flushState(); |
$this->flushState(); |
547 |
|
|
548 |
} else { |
} else { |
549 |
//print "Error in _loadRemote!!!<br>"; |
print $style->render(); |
550 |
logp(get_class($this) . "->_loadRemote: error while trying to talk to remote side", PEAR_LOG_CRIT); |
print $statusbox->render(); |
551 |
|
|
552 |
} |
} |
553 |
|
|
554 |
} |
} |