PHP Class AppserverIo\Appserver\Core\AbstractContainerThread

Author: Tim Wagner ([email protected])
Author: Johann Zelger ([email protected])
Author: Bernhard Wick ([email protected])
Inheritance: extends AppserverIo\Appserver\Core\AbstractContextThread, implements AppserverIo\Appserver\Core\Interfaces\ContainerInterface
Show file Open project: appserver-io/appserver

Public Methods

Method Description
__construct ( AppserverIo\Appserver\Application\Interfaces\ContextInterface $initialContext, AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory, AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode, string $runlevel ) Initializes the container with the initial context, the unique container ID and the deployed applications.
addApplication ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void Append the deployed application to the deployment instance and registers it in the system configuration.
addApplicationToSystemConfiguration ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void Connects the passed application to the system configuration.
getAppBase ( ) : string (non-PHPdoc)
getApplication ( string $name ) : AppserverIo\Psr\Application\ApplicationInterface Returns the application instance with the passed name.
getApplications ( ) : AppserverIo\Storage\GenericStackable Returns the deployed applications.
getBaseDirectory ( string | null $directoryToAppend = null ) : string (non-PHPdoc)
getContainerNode ( ) : ContainerNode Returns the containers configuration node.
getDeployment ( ) : AppserverIo\Psr\Deployment\DeploymentInterface Returns the deployment interface for the container for this container thread.
getInitialContext ( ) : AppserverIo\Appserver\Application\Interfaces\ContextInterface Returns the initial context instance.
getName ( ) : string Returns the unique container name from the configuration.
getNamingDirectory ( ) : AppserverIo\Psr\Naming\NamingDirectoryInterface Returns the containers naming directory.
getRunlevel ( ) : string Returns the runlevel the container has been started in.
getServer ( string $name ) : AppserverIo\Server\Interfaces\ServerInterface Returns the sever instance with the passed name.
getServers ( ) : AppserverIo\Storage\GenericStackable Returns the deployed servers.
getService ( ) : AppService Returns the service instance we need to handle system configuration tasks.
getTmpDir ( string | null $directoryToAppend = null ) : string Returns the servers tmp directory, append with the passed directory.
hasProvisioningEnabled ( ) : boolean Returns TRUE if application provisioning for the container is enabled, else FALSE.
hasServersStarted ( ) : boolean Returns boolean wheather the servers has been started yet or not
main ( ) : void Run the containers logic
newInstance ( string $className, array $args = [] ) : object (non-PHPdoc)
newService ( string $className ) : AppserverIo\Appserver\Core\Api\ServiceInterface (non-PHPdoc)
shutdown ( ) : void Does shutdown logic for request handler if something went wrong and produces a fatal error for example.
stop ( ) : void Stops the container instance.

Protected Methods

Method Description
getServerNodeConfiguration ( AppserverIo\Appserver\Core\Api\Node\ServerNodeInterface $serverNode ) : ServerNodeConfiguration Return's the prepared server node configuration.
registerClassLoaders ( AppserverIo\Storage\GenericStackable $classLoaders ) : void Register's the class loaders configured for this container.
validateDirectories ( ) : void Validates that the container's application and temporary directory is available.

Method Details

__construct() public method

Initializes the container with the initial context, the unique container ID and the deployed applications.
public __construct ( AppserverIo\Appserver\Application\Interfaces\ContextInterface $initialContext, AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory, AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode, string $runlevel )
$initialContext AppserverIo\Appserver\Application\Interfaces\ContextInterface The initial context
$namingDirectory AppserverIo\Psr\Naming\NamingDirectoryInterface The naming directory
$containerNode AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface The container node
$runlevel string The runlevel the container has been started in

addApplication() public method

Append the deployed application to the deployment instance and registers it in the system configuration.
public addApplication ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void
$application AppserverIo\Psr\Application\ApplicationInterface The application to append
return void

addApplicationToSystemConfiguration() public method

Connects the passed application to the system configuration.
public addApplicationToSystemConfiguration ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void
$application AppserverIo\Psr\Application\ApplicationInterface The application to be prepared
return void

getAppBase() public method

(non-PHPdoc)
See also: AppserverIo\Appserver\Core\Api\ContainerService::getAppBase()
public getAppBase ( ) : string
return string The application base directory for this container

getApplication() public method

