当前位置: 首页>>代码示例>>Java>>正文


Java ContextDetailNested类代码示例

本文整理汇总了Java中com.espertech.esper.epl.spec.ContextDetailNested的典型用法代码示例。如果您正苦于以下问题:Java ContextDetailNested类的具体用法?Java ContextDetailNested怎么用?Java ContextDetailNested使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContextDetailNested类属于com.espertech.esper.epl.spec包,在下文中一共展示了ContextDetailNested类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addContextSpec

import com.espertech.esper.epl.spec.ContextDetailNested; //导入依赖的package包/类
public void addContextSpec(EPServicesContext servicesContext, AgentInstanceContext agentInstanceContext, CreateContextDesc contextDesc, boolean isRecoveringResilient) throws ExprValidationException {

        ContextManagerEntry mgr = contexts.get(contextDesc.getContextName());
        if (mgr != null) {
            if (destroyedContexts.contains(contextDesc.getContextName())) {
                throw new ExprValidationException("Context by name '" + contextDesc.getContextName() + "' is still referenced by statements and may not be changed");
            }
            throw new ExprValidationException("Context by name '" + contextDesc.getContextName() + "' already exists");
        }

        ContextControllerFactoryServiceContext factoryServiceContext = new ContextControllerFactoryServiceContext(contextDesc.getContextName(), servicesContext, contextDesc.getContextDetail(), agentInstanceContext, isRecoveringResilient);
        ContextManager contextManager;
        if (contextDesc.getContextDetail() instanceof ContextDetailNested) {
            contextManager = new ContextManagerNested(factoryServiceContext);
        }
        else {
            contextManager = new ContextManagerImpl(factoryServiceContext);
        }

        factoryServiceContext.getAgentInstanceContextCreate().getEpStatementAgentInstanceHandle().setFilterFaultHandler(contextManager);

        contexts.put(contextDesc.getContextName(), new ContextManagerEntry(contextManager));
    }
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:24,代码来源:ContextManagementServiceImpl.java

示例2: getFactory

import com.espertech.esper.epl.spec.ContextDetailNested; //导入依赖的package包/类
public static ContextControllerFactory[] getFactory(ContextControllerFactoryServiceContext serviceContext, ContextStateCache contextStateCache) throws ExprValidationException {
    if (!(serviceContext.getDetail() instanceof ContextDetailNested)) {
        ContextControllerFactory factory = buildContextFactory(serviceContext, serviceContext.getContextName(), serviceContext.getDetail(), 1, 1, null, contextStateCache);
        factory.validateFactory();
        return new ContextControllerFactory[]{factory};
    }
    return buildNestedContextFactories(serviceContext, contextStateCache);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:9,代码来源:ContextControllerFactoryHelper.java

示例3: make

import com.espertech.esper.epl.spec.ContextDetailNested; //导入依赖的package包/类
public ContextManager make(ContextDetail contextDetail, ContextControllerFactoryServiceContext factoryServiceContext) throws ExprValidationException {
    if (contextDetail instanceof ContextDetailNested) {
        return new ContextManagerNested(factoryServiceContext);
    }
    return new ContextManagerImpl(factoryServiceContext);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:7,代码来源:ContextManagerFactoryServiceImpl.java

示例4: buildNestedContextFactories

import com.espertech.esper.epl.spec.ContextDetailNested; //导入依赖的package包/类
private static ContextControllerFactory[] buildNestedContextFactories(ContextControllerFactoryServiceContext serviceContext, ContextStateCache contextStateCache) throws ExprValidationException {
    ContextDetailNested nestedSpec = (ContextDetailNested) serviceContext.getDetail();
    // determine nested filter use
    Map<CreateContextDesc, List<FilterSpecCompiled>> filtersPerNestedContext = null;
    for (int i = 0; i < nestedSpec.getContexts().size(); i++) {
        CreateContextDesc contextParent = nestedSpec.getContexts().get(i);
        for (int j = i + 1; j < nestedSpec.getContexts().size(); j++) {
            CreateContextDesc contextControlled = nestedSpec.getContexts().get(j);
            List<FilterSpecCompiled> specs = ContextDetailUtil.getFilterSpecs(contextControlled.getContextDetail());
            if (specs == null) {
                continue;
            }
            if (filtersPerNestedContext == null) {
                filtersPerNestedContext = new HashMap<CreateContextDesc, List<FilterSpecCompiled>>();
            }
            List<FilterSpecCompiled> existing = filtersPerNestedContext.get(contextParent);
            if (existing != null) {
                existing.addAll(specs);
            } else {
                filtersPerNestedContext.put(contextParent, specs);
            }
        }
    }

    // create contexts
    Set<String> namesUsed = new HashSet<String>();
    ContextControllerFactory[] hierarchy = new ContextControllerFactory[nestedSpec.getContexts().size()];
    for (int i = 0; i < nestedSpec.getContexts().size(); i++) {
        CreateContextDesc context = nestedSpec.getContexts().get(i);

        if (namesUsed.contains(context.getContextName())) {
            throw new ExprValidationException("Context by name '" + context.getContextName() + "' has already been declared within nested context '" + serviceContext.getContextName() + "'");
        }
        namesUsed.add(context.getContextName());

        int nestingLevel = i + 1;

        List<FilterSpecCompiled> optFiltersNested = null;
        if (filtersPerNestedContext != null) {
            optFiltersNested = filtersPerNestedContext.get(context);
        }

        hierarchy[i] = buildContextFactory(serviceContext, context.getContextName(), context.getContextDetail(), nestingLevel, nestedSpec.getContexts().size(), optFiltersNested, contextStateCache);
        hierarchy[i].validateFactory();
    }
    return hierarchy;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:48,代码来源:ContextControllerFactoryHelper.java


注:本文中的com.espertech.esper.epl.spec.ContextDetailNested类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。