コード例 #1
0
 public function setUp(ExportDestination $destination, ExportVariables $variables)
 {
     //save parameters
     $this->destination = $destination;
     $this->variables = $variables;
     //print info message
     echo "Export API Demo\n";
     echo "Dummy for external system\n";
     echo "prints only information about exported objects\n\n";
     //print parameters
     echo "External System: Dummy\n";
     echo "Defined Parameters:\n";
     foreach ($destination->getParameterKeys() as $key) {
         echo "key {$key}:\t\t\tvalue " . $destination->getParameterValue($key) . "\n";
     }
     echo "\n";
     //print export start
     echo "Start of dummy export\n";
 }
コード例 #2
0
 public function setUp(ExportDestination $destination, ExportVariables $variables)
 {
     //get variables
     $this->variables = $variables;
     //check, if parameters are set
     $parameterKeys = $destination->getParameterKeys();
     if (!(in_array("resturl", $parameterKeys) && in_array("restuser", $parameterKeys) && in_array("restpassword", $parameterKeys) && in_array("requisition", $parameterKeys))) {
         throw new ExportExternalSystemException("Parameters for ExternalSystem not set correctly");
     }
     //get parameters for OpenNMS access
     $this->restUrl = $destination->getParameterValue("resturl");
     $this->restUser = $destination->getParameterValue("restuser");
     $this->restPassword = $destination->getParameterValue("restpassword");
     $this->requisition = $destination->getParameterValue("requisition");
     //set services array for services to bind on each node of the requisition
     $this->services = array();
     if (in_array("services", $parameterKeys)) {
         $services = explode(" ", $destination->getParameterValue("services"));
         if ($services != false) {
             $this->services = $services;
         }
     }
     //SSL verify option
     $this->sslVerify = "true";
     if (in_array("sslVerify", $parameterKeys)) {
         $this->sslVerify = $destination->getParameterValue("sslVerify");
     }
     //rescanExisting
     $this->rescanExisting = "true";
     if (in_array("rescanExisting", $parameterKeys)) {
         $this->rescanExisting = $destination->getParameterValue("rescanExisting");
     }
     //check connection to OpenNMS
     if (!$this->checkConnection()) {
         throw new ExportExternalSystemException("Cannot establish connection to OpenNMS REST API");
     }
     //start requisitionXml
     $this->requisitionXml = "";
 }
コード例 #3
0
 public function setUp(ExportDestination $destination, ExportVariables $variables)
 {
     //get variables
     $this->variables = $variables;
     //check, if parameters are set
     $parameterKeys = $destination->getParameterKeys();
     if (!(in_array("pleskApiUrl", $parameterKeys) && in_array("pleskApiUser", $parameterKeys) && in_array("pleskApiPassword", $parameterKeys) && in_array("domainName", $parameterKeys))) {
         throw new ExportExternalSystemException("Parameters for ExternalSystem not set correctly");
     }
     //get parameters for OpenNMS access
     $this->pleskApiUrl = $destination->getParameterValue("pleskApiUrl");
     $this->pleskApiUser = $destination->getParameterValue("pleskApiUser");
     $this->pleskApiPassword = $destination->getParameterValue("pleskApiPassword");
     $this->domainName = $destination->getParameterValue("domainName");
     //SSL verify option
     $this->pleskApiSslVerify = "true";
     if (in_array("pleskApiSslVerify", $parameterKeys)) {
         $this->pleskApiSslVerify = $destination->getParameterValue("pleskApiSslVerify");
     }
     //get all existing DNS records from Plesk Automation
     $this->existingRecords = $this->getARecords($this->domainName);
     $this->createdRecords = array();
 }