PHP Класс AppserverIo\Appserver\Application\Application

Автор: Tim Wagner ([email protected])
Наследование: 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
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__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.

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

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

Initialize the internal members.
public __construct ( )

addClassLoader() публичный Метод

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
Результат void

addLogger() публичный Метод

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
Результат void

addManager() публичный Метод

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
Результат void

addProvisioner() публичный Метод

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
Результат void

connect() публичный Метод

Has been automatically invoked by the container after the application instance has been created.
См. также: Thread::run()
public connect ( ) : void
Результат void

getAppBase() публичный Метод

Returns the absolute path to the applications base directory.
public getAppBase ( ) : string
Результат string The app base directory

getBaseDirectory() публичный Метод

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
Результат string The base directory with appended dir if given

getCacheDir() публичный Метод

Returns the absolute path to the applications cache directory.
public getCacheDir ( ) : string
Результат string The app cache directory

getClassLoader() публичный Метод

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
Результат AppserverIo\Appserver\Core\Interfaces\ClassLoaderInterface The class loader instance

getClassLoaders() публичный Метод

Return the class loaders.
public getClassLoaders ( ) : AppserverIo\Storage\GenericStackable
Результат AppserverIo\Storage\GenericStackable The class loader instances

getContainer() публичный Метод

Return's the container instance the application is bound to.
public getContainer ( ) : AppserverIo\Appserver\Core\Interfaces\ContainerInterface
Результат AppserverIo\Appserver\Core\Interfaces\ContainerInterface The container instance

getContainerName() публичный Метод

Returns the name of the container the application is bound to.
public getContainerName ( ) : string
Результат string The container's name

getContainerRunlevel() публичный Метод

Returns the runlevel of the container the application is bound to.
public getContainerRunlevel ( ) : string
Результат string The container's runlevel

getEnvironmentName() публичный Метод

Returns the applications environment name
public getEnvironmentName ( ) : string
Результат string The applications environment name

getGroup() публичный Метод

Returns the groupname the application should be executed with.
public getGroup ( ) : string
Результат string The groupname

getInitialContext() публичный Метод

Returns the initial context instance.
public getInitialContext ( ) : AppserverIo\Appserver\Application\Interfaces\ContextInterface
Результат AppserverIo\Appserver\Application\Interfaces\ContextInterface The initial Context

getLogger() публичный Метод

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
Результат Psr\Log\LoggerInterface | null The logger instance

getLoggers() публичный Метод

Returns the logger instances.
public getLoggers ( ) : AppserverIo\Storage\GenericStackable
Результат AppserverIo\Storage\GenericStackable The logger instances

getManager() публичный Метод

Return the requested manager instance.
public getManager ( string $identifier ) : AppserverIo\Psr\Application\ManagerInterface
$identifier string The unique identifier of the requested manager
Результат AppserverIo\Psr\Application\ManagerInterface The manager instance

getManagers() публичный Метод

Returns the manager instances.
public getManagers ( ) : AppserverIo\Storage\GenericStackable
Результат AppserverIo\Storage\GenericStackable The manager instances

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

Returns the application name (that has to be the class namespace, e.g. example)
public getName ( ) : string
Результат string The application name

getNamingDirectory() публичный Метод

Returns the applications naming directory.
public getNamingDirectory ( ) : AppserverIo\Psr\Naming\NamingDirectoryInterface
Результат AppserverIo\Psr\Naming\NamingDirectoryInterface The applications naming directory interface

getProvisioner() публичный Метод

Return the requested provisioner instance.
public getProvisioner ( string $identifier ) : AppserverIo\Psr\Application\ProvisionerInterface
$identifier string The unique identifier of the requested provisioner
Результат AppserverIo\Psr\Application\ProvisionerInterface The provisioner instance

getProvisioners() публичный Метод

Returns the provisioner instances.
public getProvisioners ( ) : AppserverIo\Storage\GenericStackable
Результат AppserverIo\Storage\GenericStackable The provisioner instances

getSerial() публичный Метод

Return's the application's UUID.
public getSerial ( ) : string
Результат string The application's UUID

