PHP Class AppserverIo\Appserver\Core\ApplicationServer

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

Protected Properties

Property Type Description
$instance AppserverIo\Appserver\Core\Interfaces\ApplicationServerInterface The application server instance itself.

Public Methods

Method 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.

Protected Methods

Method 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 method

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 method

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
return void

doDoctrine() protected method

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

doLoadBootstrap() protected method

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

doStopServices() protected method

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

doSwitchSetupMode() protected method

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
return void

doctrine() public method

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
return void

getBootstrapConfigurationFilename() public method

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

getConfigurationFilename() public method

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

getInitialContext() public method

Return's the initial context instance.
public getInitialContext ( ) : InitialContext
return InitialContext The initial context instance

getLogger() public method

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

getLoggers() public method

Returns the logger instances.
public getLoggers ( ) : array
return array The logger instances

getNamingDirectory() public method

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

getService() public method

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 method

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

getSystemLogger() public method

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

init() public method

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
return void

keepRunning() public method

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

mode() public method

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
return void

newService() public method

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
return AppserverIo\Appserver\Core\Api\ServiceInterface The service instance

run() public method

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

runlevelFromString() public method

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
return integer The runlevel of the passed string representation

runlevelToString() public method

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
return string The string representation for the passed runlevel

setInitialContext() public method

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

setLoggers() public method

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

setSystemConfiguration() public method

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

shutdown() public method

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

singleton() public static method

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
return AppserverIo\Appserver\Core\Interfaces\ApplicationServerInterface The singleton application instance

stopServices() public method

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

unbindService() public method

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
return void

Property Details

$instance protected_oe static_oe property

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