AppserverIo\Appserver\Core\Api\Node\ProvisionNode::getDatasource PHP Method

getDatasource() public method

Returns the node containing datasource information.
public getDatasource ( ) : DatasourceNode
return DatasourceNode The node containing datasource information
    public function getDatasource()
    {
        return $this->datasource;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Executes the passed applications provisioning workflow.
  *
  *
  * @param \AppserverIo\Psr\Application\ApplicationInterface  $application   The application instance
  * @param \AppserverIo\Appserver\Core\Api\Node\ProvisionNode $provisionNode The file with the provisioning information
  * @param \SplFileInfo                                       $webappPath    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());
         }
     }
 }
All Usage Examples Of AppserverIo\Appserver\Core\Api\Node\ProvisionNode::getDatasource