getSessionDir() публичный Метод

Returns the absolute path to the applications session directory.
public getSessionDir ( ) : string
Результат string The app session directory

getTmpDir() публичный Метод

Returns the absolute path to the applications temporary directory.
public getTmpDir ( ) : string
Результат string The app temporary directory

getUmask() публичный Метод

Returns the umask the application should create files/directories with.
public getUmask ( ) : string
Результат string The umask

getUniqueName() публичный Метод

Return's the unique application name that is the container + application name separated with a slash, e. g. combined-appserver/example.
public getUniqueName ( ) : string
Результат string

getUser() публичный Метод

Returns the username the application should be executed with.
public getUser ( ) : string
Результат string The username

getWebappPath() публичный Метод

Returns the absolute path to the web application base directory.
public getWebappPath ( ) : string
Результат string The path to the webapps folder

initializeManagers() публичный Метод

Registers all managers in the application.
public initializeManagers ( ) : void
Результат void

injectClassLoaders() публичный Метод

Injects the storage for the class loaders.
public injectClassLoaders ( AppserverIo\Storage\GenericStackable $classLoaders ) : void
$classLoaders AppserverIo\Storage\GenericStackable The storage for the class loaders
Результат void

injectContainerName() публичный Метод

Injects the name of the container the application is bound to.
public injectContainerName ( string $containerName ) : void
$containerName string The container's name
Результат void

injectContainerRunlevel() публичный Метод

Injects the runlevel of the container the application is bound to.
public injectContainerRunlevel ( string $containerRunlevel ) : void
$containerRunlevel string The container's runlevel
Результат void

injectEnvironmentName() публичный Метод

Inject the environment name
public injectEnvironmentName ( string $environmentName ) : void
$environmentName string The environment name to inject
Результат void

injectInitialContext() публичный Метод

The initial context instance.
public injectInitialContext ( AppserverIo\Appserver\Application\Interfaces\ContextInterface $initialContext ) : void
$initialContext AppserverIo\Appserver\Application\Interfaces\ContextInterface The initial context instance
Результат void

injectLoggers() публичный Метод

Injects the storage for the loggers.
public injectLoggers ( AppserverIo\Storage\GenericStackable $loggers ) : void
$loggers AppserverIo\Storage\GenericStackable The storage for the loggers
Результат void

injectManagers() публичный Метод

Injects the storage for the managers.
public injectManagers ( AppserverIo\Storage\GenericStackable $managers ) : void
$managers AppserverIo\Storage\GenericStackable The storage for the managers
Результат void

injectName() публичный Метод

Injects the application name.
public injectName ( string $name ) : void
$name string The application name
Результат void

injectNamingDirectory() публичный Метод

Injects the naming directory.
public injectNamingDirectory ( AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory ) : void
$namingDirectory AppserverIo\Psr\Naming\NamingDirectoryInterface The naming directory instance
Результат void

injectProvisioners() публичный Метод

Injects the storage for the provisioners.
public injectProvisioners ( AppserverIo\Storage\GenericStackable $provisioners ) : void
$provisioners AppserverIo\Storage\GenericStackable The storage for the provisioners
Результат void

isConnected() публичный Метод

TRUE if the application has been connected, else FALSE.
public isConnected ( ) : boolean
Результат boolean Returns TRUE if the application has been connected, else FALSE

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

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

prepare() публичный Метод

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
Результат void

provision() публичный Метод

Provisions the initialized application.
public provision ( ) : void
Результат void

registerClassLoaders() публичный Метод

Registers all class loaders injected to the applications in the opposite order as they have been injected.
public registerClassLoaders ( ) : void
Результат void

run() публичный Метод

This is the threads main() method that initializes the application with the autoloader and instantiates all the necessary manager instances.
public run ( ) : void
Результат void

shutdown() публичный Метод

Shutdown function to log unexpected errors.
См. также: http://php.net/register_shutdown_function
public shutdown ( ) : void
Результат void

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

Stops the application instance.
public stop ( ) : void
Результат void

unload() публичный Метод

Cleanup the naming directory from the application entries.
public unload ( ) : void
Результат void