Creates the temporary directory for the webapp.

@param \AppserverIo\Psr\Application\ApplicationInterface $application The application to create the temporary directories for

@return void
171609
public function createTmpFolders(ApplicationInterface $application)
    {

        // create the directory we want to store the sessions in
        $tmpFolders = array(
            new \SplFileInfo($application->getTmpDir()),
            new \SplFileInfo($application->getDataDir()),
            new \SplFileInfo($application->getCacheDir()),
            new \SplFileInfo($application->getSessionDir())
        );

        // create the applications temporary directories
        foreach ($tmpFolders as $tmpFolder) {
            $this->createDirectory($tmpFolder);
        }
    }
944103
protected function loadConfigurationFiles(Application $app, Config $repository)
    {
        Factory::fromFiles($repository, $this->getConfigurationFiles($app));
    }
788016
public function setApplication(ApplicationContract $application = null)
    {
        $this->application = $application;
        if ($application) {
            $this->setHelperSet($application->getHelperSet());
        } else {
            $this->helperSet = null;
        }
    }
221377
public function setApplication($application) {
        $this->application = $application;
        foreach($this->translations as $locale => $translations) {
            foreach($translations as $translation) {
                $translation->translation_key = $this;
            }
        }
    }
643041
protected function configureLockDirectory(string $lockDirectory)
    {
        Utility\Files::createDirectoryRecursively($lockDirectory);
        $this->temporaryDirectory = $lockDirectory;
    }
957686
protected function setUpPaths(Application $app)
    {
        $pathRoot = $app->path;

        $pathRoot->register('root', $pathRoot); // recursive reference.

        $pathRoot->register('public', isset($params['path.public']) ? $params['path.public'] : $pathRoot->to('public'), true);

        $pathApp = $pathRoot->register('app', isset($params['path.app']) ? $params['path.app'] : $pathRoot->to('app'), true);

        $pathRoot->register('src', isset($params['path.src']) ? $params['path.src'] : $pathApp->to('src'), true);

        $pathRoot->register('routes', isset($params['path.routes']) ? $params['path.routes'] : $pathApp->to('routes'), true);

        $pathRoot->register('views', isset($params['path.views']) ? $params['path.views'] : $pathApp->to('views'), true);
    }
418576
public function addApplications(Application ...$applications)
    {
        foreach ($applications as $application) {
            $this->getApplications()->add($application);
        }

        return $this;
    }
1268395
public function initialize(ApplicationInterface $application)
    {

        /** @var \AppserverIo\Appserver\Core\DgClassLoader $dgClassLoader */
        $dgClassLoader = $application->search('DgClassLoader');

        // if we did not get the correct class loader our efforts are for naught
        if (!$dgClassLoader instanceof DgClassLoader) {
            $application->getInitialContext()->getSystemLogger()->warning(
                sprintf(
                    'Application %s uses the aspect manager but does not have access to the required Doppelgaenger class loader, AOP functionality will be omitted.',
                    $application->getName()
                )
            );
            return;
        }

        // register the aspects and tell the class loader it can fill the cache
        $this->registerAspects($application);

        // inject the filled aspect register and create the cache based on it
        $dgClassLoader->injectAspectRegister($this->getAspectRegister());
        $dgClassLoader->createCache();
    }
1044149
public function install(ApplicationInterface $app)
    {
        try{
            $request = new ShellRequest($GLOBALS['argv'] ?? []);
            $app->request($request);

            // fire event
            $app->eventstream()->channel(Channels::SYSTEM)->push(Events::REQUEST_ATTACHED, $request);
        }
        catch(\Throwable $e)
        {
            throw new ModuleInstallationException(self::class, $e->getMessage(), $e);
        }
    }
6370
public static function Init(\Puzzlout\Framework\Core\Application $app) {
        $instance = new ArrayFilterFileSearch();
        $instance->FileList = array();
        $instance->ContextApp = $app;
        return $instance;
    }
449323
public function initialize(ApplicationInterface $application)
    {

        // query whether or not the web application folder exists
        if (is_dir($this->getWebappPath()) === false) {
            return;
        }

        // initialize the map for the realms
        $realms = new HashMap();

        // query whether or not we've manager configuration found
        /** @var \AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface $managerNode */
        if ($managerNode = $this->getManagerConfiguration()) {
            // initialize the security domains found in the manager configuration
            /** @var \AppserverIo\Appserver\Core\Api\Node\SecurityDomainNodeInterface $securityDomainNode */
            foreach ($this->getManagerConfiguration()->getSecurityDomains() as $securityDomainNode) {
                // create the realm instance
                $realm = new Realm($this, $securityDomainNode->getName());
                $realm->injectConfiguration($securityDomainNode);
                // add the initialized security domain to the map
                $realms->add($realm->getName(), $realm);
            }
        }

        // inject the map with the realms
        $this->injectRealms($realms);

        // initialize the deployment descriptor parser and parse the web application's deployment descriptor for servlets
        $deploymentDescriptorParser = new DeploymentDescriptorParser();
        $deploymentDescriptorParser->injectAuthenticationContext($this);
        $deploymentDescriptorParser->parse();
    }
1301161
public function setPaths() : ApplicationInterface
    {
        $this->container->set('app', $this);
        $paths = $this->bootstrappers->getBootstrapper()->getPaths();

        foreach ($paths->all() as $key => $path) {
            $this->container->set($key, $path);
        }

        return $this;
    }
710854
private function preparePassDirectory(PassInterface $pass)
    {
        $passDir = $this->getNormalizedOutputPath() . $pass->getSerialNumber() . DIRECTORY_SEPARATOR;
        $passDirExists = file_exists($passDir);
        if ($passDirExists && !$this->isOverwrite()) {
            throw new FileException("Temporary pass directory already exists");
        } elseif (!$passDirExists && !mkdir($passDir, 0777, true)) {
            throw new FileException("Couldn't create temporary pass directory");
        }

        return $passDir;
    }
454837
public function dir()
    {
        $this->_name = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid($this->_prefix);
        if (!mkdir($this->_name)) {
            throw new \Exception('Cannot create temporary directory');
        }
        return $this;
    }
929225
public function init(Application $application)
    {
        $application->addService('staticController', new StaticControllerService());
        $application->any(':all', $application->getService('staticController'));
    }
196007
private function executeInNamespace(ComposerApplication $application, $namespace, InputInterface $input, OutputInterface $output)
    {
        if (!file_exists($namespace)) {
            mkdir($namespace, 0777, true);
        }

        $this->chdir($namespace);

        // some plugins require access to composer file e.g. Symfony Flex
        if (!file_exists(Factory::getComposerFile())) {
            file_put_contents(Factory::getComposerFile(), '{}');
        }
        
        $input = new StringInput((string) $input . ' --working-dir=.');

        $this->getIO()->writeError('<info>Run with <comment>' . $input->__toString() . '</comment></info>', true, IOInterface::VERBOSE);
        
        return $application->doRun($input, $output);
    }
873198
public function register(Application $app)
    {
        $this->setup($app);
        $app
            ->offsetGet('console')
            ->getHelperSet()
            ->set(new ConnectionHelper($app->offsetGet('connection')), 'connection')
        ;
    }