mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
BpConfig: renamed from BusinessProcess
This commit is contained in:
parent
149696fb50
commit
22583aa083
37 changed files with 128 additions and 127 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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\Storage\ConfigDiff;
|
||||
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')) {
|
||||
return $bp->getNode($nodeName);
|
||||
|
|
@ -158,7 +158,7 @@ class ProcessController extends Controller
|
|||
return $this->renderer;
|
||||
}
|
||||
|
||||
protected function getProcessTabs(BusinessProcess $bp, Renderer $renderer)
|
||||
protected function getProcessTabs(BpConfig $bp, Renderer $renderer)
|
||||
{
|
||||
|
||||
$tabs = $this->singleTab($bp->getTitle());
|
||||
|
|
@ -169,7 +169,7 @@ class ProcessController extends Controller
|
|||
return $tabs;
|
||||
}
|
||||
|
||||
protected function handleSimulations(BusinessProcess $bp)
|
||||
protected function handleSimulations(BpConfig $bp)
|
||||
{
|
||||
$simulation = new Simulation($bp, $this->session());
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ class ProcessController extends Controller
|
|||
$bp->applySimulation($simulation);
|
||||
}
|
||||
|
||||
protected function loadActionForm(BusinessProcess $bp, Node $node = null)
|
||||
protected function loadActionForm(BpConfig $bp, Node $node = null)
|
||||
{
|
||||
$action = $this->params->get('action');
|
||||
$form = null;
|
||||
|
|
@ -243,7 +243,7 @@ class ProcessController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
protected function showWarnings(BusinessProcess $bp)
|
||||
protected function showWarnings(BpConfig $bp)
|
||||
{
|
||||
if ($bp->hasWarnings()) {
|
||||
$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'));
|
||||
foreach ($bp->getErrors() as $error) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Icinga\Module\Businessprocess\Forms;
|
||||
|
||||
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\Web\Form\QuickForm;
|
||||
use Icinga\Module\Monitoring\Backend\MonitoringBackend;
|
||||
|
|
@ -14,7 +14,7 @@ class AddNodeForm extends QuickForm
|
|||
/** @var MonitoringBackend */
|
||||
protected $backend;
|
||||
|
||||
/** @var BusinessProcess */
|
||||
/** @var BpConfig */
|
||||
protected $bp;
|
||||
|
||||
/** @var BpNode */
|
||||
|
|
@ -234,10 +234,10 @@ class AddNodeForm extends QuickForm
|
|||
}
|
||||
|
||||
/**
|
||||
* @param BusinessProcess $process
|
||||
* @param BpConfig $process
|
||||
* @return $this
|
||||
*/
|
||||
public function setProcess(BusinessProcess $process)
|
||||
public function setProcess(BpConfig $process)
|
||||
{
|
||||
$this->bp = $process;
|
||||
$this->setBackend($process->getBackend());
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Icinga\Module\Businessprocess\Forms;
|
|||
|
||||
use Icinga\Application\Config;
|
||||
use Icinga\Authentication\Auth;
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\Storage\Storage;
|
||||
use Icinga\Module\Businessprocess\Web\Form\QuickForm;
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ class BpConfigForm extends QuickForm
|
|||
|
||||
protected $backend;
|
||||
|
||||
/** @var BusinessProcess */
|
||||
/** @var BpConfig */
|
||||
protected $config;
|
||||
|
||||
protected $node;
|
||||
|
|
@ -153,7 +153,7 @@ class BpConfigForm extends QuickForm
|
|||
|
||||
if ($this->config === null) {
|
||||
// New config
|
||||
$config = new BusinessProcess();
|
||||
$config = new BpConfig();
|
||||
$config->setName($name);
|
||||
$config->getMetadata()->set('Owner', Auth::getInstance()->getUser()->getUsername());
|
||||
$this->setSuccessUrl(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Icinga\Module\Businessprocess\Forms;
|
||||
|
||||
use Icinga\Application\Config;
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\Storage\LegacyStorage;
|
||||
use Icinga\Module\Businessprocess\Web\Form\QuickForm;
|
||||
use Icinga\Web\Notification;
|
||||
|
|
@ -15,7 +15,7 @@ class BpUploadForm extends QuickForm
|
|||
|
||||
protected $backend;
|
||||
|
||||
/** @var BusinessProcess */
|
||||
/** @var BpConfig */
|
||||
protected $config;
|
||||
|
||||
protected $node;
|
||||
|
|
@ -133,7 +133,7 @@ class BpUploadForm extends QuickForm
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setProcessConfig(BusinessProcess $config)
|
||||
public function setProcessConfig(BpConfig $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
return $this;
|
||||
|
|
@ -172,7 +172,7 @@ class BpUploadForm extends QuickForm
|
|||
|
||||
if ($this->config === null) {
|
||||
// New config
|
||||
$config = new BusinessProcess();
|
||||
$config = new BpConfig();
|
||||
$config->setName($name);
|
||||
if ($title) {
|
||||
$config->setTitle($title);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Icinga\Module\Businessprocess\Forms;
|
||||
|
||||
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\Node;
|
||||
use Icinga\Module\Businessprocess\Web\Form\QuickForm;
|
||||
|
|
@ -15,7 +15,7 @@ class DeleteNodeForm extends QuickForm
|
|||
/** @var MonitoringBackend */
|
||||
protected $backend;
|
||||
|
||||
/** @var BusinessProcess */
|
||||
/** @var BpConfig */
|
||||
protected $bp;
|
||||
|
||||
/** @var Node */
|
||||
|
|
@ -89,10 +89,10 @@ class DeleteNodeForm extends QuickForm
|
|||
}
|
||||
|
||||
/**
|
||||
* @param BusinessProcess $process
|
||||
* @param BpConfig $process
|
||||
* @return $this
|
||||
*/
|
||||
public function setProcess(BusinessProcess $process)
|
||||
public function setProcess(BpConfig $process)
|
||||
{
|
||||
$this->bp = $process;
|
||||
$this->setBackend($process->getBackend());
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Icinga\Module\Businessprocess\Forms;
|
||||
|
||||
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\Web\Form\QuickForm;
|
||||
use Icinga\Module\Monitoring\Backend\MonitoringBackend;
|
||||
|
|
@ -15,7 +15,7 @@ class ProcessForm extends QuickForm
|
|||
/** @var MonitoringBackend */
|
||||
protected $backend;
|
||||
|
||||
/** @var BusinessProcess */
|
||||
/** @var BpConfig */
|
||||
protected $bp;
|
||||
|
||||
/** @var BpNode */
|
||||
|
|
@ -115,10 +115,10 @@ class ProcessForm extends QuickForm
|
|||
}
|
||||
|
||||
/**
|
||||
* @param BusinessProcess $process
|
||||
* @param BpConfig $process
|
||||
* @return $this
|
||||
*/
|
||||
public function setProcess(BusinessProcess $process)
|
||||
public function setProcess(BpConfig $process)
|
||||
{
|
||||
$this->bp = $process;
|
||||
$this->setBackend($process->getBackend());
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use Icinga\Module\Businessprocess\Modification\ProcessChanges;
|
|||
use Icinga\Module\Monitoring\Backend\MonitoringBackend;
|
||||
use Exception;
|
||||
|
||||
class BusinessProcess
|
||||
class BpConfig
|
||||
{
|
||||
const SOFT_STATE = 0;
|
||||
|
||||
|
|
@ -476,7 +476,7 @@ class BusinessProcess
|
|||
$host = substr($name, 0, $pos);
|
||||
$service = substr($name, $pos + 1);
|
||||
// TODO: deactivated, this scares me, test it
|
||||
if (false && $service === 'Hoststatus') {
|
||||
if ($service === 'Hoststatus') {
|
||||
return $this->createHost($host);
|
||||
} else {
|
||||
return $this->createService($host, $service);
|
||||
|
|
@ -47,7 +47,7 @@ class BpNode extends Node
|
|||
|
||||
protected $className = 'process';
|
||||
|
||||
public function __construct(BusinessProcess $bp, $object)
|
||||
public function __construct(BpConfig $bp, $object)
|
||||
{
|
||||
$this->bp = $bp;
|
||||
$this->name = $object->name;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class HostNode extends MonitoredNode
|
|||
|
||||
protected $className = 'host';
|
||||
|
||||
public function __construct(BusinessProcess $bp, $object)
|
||||
public function __construct(BpConfig $bp, $object)
|
||||
{
|
||||
$this->name = $object->hostname . ';Hoststatus';
|
||||
$this->hostname = $object->hostname;
|
||||
|
|
|
|||
|
|
@ -21,13 +21,13 @@ class ImportedNode extends Node
|
|||
|
||||
protected $className = 'subtree';
|
||||
|
||||
/** @var BusinessProcess */
|
||||
/** @var BpConfig */
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function __construct(BusinessProcess $bp, $object)
|
||||
public function __construct(BpConfig $bp, $object)
|
||||
{
|
||||
$this->bp = $bp;
|
||||
$this->configName = $object->configName;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use Icinga\User;
|
|||
|
||||
class Metadata
|
||||
{
|
||||
/** @var string Configuration name */
|
||||
protected $name;
|
||||
|
||||
protected $properties = array(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Businessprocess\Modification;
|
||||
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\Node;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
|
||||
|
|
@ -42,18 +42,18 @@ abstract class NodeAction
|
|||
/**
|
||||
* Every NodeAction must be able to apply itself to a BusinessProcess
|
||||
*
|
||||
* @param BusinessProcess $bp
|
||||
* @param BpConfig $bp
|
||||
* @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
|
||||
*
|
||||
* @param BusinessProcess $bp
|
||||
* @param BpConfig $bp
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function appliesTo(BusinessProcess $bp);
|
||||
abstract public function appliesTo(BpConfig $bp);
|
||||
|
||||
/**
|
||||
* The name of the node this modification applies to
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Icinga\Module\Businessprocess\Modification;
|
||||
|
||||
use Icinga\Module\Businessprocess\BpNode;
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
|
||||
class NodeAddChildrenAction extends NodeAction
|
||||
{
|
||||
|
|
@ -14,7 +14,7 @@ class NodeAddChildrenAction extends NodeAction
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function appliesTo(BusinessProcess $bp)
|
||||
public function appliesTo(BpConfig $bp)
|
||||
{
|
||||
$name = $this->getNodeName();
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ class NodeAddChildrenAction extends NodeAction
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function applyTo(BusinessProcess $bp)
|
||||
public function applyTo(BpConfig $bp)
|
||||
{
|
||||
/** @var BpNode $node */
|
||||
if (! $this->hasNode()) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Businessprocess\Modification;
|
||||
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\BpNode;
|
||||
use Icinga\Module\Businessprocess\Node;
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ class NodeCreateAction extends NodeAction
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function appliesTo(BusinessProcess $bp)
|
||||
public function appliesTo(BpConfig $bp)
|
||||
{
|
||||
return ! $bp->hasNode($this->getNodeName());
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ class NodeCreateAction extends NodeAction
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function applyTo(BusinessProcess $bp)
|
||||
public function applyTo(BpConfig $bp)
|
||||
{
|
||||
$name = $this->getNodeName();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Businessprocess\Modification;
|
||||
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\Node;
|
||||
|
||||
class NodeModifyAction extends NodeAction
|
||||
|
|
@ -43,7 +43,7 @@ class NodeModifyAction extends NodeAction
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function appliesTo(BusinessProcess $bp)
|
||||
public function appliesTo(BpConfig $bp)
|
||||
{
|
||||
$name = $this->getNodeName();
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ class NodeModifyAction extends NodeAction
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function applyTo(BusinessProcess $bp)
|
||||
public function applyTo(BpConfig $bp)
|
||||
{
|
||||
$node = $bp->getNode($this->getNodeName());
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Businessprocess\Modification;
|
||||
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
|
||||
/**
|
||||
* NodeRemoveAction
|
||||
|
|
@ -38,7 +38,7 @@ class NodeRemoveAction extends NodeAction
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function appliesTo(BusinessProcess $bp)
|
||||
public function appliesTo(BpConfig $bp)
|
||||
{
|
||||
$parent = $this->getParentName();
|
||||
if ($parent === null) {
|
||||
|
|
@ -51,7 +51,7 @@ class NodeRemoveAction extends NodeAction
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function applyTo(BusinessProcess $bp)
|
||||
public function applyTo(BpConfig $bp)
|
||||
{
|
||||
$parent = $this->getParentName();
|
||||
if ($parent === null) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Businessprocess\Modification;
|
||||
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\Node;
|
||||
use Icinga\Web\Session\SessionNamespace as Session;
|
||||
|
||||
|
|
@ -30,12 +30,12 @@ class ProcessChanges
|
|||
}
|
||||
|
||||
/**
|
||||
* @param BusinessProcess $bp
|
||||
* @param BpConfig $bp
|
||||
* @param Session $session
|
||||
*
|
||||
* @return ProcessChanges
|
||||
*/
|
||||
public static function construct(BusinessProcess $bp, Session $session)
|
||||
public static function construct(BpConfig $bp, Session $session)
|
||||
{
|
||||
$key = 'changes.' . $bp->getName();
|
||||
$changes = new ProcessChanges();
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ abstract class Node
|
|||
/**
|
||||
* Main business process object
|
||||
*
|
||||
* @var BusinessProcess
|
||||
* @var BpConfig
|
||||
*/
|
||||
protected $bp;
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ abstract class Node
|
|||
99 => 'PENDING'
|
||||
);
|
||||
|
||||
abstract public function __construct(BusinessProcess $bp, $object);
|
||||
abstract public function __construct(BpConfig $bp, $object);
|
||||
|
||||
public function setMissing($missing = true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Icinga\Module\Businessprocess\Renderer;
|
|||
use Icinga\Date\DateFormatter;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
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\Element;
|
||||
use Icinga\Module\Businessprocess\Html\Html;
|
||||
|
|
@ -15,7 +15,7 @@ use Icinga\Module\Businessprocess\Web\Url;
|
|||
|
||||
abstract class Renderer extends Html
|
||||
{
|
||||
/** @var BusinessProcess */
|
||||
/** @var BpConfig */
|
||||
protected $bp;
|
||||
|
||||
/** @var BpNode */
|
||||
|
|
@ -39,17 +39,17 @@ abstract class Renderer extends Html
|
|||
/**
|
||||
* Renderer constructor.
|
||||
*
|
||||
* @param BusinessProcess $bp
|
||||
* @param BpConfig $bp
|
||||
* @param BpNode|null $parent
|
||||
*/
|
||||
public function __construct(BusinessProcess $bp, BpNode $parent = null)
|
||||
public function __construct(BpConfig $bp, BpNode $parent = null)
|
||||
{
|
||||
$this->bp = $bp;
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BusinessProcess
|
||||
* @return BpConfig
|
||||
*/
|
||||
public function getBusinessProcess()
|
||||
{
|
||||
|
|
@ -299,7 +299,7 @@ abstract class Renderer extends Html
|
|||
)->setContent(DateFormatter::timeSince($time, $timeOnly));
|
||||
}
|
||||
|
||||
protected function createUnboundParent(BusinessProcess $bp)
|
||||
protected function createUnboundParent(BpConfig $bp)
|
||||
{
|
||||
$unbound = $bp->getUnboundNodes();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Icinga\Module\Businessprocess\Renderer;
|
||||
|
||||
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\Element;
|
||||
use Icinga\Module\Businessprocess\Html\Icon;
|
||||
|
|
@ -31,10 +31,10 @@ class TreeRenderer extends Renderer
|
|||
}
|
||||
|
||||
/**
|
||||
* @param BusinessProcess $bp
|
||||
* @param BpConfig $bp
|
||||
* @return string
|
||||
*/
|
||||
public function renderBp(BusinessProcess $bp)
|
||||
public function renderBp(BpConfig $bp)
|
||||
{
|
||||
$html = array();
|
||||
if ($this->wantsRootNodes()) {
|
||||
|
|
@ -94,13 +94,13 @@ class TreeRenderer extends Renderer
|
|||
}
|
||||
|
||||
/**
|
||||
* @param BusinessProcess $bp
|
||||
* @param BpConfig $bp
|
||||
* @param Node $node
|
||||
* @param array $path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderNode(BusinessProcess $bp, Node $node, $path = array())
|
||||
public function renderNode(BpConfig $bp, Node $node, $path = array())
|
||||
{
|
||||
$table = Element::create(
|
||||
'table',
|
||||
|
|
@ -179,7 +179,7 @@ class TreeRenderer extends Renderer
|
|||
return $table;
|
||||
}
|
||||
|
||||
protected function getActionIcons(BusinessProcess $bp, Node $node)
|
||||
protected function getActionIcons(BpConfig $bp, Node $node)
|
||||
{
|
||||
if ($node instanceof BpNode) {
|
||||
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(
|
||||
'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(
|
||||
'magic',
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class ServiceNode extends MonitoredNode
|
|||
|
||||
protected $className = 'service';
|
||||
|
||||
public function __construct(BusinessProcess $bp, $object)
|
||||
public function __construct(BpConfig $bp, $object)
|
||||
{
|
||||
$this->name = $object->hostname . ';' . $object->service;
|
||||
$this->hostname = $object->hostname;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class Simulation
|
|||
protected $session;
|
||||
|
||||
/**
|
||||
* @var BusinessProcess
|
||||
* @var BpConfig
|
||||
*/
|
||||
protected $bp;
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ class Simulation
|
|||
*/
|
||||
protected $simulations;
|
||||
|
||||
public function __construct(BusinessProcess $bp, SessionNamespace $session)
|
||||
public function __construct(BpConfig $bp, SessionNamespace $session)
|
||||
{
|
||||
$this->bp = $bp;
|
||||
$this->session = $session;
|
||||
|
|
|
|||
|
|
@ -5,24 +5,24 @@ namespace Icinga\Module\Businessprocess\State;
|
|||
use Exception;
|
||||
use Icinga\Application\Benchmark;
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Monitoring\Backend\MonitoringBackend;
|
||||
|
||||
class MonitoringState
|
||||
{
|
||||
/** @var BusinessProcess */
|
||||
/** @var BpConfig */
|
||||
protected $config;
|
||||
|
||||
/** @var MonitoringBackend */
|
||||
protected $backend;
|
||||
|
||||
private function __construct(BusinessProcess $config)
|
||||
private function __construct(BpConfig $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->backend = $config->getBackend();
|
||||
}
|
||||
|
||||
public static function apply(BusinessProcess $config)
|
||||
public static function apply(BpConfig $config)
|
||||
{
|
||||
$self = new static($config);
|
||||
$self->retrieveStatesFromBackend();
|
||||
|
|
@ -101,7 +101,7 @@ class MonitoringState
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected function handleDbRow($row, BusinessProcess $config)
|
||||
protected function handleDbRow($row, BpConfig $config)
|
||||
{
|
||||
$key = $row->hostname;
|
||||
if (property_exists($row, 'service')) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use Icinga\Application\Benchmark;
|
|||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Exception\SystemPermissionException;
|
||||
use Icinga\Module\Businessprocess\BpNode;
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\Metadata;
|
||||
|
||||
class LegacyConfigParser
|
||||
|
|
@ -19,7 +19,7 @@ class LegacyConfigParser
|
|||
|
||||
protected $name;
|
||||
|
||||
/** @var BusinessProcess */
|
||||
/** @var BpConfig */
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
|
|
@ -30,12 +30,12 @@ class LegacyConfigParser
|
|||
private function __construct($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->config = new BusinessProcess();
|
||||
$this->config = new BpConfig();
|
||||
$this->config->setName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BusinessProcess
|
||||
* @return BpConfig
|
||||
*/
|
||||
public function getParsedConfig()
|
||||
{
|
||||
|
|
@ -147,9 +147,9 @@ class LegacyConfigParser
|
|||
|
||||
/**
|
||||
* @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);
|
||||
$bp->getBpNode($name)->setAlias($desc)->setDisplay($display);
|
||||
|
|
@ -160,28 +160,28 @@ class LegacyConfigParser
|
|||
|
||||
/**
|
||||
* @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);
|
||||
$bp->getBpNode($name)->setInfoCommand($script);
|
||||
}
|
||||
|
||||
protected function parseExtraInfo(& $line, BusinessProcess $bp)
|
||||
protected function parseExtraInfo(& $line, BpConfig $bp)
|
||||
{
|
||||
// TODO: Not yet
|
||||
// list($name, $script) = preg_split('~\s*;\s*~', substr($line, 14), 2);
|
||||
// $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);
|
||||
$bp->getBpNode($name)->setInfoUrl($url);
|
||||
}
|
||||
|
||||
protected function parseExtraLine(& $line, $typeLength, BusinessProcess $bp)
|
||||
protected function parseExtraLine(& $line, $typeLength, BpConfig $bp)
|
||||
{
|
||||
$type = substr($line, 0, $typeLength);
|
||||
if (substr($type, 0, 7) === 'display') {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Icinga\Module\Businessprocess\Storage;
|
||||
|
||||
use Icinga\Module\Businessprocess\BpNode;
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
|
||||
class LegacyConfigRenderer
|
||||
{
|
||||
|
|
@ -13,9 +13,9 @@ class LegacyConfigRenderer
|
|||
/**
|
||||
* LecagyConfigRenderer constructor
|
||||
*
|
||||
* @param BusinessProcess $config
|
||||
* @param BpConfig $config
|
||||
*/
|
||||
public function __construct(BusinessProcess $config)
|
||||
public function __construct(BpConfig $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
|
@ -29,10 +29,10 @@ class LegacyConfigRenderer
|
|||
}
|
||||
|
||||
/**
|
||||
* @param BusinessProcess $config
|
||||
* @param BpConfig $config
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderConfig(BusinessProcess $config)
|
||||
public static function renderConfig(BpConfig $config)
|
||||
{
|
||||
$renderer = new static($config);
|
||||
return $renderer->render();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Icinga\Module\Businessprocess\Storage;
|
|||
|
||||
use DirectoryIterator;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Exception\SystemPermissionException;
|
||||
|
||||
class LegacyStorage extends Storage
|
||||
|
|
@ -125,7 +125,7 @@ class LegacyStorage extends Storage
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function storeProcess(BusinessProcess $process)
|
||||
public function storeProcess(BpConfig $process)
|
||||
{
|
||||
file_put_contents(
|
||||
$this->getFilename($process->getName()),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Icinga\Module\Businessprocess\Storage;
|
||||
|
||||
use Icinga\Data\ConfigObject;
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\Metadata;
|
||||
|
||||
abstract class Storage
|
||||
|
|
@ -65,18 +65,18 @@ abstract class Storage
|
|||
|
||||
/**
|
||||
* @param $name
|
||||
* @return BusinessProcess
|
||||
* @return BpConfig
|
||||
*/
|
||||
abstract public function loadProcess($name);
|
||||
|
||||
/**
|
||||
* Store eventual changes applied to the given configuration
|
||||
*
|
||||
* @param BusinessProcess $config
|
||||
* @param BpConfig $config
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function storeProcess(BusinessProcess $config);
|
||||
abstract public function storeProcess(BpConfig $config);
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Icinga\Module\Businessprocess\Test;
|
|||
use Icinga\Application\Config;
|
||||
use Icinga\Application\ApplicationBootstrap;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\Storage\LegacyStorage;
|
||||
use Icinga\Module\Businessprocess\Web\FakeRequest;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
|
|
@ -30,7 +30,7 @@ abstract class BaseTestCase extends PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
/***
|
||||
* @return BusinessProcess
|
||||
* @return BpConfig
|
||||
*/
|
||||
protected function makeLoop()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Icinga\Module\Businessprocess\Web\Component;
|
||||
|
||||
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\Link;
|
||||
use Icinga\Module\Businessprocess\Renderer\Renderer;
|
||||
|
|
@ -12,7 +12,7 @@ use Icinga\Module\Businessprocess\Web\Url;
|
|||
|
||||
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();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Icinga\Module\Businessprocess\Web;
|
||||
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\Html\HtmlTag;
|
||||
use Icinga\Module\Businessprocess\Modification\ProcessChanges;
|
||||
use Icinga\Module\Businessprocess\Storage\LegacyStorage;
|
||||
|
|
@ -22,7 +22,7 @@ class Controller extends ModuleController
|
|||
/** @var View */
|
||||
public $view;
|
||||
|
||||
/** @var BusinessProcess */
|
||||
/** @var BpConfig */
|
||||
protected $bp;
|
||||
|
||||
/** @var Tabs */
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Tests\Icinga\Module\Businessprocess;
|
||||
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\HostNode;
|
||||
use Icinga\Module\Businessprocess\Test\BaseTestCase;
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ class HostNodeTest extends BaseTestCase
|
|||
*/
|
||||
public function testWhetherSettingAnInvalidStateFails()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$bp = new BpConfig();
|
||||
$host = $bp->createHost('localhost')->setState(98);
|
||||
$bp->createBp('p')->addChild($host)->getState();
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ class HostNodeTest extends BaseTestCase
|
|||
*/
|
||||
protected function localhost()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$bp = new BpConfig();
|
||||
return new HostNode($bp, (object) array(
|
||||
'hostname' => 'localhost',
|
||||
'state' => 0,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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\Storage\LegacyStorage;
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ class AndOperatorTest extends BaseTestCase
|
|||
|
||||
foreach ($expressions as $expression) {
|
||||
$this->assertInstanceOf(
|
||||
'Icinga\\Module\\Businessprocess\\Businessprocess',
|
||||
'Icinga\\Module\\Businessprocess\\BpConfig',
|
||||
$storage->loadFromString('dummy', $expression)
|
||||
);
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ class AndOperatorTest extends BaseTestCase
|
|||
|
||||
public function testWhetherSimpleAndOperationWorks()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$bp = new BpConfig();
|
||||
$bp->throwErrors();
|
||||
$host = $bp->createHost('localhost')->setState(1);
|
||||
$service = $bp->createService('localhost', 'ping')->setState(1);
|
||||
|
|
@ -130,7 +130,7 @@ class AndOperatorTest extends BaseTestCase
|
|||
|
||||
public function testWhetherSimpleOrOperationWorks()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$bp = new BpConfig();
|
||||
$bp->throwErrors();
|
||||
$host = $bp->createHost('localhost')->setState(1);
|
||||
$service = $bp->createService('localhost', 'ping')->setState(1);
|
||||
|
|
@ -145,7 +145,7 @@ class AndOperatorTest extends BaseTestCase
|
|||
|
||||
public function testWhetherPendingIsAccepted()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$bp = new BpConfig();
|
||||
$host = $bp->createHost('localhost')->setState(99);
|
||||
$service = $bp->createService('localhost', 'ping')->setState(99);
|
||||
$p = $bp->createBp('p')
|
||||
|
|
@ -160,7 +160,7 @@ class AndOperatorTest extends BaseTestCase
|
|||
|
||||
public function testWhetherWarningIsWorseThanPending()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$bp = new BpConfig();
|
||||
$host = $bp->createHost('localhost')->setState(99);
|
||||
$service = $bp->createService('localhost', 'ping')->setState(1);
|
||||
$p = $bp->createBp('p')
|
||||
|
|
@ -175,7 +175,7 @@ class AndOperatorTest extends BaseTestCase
|
|||
|
||||
public function testWhetherPendingIsWorseThanUpOrOk()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$bp = new BpConfig();
|
||||
$host = $bp->createHost('localhost')->setState(99);
|
||||
$service = $bp->createService('localhost', 'ping')->setState(0);
|
||||
$p = $bp->createBp('p')
|
||||
|
|
@ -198,7 +198,7 @@ class AndOperatorTest extends BaseTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return BusinessProcess
|
||||
* @return BpConfig
|
||||
*/
|
||||
protected function getBp()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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\Storage\LegacyStorage;
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ class MinOperatorTest extends BaseTestCase
|
|||
$this->getName();
|
||||
foreach ($expressions as $expression) {
|
||||
$this->assertInstanceOf(
|
||||
'Icinga\\Module\\Businessprocess\\Businessprocess',
|
||||
'Icinga\\Module\\Businessprocess\\BpConfig',
|
||||
$storage->loadFromString('dummy', $expression)
|
||||
);
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ class MinOperatorTest extends BaseTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return BusinessProcess
|
||||
* @return BpConfig
|
||||
*/
|
||||
protected function getBp()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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\Storage\LegacyStorage;
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ class NotOperatorTest extends BaseTestCase
|
|||
|
||||
foreach ($expressions as $expression) {
|
||||
$this->assertInstanceOf(
|
||||
'Icinga\\Module\\Businessprocess\\Businessprocess',
|
||||
'Icinga\\Module\\Businessprocess\\BpConfig',
|
||||
$storage->loadFromString('dummy', $expression)
|
||||
);
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ class NotOperatorTest extends BaseTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return BusinessProcess
|
||||
* @return BpConfig
|
||||
*/
|
||||
protected function getBp()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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\Storage\LegacyStorage;
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ class OrOperatorTest extends BaseTestCase
|
|||
|
||||
foreach ($expressions as $expression) {
|
||||
$this->assertInstanceOf(
|
||||
'Icinga\\Module\\Businessprocess\\Businessprocess',
|
||||
'Icinga\\Module\\Businessprocess\\BpConfig',
|
||||
$storage->loadFromString('dummy', $expression)
|
||||
);
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ class OrOperatorTest extends BaseTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return BusinessProcess
|
||||
* @return BpConfig
|
||||
*/
|
||||
protected function getBp()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Tests\Icinga\Module\Businessprocess;
|
||||
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\BpConfig;
|
||||
use Icinga\Module\Businessprocess\ServiceNode;
|
||||
use Icinga\Module\Businessprocess\Test\BaseTestCase;
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ class ServiceNodeTest extends BaseTestCase
|
|||
*/
|
||||
protected function pingOnLocalhost()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$bp = new BpConfig();
|
||||
return new ServiceNode($bp, (object) array(
|
||||
'hostname' => 'localhost',
|
||||
'service' => 'ping <> pong',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use Icinga\Module\Businessprocess\Storage\LegacyStorage;
|
|||
|
||||
class LegacyStorageTest extends BaseTestCase
|
||||
{
|
||||
private $processClass = 'Icinga\\Module\\Businessprocess\\BusinessProcess';
|
||||
private $processClass = 'Icinga\\Module\\Businessprocess\\BpConfig';
|
||||
|
||||
public function testCanBeInstantiatedWithAnEmptyConfigSection()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue