PHP Class AppserverIo\Appserver\Application\Application

Inheritance: extends Thread, implements AppserverIo\Psr\Application\ApplicationInterface, implements AppserverIo\Psr\Application\DirectoryAwareInterface, implements AppserverIo\Psr\Application\FilesystemAwareInterface, implements AppserverIo\Psr\Context\ContextInterface, use trait AppserverIo\Appserver\Core\Traits\ThreadedContextTrait
Afficher le fichier Open project: appserver-io/appserver Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( ) Initialize the internal members.
addClassLoader ( AppserverIo\Appserver\Core\Interfaces\ClassLoaderInterface $classLoader, AppserverIo\Appserver\Core\Api\Node\ClassLoaderNodeInterface $configuration ) : void Injects an additional class loader.
addLogger ( Psr\Log\LoggerInterface $logger, AppserverIo\Appserver\Core\Api\Node\LoggerNodeInterface $configuration ) : void Injects the logger instance and the configuration.
addManager ( AppserverIo\Psr\Application\ManagerInterface $manager, AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface $configuration ) : void Injects manager instance and the configuration.
addProvisioner ( AppserverIo\Psr\Application\ProvisionerInterface $provisioner, AppserverIo\Appserver\Core\Api\Node\ProvisionerNodeInterface $configuration ) : void Injects the provisioner instance and the configuration.
connect ( ) : void Has been automatically invoked by the container after the application instance has been created.
getAppBase ( ) : string Returns the absolute path to the applications base directory.
getBaseDirectory ( string $directoryToAppend = null ) : string Returns the absolute path to the servers document root directory
getCacheDir ( ) : string Returns the absolute path to the applications cache directory.
getClassLoader ( string $identifier ) : AppserverIo\Appserver\Core\Interfaces\ClassLoaderInterface Return the requested class loader instance
getClassLoaders ( ) : AppserverIo\Storage\GenericStackable Return the class loaders.
getContainer ( ) : AppserverIo\Appserver\Core\Interfaces\ContainerInterface Return's the container instance the application is bound to.
getContainerName ( ) : string Returns the name of the container the application is bound to.
getContainerRunlevel ( ) : string Returns the runlevel of the container the application is bound to.
getEnvironmentName ( ) : string Returns the applications environment name
getGroup ( ) : string Returns the groupname the application should be executed with.
getInitialContext ( ) : AppserverIo\Appserver\Application\Interfaces\ContextInterface Returns the initial context instance.
getLogger ( string $name = LoggerUtils::SYSTEM ) : Psr\Log\LoggerInterface | null Return the requested logger instance, by default the application's system logger.
getLoggers ( ) : AppserverIo\Storage\GenericStackable Returns the logger instances.
getManager ( string $identifier ) : AppserverIo\Psr\Application\ManagerInterface Return the requested manager instance.
getManagers ( ) : AppserverIo\Storage\GenericStackable Returns the manager instances.
getName ( ) : string Returns the application name (that has to be the class namespace, e.g. example)
getNamingDirectory ( ) : AppserverIo\Psr\Naming\NamingDirectoryInterface Returns the applications naming directory.
getProvisioner ( string $identifier ) : AppserverIo\Psr\Application\ProvisionerInterface Return the requested provisioner instance.
getProvisioners ( ) : AppserverIo\Storage\GenericStackable Returns the provisioner instances.
getSerial ( ) : string Return's the application's UUID.
getSessionDir ( ) : string Returns the absolute path to the applications session directory.
getTmpDir ( ) : string Returns the absolute path to the applications temporary directory.
getUmask ( ) : string Returns the umask the application should create files/directories with.
getUniqueName ( ) : string Return's the unique application name that is the container + application name separated with a slash, e. g. combined-appserver/example.
getUser ( ) : string Returns the username the application should be executed with.
getWebappPath ( ) : string Returns the absolute path to the web application base directory.
initializeManagers ( ) : void Registers all managers in the application.
injectClassLoaders ( AppserverIo\Storage\GenericStackable $classLoaders ) : void Injects the storage for the class loaders.
injectContainerName ( string $containerName ) : void Injects the name of the container the application is bound to.
injectContainerRunlevel ( string $containerRunlevel ) : void Injects the runlevel of the container the application is bound to.
injectEnvironmentName ( string $environmentName ) : void Inject the environment name
injectInitialContext ( AppserverIo\Appserver\Application\Interfaces\ContextInterface $initialContext ) : void The initial context instance.
injectLoggers ( AppserverIo\Storage\GenericStackable $loggers ) : void Injects the storage for the loggers.
injectManagers ( AppserverIo\Storage\GenericStackable $managers ) : void Injects the storage for the managers.
injectName ( string $name ) : void Injects the application name.
injectNamingDirectory ( AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory ) : void Injects the naming directory.
injectProvisioners ( AppserverIo\Storage\GenericStackable $provisioners ) : void Injects the storage for the provisioners.
isConnected ( ) : boolean TRUE if the application has been connected, else FALSE.
newService ( string $className ) : object (non-PHPdoc)
prepare ( AppserverIo\Appserver\Core\Interfaces\ContainerInterface $container, ContextNode $context ) : void Prepares the application with the specific data found in the passed context node.
provision ( ) : void Provisions the initialized application.
registerClassLoaders ( ) : void Registers all class loaders injected to the applications in the opposite order as they have been injected.
run ( ) : void This is the threads main() method that initializes the application with the autoloader and instantiates all the necessary manager instances.
search ( string $name, array $args = [] ) : mixed Queries the naming directory for the requested name and returns the value or invokes the bound callback.
shutdown ( ) : void Shutdown function to log unexpected errors.
stop ( ) : void Stops the application instance.
unload ( ) : void Cleanup the naming directory from the application entries.

Method Details

__construct() public méthode

Initialize the internal members.
public __construct ( )

addClassLoader() public méthode

Injects an additional class loader.
public addClassLoader ( AppserverIo\Appserver\Core\Interfaces\ClassLoaderInterface $classLoader, AppserverIo\Appserver\Core\Api\Node\ClassLoaderNodeInterface $configuration ) : void
$classLoader AppserverIo\Appserver\Core\Interfaces\ClassLoaderInterface A class loader to put on the class loader stack
$configuration AppserverIo\Appserver\Core\Api\Node\ClassLoaderNodeInterface The class loader's configuration
Résultat void

addLogger() public méthode

Injects the logger instance and the configuration.
public addLogger ( Psr\Log\LoggerInterface $logger, AppserverIo\Appserver\Core\Api\Node\LoggerNodeInterface $configuration ) : void
$logger Psr\Log\LoggerInterface A provisioner instance
$configuration AppserverIo\Appserver\Core\Api\Node\LoggerNodeInterface The provisioner configuration
Résultat void

addManager() public méthode

Injects manager instance and the configuration.
public addManager ( AppserverIo\Psr\Application\ManagerInterface $manager, AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface $configuration ) : void
$manager AppserverIo\Psr\Application\ManagerInterface A manager instance
$configuration AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface The managers configuration
Résultat void

addProvisioner() public méthode

Injects the provisioner instance and the configuration.
public addProvisioner ( AppserverIo\Psr\Application\ProvisionerInterface $provisioner, AppserverIo\Appserver\Core\Api\Node\ProvisionerNodeInterface $configuration ) : void
$provisioner AppserverIo\Psr\Application\ProvisionerInterface A provisioner instance
$configuration AppserverIo\Appserver\Core\Api\Node\ProvisionerNodeInterface The provisioner configuration
Résultat void

connect() public méthode

Has been automatically invoked by the container after the application instance has been created.
See also: Thread::run()
public connect ( ) : void
Résultat void

getAppBase() public méthode

Returns the absolute path to the applications base directory.
public getAppBase ( ) : string
Résultat string The app base directory

getBaseDirectory() public méthode

Returns the absolute path to the servers document root directory
public getBaseDirectory ( string $directoryToAppend = null ) : string
$directoryToAppend string The directory to append to the base directory
Résultat string The base directory with appended dir if given

getCacheDir() public méthode

Returns the absolute path to the applications cache directory.
public getCacheDir ( ) : string
Résultat string The app cache directory

getClassLoader() public méthode

Return the requested class loader instance
public getClassLoader ( string $identifier ) : AppserverIo\Appserver\Core\Interfaces\ClassLoaderInterface
$identifier string The unique identifier of the requested class loader
Résultat AppserverIo\Appserver\Core\Interfaces\ClassLoaderInterface The class loader instance

getClassLoaders() public méthode

Return the class loaders.
public getClassLoaders ( ) : AppserverIo\Storage\GenericStackable
Résultat AppserverIo\Storage\GenericStackable The class loader instances

getContainer() public méthode

Return's the container instance the application is bound to.
public getContainer ( ) : AppserverIo\Appserver\Core\Interfaces\ContainerInterface
Résultat AppserverIo\Appserver\Core\Interfaces\ContainerInterface The container instance

getContainerName() public méthode

Returns the name of the container the application is bound to.
public getContainerName ( ) : string
Résultat string The container's name

getContainerRunlevel() public méthode

Returns the runlevel of the container the application is bound to.
public getContainerRunlevel ( ) : string
Résultat string The container's runlevel

getEnvironmentName() public méthode

Returns the applications environment name
public getEnvironmentName ( ) : string
Résultat string The applications environment name

getGroup() public méthode

Returns the groupname the application should be executed with.
public getGroup ( ) : string
Résultat string The groupname

getInitialContext() public méthode

Returns the initial context instance.
public getInitialContext ( ) : AppserverIo\Appserver\Application\Interfaces\ContextInterface
Résultat AppserverIo\Appserver\Application\Interfaces\ContextInterface The initial Context

getLogger() public méthode

Return the requested logger instance, by default the application's system logger.
public getLogger ( string $name = LoggerUtils::SYSTEM ) : Psr\Log\LoggerInterface | null
$name string The name of the requested logger
Résultat Psr\Log\LoggerInterface | null The logger instance

getLoggers() public méthode

Returns the logger instances.
public getLoggers ( ) : AppserverIo\Storage\GenericStackable
Résultat AppserverIo\Storage\GenericStackable The logger instances

getManager() public méthode

Return the requested manager instance.
public getManager ( string $identifier ) : AppserverIo\Psr\Application\ManagerInterface
$identifier string The unique identifier of the requested manager
Résultat AppserverIo\Psr\Application\ManagerInterface The manager instance

getManagers() public méthode

Returns the manager instances.
public getManagers ( ) : AppserverIo\Storage\GenericStackable
Résultat AppserverIo\Storage\GenericStackable The manager instances

getName() public méthode

Returns the application name (that has to be the class namespace, e.g. example)
public getName ( ) : string
Résultat string The application name

getNamingDirectory() public méthode

Returns the applications naming directory.
public getNamingDirectory ( ) : AppserverIo\Psr\Naming\NamingDirectoryInterface
Résultat AppserverIo\Psr\Naming\NamingDirectoryInterface The applications naming directory interface

getProvisioner() public méthode

Return the requested provisioner instance.
public getProvisioner ( string $identifier ) : AppserverIo\Psr\Application\ProvisionerInterface
$identifier string The unique identifier of the requested provisioner
Résultat AppserverIo\Psr\Application\ProvisionerInterface The provisioner instance

getProvisioners() public méthode

Returns the provisioner instances.
public getProvisioners ( ) : AppserverIo\Storage\GenericStackable
Résultat AppserverIo\Storage\GenericStackable The provisioner instances

getSerial() public méthode

Return's the application's UUID.
public getSerial ( ) : string
Résultat string The application's UUID

getSessionDir() public méthode

Returns the absolute path to the applications session directory.
public getSessionDir ( ) : string
Résultat string The app session directory

getTmpDir() public méthode

Returns the absolute path to the applications temporary directory.
public getTmpDir ( ) : string
Résultat string The app temporary directory

getUmask() public méthode

Returns the umask the application should create files/directories with.
public getUmask ( ) : string
Résultat string The umask

getUniqueName() public méthode

Return's the unique application name that is the container + application name separated with a slash, e. g. combined-appserver/example.
public getUniqueName ( ) : string
Résultat string

