Example #1
0
 public ContextControllerInitTermFactory(ContextControllerFactoryContext factoryContext, ContextDetailInitiatedTerminated detail, ContextStateCache stateCache)
     : base(factoryContext)
 {
     _detail     = detail;
     _stateCache = stateCache;
     _binding    = stateCache.GetBinding(detail);
 }
Example #2
0
        public void Visit(int nestingLevel, int pathId, ContextStatePathValueBinding binding, Object payload, ContextController contextController, ContextControllerInstanceHandle instanceHandle)
        {
            var key             = new ContextStatePathKey(nestingLevel, pathId, instanceHandle.SubPathId);
            int maxNestingLevel = _nestedFactories.Length;

            int contextPartitionOrSubPath = instanceHandle.ContextPartitionOrPathId;

            if (contextController.Factory.FactoryContext.NestingLevel == maxNestingLevel)
            {
                var agentInstances = ControllerAgentInstances.Get(contextController);
                if (agentInstances == null)
                {
                    agentInstances = new List <LeafDesc>();
                    ControllerAgentInstances.Put(contextController, agentInstances);
                }
                var value = new ContextStatePathValue(contextPartitionOrSubPath, binding.ToByteArray(payload), instanceHandle.Instances.State);
                agentInstances.Add(new LeafDesc(key, value));

                // generate a nice payload text from the paths of keys
                var entry      = _subcontexts.Get(contextController);
                var keys       = ContextManagerNested.GetTreeCompositeKey(_nestedFactories, payload, entry, _subcontexts);
                var descriptor = new ContextPartitionDescriptor(contextPartitionOrSubPath, new ContextPartitionIdentifierNested(keys), value.State);
                AgentInstanceInfo.Put(contextPartitionOrSubPath, descriptor);
                States.Put(key, value);
            }
            else
            {
                // handle non-leaf
                Subpaths.Add(contextPartitionOrSubPath);
                States.Put(key, new ContextStatePathValue(contextPartitionOrSubPath, binding.ToByteArray(payload), ContextPartitionState.STARTED));
            }
        }
 public ContextControllerCategoryFactoryImpl(
     ContextControllerFactoryContext factoryContext,
     ContextDetailCategory categorySpec,
     IList <FilterSpecCompiled> filtersSpecsNestedContexts)
     : base(factoryContext, categorySpec, filtersSpecsNestedContexts)
 {
     _binding = factoryContext.StateCache.GetBinding(typeof(int));        // the integer ordinal of the category
 }
Example #4
0
 public ContextControllerHashFactory(ContextControllerFactoryContext factoryContext, ContextDetailHash hashedSpec, IList <FilterSpecCompiled> filtersSpecsNestedContexts, ContextStateCache stateCache)
     : base(factoryContext)
 {
     _hashedSpec = hashedSpec;
     _filtersSpecsNestedContexts = filtersSpecsNestedContexts;
     _stateCache = stateCache;
     _binding    = stateCache.GetBinding(typeof(int));
 }
Example #5
0
 public ContextControllerHashFactoryImpl(
     ContextControllerFactoryContext factoryContext,
     ContextDetailHash hashedSpec,
     IList<FilterSpecCompiled> filtersSpecsNestedContexts)
     : base(factoryContext, hashedSpec, filtersSpecsNestedContexts)
 {
     _binding = factoryContext.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 void Visit(int nestingLevel, int pathId, ContextStatePathValueBinding binding, Object payload, ContextController contextController, ContextControllerInstanceHandle instanceHandle)
 {
     if (nestingLevel == _maxNestingLevel)
     {
         _agentInstanceIds.Add(instanceHandle.ContextPartitionOrPathId);
     }
     else
     {
         _subpaths.Add(instanceHandle.ContextPartitionOrPathId);
     }
 }
Example #8
0
 public void AddContextPath(
     String contextName,
     int level,
     int parentPath,
     int subPath,
     int?optionalContextPartitionId,
     Object additionalInfo,
     ContextStatePathValueBinding binding)
 {
     // no action required
 }
Example #9
0
 public ContextControllerPartitionedFactory(
     ContextControllerFactoryContext factoryContext,
     ContextDetailPartitioned segmentedSpec,
     IList <FilterSpecCompiled> filtersSpecsNestedContexts,
     ContextStateCache stateCache)
     : base(factoryContext)
 {
     _segmentedSpec = segmentedSpec;
     _filtersSpecsNestedContexts = filtersSpecsNestedContexts;
     _stateCache = stateCache;
     _binding    = stateCache.GetBinding(typeof(ContextControllerPartitionedState));
 }
        public void Visit(int nestingLevel, int pathId, ContextStatePathValueBinding binding, Object payload, ContextController contextController, ContextControllerInstanceHandle instanceHandle)
        {
            ContextStatePathKey key = new ContextStatePathKey(nestingLevel, pathId, instanceHandle.SubPathId);
            int agentInstanceId     = instanceHandle.ContextPartitionOrPathId;

            States.Put(key, new ContextStatePathValue(agentInstanceId, binding.ToByteArray(payload), instanceHandle.Instances.State));

            ContextPartitionState      state      = instanceHandle.Instances.State;
            ContextPartitionIdentifier identifier = contextController.Factory.KeyPayloadToIdentifier(payload);
            ContextPartitionDescriptor descriptor = new ContextPartitionDescriptor(agentInstanceId, identifier, state);

            ContextPartitionInfo.Put(agentInstanceId, descriptor);
        }
Example #11
0
 public void AddContextPath(String contextName, int level, int parentPath, int subPath, int?optionalContextPartitionId, Object additionalInfo, ContextStatePathValueBinding binding)
 {
     state.Put(new ContextStatePathKey(level, parentPath, subPath), new ContextStatePathValue(optionalContextPartitionId, binding.ToByteArray(additionalInfo), ContextPartitionState.STARTED));
 }
Example #12
0
 public ContextControllerInitTermFactoryImpl(ContextControllerFactoryContext factoryContext, ContextDetailInitiatedTerminated detail)
     : base(factoryContext, detail)
 {
     _binding = factoryContext.StateCache.GetBinding(detail);
 }
 public ContextControllerPartitionedFactoryImpl(ContextControllerFactoryContext factoryContext, ContextDetailPartitioned segmentedSpec, IList <FilterSpecCompiled> filtersSpecsNestedContexts)
     : base(factoryContext, segmentedSpec, filtersSpecsNestedContexts)
 {
     _binding = factoryContext.StateCache.GetBinding(typeof(ContextControllerPartitionedState));
 }