BpConfig: renamed from BusinessProcess

This commit is contained in:
Thomas Gelf 2017-01-11 14:04:45 +01:00
parent 149696fb50
commit 22583aa083
37 changed files with 128 additions and 127 deletions

View file

@ -2,7 +2,7 @@
namespace Icinga\Module\Businessprocess\Controllers; namespace Icinga\Module\Businessprocess\Controllers;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\State\MonitoringState; use Icinga\Module\Businessprocess\State\MonitoringState;
use Icinga\Module\Businessprocess\Storage\ConfigDiff; use Icinga\Module\Businessprocess\Storage\ConfigDiff;
use Icinga\Module\Businessprocess\Html\Element; use Icinga\Module\Businessprocess\Html\Element;
@ -131,7 +131,7 @@ class ProcessController extends Controller
} }
} }
protected function getNode(BusinessProcess $bp) protected function getNode(BpConfig $bp)
{ {
if ($nodeName = $this->params->get('node')) { if ($nodeName = $this->params->get('node')) {
return $bp->getNode($nodeName); return $bp->getNode($nodeName);
@ -158,7 +158,7 @@ class ProcessController extends Controller
return $this->renderer; return $this->renderer;
} }
protected function getProcessTabs(BusinessProcess $bp, Renderer $renderer) protected function getProcessTabs(BpConfig $bp, Renderer $renderer)
{ {
$tabs = $this->singleTab($bp->getTitle()); $tabs = $this->singleTab($bp->getTitle());
@ -169,7 +169,7 @@ class ProcessController extends Controller
return $tabs; return $tabs;
} }
protected function handleSimulations(BusinessProcess $bp) protected function handleSimulations(BpConfig $bp)
{ {
$simulation = new Simulation($bp, $this->session()); $simulation = new Simulation($bp, $this->session());
@ -187,7 +187,7 @@ class ProcessController extends Controller
$bp->applySimulation($simulation); $bp->applySimulation($simulation);
} }
protected function loadActionForm(BusinessProcess $bp, Node $node = null) protected function loadActionForm(BpConfig $bp, Node $node = null)
{ {
$action = $this->params->get('action'); $action = $this->params->get('action');
$form = null; $form = null;
@ -243,7 +243,7 @@ class ProcessController extends Controller
} }
} }
protected function showWarnings(BusinessProcess $bp) protected function showWarnings(BpConfig $bp)
{ {
if ($bp->hasWarnings()) { if ($bp->hasWarnings()) {
$ul = Element::create('ul', array('class' => 'warning')); $ul = Element::create('ul', array('class' => 'warning'));
@ -257,7 +257,7 @@ class ProcessController extends Controller
} }
} }
protected function showHints(BusinessProcess $bp) protected function showHints(BpConfig $bp)
{ {
$ul = Element::create('ul', array('class' => 'error')); $ul = Element::create('ul', array('class' => 'error'));
foreach ($bp->getErrors() as $error) { foreach ($bp->getErrors() as $error) {

View file

@ -3,7 +3,7 @@
namespace Icinga\Module\Businessprocess\Forms; namespace Icinga\Module\Businessprocess\Forms;
use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Modification\ProcessChanges; use Icinga\Module\Businessprocess\Modification\ProcessChanges;
use Icinga\Module\Businessprocess\Web\Form\QuickForm; use Icinga\Module\Businessprocess\Web\Form\QuickForm;
use Icinga\Module\Monitoring\Backend\MonitoringBackend; use Icinga\Module\Monitoring\Backend\MonitoringBackend;
@ -14,7 +14,7 @@ class AddNodeForm extends QuickForm
/** @var MonitoringBackend */ /** @var MonitoringBackend */
protected $backend; protected $backend;
/** @var BusinessProcess */ /** @var BpConfig */
protected $bp; protected $bp;
/** @var BpNode */ /** @var BpNode */
@ -234,10 +234,10 @@ class AddNodeForm extends QuickForm
} }
/** /**
* @param BusinessProcess $process * @param BpConfig $process
* @return $this * @return $this
*/ */
public function setProcess(BusinessProcess $process) public function setProcess(BpConfig $process)
{ {
$this->bp = $process; $this->bp = $process;
$this->setBackend($process->getBackend()); $this->setBackend($process->getBackend());

View file

@ -4,7 +4,7 @@ namespace Icinga\Module\Businessprocess\Forms;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Authentication\Auth; use Icinga\Authentication\Auth;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Storage\Storage; use Icinga\Module\Businessprocess\Storage\Storage;
use Icinga\Module\Businessprocess\Web\Form\QuickForm; use Icinga\Module\Businessprocess\Web\Form\QuickForm;
@ -15,7 +15,7 @@ class BpConfigForm extends QuickForm
protected $backend; protected $backend;
/** @var BusinessProcess */ /** @var BpConfig */
protected $config; protected $config;
protected $node; protected $node;
@ -153,7 +153,7 @@ class BpConfigForm extends QuickForm
if ($this->config === null) { if ($this->config === null) {
// New config // New config
$config = new BusinessProcess(); $config = new BpConfig();
$config->setName($name); $config->setName($name);
$config->getMetadata()->set('Owner', Auth::getInstance()->getUser()->getUsername()); $config->getMetadata()->set('Owner', Auth::getInstance()->getUser()->getUsername());
$this->setSuccessUrl( $this->setSuccessUrl(

View file

@ -3,7 +3,7 @@
namespace Icinga\Module\Businessprocess\Forms; namespace Icinga\Module\Businessprocess\Forms;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Storage\LegacyStorage; use Icinga\Module\Businessprocess\Storage\LegacyStorage;
use Icinga\Module\Businessprocess\Web\Form\QuickForm; use Icinga\Module\Businessprocess\Web\Form\QuickForm;
use Icinga\Web\Notification; use Icinga\Web\Notification;
@ -15,7 +15,7 @@ class BpUploadForm extends QuickForm
protected $backend; protected $backend;
/** @var BusinessProcess */ /** @var BpConfig */
protected $config; protected $config;
protected $node; protected $node;
@ -133,7 +133,7 @@ class BpUploadForm extends QuickForm
return $this; return $this;
} }
public function setProcessConfig(BusinessProcess $config) public function setProcessConfig(BpConfig $config)
{ {
$this->config = $config; $this->config = $config;
return $this; return $this;
@ -172,7 +172,7 @@ class BpUploadForm extends QuickForm
if ($this->config === null) { if ($this->config === null) {
// New config // New config
$config = new BusinessProcess(); $config = new BpConfig();
$config->setName($name); $config->setName($name);
if ($title) { if ($title) {
$config->setTitle($title); $config->setTitle($title);

View file

@ -3,7 +3,7 @@
namespace Icinga\Module\Businessprocess\Forms; namespace Icinga\Module\Businessprocess\Forms;
use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Modification\ProcessChanges; use Icinga\Module\Businessprocess\Modification\ProcessChanges;
use Icinga\Module\Businessprocess\Node; use Icinga\Module\Businessprocess\Node;
use Icinga\Module\Businessprocess\Web\Form\QuickForm; use Icinga\Module\Businessprocess\Web\Form\QuickForm;
@ -15,7 +15,7 @@ class DeleteNodeForm extends QuickForm
/** @var MonitoringBackend */ /** @var MonitoringBackend */
protected $backend; protected $backend;
/** @var BusinessProcess */ /** @var BpConfig */
protected $bp; protected $bp;
/** @var Node */ /** @var Node */
@ -89,10 +89,10 @@ class DeleteNodeForm extends QuickForm
} }
/** /**
* @param BusinessProcess $process * @param BpConfig $process
* @return $this * @return $this
*/ */
public function setProcess(BusinessProcess $process) public function setProcess(BpConfig $process)
{ {
$this->bp = $process; $this->bp = $process;
$this->setBackend($process->getBackend()); $this->setBackend($process->getBackend());

View file

@ -3,7 +3,7 @@
namespace Icinga\Module\Businessprocess\Forms; namespace Icinga\Module\Businessprocess\Forms;
use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Modification\ProcessChanges; use Icinga\Module\Businessprocess\Modification\ProcessChanges;
use Icinga\Module\Businessprocess\Web\Form\QuickForm; use Icinga\Module\Businessprocess\Web\Form\QuickForm;
use Icinga\Module\Monitoring\Backend\MonitoringBackend; use Icinga\Module\Monitoring\Backend\MonitoringBackend;
@ -15,7 +15,7 @@ class ProcessForm extends QuickForm
/** @var MonitoringBackend */ /** @var MonitoringBackend */
protected $backend; protected $backend;
/** @var BusinessProcess */ /** @var BpConfig */
protected $bp; protected $bp;
/** @var BpNode */ /** @var BpNode */
@ -115,10 +115,10 @@ class ProcessForm extends QuickForm
} }
/** /**
* @param BusinessProcess $process * @param BpConfig $process
* @return $this * @return $this
*/ */
public function setProcess(BusinessProcess $process) public function setProcess(BpConfig $process)
{ {
$this->bp = $process; $this->bp = $process;
$this->setBackend($process->getBackend()); $this->setBackend($process->getBackend());

View file

@ -9,7 +9,7 @@ use Icinga\Module\Businessprocess\Modification\ProcessChanges;
use Icinga\Module\Monitoring\Backend\MonitoringBackend; use Icinga\Module\Monitoring\Backend\MonitoringBackend;
use Exception; use Exception;
class BusinessProcess class BpConfig
{ {
const SOFT_STATE = 0; const SOFT_STATE = 0;
@ -476,7 +476,7 @@ class BusinessProcess
$host = substr($name, 0, $pos); $host = substr($name, 0, $pos);
$service = substr($name, $pos + 1); $service = substr($name, $pos + 1);
// TODO: deactivated, this scares me, test it // TODO: deactivated, this scares me, test it
if (false && $service === 'Hoststatus') { if ($service === 'Hoststatus') {
return $this->createHost($host); return $this->createHost($host);
} else { } else {
return $this->createService($host, $service); return $this->createService($host, $service);

View file

@ -47,7 +47,7 @@ class BpNode extends Node
protected $className = 'process'; protected $className = 'process';
public function __construct(BusinessProcess $bp, $object) public function __construct(BpConfig $bp, $object)
{ {
$this->bp = $bp; $this->bp = $bp;
$this->name = $object->name; $this->name = $object->name;

View file

@ -32,7 +32,7 @@ class HostNode extends MonitoredNode
protected $className = 'host'; protected $className = 'host';
public function __construct(BusinessProcess $bp, $object) public function __construct(BpConfig $bp, $object)
{ {
$this->name = $object->hostname . ';Hoststatus'; $this->name = $object->hostname . ';Hoststatus';
$this->hostname = $object->hostname; $this->hostname = $object->hostname;

View file

@ -21,13 +21,13 @@ class ImportedNode extends Node
protected $className = 'subtree'; protected $className = 'subtree';
/** @var BusinessProcess */ /** @var BpConfig */
protected $config; protected $config;
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function __construct(BusinessProcess $bp, $object) public function __construct(BpConfig $bp, $object)
{ {
$this->bp = $bp; $this->bp = $bp;
$this->configName = $object->configName; $this->configName = $object->configName;

View file

@ -9,6 +9,7 @@ use Icinga\User;
class Metadata class Metadata
{ {
/** @var string Configuration name */
protected $name; protected $name;
protected $properties = array( protected $properties = array(

View file

@ -2,7 +2,7 @@
namespace Icinga\Module\Businessprocess\Modification; namespace Icinga\Module\Businessprocess\Modification;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Node; use Icinga\Module\Businessprocess\Node;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
@ -42,18 +42,18 @@ abstract class NodeAction
/** /**
* Every NodeAction must be able to apply itself to a BusinessProcess * Every NodeAction must be able to apply itself to a BusinessProcess
* *
* @param BusinessProcess $bp * @param BpConfig $bp
* @return mixed * @return mixed
*/ */
abstract public function applyTo(BusinessProcess $bp); abstract public function applyTo(BpConfig $bp);
/** /**
* Every NodeAction must be able to tell whether it could be applied to a BusinessProcess * Every NodeAction must be able to tell whether it could be applied to a BusinessProcess
* *
* @param BusinessProcess $bp * @param BpConfig $bp
* @return bool * @return bool
*/ */
abstract public function appliesTo(BusinessProcess $bp); abstract public function appliesTo(BpConfig $bp);
/** /**
* The name of the node this modification applies to * The name of the node this modification applies to

View file

@ -3,7 +3,7 @@
namespace Icinga\Module\Businessprocess\Modification; namespace Icinga\Module\Businessprocess\Modification;
use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
class NodeAddChildrenAction extends NodeAction class NodeAddChildrenAction extends NodeAction
{ {
@ -14,7 +14,7 @@ class NodeAddChildrenAction extends NodeAction
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function appliesTo(BusinessProcess $bp) public function appliesTo(BpConfig $bp)
{ {
$name = $this->getNodeName(); $name = $this->getNodeName();
@ -28,7 +28,7 @@ class NodeAddChildrenAction extends NodeAction
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function applyTo(BusinessProcess $bp) public function applyTo(BpConfig $bp)
{ {
/** @var BpNode $node */ /** @var BpNode $node */
if (! $this->hasNode()) { if (! $this->hasNode()) {

View file

@ -2,7 +2,7 @@
namespace Icinga\Module\Businessprocess\Modification; namespace Icinga\Module\Businessprocess\Modification;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\Node; use Icinga\Module\Businessprocess\Node;
@ -70,7 +70,7 @@ class NodeCreateAction extends NodeAction
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function appliesTo(BusinessProcess $bp) public function appliesTo(BpConfig $bp)
{ {
return ! $bp->hasNode($this->getNodeName()); return ! $bp->hasNode($this->getNodeName());
} }
@ -78,7 +78,7 @@ class NodeCreateAction extends NodeAction
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function applyTo(BusinessProcess $bp) public function applyTo(BpConfig $bp)
{ {
$name = $this->getNodeName(); $name = $this->getNodeName();

View file

@ -2,7 +2,7 @@
namespace Icinga\Module\Businessprocess\Modification; namespace Icinga\Module\Businessprocess\Modification;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Node; use Icinga\Module\Businessprocess\Node;
class NodeModifyAction extends NodeAction class NodeModifyAction extends NodeAction
@ -43,7 +43,7 @@ class NodeModifyAction extends NodeAction
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function appliesTo(BusinessProcess $bp) public function appliesTo(BpConfig $bp)
{ {
$name = $this->getNodeName(); $name = $this->getNodeName();
@ -66,7 +66,7 @@ class NodeModifyAction extends NodeAction
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function applyTo(BusinessProcess $bp) public function applyTo(BpConfig $bp)
{ {
$node = $bp->getNode($this->getNodeName()); $node = $bp->getNode($this->getNodeName());

View file

@ -2,7 +2,7 @@
namespace Icinga\Module\Businessprocess\Modification; namespace Icinga\Module\Businessprocess\Modification;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
/** /**
* NodeRemoveAction * NodeRemoveAction
@ -38,7 +38,7 @@ class NodeRemoveAction extends NodeAction
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function appliesTo(BusinessProcess $bp) public function appliesTo(BpConfig $bp)
{ {
$parent = $this->getParentName(); $parent = $this->getParentName();
if ($parent === null) { if ($parent === null) {
@ -51,7 +51,7 @@ class NodeRemoveAction extends NodeAction
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function applyTo(BusinessProcess $bp) public function applyTo(BpConfig $bp)
{ {
$parent = $this->getParentName(); $parent = $this->getParentName();
if ($parent === null) { if ($parent === null) {

View file

@ -2,7 +2,7 @@
namespace Icinga\Module\Businessprocess\Modification; namespace Icinga\Module\Businessprocess\Modification;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Node; use Icinga\Module\Businessprocess\Node;
use Icinga\Web\Session\SessionNamespace as Session; use Icinga\Web\Session\SessionNamespace as Session;
@ -30,12 +30,12 @@ class ProcessChanges
} }
/** /**
* @param BusinessProcess $bp * @param BpConfig $bp
* @param Session $session * @param Session $session
* *
* @return ProcessChanges * @return ProcessChanges
*/ */
public static function construct(BusinessProcess $bp, Session $session) public static function construct(BpConfig $bp, Session $session)
{ {
$key = 'changes.' . $bp->getName(); $key = 'changes.' . $bp->getName();
$changes = new ProcessChanges(); $changes = new ProcessChanges();

View file

@ -41,7 +41,7 @@ abstract class Node
/** /**
* Main business process object * Main business process object
* *
* @var BusinessProcess * @var BpConfig
*/ */
protected $bp; protected $bp;
@ -102,7 +102,7 @@ abstract class Node
99 => 'PENDING' 99 => 'PENDING'
); );
abstract public function __construct(BusinessProcess $bp, $object); abstract public function __construct(BpConfig $bp, $object);
public function setMissing($missing = true) public function setMissing($missing = true)
{ {

View file

@ -5,7 +5,7 @@ namespace Icinga\Module\Businessprocess\Renderer;
use Icinga\Date\DateFormatter; use Icinga\Date\DateFormatter;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Html\Container; use Icinga\Module\Businessprocess\Html\Container;
use Icinga\Module\Businessprocess\Html\Element; use Icinga\Module\Businessprocess\Html\Element;
use Icinga\Module\Businessprocess\Html\Html; use Icinga\Module\Businessprocess\Html\Html;
@ -15,7 +15,7 @@ use Icinga\Module\Businessprocess\Web\Url;
abstract class Renderer extends Html abstract class Renderer extends Html
{ {
/** @var BusinessProcess */ /** @var BpConfig */
protected $bp; protected $bp;
/** @var BpNode */ /** @var BpNode */
@ -39,17 +39,17 @@ abstract class Renderer extends Html
/** /**
* Renderer constructor. * Renderer constructor.
* *
* @param BusinessProcess $bp * @param BpConfig $bp
* @param BpNode|null $parent * @param BpNode|null $parent
*/ */
public function __construct(BusinessProcess $bp, BpNode $parent = null) public function __construct(BpConfig $bp, BpNode $parent = null)
{ {
$this->bp = $bp; $this->bp = $bp;
$this->parent = $parent; $this->parent = $parent;
} }
/** /**
* @return BusinessProcess * @return BpConfig
*/ */
public function getBusinessProcess() public function getBusinessProcess()
{ {
@ -299,7 +299,7 @@ abstract class Renderer extends Html
)->setContent(DateFormatter::timeSince($time, $timeOnly)); )->setContent(DateFormatter::timeSince($time, $timeOnly));
} }
protected function createUnboundParent(BusinessProcess $bp) protected function createUnboundParent(BpConfig $bp)
{ {
$unbound = $bp->getUnboundNodes(); $unbound = $bp->getUnboundNodes();

View file

@ -3,7 +3,7 @@
namespace Icinga\Module\Businessprocess\Renderer; namespace Icinga\Module\Businessprocess\Renderer;
use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Html\Container; use Icinga\Module\Businessprocess\Html\Container;
use Icinga\Module\Businessprocess\Html\Element; use Icinga\Module\Businessprocess\Html\Element;
use Icinga\Module\Businessprocess\Html\Icon; use Icinga\Module\Businessprocess\Html\Icon;
@ -31,10 +31,10 @@ class TreeRenderer extends Renderer
} }
/** /**
* @param BusinessProcess $bp * @param BpConfig $bp
* @return string * @return string
*/ */
public function renderBp(BusinessProcess $bp) public function renderBp(BpConfig $bp)
{ {
$html = array(); $html = array();
if ($this->wantsRootNodes()) { if ($this->wantsRootNodes()) {
@ -94,13 +94,13 @@ class TreeRenderer extends Renderer
} }
/** /**
* @param BusinessProcess $bp * @param BpConfig $bp
* @param Node $node * @param Node $node
* @param array $path * @param array $path
* *
* @return string * @return string
*/ */
public function renderNode(BusinessProcess $bp, Node $node, $path = array()) public function renderNode(BpConfig $bp, Node $node, $path = array())
{ {
$table = Element::create( $table = Element::create(
'table', 'table',
@ -179,7 +179,7 @@ class TreeRenderer extends Renderer
return $table; return $table;
} }
protected function getActionIcons(BusinessProcess $bp, Node $node) protected function getActionIcons(BpConfig $bp, Node $node)
{ {
if ($node instanceof BpNode) { if ($node instanceof BpNode) {
return $this->createEditAction($bp, $node); return $this->createEditAction($bp, $node);
@ -188,7 +188,7 @@ class TreeRenderer extends Renderer
} }
} }
protected function createEditAction(BusinessProcess $bp, BpNode $node) protected function createEditAction(BpConfig $bp, BpNode $node)
{ {
return $this->actionIcon( return $this->actionIcon(
'wrench', 'wrench',
@ -200,7 +200,7 @@ class TreeRenderer extends Renderer
); );
} }
protected function createSimulationAction(BusinessProcess $bp, Node $node) protected function createSimulationAction(BpConfig $bp, Node $node)
{ {
return $this->actionIcon( return $this->actionIcon(
'magic', 'magic',

View file

@ -12,7 +12,7 @@ class ServiceNode extends MonitoredNode
protected $className = 'service'; protected $className = 'service';
public function __construct(BusinessProcess $bp, $object) public function __construct(BpConfig $bp, $object)
{ {
$this->name = $object->hostname . ';' . $object->service; $this->name = $object->hostname . ';' . $object->service;
$this->hostname = $object->hostname; $this->hostname = $object->hostname;

View file

@ -13,7 +13,7 @@ class Simulation
protected $session; protected $session;
/** /**
* @var BusinessProcess * @var BpConfig
*/ */
protected $bp; protected $bp;
@ -27,7 +27,7 @@ class Simulation
*/ */
protected $simulations; protected $simulations;
public function __construct(BusinessProcess $bp, SessionNamespace $session) public function __construct(BpConfig $bp, SessionNamespace $session)
{ {
$this->bp = $bp; $this->bp = $bp;
$this->session = $session; $this->session = $session;

View file

@ -5,24 +5,24 @@ namespace Icinga\Module\Businessprocess\State;
use Exception; use Exception;
use Icinga\Application\Benchmark; use Icinga\Application\Benchmark;
use Icinga\Data\Filter\Filter; use Icinga\Data\Filter\Filter;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Monitoring\Backend\MonitoringBackend; use Icinga\Module\Monitoring\Backend\MonitoringBackend;
class MonitoringState class MonitoringState
{ {
/** @var BusinessProcess */ /** @var BpConfig */
protected $config; protected $config;
/** @var MonitoringBackend */ /** @var MonitoringBackend */
protected $backend; protected $backend;
private function __construct(BusinessProcess $config) private function __construct(BpConfig $config)
{ {
$this->config = $config; $this->config = $config;
$this->backend = $config->getBackend(); $this->backend = $config->getBackend();
} }
public static function apply(BusinessProcess $config) public static function apply(BpConfig $config)
{ {
$self = new static($config); $self = new static($config);
$self->retrieveStatesFromBackend(); $self->retrieveStatesFromBackend();
@ -101,7 +101,7 @@ class MonitoringState
return $this; return $this;
} }
protected function handleDbRow($row, BusinessProcess $config) protected function handleDbRow($row, BpConfig $config)
{ {
$key = $row->hostname; $key = $row->hostname;
if (property_exists($row, 'service')) { if (property_exists($row, 'service')) {

View file

@ -6,7 +6,7 @@ use Icinga\Application\Benchmark;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
use Icinga\Exception\SystemPermissionException; use Icinga\Exception\SystemPermissionException;
use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Metadata; use Icinga\Module\Businessprocess\Metadata;
class LegacyConfigParser class LegacyConfigParser
@ -19,7 +19,7 @@ class LegacyConfigParser
protected $name; protected $name;
/** @var BusinessProcess */ /** @var BpConfig */
protected $config; protected $config;
/** /**
@ -30,12 +30,12 @@ class LegacyConfigParser
private function __construct($name) private function __construct($name)
{ {
$this->name = $name; $this->name = $name;
$this->config = new BusinessProcess(); $this->config = new BpConfig();
$this->config->setName($name); $this->config->setName($name);
} }
/** /**
* @return BusinessProcess * @return BpConfig
*/ */
public function getParsedConfig() public function getParsedConfig()
{ {
@ -147,9 +147,9 @@ class LegacyConfigParser
/** /**
* @param $line * @param $line
* @param BusinessProcess $bp * @param BpConfig $bp
*/ */
protected function parseDisplay(& $line, BusinessProcess $bp) protected function parseDisplay(& $line, BpConfig $bp)
{ {
list($display, $name, $desc) = preg_split('~\s*;\s*~', substr($line, 8), 3); list($display, $name, $desc) = preg_split('~\s*;\s*~', substr($line, 8), 3);
$bp->getBpNode($name)->setAlias($desc)->setDisplay($display); $bp->getBpNode($name)->setAlias($desc)->setDisplay($display);
@ -160,28 +160,28 @@ class LegacyConfigParser
/** /**
* @param $line * @param $line
* @param BusinessProcess $bp * @param BpConfig $bp
*/ */
protected function parseExternalInfo(& $line, BusinessProcess $bp) protected function parseExternalInfo(& $line, BpConfig $bp)
{ {
list($name, $script) = preg_split('~\s*;\s*~', substr($line, 14), 2); list($name, $script) = preg_split('~\s*;\s*~', substr($line, 14), 2);
$bp->getBpNode($name)->setInfoCommand($script); $bp->getBpNode($name)->setInfoCommand($script);
} }
protected function parseExtraInfo(& $line, BusinessProcess $bp) protected function parseExtraInfo(& $line, BpConfig $bp)
{ {
// TODO: Not yet // TODO: Not yet
// list($name, $script) = preg_split('~\s*;\s*~', substr($line, 14), 2); // list($name, $script) = preg_split('~\s*;\s*~', substr($line, 14), 2);
// $this->getNode($name)->setExtraInfo($script); // $this->getNode($name)->setExtraInfo($script);
} }
protected function parseInfoUrl(& $line, BusinessProcess $bp) protected function parseInfoUrl(& $line, BpConfig $bp)
{ {
list($name, $url) = preg_split('~\s*;\s*~', substr($line, 9), 2); list($name, $url) = preg_split('~\s*;\s*~', substr($line, 9), 2);
$bp->getBpNode($name)->setInfoUrl($url); $bp->getBpNode($name)->setInfoUrl($url);
} }
protected function parseExtraLine(& $line, $typeLength, BusinessProcess $bp) protected function parseExtraLine(& $line, $typeLength, BpConfig $bp)
{ {
$type = substr($line, 0, $typeLength); $type = substr($line, 0, $typeLength);
if (substr($type, 0, 7) === 'display') { if (substr($type, 0, 7) === 'display') {

View file

@ -3,7 +3,7 @@
namespace Icinga\Module\Businessprocess\Storage; namespace Icinga\Module\Businessprocess\Storage;
use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
class LegacyConfigRenderer class LegacyConfigRenderer
{ {
@ -13,9 +13,9 @@ class LegacyConfigRenderer
/** /**
* LecagyConfigRenderer constructor * LecagyConfigRenderer constructor
* *
* @param BusinessProcess $config * @param BpConfig $config
*/ */
public function __construct(BusinessProcess $config) public function __construct(BpConfig $config)
{ {
$this->config = $config; $this->config = $config;
} }
@ -29,10 +29,10 @@ class LegacyConfigRenderer
} }
/** /**
* @param BusinessProcess $config * @param BpConfig $config
* @return mixed * @return mixed
*/ */
public static function renderConfig(BusinessProcess $config) public static function renderConfig(BpConfig $config)
{ {
$renderer = new static($config); $renderer = new static($config);
return $renderer->render(); return $renderer->render();

View file

@ -4,7 +4,7 @@ namespace Icinga\Module\Businessprocess\Storage;
use DirectoryIterator; use DirectoryIterator;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Exception\SystemPermissionException; use Icinga\Exception\SystemPermissionException;
class LegacyStorage extends Storage class LegacyStorage extends Storage
@ -125,7 +125,7 @@ class LegacyStorage extends Storage
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function storeProcess(BusinessProcess $process) public function storeProcess(BpConfig $process)
{ {
file_put_contents( file_put_contents(
$this->getFilename($process->getName()), $this->getFilename($process->getName()),

View file

@ -3,7 +3,7 @@
namespace Icinga\Module\Businessprocess\Storage; namespace Icinga\Module\Businessprocess\Storage;
use Icinga\Data\ConfigObject; use Icinga\Data\ConfigObject;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Metadata; use Icinga\Module\Businessprocess\Metadata;
abstract class Storage abstract class Storage
@ -65,18 +65,18 @@ abstract class Storage
/** /**
* @param $name * @param $name
* @return BusinessProcess * @return BpConfig
*/ */
abstract public function loadProcess($name); abstract public function loadProcess($name);
/** /**
* Store eventual changes applied to the given configuration * Store eventual changes applied to the given configuration
* *
* @param BusinessProcess $config * @param BpConfig $config
* *
* @return mixed * @return mixed
*/ */
abstract public function storeProcess(BusinessProcess $config); abstract public function storeProcess(BpConfig $config);
/** /**
* @param $name * @param $name

View file

@ -5,7 +5,7 @@ namespace Icinga\Module\Businessprocess\Test;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Application\ApplicationBootstrap; use Icinga\Application\ApplicationBootstrap;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Storage\LegacyStorage; use Icinga\Module\Businessprocess\Storage\LegacyStorage;
use Icinga\Module\Businessprocess\Web\FakeRequest; use Icinga\Module\Businessprocess\Web\FakeRequest;
use PHPUnit_Framework_TestCase; use PHPUnit_Framework_TestCase;
@ -30,7 +30,7 @@ abstract class BaseTestCase extends PHPUnit_Framework_TestCase
} }
/*** /***
* @return BusinessProcess * @return BpConfig
*/ */
protected function makeLoop() protected function makeLoop()
{ {

View file

@ -3,7 +3,7 @@
namespace Icinga\Module\Businessprocess\Web\Component; namespace Icinga\Module\Businessprocess\Web\Component;
use Icinga\Authentication\Auth; use Icinga\Authentication\Auth;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Html\BaseElement; use Icinga\Module\Businessprocess\Html\BaseElement;
use Icinga\Module\Businessprocess\Html\Link; use Icinga\Module\Businessprocess\Html\Link;
use Icinga\Module\Businessprocess\Renderer\Renderer; use Icinga\Module\Businessprocess\Renderer\Renderer;
@ -12,7 +12,7 @@ use Icinga\Module\Businessprocess\Web\Url;
class RenderedProcessActionBar extends ActionBar class RenderedProcessActionBar extends ActionBar
{ {
public function __construct(BusinessProcess $config, Renderer $renderer, Auth $auth, Url $url) public function __construct(BpConfig $config, Renderer $renderer, Auth $auth, Url $url)
{ {
$meta = $config->getMetadata(); $meta = $config->getMetadata();

View file

@ -3,7 +3,7 @@
namespace Icinga\Module\Businessprocess\Web; namespace Icinga\Module\Businessprocess\Web;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Html\HtmlTag; use Icinga\Module\Businessprocess\Html\HtmlTag;
use Icinga\Module\Businessprocess\Modification\ProcessChanges; use Icinga\Module\Businessprocess\Modification\ProcessChanges;
use Icinga\Module\Businessprocess\Storage\LegacyStorage; use Icinga\Module\Businessprocess\Storage\LegacyStorage;
@ -22,7 +22,7 @@ class Controller extends ModuleController
/** @var View */ /** @var View */
public $view; public $view;
/** @var BusinessProcess */ /** @var BpConfig */
protected $bp; protected $bp;
/** @var Tabs */ /** @var Tabs */

View file

@ -2,7 +2,7 @@
namespace Tests\Icinga\Module\Businessprocess; namespace Tests\Icinga\Module\Businessprocess;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\HostNode; use Icinga\Module\Businessprocess\HostNode;
use Icinga\Module\Businessprocess\Test\BaseTestCase; use Icinga\Module\Businessprocess\Test\BaseTestCase;
@ -46,7 +46,7 @@ class HostNodeTest extends BaseTestCase
*/ */
public function testWhetherSettingAnInvalidStateFails() public function testWhetherSettingAnInvalidStateFails()
{ {
$bp = new BusinessProcess(); $bp = new BpConfig();
$host = $bp->createHost('localhost')->setState(98); $host = $bp->createHost('localhost')->setState(98);
$bp->createBp('p')->addChild($host)->getState(); $bp->createBp('p')->addChild($host)->getState();
} }
@ -56,7 +56,7 @@ class HostNodeTest extends BaseTestCase
*/ */
protected function localhost() protected function localhost()
{ {
$bp = new BusinessProcess(); $bp = new BpConfig();
return new HostNode($bp, (object) array( return new HostNode($bp, (object) array(
'hostname' => 'localhost', 'hostname' => 'localhost',
'state' => 0, 'state' => 0,

View file

@ -2,7 +2,7 @@
namespace Tests\Icinga\Module\Businessprocess\Operator; namespace Tests\Icinga\Module\Businessprocess\Operator;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Test\BaseTestCase; use Icinga\Module\Businessprocess\Test\BaseTestCase;
use Icinga\Module\Businessprocess\Storage\LegacyStorage; use Icinga\Module\Businessprocess\Storage\LegacyStorage;
@ -18,7 +18,7 @@ class AndOperatorTest extends BaseTestCase
foreach ($expressions as $expression) { foreach ($expressions as $expression) {
$this->assertInstanceOf( $this->assertInstanceOf(
'Icinga\\Module\\Businessprocess\\Businessprocess', 'Icinga\\Module\\Businessprocess\\BpConfig',
$storage->loadFromString('dummy', $expression) $storage->loadFromString('dummy', $expression)
); );
} }
@ -104,7 +104,7 @@ class AndOperatorTest extends BaseTestCase
public function testWhetherSimpleAndOperationWorks() public function testWhetherSimpleAndOperationWorks()
{ {
$bp = new BusinessProcess(); $bp = new BpConfig();
$bp->throwErrors(); $bp->throwErrors();
$host = $bp->createHost('localhost')->setState(1); $host = $bp->createHost('localhost')->setState(1);
$service = $bp->createService('localhost', 'ping')->setState(1); $service = $bp->createService('localhost', 'ping')->setState(1);
@ -130,7 +130,7 @@ class AndOperatorTest extends BaseTestCase
public function testWhetherSimpleOrOperationWorks() public function testWhetherSimpleOrOperationWorks()
{ {
$bp = new BusinessProcess(); $bp = new BpConfig();
$bp->throwErrors(); $bp->throwErrors();
$host = $bp->createHost('localhost')->setState(1); $host = $bp->createHost('localhost')->setState(1);
$service = $bp->createService('localhost', 'ping')->setState(1); $service = $bp->createService('localhost', 'ping')->setState(1);
@ -145,7 +145,7 @@ class AndOperatorTest extends BaseTestCase
public function testWhetherPendingIsAccepted() public function testWhetherPendingIsAccepted()
{ {
$bp = new BusinessProcess(); $bp = new BpConfig();
$host = $bp->createHost('localhost')->setState(99); $host = $bp->createHost('localhost')->setState(99);
$service = $bp->createService('localhost', 'ping')->setState(99); $service = $bp->createService('localhost', 'ping')->setState(99);
$p = $bp->createBp('p') $p = $bp->createBp('p')
@ -160,7 +160,7 @@ class AndOperatorTest extends BaseTestCase
public function testWhetherWarningIsWorseThanPending() public function testWhetherWarningIsWorseThanPending()
{ {
$bp = new BusinessProcess(); $bp = new BpConfig();
$host = $bp->createHost('localhost')->setState(99); $host = $bp->createHost('localhost')->setState(99);
$service = $bp->createService('localhost', 'ping')->setState(1); $service = $bp->createService('localhost', 'ping')->setState(1);
$p = $bp->createBp('p') $p = $bp->createBp('p')
@ -175,7 +175,7 @@ class AndOperatorTest extends BaseTestCase
public function testWhetherPendingIsWorseThanUpOrOk() public function testWhetherPendingIsWorseThanUpOrOk()
{ {
$bp = new BusinessProcess(); $bp = new BpConfig();
$host = $bp->createHost('localhost')->setState(99); $host = $bp->createHost('localhost')->setState(99);
$service = $bp->createService('localhost', 'ping')->setState(0); $service = $bp->createService('localhost', 'ping')->setState(0);
$p = $bp->createBp('p') $p = $bp->createBp('p')
@ -198,7 +198,7 @@ class AndOperatorTest extends BaseTestCase
} }
/** /**
* @return BusinessProcess * @return BpConfig
*/ */
protected function getBp() protected function getBp()
{ {

View file

@ -2,7 +2,7 @@
namespace Tests\Icinga\Module\Businessprocess\Operator; namespace Tests\Icinga\Module\Businessprocess\Operator;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Test\BaseTestCase; use Icinga\Module\Businessprocess\Test\BaseTestCase;
use Icinga\Module\Businessprocess\Storage\LegacyStorage; use Icinga\Module\Businessprocess\Storage\LegacyStorage;
@ -18,7 +18,7 @@ class MinOperatorTest extends BaseTestCase
$this->getName(); $this->getName();
foreach ($expressions as $expression) { foreach ($expressions as $expression) {
$this->assertInstanceOf( $this->assertInstanceOf(
'Icinga\\Module\\Businessprocess\\Businessprocess', 'Icinga\\Module\\Businessprocess\\BpConfig',
$storage->loadFromString('dummy', $expression) $storage->loadFromString('dummy', $expression)
); );
} }
@ -102,7 +102,7 @@ class MinOperatorTest extends BaseTestCase
} }
/** /**
* @return BusinessProcess * @return BpConfig
*/ */
protected function getBp() protected function getBp()
{ {

View file

@ -2,7 +2,7 @@
namespace Tests\Icinga\Module\Businessprocess\Operator; namespace Tests\Icinga\Module\Businessprocess\Operator;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Test\BaseTestCase; use Icinga\Module\Businessprocess\Test\BaseTestCase;
use Icinga\Module\Businessprocess\Storage\LegacyStorage; use Icinga\Module\Businessprocess\Storage\LegacyStorage;
@ -20,7 +20,7 @@ class NotOperatorTest extends BaseTestCase
foreach ($expressions as $expression) { foreach ($expressions as $expression) {
$this->assertInstanceOf( $this->assertInstanceOf(
'Icinga\\Module\\Businessprocess\\Businessprocess', 'Icinga\\Module\\Businessprocess\\BpConfig',
$storage->loadFromString('dummy', $expression) $storage->loadFromString('dummy', $expression)
); );
} }
@ -138,7 +138,7 @@ class NotOperatorTest extends BaseTestCase
} }
/** /**
* @return BusinessProcess * @return BpConfig
*/ */
protected function getBp() protected function getBp()
{ {

View file

@ -2,7 +2,7 @@
namespace Tests\Icinga\Module\Businessprocess\Operator; namespace Tests\Icinga\Module\Businessprocess\Operator;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Test\BaseTestCase; use Icinga\Module\Businessprocess\Test\BaseTestCase;
use Icinga\Module\Businessprocess\Storage\LegacyStorage; use Icinga\Module\Businessprocess\Storage\LegacyStorage;
@ -18,7 +18,7 @@ class OrOperatorTest extends BaseTestCase
foreach ($expressions as $expression) { foreach ($expressions as $expression) {
$this->assertInstanceOf( $this->assertInstanceOf(
'Icinga\\Module\\Businessprocess\\Businessprocess', 'Icinga\\Module\\Businessprocess\\BpConfig',
$storage->loadFromString('dummy', $expression) $storage->loadFromString('dummy', $expression)
); );
} }
@ -103,7 +103,7 @@ class OrOperatorTest extends BaseTestCase
} }
/** /**
* @return BusinessProcess * @return BpConfig
*/ */
protected function getBp() protected function getBp()
{ {

View file

@ -2,7 +2,7 @@
namespace Tests\Icinga\Module\Businessprocess; namespace Tests\Icinga\Module\Businessprocess;
use Icinga\Module\Businessprocess\BusinessProcess; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\ServiceNode; use Icinga\Module\Businessprocess\ServiceNode;
use Icinga\Module\Businessprocess\Test\BaseTestCase; use Icinga\Module\Businessprocess\Test\BaseTestCase;
@ -46,7 +46,7 @@ class ServiceNodeTest extends BaseTestCase
*/ */
protected function pingOnLocalhost() protected function pingOnLocalhost()
{ {
$bp = new BusinessProcess(); $bp = new BpConfig();
return new ServiceNode($bp, (object) array( return new ServiceNode($bp, (object) array(
'hostname' => 'localhost', 'hostname' => 'localhost',
'service' => 'ping <> pong', 'service' => 'ping <> pong',

View file

@ -7,7 +7,7 @@ use Icinga\Module\Businessprocess\Storage\LegacyStorage;
class LegacyStorageTest extends BaseTestCase class LegacyStorageTest extends BaseTestCase
{ {
private $processClass = 'Icinga\\Module\\Businessprocess\\BusinessProcess'; private $processClass = 'Icinga\\Module\\Businessprocess\\BpConfig';
public function testCanBeInstantiatedWithAnEmptyConfigSection() public function testCanBeInstantiatedWithAnEmptyConfigSection()
{ {