public ContextPartitionCollection GetContextPartitions(ContextPartitionSelector selector) { if (selector is ContextPartitionSelectorAll) { IDictionary<int, ContextPartitionIdentifier> map = new Dictionary<int, ContextPartitionIdentifier>(); var idsInner = ContextPartitionIdService.Ids; foreach (var id in idsInner) { var partitionKeys = ContextPartitionIdService.GetPartitionKeys(id); if (partitionKeys != null) { var identifier = GetContextPartitionIdentifier(partitionKeys); map.Put(id, identifier); } } return new ContextPartitionCollection(map); } var ids = Realization.GetAgentInstanceIds(selector); IDictionary<int, ContextPartitionIdentifier> identifiers = new Dictionary<int, ContextPartitionIdentifier>(); foreach (var id in ids) { var partitionKeys = ContextPartitionIdService.GetPartitionKeys(id); if (partitionKeys == null) { continue; } var identifier = GetContextPartitionIdentifier(partitionKeys); identifiers.Put(id, identifier); } return new ContextPartitionCollection(identifiers); }
public void SetStatementContext(StatementContext value) { StatementContextCreate = value; ContextPartitionKeySerdes = StatementContextCreate.ContextServiceFactory .GetContextPartitionKeyBindings(ContextDefinition); ContextPartitionIdService = StatementContextCreate.ContextServiceFactory .GetContextPartitionIdService(StatementContextCreate, ContextPartitionKeySerdes); }
public void DestroyContext() { if (!Statements.IsEmpty()) { throw new IllegalStateException("Cannot invoke destroy with statements still attached"); } if (ContextPartitionIdService == null) { return; } Realization.SafeDestroyContext(); ContextPartitionIdService.Destroy(); ContextPartitionIdService = null; }
public ContextAgentInstanceInfo GetContextAgentInstanceInfo( StatementContext statementContextOfStatement, int agentInstanceId) { var partitionKeys = ContextPartitionIdService.GetPartitionKeys(agentInstanceId); if (partitionKeys == null) { return null; } var statement = Statements.Get(statementContextOfStatement.StatementId); var props = ContextManagerUtil.BuildContextProperties( agentInstanceId, partitionKeys, ContextDefinition, StatementContextCreate); var proxy = ComputeFilterAddendum(statement, partitionKeys); return new ContextAgentInstanceInfo(props, proxy); }
public ContextPartitionIdentifier GetContextIdentifier(int agentInstanceId) { var partitionKeys = ContextPartitionIdService.GetPartitionKeys(agentInstanceId); return partitionKeys == null ? null : GetContextPartitionIdentifier(partitionKeys); }