Returns the application instance with the passed name.
public getApplication ( string $name ) : AppserverIo\Psr\Application\ApplicationInterface
$name string The name of the application to return
return AppserverIo\Psr\Application\ApplicationInterface The application instance

getApplications() public method

Returns the deployed applications.
public getApplications ( ) : AppserverIo\Storage\GenericStackable
return AppserverIo\Storage\GenericStackable The applications

getBaseDirectory() public method

(non-PHPdoc)
See also: AppserverIo\Appserver\Core\Api\ContainerService::getBaseDirectory()
public getBaseDirectory ( string | null $directoryToAppend = null ) : string
$directoryToAppend string | null Append this directory to the base directory before returning it
return string The base directory

getContainerNode() public method

Returns the containers configuration node.
public getContainerNode ( ) : ContainerNode
return AppserverIo\Appserver\Core\Api\Node\ContainerNode The configuration node

getDeployment() public method

Returns the deployment interface for the container for this container thread.
public getDeployment ( ) : AppserverIo\Psr\Deployment\DeploymentInterface
return AppserverIo\Psr\Deployment\DeploymentInterface The deployment instance for this container thread

getInitialContext() public method

Returns the initial context instance.
See also: AppserverIo\Appserver\Core\Interfaces\ContainerInterface::getInitialContext()
public getInitialContext ( ) : AppserverIo\Appserver\Application\Interfaces\ContextInterface
return AppserverIo\Appserver\Application\Interfaces\ContextInterface The initial context instance

getName() public method

Returns the unique container name from the configuration.
See also: AppserverIo\Appserver\Core\Interfaces\ContainerInterface::getName()
public getName ( ) : string
return string The unique container name

getNamingDirectory() public method

Returns the containers naming directory.
public getNamingDirectory ( ) : AppserverIo\Psr\Naming\NamingDirectoryInterface
return AppserverIo\Psr\Naming\NamingDirectoryInterface The containers naming directory

getRunlevel() public method

Returns the runlevel the container has been started in.
public getRunlevel ( ) : string
return string The runlevel

getServer() public method

Returns the sever instance with the passed name.
public getServer ( string $name ) : AppserverIo\Server\Interfaces\ServerInterface
$name string The name of the server to return
return AppserverIo\Server\Interfaces\ServerInterface The server instance

getServerNodeConfiguration() protected method

Return's the prepared server node configuration.
protected getServerNodeConfiguration ( AppserverIo\Appserver\Core\Api\Node\ServerNodeInterface $serverNode ) : ServerNodeConfiguration
$serverNode AppserverIo\Appserver\Core\Api\Node\ServerNodeInterface The server node
return ServerNodeConfiguration The server node configuration

getServers() public method

Returns the deployed servers.
public getServers ( ) : AppserverIo\Storage\GenericStackable
return AppserverIo\Storage\GenericStackable The servers

getService() public method

Returns the service instance we need to handle system configuration tasks.
public getService ( ) : AppService
return AppserverIo\Appserver\Core\Api\AppService The service instance we need

getTmpDir() public method

Returns the servers tmp directory, append with the passed directory.
public getTmpDir ( string | null $directoryToAppend = null ) : string
$directoryToAppend string | null The directory to append
return string

hasProvisioningEnabled() public method

Returns TRUE if application provisioning for the container is enabled, else FALSE.
public hasProvisioningEnabled ( ) : boolean
return boolean TRUE if application provisioning is enabled, else FALSE

hasServersStarted() public method

Returns boolean wheather the servers has been started yet or not
public hasServersStarted ( ) : boolean
return boolean

main() public method

Run the containers logic
public main ( ) : void
return void

newInstance() public method

(non-PHPdoc)
See also: AppserverIo\Appserver\Core\InitialContext::newInstance()
public newInstance ( string $className, array $args = [] ) : object
$className string The fully qualified class name to return the instance for
$args array Arguments to pass to the constructor of the instance
return object The instance itself

newService() public method

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

registerClassLoaders() protected method

Register's the class loaders configured for this container.
protected registerClassLoaders ( AppserverIo\Storage\GenericStackable $classLoaders ) : void
$classLoaders AppserverIo\Storage\GenericStackable The container for the class loader instances
return void

shutdown() public method

Does shutdown logic for request handler if something went wrong and produces a fatal error for example.
public shutdown ( ) : void
return void

stop() public method

Stops the container instance.
public stop ( ) : void
return void

validateDirectories() protected method

Validates that the container's application and temporary directory is available.
protected validateDirectories ( ) : void
return void