PHP Класс AppserverIo\Appserver\Core\Scanner\AbstractScanner

Автор: Bernhard Wick ([email protected])
Наследование: extends AppserverIo\Appserver\Core\AbstractContextThread, implements AppserverIo\Appserver\Core\Interfaces\ScannerInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$distroMapping array The mapping of Linux distributions to their release file's name
$name string The unique scanner name.
$restartCommands array Array that contains the available startup scripts.
$service AppserverIo\Appserver\Core\Api\ContainerService The API service used to load the deployment directory.

Открытые методы

Метод Описание
__construct ( AppserverIo\Appserver\Application\Interfaces\ContextInterface $initialContext, string $name ) Constructor sets initialContext object per default and calls init function to pass other args.
getName ( ) : string Returns the unique scanner name.
getRestartCommand ( string $os, string | null $distVersion = null ) : string Returns the restart command for the passed OS if available.
getService ( ) : ContainerService Returns The API service, e. g. to load the deployment directory.
getSystemLogger ( ) : Psr\Log\LoggerInterface The system logger to use.
init ( ) : void Initalizes the scanner with the necessary service instance.
newService ( string $className ) : AppserverIo\Appserver\Core\Api\ServiceInterface (non-PHPdoc)
restart ( ) : void Restart the appserver using the appserverctl file in the sbin folder.
stop ( ) : void Stop's the scanner.

Защищенные методы

Метод Описание
getDirectoryHash ( SplFileInfo $directory ) : string Calculates an hash value for all files with certain extensions.
getDistributionVersion ( string | null $distribution = null, array $etcList = [] ) : string | boolean This method will check for the Linux release file normally stored in /etc and will return the version of the distribution
getEtcDir ( ) : string Returns the systems configuration root directory aka "etc"
getExtensionsToWatch ( ) : array Returns an array with file extensions that are used to create the directory hash.
getLastFileTouch ( string $file ) : integer Returns the time when the contents of the file were changed. The time returned is a UNIX timestamp.
getLinuxDistribution ( array $etcList = [] ) : string | boolean This method will check for the Linux release file normally stored in /etc and will return the corresponding distribution

Описание методов

__construct() публичный метод

Constructor sets initialContext object per default and calls init function to pass other args.
public __construct ( AppserverIo\Appserver\Application\Interfaces\ContextInterface $initialContext, string $name )
$initialContext AppserverIo\Appserver\Application\Interfaces\ContextInterface The initial context instance
$name string The unique scanner name from the configuration

getDirectoryHash() защищенный метод

This is used to test if the hash value changed, so if it changed, the appserver can react accordingly.
protected getDirectoryHash ( SplFileInfo $directory ) : string
$directory SplFileInfo The directory to watch
Результат string The hash value build out of the found filenames

getDistributionVersion() защищенный метод

This method will check for the Linux release file normally stored in /etc and will return the version of the distribution
protected getDistributionVersion ( string | null $distribution = null, array $etcList = [] ) : string | boolean
$distribution string | null Distribution to search a version for
$etcList array List of already collected AND flipped release files we need to filter
Результат string | boolean

getEtcDir() защищенный метод

Returns the systems configuration root directory aka "etc"
protected getEtcDir ( ) : string
Результат string

getExtensionsToWatch() абстрактный защищенный метод

Returns an array with file extensions that are used to create the directory hash.
См. также: AppserverIo\Appserver\Core\Scanner\AbstractScanner::getDirectoryHash()
abstract protected getExtensionsToWatch ( ) : array
Результат array The array with the file extensions

getLastFileTouch() защищенный метод

If the file doesn't exists, the method returns 0 to signal that the no successfull depolyment has been processed so far, e. g. the server has been installed and not been started yet.
protected getLastFileTouch ( string $file ) : integer
$file string The deployment directory
Результат integer The UNIX timestamp with the last successfully deployment date or 0 if no successful deployment has been processed

getLinuxDistribution() защищенный метод

This method will check for the Linux release file normally stored in /etc and will return the corresponding distribution
protected getLinuxDistribution ( array $etcList = [] ) : string | boolean
$etcList array List of already collected AND flipped release files we need to filter
Результат string | boolean

getName() публичный метод

Returns the unique scanner name.
См. также: AppserverIo\Appserver\Core\Interfaces\ScannerInterface::getName()
public getName ( ) : string
Результат string The scanner name

getRestartCommand() публичный метод

Returns the restart command for the passed OS if available.
public getRestartCommand ( string $os, string | null $distVersion = null ) : string
$os string The OS to return the restart command for
$distVersion string | null Version of the operating system to get the restart command for
Результат string The restart command

getService() публичный метод

Returns The API service, e. g. to load the deployment directory.
public getService ( ) : ContainerService
Результат AppserverIo\Appserver\Core\Api\ContainerService The API service instance

getSystemLogger() публичный метод

The system logger to use.
public getSystemLogger ( ) : Psr\Log\LoggerInterface
Результат Psr\Log\LoggerInterface The system logger instance

init() публичный метод

Initalizes the scanner with the necessary service instance.
См. также: AppserverIo\Appserver\Core\AbstractThread::init()
public init ( ) : void
Результат void

newService() публичный метод

(non-PHPdoc)
См. также: AppserverIo\Appserver\Core\InitialContext::newService()
public newService ( string $className ) : AppserverIo\Appserver\Core\Api\ServiceInterface
$className string The API service class name to return the instance for
Результат AppserverIo\Appserver\Core\Api\ServiceInterface The service instance

restart() публичный метод

Restart the appserver using the appserverctl file in the sbin folder.
public restart ( ) : void
Результат void

stop() публичный метод

Stop's the scanner.
См. также: AppserverIo\Appserver\Core\Interfaces\ScannerInterface::stop()
public stop ( ) : void
Результат void

Описание свойств

$distroMapping защищенное свойство

The mapping of Linux distributions to their release file's name
protected array $distroMapping
Результат array

$name защищенное свойство

The unique scanner name.
protected string $name
Результат string

$restartCommands защищенное свойство

Array that contains the available startup scripts.
protected array $restartCommands
Результат array

$service защищенное свойство

The API service used to load the deployment directory.
protected ContainerService,AppserverIo\Appserver\Core\Api $service
Результат AppserverIo\Appserver\Core\Api\ContainerService