getUser() public méthode

Returns the username the application should be executed with.
public getUser ( ) : string
Résultat string The username

getWebappPath() public méthode

Returns the absolute path to the web application base directory.
public getWebappPath ( ) : string
Résultat string The path to the webapps folder

initializeManagers() public méthode

Registers all managers in the application.
public initializeManagers ( ) : void
Résultat void

injectClassLoaders() public méthode

Injects the storage for the class loaders.
public injectClassLoaders ( AppserverIo\Storage\GenericStackable $classLoaders ) : void
$classLoaders AppserverIo\Storage\GenericStackable The storage for the class loaders
Résultat void

injectContainerName() public méthode

Injects the name of the container the application is bound to.
public injectContainerName ( string $containerName ) : void
$containerName string The container's name
Résultat void

injectContainerRunlevel() public méthode

Injects the runlevel of the container the application is bound to.
public injectContainerRunlevel ( string $containerRunlevel ) : void
$containerRunlevel string The container's runlevel
Résultat void

injectEnvironmentName() public méthode

Inject the environment name
public injectEnvironmentName ( string $environmentName ) : void
$environmentName string The environment name to inject
Résultat void

injectInitialContext() public méthode

The initial context instance.
public injectInitialContext ( AppserverIo\Appserver\Application\Interfaces\ContextInterface $initialContext ) : void
$initialContext AppserverIo\Appserver\Application\Interfaces\ContextInterface The initial context instance
Résultat void

injectLoggers() public méthode

Injects the storage for the loggers.
public injectLoggers ( AppserverIo\Storage\GenericStackable $loggers ) : void
$loggers AppserverIo\Storage\GenericStackable The storage for the loggers
Résultat void

injectManagers() public méthode

Injects the storage for the managers.
public injectManagers ( AppserverIo\Storage\GenericStackable $managers ) : void
$managers AppserverIo\Storage\GenericStackable The storage for the managers
Résultat void

injectName() public méthode

Injects the application name.
public injectName ( string $name ) : void
$name string The application name
Résultat void

injectNamingDirectory() public méthode

Injects the naming directory.
public injectNamingDirectory ( AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory ) : void
$namingDirectory AppserverIo\Psr\Naming\NamingDirectoryInterface The naming directory instance
Résultat void

injectProvisioners() public méthode

Injects the storage for the provisioners.
public injectProvisioners ( AppserverIo\Storage\GenericStackable $provisioners ) : void
$provisioners AppserverIo\Storage\GenericStackable The storage for the provisioners
Résultat void

isConnected() public méthode

TRUE if the application has been connected, else FALSE.
public isConnected ( ) : boolean
Résultat boolean Returns TRUE if the application has been connected, else FALSE

newService() public méthode

(non-PHPdoc)
See also: AppserverIo\Appserver\Application\Interfaces\ContextInterface::newService()
public newService ( string $className ) : object
$className string The API service class name to return the instance for
Résultat object The service instance

prepare() public méthode

Prepares the application with the specific data found in the passed context node.
public prepare ( AppserverIo\Appserver\Core\Interfaces\ContainerInterface $container, ContextNode $context ) : void
$container AppserverIo\Appserver\Core\Interfaces\ContainerInterface The container instance bind the application to
$context AppserverIo\Appserver\Core\Api\Node\ContextNode The application configuration
Résultat void

provision() public méthode

Provisions the initialized application.
public provision ( ) : void
Résultat void

registerClassLoaders() public méthode

Registers all class loaders injected to the applications in the opposite order as they have been injected.
public registerClassLoaders ( ) : void
Résultat void

run() public méthode

This is the threads main() method that initializes the application with the autoloader and instantiates all the necessary manager instances.
public run ( ) : void
Résultat void

shutdown() public méthode

Shutdown function to log unexpected errors.
See also: http://php.net/register_shutdown_function
public shutdown ( ) : void
Résultat void

stop() public méthode

Stops the application instance.
public stop ( ) : void
Résultat void

unload() public méthode

Cleanup the naming directory from the application entries.
public unload ( ) : void
Résultat void