AppserverIo\Appserver\PersistenceContainer\BeanManagerFactory::visit PHP Метод

visit() публичный статический Метод

The main method that creates new instances in a separate context.
public static visit ( AppserverIo\Psr\Application\ApplicationInterface $application, AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface $managerConfiguration ) : void
$application AppserverIo\Psr\Application\ApplicationInterface The application instance to register the class loader with
$managerConfiguration AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface The manager configuration
Результат void
    public static function visit(ApplicationInterface $application, ManagerNodeInterface $managerConfiguration)
    {
        // initialize the bean locator
        $beanLocator = new BeanLocator();
        // initialize the stackable for the data, the stateful + singleton session beans and the naming directory
        $data = new StackableStorage();
        $instances = new GenericStackable();
        $singletonSessionBeans = new StackableStorage();
        $statefulSessionBeans = new StatefulSessionBeanMap();
        // initialize the default settings for the stateful session beans
        $beanManagerSettings = new BeanManagerSettings();
        $beanManagerSettings->mergeWithParams($managerConfiguration->getParamsAsArray());
        // create an instance of the object factory
        $objectFactory = new GenericObjectFactory();
        $objectFactory->injectInstances($instances);
        $objectFactory->injectApplication($application);
        $objectFactory->start();
        // add a garbage collector and timer service workers for each application
        $garbageCollector = new StandardGarbageCollector();
        $garbageCollector->injectApplication($application);
        $garbageCollector->start();
        // initialize the bean manager
        $beanManager = new BeanManager();
        $beanManager->injectData($data);
        $beanManager->injectApplication($application);
        $beanManager->injectResourceLocator($beanLocator);
        $beanManager->injectObjectFactory($objectFactory);
        $beanManager->injectGarbageCollector($garbageCollector);
        $beanManager->injectManagerSettings($beanManagerSettings);
        $beanManager->injectStatefulSessionBeans($statefulSessionBeans);
        $beanManager->injectSingletonSessionBeans($singletonSessionBeans);
        $beanManager->injectDirectories($managerConfiguration->getDirectories());
        // create the naming context and add it the manager
        $contextFactory = $managerConfiguration->getContextFactory();
        $contextFactory::visit($beanManager);
        // attach the instance
        $application->addManager($beanManager, $managerConfiguration);
    }
BeanManagerFactory