AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface::getInitialContext PHP Метод

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

Returns the node containing information about the initial context.
public getInitialContext ( ) : InitialContextNode
Результат AppserverIo\Appserver\Core\Api\Node\InitialContextNode The initial context information
    public function getInitialContext();

Usage Example

Пример #1
0
 /**
  * Initializes the context with the connection to the storage backend.
  *
  * @param \AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface $systemConfiguration The system configuration
  */
 public function __construct(SystemConfigurationInterface $systemConfiguration)
 {
     // initialize the storage
     $initialContextNode = $systemConfiguration->getInitialContext();
     $storageNode = $initialContextNode->getStorage();
     $reflectionClass = $this->newReflectionClass($storageNode->getType());
     // create the storage instance
     $storage = $reflectionClass->newInstance();
     // append the storage servers registered in system configuration
     foreach ($storageNode->getStorageServers() as $storageServer) {
         $storage->addServer($storageServer->getAddress(), $storageServer->getPort(), $storageServer->getWeight());
     }
     // add the storage to the initial context
     $this->setStorage($storage);
     // attach the system configuration to the initial context
     $this->setSystemConfiguration($systemConfiguration);
 }