private static ContextControllerFactory BuildContextFactory(ContextControllerFactoryContext factoryContext, ContextDetail detail, IList <FilterSpecCompiled> optFiltersNested, ContextStateCache contextStateCache) { return(factoryContext.ServicesContext.ContextControllerFactoryFactorySvc.Make(factoryContext, detail, optFiltersNested, contextStateCache)); }
public ContextControllerInitTermFactory(ContextControllerFactoryContext factoryContext, ContextDetailInitiatedTerminated detail, ContextStateCache stateCache) : base(factoryContext) { _detail = detail; _stateCache = stateCache; _binding = stateCache.GetBinding(detail); }
public ContextControllerHashFactory(ContextControllerFactoryContext factoryContext, ContextDetailHash hashedSpec, IList <FilterSpecCompiled> filtersSpecsNestedContexts, ContextStateCache stateCache) : base(factoryContext) { _hashedSpec = hashedSpec; _filtersSpecsNestedContexts = filtersSpecsNestedContexts; _stateCache = stateCache; _binding = stateCache.GetBinding(typeof(int)); }
public ContextControllerCategoryFactory(ContextControllerFactoryContext factoryContext, ContextDetailCategory categorySpec, IList <FilterSpecCompiled> filtersSpecsNestedContexts, ContextStateCache stateCache) : base(factoryContext) { _categorySpec = categorySpec; _filtersSpecsNestedContexts = filtersSpecsNestedContexts; _stateCache = stateCache; _binding = stateCache.GetBinding(typeof(int)); // the integer ordinal of the category }
public static ContextControllerState GetRecoveryStates(ContextStateCache cache, String contextName) { OrderedDictionary <ContextStatePathKey, ContextStatePathValue> state = cache.GetContextPaths(contextName); if (state == null || state.IsEmpty()) { return(null); } return(new ContextControllerState(state, false, null)); }
public ContextControllerPartitionedFactory( ContextControllerFactoryContext factoryContext, ContextDetailPartitioned segmentedSpec, IList <FilterSpecCompiled> filtersSpecsNestedContexts, ContextStateCache stateCache) : base(factoryContext) { _segmentedSpec = segmentedSpec; _filtersSpecsNestedContexts = filtersSpecsNestedContexts; _stateCache = stateCache; _binding = stateCache.GetBinding(typeof(ContextControllerPartitionedState)); }
private static ContextControllerFactory BuildContextFactory( ContextControllerFactoryServiceContext serviceContext, String contextName, ContextDetail detail, int nestingLevel, IList <FilterSpecCompiled> optFiltersNested, ContextStateCache contextStateCache) { var factoryContext = new ContextControllerFactoryContext( serviceContext.ContextName, contextName, serviceContext.ServicesContext, serviceContext.AgentInstanceContextCreate, nestingLevel, serviceContext.IsRecoveringResilient); return(BuildContextFactory(factoryContext, detail, optFiltersNested, contextStateCache)); }
public static ContextControllerFactory[] GetFactory(ContextControllerFactoryServiceContext serviceContext, ContextStateCache contextStateCache) { if (!(serviceContext.Detail is ContextDetailNested)) { ContextControllerFactory factory = BuildContextFactory( serviceContext, serviceContext.ContextName, serviceContext.Detail, 1, null, contextStateCache); factory.ValidateFactory(); return(new ContextControllerFactory[] { factory }); } return(BuildNestedContextFactories(serviceContext, contextStateCache)); }
public EPContextPartitionImportResult ImportStartPaths(String contextName, EPContextPartitionImportable importable, AgentInstanceSelector agentInstanceSelector) { var contextManager = CheckedGetContextManager(contextName); var importCallback = new CPImportCallback(); var state = new ContextControllerState(importable.Paths, true, importCallback); contextManager.ImportStartPaths(state, agentInstanceSelector); ContextStateCache contextStateCache = contextManager.ContextStateCache; foreach (var entry in importable.Paths) { entry.Value.State = ContextPartitionState.STARTED; contextStateCache.UpdateContextPath(contextName, entry.Key, entry.Value); } return(new EPContextPartitionImportResult(importCallback.ExistingToImported, importCallback.AllocatedToImported)); }
public ContextControllerFactoryContext( String outermostContextName, String contextName, EPServicesContext servicesContext, AgentInstanceContext agentInstanceContextCreate, int nestingLevel, int numNestingLevels, bool isRecoveringResilient, ContextStateCache stateCache) { OutermostContextName = outermostContextName; ContextName = contextName; ServicesContext = servicesContext; AgentInstanceContextCreate = agentInstanceContextCreate; NestingLevel = nestingLevel; NumNestingLevels = numNestingLevels; IsRecoveringResilient = isRecoveringResilient; StateCache = stateCache; }
public ContextControllerFactory Make(ContextControllerFactoryContext factoryContext, ContextDetail detail, IList <FilterSpecCompiled> optFiltersNested, ContextStateCache contextStateCache) { ContextControllerFactory factory; if (detail is ContextDetailInitiatedTerminated) { factory = new ContextControllerInitTermFactory(factoryContext, (ContextDetailInitiatedTerminated)detail, contextStateCache); } else if (detail is ContextDetailPartitioned) { factory = new ContextControllerPartitionedFactory(factoryContext, (ContextDetailPartitioned)detail, optFiltersNested, contextStateCache); } else if (detail is ContextDetailCategory) { factory = new ContextControllerCategoryFactory(factoryContext, (ContextDetailCategory)detail, optFiltersNested, contextStateCache); } else if (detail is ContextDetailHash) { factory = new ContextControllerHashFactory(factoryContext, (ContextDetailHash)detail, optFiltersNested, contextStateCache); } else { throw new UnsupportedOperationException("Context detail " + detail + " is not yet supported in a nested context"); } return(factory); }
private static ContextControllerFactory[] BuildNestedContextFactories( ContextControllerFactoryServiceContext serviceContext, ContextStateCache contextStateCache) { var nestedSpec = (ContextDetailNested)serviceContext.Detail; // determine nested filter use IDictionary <CreateContextDesc, IList <FilterSpecCompiled> > filtersPerNestedContext = null; for (int i = 0; i < nestedSpec.Contexts.Count; i++) { CreateContextDesc contextParent = nestedSpec.Contexts[i]; for (int j = i + 1; j < nestedSpec.Contexts.Count; j++) { CreateContextDesc contextControlled = nestedSpec.Contexts[j]; IList <FilterSpecCompiled> specs = contextControlled.FilterSpecs; if (specs == null) { continue; } if (filtersPerNestedContext == null) { filtersPerNestedContext = new Dictionary <CreateContextDesc, IList <FilterSpecCompiled> >(); } IList <FilterSpecCompiled> existing = filtersPerNestedContext.Get(contextParent); if (existing != null) { existing.AddAll(specs); } else { filtersPerNestedContext.Put(contextParent, specs); } } } // create contexts ICollection <String> namesUsed = new HashSet <String>(); var hierarchy = new ContextControllerFactory[nestedSpec.Contexts.Count]; for (int i = 0; i < nestedSpec.Contexts.Count; i++) { CreateContextDesc context = nestedSpec.Contexts[i]; if (namesUsed.Contains(context.ContextName)) { throw new ExprValidationException( "Context by name '" + context.ContextName + "' has already been declared within nested context '" + serviceContext.ContextName + "'"); } namesUsed.Add(context.ContextName); int nestingLevel = i + 1; IList <FilterSpecCompiled> optFiltersNested = null; if (filtersPerNestedContext != null) { optFiltersNested = filtersPerNestedContext.Get(context); } hierarchy[i] = BuildContextFactory( serviceContext, context.ContextName, context.ContextDetail, nestingLevel, optFiltersNested, contextStateCache); hierarchy[i].ValidateFactory(); } return(hierarchy); }
public ContextControllerFactoryServiceImpl(ContextStateCache cache) { _cache = cache; }