AppserverIo\Appserver\PersistenceContainer\BeanManager::registerBean PHP Method

registerBean() public method

Register the bean described by the passed descriptor.
public registerBean ( AppserverIo\Psr\EnterpriseBeans\Description\BeanDescriptorInterface $descriptor ) : void
$descriptor AppserverIo\Psr\EnterpriseBeans\Description\BeanDescriptorInterface The bean descriptor
return void
    public function registerBean(BeanDescriptorInterface $descriptor)
    {
        try {
            // load the application instance
            $application = $this->getApplication();
            // register the bean with the default name/short class name
            $application->getNamingDirectory()->bind(sprintf('php:global/%s/%s', $application->getUniqueName(), $descriptor->getName()), array(&$this, 'lookup'), array($descriptor->getClassName()));
            //  register the EPB references
            foreach ($descriptor->getEpbReferences() as $epbReference) {
                $this->registerEpbReference($epbReference);
            }
            // register the resource references
            foreach ($descriptor->getResReferences() as $resReference) {
                $this->registerResReference($resReference);
            }
            // register the persistence unit references
            foreach ($descriptor->getPersistenceUnitReferences() as $persistenceUnitReference) {
                $this->registerPersistenceUnitReference($persistenceUnitReference);
            }
        } catch (\Exception $e) {
            // log the exception
            $this->getApplication()->getInitialContext()->getSystemLogger()->critical($e->__toString());
        }
    }