Пример #1
0
 /**
  * Deploy
  *
  * @param   remote.server.deploy.Deployable deployment
  */
 public function deployBean($deployment)
 {
     if ($deployment instanceof IncompleteDeployment) {
         throw new DeployException('Incomplete deployment originating from ' . $deployment->origin, $deployment->cause);
     }
     $this->cat && $this->cat->info($this->getClassName(), 'Begin deployment of', $deployment);
     // Register beans classloader. This classloader must be put at the beginning
     // to prevent loading of the home interface not implmenenting BeanInterface
     $cl = $deployment->getClassLoader();
     ClassLoader::getDefault()->registerLoader($cl, TRUE);
     $impl = $cl->loadClass($deployment->getImplementation());
     $interface = $cl->loadClass($deployment->getInterface());
     $directoryName = $deployment->getDirectoryName();
     // Fetch naming directory
     $directory = NamingDirectory::getInstance();
     // Create beanContainer
     // TBI: Check which kind of bean container has to be created
     $beanContainer = StatelessSessionBeanContainer::forClass($impl);
     $this->cat && $beanContainer->setTrace($this->cat);
     // Create invocation handler
     $invocationHandler = new ContainerInvocationHandler();
     $invocationHandler->setContainer($beanContainer);
     // Now bind into directory
     $directory->bind($directoryName, Proxy::newProxyInstance($cl, array($interface), $invocationHandler));
     $this->cat && $this->cat->info($this->getClassName(), 'End deployment of', $impl->getName(), 'with ND entry', $directoryName);
     return $beanContainer;
 }
 /**
  * Handle message
  *
  * @param   remote.server.EASCProtocol protocol
  * @return  var data
  */
 public function handle($protocol, $data)
 {
     $offset = 0;
     $name = $protocol->readString($data, $offset);
     $directory = NamingDirectory::getInstance();
     $this->setValue($directory->lookup($name));
 }
 static function __static()
 {
     self::$instance = new NamingDirectory();
 }
Пример #4
0
 /**
  * Create and return a new naming subdirectory with the attributes
  * of this one.
  *
  * @param string $name   The name of the new subdirectory
  * @param array  $filter Array with filters that will be applied when copy the attributes
  *
  * @return \AppserverIo\Appserver\Naming\NamingDirectory The new naming subdirectory
  */
 public function createSubdirectory($name, array $filter = array())
 {
     // create a new subdirectory instance
     $subdirectory = new NamingDirectory($name, $this);
     // copy the attributes specified by the filter
     if (sizeof($filter) > 0) {
         foreach ($this->getAllKeys() as $key => $value) {
             foreach ($filter as $pattern) {
                 if (fnmatch($pattern, $key)) {
                     $subdirectory->bind($key, $value);
                 }
             }
         }
     }
     // bind it the directory
     $this->bind($name, $subdirectory);
     // return the instance
     return clone $subdirectory;
 }