Author: Tim Wagner (tw@appserver.io)
Inheritance: extends AppserverIo\Storage\GenericStackable, implements AppserverIo\Psr\Naming\NamingDirectoryInterface, use trait AppserverIo\Appserver\Core\Traits\ThreadedContextTrait
Ejemplo n.º 1
0
 /**
  * Test if the search for a subdirectory works.
  *
  * @return void
  */
 public function testSearchForASubdirectory()
 {
     // create a three level directory
     $level1 = $this->namingDirectory->createSubdirectory('level1');
     $level2 = $level1->createSubdirectory('level2');
     $level3 = $level2->createSubdirectory('level3');
     // search for the last created subdirectory
     $this->assertInstanceOf('AppserverIo\\Psr\\Naming\\NamingDirectoryInterface', $this->namingDirectory->search('php:level1/level2/level3'));
 }
Ejemplo n.º 2
0
 /**
  * Test if the search for a subdirectory works.
  *
  * @return void
  */
 public function testSearchForASubdirectory()
 {
     // create a three level directory
     $level1 = $this->namingDirectory->createSubdirectory('level1');
     $level2 = $level1->createSubdirectory('level2');
     $level2->createSubdirectory('level3');
     // search for the last created subdirectory
     $this->assertSame('.', $this->namingDirectory->search('php:level1/level2/level3'));
 }
Ejemplo n.º 3
0
    $bootstrapFilename = $arguments[$bootstrap];
} elseif ((array_key_exists($setup, $arguments) || array_key_exists($configTest, $arguments)) && file_exists(sprintf('%s/etc/appserver/conf.d/bootstrap-commands.xml', APPSERVER_BP))) {
    // set the default commands boostrap file
    $bootstrapFilename = sprintf('%s/etc/appserver/conf.d/bootstrap-commands.xml', APPSERVER_BP);
} elseif (array_key_exists($watch, $arguments) && file_exists(sprintf('%s/etc/appserver/conf.d/bootstrap-watcher.xml', APPSERVER_BP))) {
    // set the default watcher boostrap file
    $bootstrapFilename = sprintf('%s/etc/appserver/conf.d/bootstrap-watcher.xml', APPSERVER_BP);
} elseif (file_exists(sprintf('%s/etc/appserver/conf.d/bootstrap.xml', APPSERVER_BP))) {
    // try to load the default bootstrap file
    $bootstrapFilename = sprintf('%s/etc/appserver/conf.d/bootstrap.xml', APPSERVER_BP);
} else {
    // throw an exception if we don't have a bootstrap file
    throw new \Exception('Can\'t find a bootstrap file');
}
// create and initialize the naming directory
$namingDirectory = new NamingDirectory();
$namingDirectory->setScheme('php');
// create a directory for the services
$namingDirectory->createSubdirectory('php:env');
$namingDirectory->createSubdirectory('php:env/args');
$namingDirectory->createSubdirectory('php:global');
$namingDirectory->createSubdirectory('php:global/log');
$namingDirectory->createSubdirectory('php:services');
// create the default subdirectories
foreach (array_keys(ApplicationServer::$runlevels) as $runlevel) {
    $namingDirectory->createSubdirectory(sprintf('php:services/%s', $runlevel));
}
// bind the command line arguments to the naming directory
foreach ($arguments as $name => $value) {
    $namingDirectory->bind(sprintf('php:env/args/%s', $name), empty($value) ? true : $value);
}
Ejemplo n.º 4
0
 /**
  * Returns a new naming directory instance.
  *
  * @param string $scheme The directory scheme
  *
  * @return \AppserverIo\Psr\Naming\NamingDirectoryInterface The new directory instance
  */
 public function getNamingDirectory($scheme = 'php')
 {
     $namingDirectory = new NamingDirectory();
     $namingDirectory->setScheme($scheme);
     return $namingDirectory;
 }