Esempio n. 1
0
        public ContextManagerNested(ContextControllerFactoryServiceContext factoryServiceContext)
        {
            _contextName               = factoryServiceContext.ContextName;
            _servicesContext           = factoryServiceContext.ServicesContext;
            _contextPartitionIdManager = factoryServiceContext.AgentInstanceContextCreate.StatementContext.ContextControllerFactoryService.AllocatePartitionIdMgr(
                _contextName, factoryServiceContext.AgentInstanceContextCreate.StatementContext.StatementId);
            _nestedContextFactories = factoryServiceContext.AgentInstanceContextCreate.StatementContext.ContextControllerFactoryService.GetFactory(
                factoryServiceContext);

            StatementAIResourceRegistryFactory resourceRegistryFactory =
                () => new StatementAIResourceRegistry(new AIRegistryAggregationMap(), new AIRegistryExprMap());

            var contextProps = ContextPropertyEventType.GetNestedTypeBase();

            foreach (var factory in _nestedContextFactories)
            {
                contextProps.Put(factory.FactoryContext.ContextName, factory.ContextBuiltinProps);
            }
            var contextPropsType = _servicesContext.EventAdapterService.CreateAnonymousMapType(
                _contextName, contextProps, true);
            var registry = new ContextPropertyRegistryImpl(
                Collections.GetEmptyList <ContextDetailPartitionItem>(), contextPropsType);

            _contextDescriptor = new ContextDescriptor(
                _contextName, false, registry, resourceRegistryFactory, this, factoryServiceContext.Detail);
        }
Esempio n. 2
0
        public ContextManagerImpl(ContextControllerFactoryServiceContext factoryServiceContext)
        {
            _uLock                     = LockManager.CreateLock(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            _contextName               = factoryServiceContext.ContextName;
            _servicesContext           = factoryServiceContext.ServicesContext;
            _factory                   = factoryServiceContext.AgentInstanceContextCreate.StatementContext.ContextControllerFactoryService.GetFactory(factoryServiceContext)[0];
            _rootContext               = _factory.CreateNoCallback(0, this); // single instance: created here and activated/deactivated later
            _contextPartitionIdManager = factoryServiceContext.AgentInstanceContextCreate.StatementContext.ContextControllerFactoryService.AllocatePartitionIdMgr(_contextName, factoryServiceContext.AgentInstanceContextCreate.StatementContext.StatementId);

            var resourceRegistryFactory = _factory.StatementAIResourceRegistryFactory;

            var contextProps     = _factory.ContextBuiltinProps;
            var contextPropsType = _servicesContext.EventAdapterService.CreateAnonymousMapType(_contextName, contextProps, true);
            var registry         = new ContextPropertyRegistryImpl(_factory.ContextDetailPartitionItems, contextPropsType);

            _contextDescriptor = new ContextDescriptor(_contextName, _factory.IsSingleInstanceContext, registry, resourceRegistryFactory, this, _factory.ContextDetail);
        }