示例#1
0
		public CacheRule CacheRuleForAllPossibleInstancesOfTopic(TopicName aName)
		{
			TopicsCacheRule rule = new TopicsCacheRule(Federation);
			foreach (AbsoluteTopicName possible in aName.AllAbsoluteTopicNamesFor(this))
				rule.AddTopic(possible);

			CompositeCacheRule answer = new CompositeCacheRule();
			answer.Add(rule);
			answer.Add(CacheRuleForDefinition);		// Add the cache rule for the content base, too, since if that changes there might be a change in imports
			return answer;
		}
示例#2
0
		/// <summary>
		/// A list of TopicChanges to a topic since a given date [sorted by date]
		/// </summary>
		/// <param name="topic">A given date</param>
		/// <param name="stamp">A non-null timestamp; changes before this time won't be included in the answer </param>
		/// <returns>Enumeration of TopicChanges</returns>
		override public IEnumerable AllChangesForTopicSince(LocalTopicName topic, DateTime stamp, CompositeCacheRule rule)
		{
			ArrayList answer = new ArrayList();
			FileInfo[] infos = FileInfosForTopic(topic);
			ArrayList sortable = new ArrayList();
			foreach (FileInfo each in infos)
				sortable.Add(new FileInfoTopicData(each, Namespace));
			BackingTopic back = GetBackingTopicNamed(topic);
			if (back != null)
				sortable.Add(new BackingTopicTopicData(back));
			sortable.Sort(new TimeSort());
			TopicsCacheRule tcr = null;
			if (rule != null)
			{
				tcr = new TopicsCacheRule(Federation);
				tcr.AddTopic(topic.AsAbsoluteTopicName(Namespace));
				rule.Add(tcr);
			}
			foreach (TopicData each in sortable)
			{
				if (each.LastModificationTime < stamp)
					continue;
				AbsoluteTopicName name = topic.AsAbsoluteTopicName(Namespace);
				name.Version = each.Version;
				TopicChange change = TopicChangeFromName(name);
				answer.Add(change);
				if (tcr != null)
					tcr.AddTopic(name.AsAbsoluteTopicName(Namespace));
			}
			return answer;
		}
示例#3
0
		/// <summary>
		/// A list of TopicChanges to a topic since a given date [sorted by date]
		/// </summary>
		/// <param name="topic">A given date</param>
		/// <param name="stamp">A non-null timestamp; changes before this time won't be included in the answer </param>
		/// <param name="rule">A composite cache rule to fill with rules that represented accumulated dependencies (or null)</param>
		/// <returns>Enumeration of TopicChanges</returns>
		public override IEnumerable AllChangesForTopicSince(LocalTopicName topic, DateTime stamp, CompositeCacheRule rule)
		{
			ArrayList answer = new ArrayList();
			SqlInfoForTopic[] infos = SqlHelper.GetSqlTopicInfosForTopicSince(Namespace, topic.Name, stamp, ConnectionString);
			ArrayList sortable = new ArrayList();
			foreach (SqlInfoForTopic each in infos)
				sortable.Add(new SqlInfoTopicData(each, Namespace));
			BackingTopic back = GetBackingTopicNamed(topic);
			bool sortAgain = false;
			if (back != null)
			{
				sortAgain = true;
				sortable.Add(new BackingTopicTopicData(back));
			}
			if( sortAgain )
				sortable.Sort(new TimeSort());

			TopicsCacheRule tcr = null;
			if (rule != null)
			{
				tcr = new TopicsCacheRule(Federation);
				tcr.AddTopic(topic.AsAbsoluteTopicName(Namespace));
				rule.Add(tcr);
			}
			foreach (TopicData each in sortable)
			{
				if (each.LastModificationTime < stamp)
					continue;
				AbsoluteTopicName name = topic.AsAbsoluteTopicName(Namespace);
				name.Version = each.Version;
				TopicChange change = TopicChangeFromName(name);
				answer.Add(change);
				if (tcr != null)
					tcr.AddTopic(name.AsAbsoluteTopicName(Namespace));
			}
			return answer;

		}