PHP Class AppserverIo\Appserver\Core\ApplicationServer

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

Protected Properties

Свойство Type Description
$instance AppserverIo\Appserver\Core\Interfaces\ApplicationServerInterface The application server instance itself.

Méthodes publiques

Méthode Description
bindService ( integer $runlevel, object $service ) : void Binds the passed service to the runlevel.
doctrine ( React\Socket\ConnectionInterface $conn, array $command ) : void Executes a Doctrine command.
getBootstrapConfigurationFilename ( ) : string Returns the name and the path of the bootstrap configuration file.
getConfigurationFilename ( ) : string Returns the name and the path of the system configuration file.
getInitialContext ( ) : InitialContext Return's the initial context instance.
getLogger ( string $name ) : Psr\Log\LoggerInterface | null Returns the requested logger instance.
getLoggers ( ) : array Returns the logger instances.
getNamingDirectory ( ) : AppserverIo\Psr\Naming\NamingDirectoryInterface Returns the naming directory instance.
getService ( integer $runlevel, string $name ) Returns the service for the passed runlevel and name.
getSystemConfiguration ( ) : AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface Returns the system configuration.
getSystemLogger ( ) : Psr\Log\LoggerInterface Return's the system logger instance.
init ( React\Socket\ConnectionInterface $conn = null, integer $runlevel = ApplicationServerInterface::FULL ) : void The runlevel to switch to.
keepRunning ( ) : boolean Query whether the application server should keep running or not.
mode ( React\Socket\ConnectionInterface $conn, string $mode ) : void Switch to the passed mode, which can either be 'dev', 'prod' or 'install'.
newService ( string $className ) : AppserverIo\Appserver\Core\Api\ServiceInterface Returns a new instance of the passed API service.
run ( ) The thread's run() method that runs asynchronously.
runlevelFromString ( string $runlevel ) : integer Translates and returns the runlevel of the passed a string representation.
runlevelToString ( integer $runlevel ) : string Translates and returns a string representation of the passed runlevel.
setInitialContext ( InitialContext $initialContext ) : void Sets the initial context instance.
setLoggers ( array $loggers ) Set's the logger instances.
setSystemConfiguration ( AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface $systemConfiguration ) : null Sets the system configuration.
shutdown ( ) : void Shutdown handler that checks for fatal/user errors.
singleton ( AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory, AppserverIo\Storage\GenericStackable $runlevels ) : AppserverIo\Appserver\Core\Interfaces\ApplicationServerInterface Creates a new singleton application server instance.
stopServices ( integer $runlevel ) : void Stops all services of the passed runlevel.
unbindService ( integer $runlevel, string $name ) : void Unbind the service with the passed name and runlevel.

Méthodes protégées

Méthode Description
__construct ( AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory, AppserverIo\Storage\GenericStackable $runlevels ) Initialize and start the application server.
doDoctrine ( array $command = [] ) : string Execute the Doctrine CLI tool.
doLoadBootstrap ( $bootstrapConfigurationFilename ) : BootstrapNode Loads the bootstrap configuration from the XML file.
doStopServices ( integer $runlevel ) : void Stops all services of the passed runlevel.
doSwitchSetupMode ( string $newMode, string $configurationFilename ) : void Switches the running setup mode to the passed value.

Method Details

__construct() protected méthode

Initialize and start the application server.
protected __construct ( AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory, AppserverIo\Storage\GenericStackable $runlevels )
$namingDirectory AppserverIo\Psr\Naming\NamingDirectoryInterface
$runlevels AppserverIo\Storage\GenericStackable The storage for the services

bindService() public méthode

Binds the passed service to the runlevel.
public bindService ( integer $runlevel, object $service ) : void
$runlevel integer The runlevel to bound the service to
$service object The service to bound
Résultat void

doDoctrine() protected méthode

Execute the Doctrine CLI tool.
protected doDoctrine ( array $command = [] ) : string
$command array The Doctrine command to be executed
Résultat string The commands output

doLoadBootstrap() protected méthode

Loads the bootstrap configuration from the XML file.
protected doLoadBootstrap ( $bootstrapConfigurationFilename ) : BootstrapNode
Résultat AppserverIo\Appserver\Core\Api\Node\BootstrapNode The boostrap configuration

doStopServices() protected méthode

Stops all services of the passed runlevel.
protected doStopServices ( integer $runlevel ) : void
$runlevel integer The runlevel to stop all services for
Résultat void

doSwitchSetupMode() protected méthode

Switches the running setup mode to the passed value.
protected doSwitchSetupMode ( string $newMode, string $configurationFilename ) : void
$newMode string The mode to switch to
$configurationFilename string The path of the configuration filename
Résultat void

doctrine() public méthode

