AppserverIo\Appserver\Provisioning\StandardProvisioner::executeProvision PHP Method

executeProvision() protected method

Executes the passed applications provisioning workflow.
protected executeProvision ( AppserverIo\Psr\Application\ApplicationInterface $application, ProvisionNode $provisionNode, SplFileInfo $webappPath ) : void
$application AppserverIo\Psr\Application\ApplicationInterface The application instance
$provisionNode AppserverIo\Appserver\Core\Api\Node\ProvisionNode The file with the provisioning information
$webappPath SplFileInfo The path to the webapp folder
return void
    protected function executeProvision(ApplicationInterface $application, ProvisionNode $provisionNode, \SplFileInfo $webappPath)
    {
        // load the steps from the configuration
        $stepNodes = $provisionNode->getInstallation()->getSteps();
        if (!is_array($stepNodes)) {
            return;
        }
        // execute all steps found in the configuration
        foreach ($stepNodes as $stepNode) {
            try {
                // create a new reflection class of the step
                $reflectionClass = new \ReflectionClass($stepNode->getType());
                $step = $reflectionClass->newInstance();
                // try to inject the datasource node if available
                if ($datasourceNode = $provisionNode->getDatasource()) {
                    $step->injectDataSourceNode($datasourceNode);
                }
                // inject all other information
                $step->injectStepNode($stepNode);
                $step->injectApplication($application);
                $step->injectService($this->getService());
                $step->injectWebappPath($webappPath->getPathname());
                $step->injectInitialContext($this->getInitialContext());
                $step->injectPhpExecutable($this->getAbsolutPathToPhpExecutable());
                // execute the step finally
                $step->start(PTHREADS_INHERIT_NONE | PTHREADS_INHERIT_CONSTANTS);
                $step->join();
            } catch (\Exception $e) {
                $this->getInitialContext()->getSystemLogger()->error($e->__toString());
            }
        }
    }