AppserverIo\Appserver\Core\Api\Node\ScannerNode::getPrimaryKey PHP Method

getPrimaryKey() public method

Returns the nodes primary key, the name by default.
See also: AppserverIo\Appserver\Core\Api\Node\AbstractNode::getPrimaryKey()
public getPrimaryKey ( ) : string
return string The nodes primary key
    public function getPrimaryKey()
    {
        return $this->getName();
    }

Usage Example

Example #1
0
 /**
  * Initializes the default scanners for archive based deployment.
  *
  * @return void
  */
 protected function initDefaultScanners()
 {
     // initialize the params for the deployment scanner
     $scannerParams = array();
     $intervalParam = new ParamNode('interval', 'integer', new NodeValue(1));
     $extensionsToWatchParam = new ParamNode('extensionsToWatch', 'string', new NodeValue('dodeploy, deployed'));
     $scannerParams[$intervalParam->getPrimaryKey()] = $intervalParam;
     $scannerParams[$extensionsToWatchParam->getPrimaryKey()] = $extensionsToWatchParam;
     // initialize the directories to scan
     $directories = array(new DirectoryNode(new NodeValue('deploy')));
     // initialize the deployment scanner
     $deploymentScanner = new ScannerNode('deployment', 'AppserverIo\\Appserver\\Core\\Scanner\\DeploymentScanner', 'AppserverIo\\Appserver\\Core\\Scanner\\DirectoryScannerFactory', $scannerParams, $directories);
     // add scanner to the appserver node
     $this->scanners[$deploymentScanner->getPrimaryKey()] = $deploymentScanner;
     // initialize the params for the logrotate scanner
     $scannerParams = array();
     $intervalParam = new ParamNode('interval', 'integer', new NodeValue(1));
     $extensionsToWatchParam = new ParamNode('extensionsToWatch', 'string', new NodeValue('log'));
     $scannerParams[$intervalParam->getPrimaryKey()] = $intervalParam;
     $scannerParams[$extensionsToWatchParam->getPrimaryKey()] = $extensionsToWatchParam;
     // initialize the directories to scan
     $directories = array(new DirectoryNode(new NodeValue('var/log')));
     // initialize the logrotate scanner
     $logrotateScanner = new ScannerNode('logrotate', 'AppserverIo\\Appserver\\Core\\Scanner\\LogrotateScanner', 'AppserverIo\\Appserver\\Core\\Scanner\\DirectoryScannerFactory', $scannerParams, $directories);
     // add scanner to the appserver node
     $this->scanners[$logrotateScanner->getPrimaryKey()] = $logrotateScanner;
     // initialize the params for the CRON scanner
     $scannerParams = array();
     $intervalParam = new ParamNode('interval', 'integer', new NodeValue(1));
     $scannerParams[$intervalParam->getPrimaryKey()] = $intervalParam;
     // initialize the CRON scanner
     $cronScanner = new ScannerNode('cron', 'AppserverIo\\Appserver\\Core\\Scanner\\CronScanner', 'AppserverIo\\Appserver\\Core\\Scanner\\StandardScannerFactory', $scannerParams);
     // add scanner to the appserver node
     $this->scanners[$cronScanner->getPrimaryKey()] = $cronScanner;
 }