PHP Class AppserverIo\Appserver\Core\Scanner\AbstractScanner

Inheritance: extends AppserverIo\Appserver\Core\AbstractContextThread, implements AppserverIo\Appserver\Core\Interfaces\ScannerInterface
Afficher le fichier Open project: appserver-io/appserver Class Usage Examples

Protected Properties

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
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

Method Details

__construct() public méthode

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() protected méthode

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
Résultat string The hash value build out of the found filenames

getDistributionVersion() protected méthode

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
Résultat string | boolean

getEtcDir() protected méthode

Returns the systems configuration root directory aka "etc"
protected getEtcDir ( ) : string
Résultat string

getExtensionsToWatch() abstract protected méthode

Returns an array with file extensions that are used to create the directory hash.
See also: AppserverIo\Appserver\Core\Scanner\AbstractScanner::getDirectoryHash()
abstract protected getExtensionsToWatch ( ) : array
Résultat array The array with the file extensions

getLastFileTouch() protected méthode

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
Résultat integer The UNIX timestamp with the last successfully deployment date or 0 if no successful deployment has been processed

getLinuxDistribution() protected méthode

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
Résultat string | boolean

getName() public méthode

Returns the unique scanner name.
See also: AppserverIo\Appserver\Core\Interfaces\ScannerInterface::getName()
public getName ( ) : string
Résultat string The scanner name

getRestartCommand() public méthode

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
Résultat string The restart command

getService() public méthode

Returns The API service, e. g. to load the deployment directory.
public getService ( ) : ContainerService
Résultat AppserverIo\Appserver\Core\Api\ContainerService The API service instance

getSystemLogger() public méthode

The system logger to use.
public getSystemLogger ( ) : Psr\Log\LoggerInterface
Résultat Psr\Log\LoggerInterface The system logger instance

init() public méthode

Initalizes the scanner with the necessary service instance.
See also: AppserverIo\Appserver\Core\AbstractThread::init()
public init ( ) : void
Résultat void

newService() public méthode

(non-PHPdoc)
See also: 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
Résultat AppserverIo\Appserver\Core\Api\ServiceInterface The service instance

restart() public méthode

Restart the appserver using the appserverctl file in the sbin folder.
public restart ( ) : void
Résultat void

stop() public méthode

Stop's the scanner.
See also: AppserverIo\Appserver\Core\Interfaces\ScannerInterface::stop()
public stop ( ) : void
Résultat void

Property Details

$distroMapping protected_oe property

The mapping of Linux distributions to their release file's name
protected array $distroMapping
Résultat array

$name protected_oe property

The unique scanner name.
protected string $name
Résultat string

$restartCommands protected_oe property

Array that contains the available startup scripts.
protected array $restartCommands
Résultat array

$service protected_oe property

The API service used to load the deployment directory.
protected ContainerService,AppserverIo\Appserver\Core\Api $service
Résultat AppserverIo\Appserver\Core\Api\ContainerService