Module: nagvis Branch: master Commit: d1384769be74c6c01479be153ec672904d743d95 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=d1384769be74c6c01479be153ec672904d743d95
Author: Roman Kyrylych <[email protected]> Date: Wed Aug 19 14:20:55 2009 +0300 gmap: Fixed numerous server-side breakages after classes split Signed-off-by: Roman Kyrylych <[email protected]> --- share/netmap/Link.php | 4 +- share/netmap/LinkService.php | 22 ++++++++++---------- share/netmap/Location.php | 4 +- share/netmap/LocationService.php | 22 ++++++++++---------- .../{DatabaseService.php => NagiosService.php} | 0 share/netmap/ViewpointService.php | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/share/netmap/Link.php b/share/netmap/Link.php index 882b6e6..e28a222 100644 --- a/share/netmap/Link.php +++ b/share/netmap/Link.php @@ -46,7 +46,7 @@ class Link $this->state = $state; } - private function fromXML($node) + public static function fromXML($node) { $object = null; $object_type = ''; @@ -83,7 +83,7 @@ class Link (string)$node['description'], (string)$node['action'], $object); } - private function toXML($parent) + public function toXML($parent) { $node = $parent->addChild('link'); $node->addAttribute('id1', $this->id1); diff --git a/share/netmap/LinkService.php b/share/netmap/LinkService.php index 4dc63ba..a09f510 100644 --- a/share/netmap/LinkService.php +++ b/share/netmap/LinkService.php @@ -23,34 +23,34 @@ class LinkService { - private function updateState() + private function updateState(&$link) { $db = new NagiosService(); - if (isset($this->object)) - switch (get_class($this->object)) + if (isset($link->object)) + switch (get_class($link->object)) { case 'Host': - $this->state = $db->getHostState($this->object); + $link->state = $db->getHostState($link->object); break; case 'HostGroup': - $this->state = $db->getHostGroupState($this->object); + $link->state = $db->getHostGroupState($link->object); break; case 'Service': - $this->state = $db->getServiceState($this->object); + $link->state = $db->getServiceState($link->object); break; case 'ServiceGroup': - $this->state = $db->getServiceGroupState($this->object); + $link->state = $db->getServiceGroupState($link->object); break; default: throw new Exception('Unknown object type in links.xml'); } else - $this->state = Link::STATE_UNKNOWN; + $link->state = Link::STATE_UNKNOWN; } /** @@ -67,7 +67,7 @@ class LinkService { $link = Link::fromXML($node); - $link->updateState(); + self::updateState($link); if (!$problemonly || $link->state != Link::STATE_OK) $links[] = $link; @@ -85,7 +85,7 @@ class LinkService if (($xml = @simplexml_load_file('links.xml')) === FALSE) throw new Exception('Could not read links.xml'); - $link->updateState(); + self::updateState($link); $node = $link->toXML($xml); if (file_put_contents('links.xml', $xml->asXML()) !== FALSE) @@ -121,7 +121,7 @@ class LinkService if (($xml = @simplexml_load_file('links.xml')) === FALSE) throw new Exception('Could not read links.xml'); - $link->updateState(); + self::updateState($link); self::removeNode($xml, $link->id1, $link->id2); diff --git a/share/netmap/Location.php b/share/netmap/Location.php index 1107552..5438959 100644 --- a/share/netmap/Location.php +++ b/share/netmap/Location.php @@ -49,7 +49,7 @@ class Location $this->state = $state; } - private function fromXML($node) + public static function fromXML($node) { $object = null; $object_type = ''; @@ -87,7 +87,7 @@ class Location (string)$node['description'], (string)$node['action'], $object); } - private function toXML($parent) + public function toXML($parent) { $node = $parent->addChild('location'); $node->addAttribute('id', $this->id); diff --git a/share/netmap/LocationService.php b/share/netmap/LocationService.php index 5835c15..b737b19 100644 --- a/share/netmap/LocationService.php +++ b/share/netmap/LocationService.php @@ -23,34 +23,34 @@ class LocationService { - private function updateState() + private function updateState(&$location) { $db = new NagiosService(); - if (isset($this->object)) - switch (get_class($this->object)) + if (isset($location->object)) + switch (get_class($location->object)) { case 'Host': - $this->state = $db->getHostState($this->object); + $location->state = $db->getHostState($location->object); break; case 'HostGroup': - $this->state = $db->getHostGroupState($this->object); + $location->state = $db->getHostGroupState($location->object); break; case 'Service': - $this->state = $db->getServiceState($this->object); + $location->state = $db->getServiceState($location->object); break; case 'ServiceGroup': - $this->state = $db->getServiceGroupState($this->object); + $location->state = $db->getServiceGroupState($location->object); break; default: throw new Exception('Unknown object type in locations.xml'); } else - $this->state = Location::STATE_UNKNOWN; + $location->state = Location::STATE_UNKNOWN; } /** @@ -67,7 +67,7 @@ class LocationService { $location = Location::fromXML($node); - $location->updateState(); + self::updateState($location); if (!$problemonly || $location->state != Location::STATE_OK) $locations[] = $location; @@ -86,7 +86,7 @@ class LocationService throw new Exception('Could not read locations.xml'); $location->id = uniqid('', true); - $location->updateState(); + self::updateState($location); $node = $location->toXML($xml); if (file_put_contents('locations.xml', $xml->asXML()) !== FALSE) @@ -122,7 +122,7 @@ class LocationService if (($xml = @simplexml_load_file('locations.xml')) === FALSE) throw new Exception('Could not read locations.xml'); - $location->updateState(); + self::updateState($location); self::removeNode($xml, $location->id); diff --git a/share/netmap/DatabaseService.php b/share/netmap/NagiosService.php similarity index 100% rename from share/netmap/DatabaseService.php rename to share/netmap/NagiosService.php diff --git a/share/netmap/ViewpointService.php b/share/netmap/ViewpointService.php index 99f1b19..2cb4723 100644 --- a/share/netmap/ViewpointService.php +++ b/share/netmap/ViewpointService.php @@ -21,7 +21,7 @@ * *****************************************************************************/ -class Viewpoint +class ViewpointService { /** * @return array of Viewpoint ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