Executes a Doctrine command.
public doctrine ( React\Socket\ConnectionInterface $conn, array $command ) : void
$conn React\Socket\ConnectionInterface The connection resource
$command array The array with the command elements to execute
Résultat void

getBootstrapConfigurationFilename() public méthode

Returns the name and the path of the bootstrap configuration file.
public getBootstrapConfigurationFilename ( ) : string
Résultat string Name and path of the bootstrap configuraiton file

getConfigurationFilename() public méthode

Returns the name and the path of the system configuration file.
public getConfigurationFilename ( ) : string
Résultat string Name and path of the sytsem configuration file

getInitialContext() public méthode

Return's the initial context instance.
public getInitialContext ( ) : InitialContext
Résultat InitialContext The initial context instance

getLogger() public méthode

Returns the requested logger instance.
public getLogger ( string $name ) : Psr\Log\LoggerInterface | null
$name string Name of the requested logger instance
Résultat Psr\Log\LoggerInterface | null The requested logger instance

getLoggers() public méthode

Returns the logger instances.
public getLoggers ( ) : array
Résultat array The logger instances

getNamingDirectory() public méthode

Returns the naming directory instance.
public getNamingDirectory ( ) : AppserverIo\Psr\Naming\NamingDirectoryInterface
Résultat AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory The default naming directory

getService() public méthode

Returns the service for the passed runlevel and name.
public getService ( integer $runlevel, string $name )
$runlevel integer The runlevel of the requested service
$name string The name of the requested service

getSystemConfiguration() public méthode

Returns the system configuration.
public getSystemConfiguration ( ) : AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface
Résultat AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface The system configuration

getSystemLogger() public méthode

Return's the system logger instance.
public getSystemLogger ( ) : Psr\Log\LoggerInterface
Résultat Psr\Log\LoggerInterface The system logger instance

init() public méthode

The runlevel to switch to.
public init ( React\Socket\ConnectionInterface $conn = null, integer $runlevel = ApplicationServerInterface::FULL ) : void
$conn React\Socket\ConnectionInterface The connection resource
$runlevel integer The new runlevel to switch to
Résultat void

keepRunning() public méthode

Query whether the application server should keep running or not.
public keepRunning ( ) : boolean
Résultat boolean TRUE if the server should keep running, else FALSE

mode() public méthode

Switch to the passed mode, which can either be 'dev', 'prod' or 'install'.
public mode ( React\Socket\ConnectionInterface $conn, string $mode ) : void
$conn React\Socket\ConnectionInterface The connection resource
$mode string The setup mode to switch to
Résultat void

newService() public méthode

Returns a new instance of the passed API service.
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

run() public méthode

The thread's run() method that runs asynchronously.
public run ( )

runlevelFromString() public méthode

Translates and returns the runlevel of the passed a string representation.
public runlevelFromString ( string $runlevel ) : integer
$runlevel string The string representation of the runlevel to return
Résultat integer The runlevel of the passed string representation

runlevelToString() public méthode

Translates and returns a string representation of the passed runlevel.
public runlevelToString ( integer $runlevel ) : string
$runlevel integer The runlevel to return the string representation for
Résultat string The string representation for the passed runlevel

setInitialContext() public méthode

Sets the initial context instance.
public setInitialContext ( InitialContext $initialContext ) : void
$initialContext InitialContext The initial context instance
Résultat void

setLoggers() public méthode

Set's the logger instances.
public setLoggers ( array $loggers )
$loggers array The logger instances to set

setSystemConfiguration() public méthode

Sets the system configuration.
public setSystemConfiguration ( AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface $systemConfiguration ) : null
$systemConfiguration AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface The system configuration object
Résultat null

shutdown() public méthode

Shutdown handler that checks for fatal/user errors.
public shutdown ( ) : void
Résultat void

singleton() public static méthode

Creates a new singleton application server instance.
public static singleton ( AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory, AppserverIo\Storage\GenericStackable $runlevels ) : AppserverIo\Appserver\Core\Interfaces\ApplicationServerInterface
$namingDirectory AppserverIo\Psr\Naming\NamingDirectoryInterface
$runlevels AppserverIo\Storage\GenericStackable The storage for the services
Résultat AppserverIo\Appserver\Core\Interfaces\ApplicationServerInterface The singleton application instance

stopServices() public méthode

Stops all services of the passed runlevel.
public stopServices ( integer $runlevel ) : void
$runlevel integer The runlevel to stop all services for
Résultat void

unbindService() public méthode

Unbind the service with the passed name and runlevel.
public unbindService ( integer $runlevel, string $name ) : void
$runlevel integer The runlevel of the service
$name string The name of the service
Résultat void

Property Details

$instance protected_oe static_oe property

The application server instance itself.
protected static ApplicationServerInterface,AppserverIo\Appserver\Core\Interfaces $instance
Résultat AppserverIo\Appserver\Core\Interfaces\ApplicationServerInterface