public ContextControllerHashFactoryImpl( ContextControllerFactoryContext factoryContext, ContextDetailHash hashedSpec, IList<FilterSpecCompiled> filtersSpecsNestedContexts) : base(factoryContext, hashedSpec, filtersSpecsNestedContexts) { _binding = factoryContext.StateCache.GetBinding(typeof(int)); }
public ContextControllerHashFactory(ContextControllerFactoryContext factoryContext, ContextDetailHash hashedSpec, IList <FilterSpecCompiled> filtersSpecsNestedContexts, ContextStateCache stateCache) : base(factoryContext) { _hashedSpec = hashedSpec; _filtersSpecsNestedContexts = filtersSpecsNestedContexts; _stateCache = stateCache; _binding = stateCache.GetBinding(typeof(int)); }
protected ContextControllerHashFactoryBase( ContextControllerFactoryContext factoryContext, ContextDetailHash hashedSpec, IList <FilterSpecCompiled> filtersSpecsNestedContexts) : base(factoryContext) { _hashedSpec = hashedSpec; _filtersSpecsNestedContexts = filtersSpecsNestedContexts; }
private ICollection <EventType> GetItemEventTypes(ContextDetailHash hashedSpec) { IList <EventType> itemEventTypes = new List <EventType>(); foreach (var item in hashedSpec.Items) { itemEventTypes.Add(item.FilterSpecCompiled.FilterForEventType); } return(itemEventTypes); }
public static FilterValueSetParam[][] GetAddendumFilters( FilterSpecCompiled filterSpecCompiled, int hashCode, ContextDetailHash hashSpec, ContextControllerStatementDesc statementDesc) { // determine whether create-named-window var isCreateWindow = statementDesc != null && statementDesc.Statement.StatementSpec.CreateWindowDesc != null; ContextDetailHashItem foundPartition = null; if (!isCreateWindow) { foundPartition = FindHashItemSpec(hashSpec, filterSpecCompiled); } else { string declaredAsName = statementDesc.Statement.StatementSpec.CreateWindowDesc.AsEventTypeName; foreach (var partitionItem in hashSpec.Items) { if (partitionItem.FilterSpecCompiled.FilterForEventType.Name.Equals(declaredAsName)) { foundPartition = partitionItem; break; } } } if (foundPartition == null) { return(null); } var filter = new FilterValueSetParamImpl(foundPartition.Lookupable, FilterOperator.EQUAL, hashCode); var addendum = new FilterValueSetParam[1][]; addendum[0] = new FilterValueSetParam[] { filter }; var partitionFilters = foundPartition.ParametersCompiled; if (partitionFilters != null) { addendum = ContextControllerAddendumUtil.AddAddendum(partitionFilters, filter); } return(addendum); }
public static ContextDetailHashItem FindHashItemSpec(ContextDetailHash hashSpec, FilterSpecCompiled filterSpec) { ContextDetailHashItem foundPartition = null; foreach (var partitionItem in hashSpec.Items) { var typeOrSubtype = EventTypeUtility.IsTypeOrSubTypeOf(filterSpec.FilterForEventType, partitionItem.FilterSpecCompiled.FilterForEventType); if (typeOrSubtype) { foundPartition = partitionItem; } } return(foundPartition); }
// Compare filters in statement with filters in segmented context, addendum filter compilation public static void GetAddendumFilters( IDictionary <FilterSpecCompiled, FilterValueSetParam[][]> addendums, int hashCode, IList <FilterSpecCompiled> filtersSpecs, ContextDetailHash hashSpec, ContextControllerStatementDesc statementDesc) { foreach (var filtersSpec in filtersSpecs) { var addendum = GetAddendumFilters(filtersSpec, hashCode, hashSpec, statementDesc); if (addendum == null) { continue; } var existing = addendums.Get(filtersSpec); if (existing != null) { addendum = ContextControllerAddendumUtil.MultiplyAddendum(existing, addendum); } addendums.Put(filtersSpec, addendum); } }
// Compare filters in statement with filters in segmented context, addendum filter compilation /// <summary> /// Gets the addendum filters. /// </summary> /// <param name="addendums">The addendums.</param> /// <param name="agentInstanceId">The agent instance identifier.</param> /// <param name="filtersSpecs">The filters specs.</param> /// <param name="hashSpec">The hash spec.</param> /// <param name="statementDesc">The statement desc.</param> private static void GetAddendumFilters( IDictionary <FilterSpecCompiled, FilterValueSetParam[][]> addendums, int agentInstanceId, IList <FilterSpecCompiled> filtersSpecs, ContextDetailHash hashSpec, ContextControllerStatementDesc statementDesc) { // determine whether create-named-window var isCreateWindow = statementDesc != null && statementDesc.Statement.StatementSpec.CreateWindowDesc != null; if (!isCreateWindow) { foreach (var filtersSpec in filtersSpecs) { var foundPartition = FindHashItemSpec(hashSpec, filtersSpec); if (foundPartition == null) { continue; } FilterValueSetParam filter = new FilterValueSetParamImpl(foundPartition.Lookupable, FilterOperator.EQUAL, agentInstanceId); var addendum = new FilterValueSetParam[1][]; addendum[0] = new FilterValueSetParam[] { filter }; var partitionFilters = foundPartition.ParametersCompiled; if (partitionFilters != null) { addendum = ContextControllerAddendumUtil.AddAddendum(partitionFilters, filter); } FilterValueSetParam[][] existing = addendums.Get(filtersSpec); if (existing != null) { addendum = ContextControllerAddendumUtil.MultiplyAddendum(existing, addendum); } addendums[filtersSpec] = addendum; } } // handle segmented context for create-window else { var declaredAsName = statementDesc.Statement.StatementSpec.CreateWindowDesc.AsEventTypeName; if (declaredAsName != null) { foreach (var filterSpec in filtersSpecs) { ContextDetailHashItem foundPartition = null; foreach (var partitionItem in hashSpec.Items) { if (partitionItem.FilterSpecCompiled.FilterForEventType.Name.Equals(declaredAsName)) { foundPartition = partitionItem; break; } } if (foundPartition == null) { continue; } FilterValueSetParam filter = new FilterValueSetParamImpl(foundPartition.Lookupable, FilterOperator.EQUAL, agentInstanceId); var addendum = new FilterValueSetParam[1][]; addendum[0] = new FilterValueSetParam[] { filter }; var existing = addendums.Get(filterSpec); if (existing != null) { addendum = ContextControllerAddendumUtil.MultiplyAddendum(existing, addendum); } addendums[filterSpec] = addendum; } } } }
private ICollection <EventType> GetItemEventTypes(ContextDetailHash hashedSpec) { return(hashedSpec.Items.Select(item => item.FilterSpecCompiled.FilterForEventType).ToList()); }