예제 #1
0
		void ProcessFederationPropertiesChanged(FederationUpdate updates)
		{
			if (!updates.FederationPropertiesChanged)
				return;
			foreach (string each in AllKeysToInvalidateForFederationPropertiesChanged)
				Remove(each);
			AllKeysToInvalidateForFederationPropertiesChanged = new Set();
		}
예제 #2
0
		void ProcessNamespaceListChanged(FederationUpdate updates)
		{
			if (!updates.NamespaceListChanged)
				return;
			foreach (string each in AllKeysToInvalidateForNamespaceListChanged)
				Remove(each);
			AllKeysToInvalidateForNamespaceListChanged = new Set();
		}
 public FederationUpdateEventArgs(FederationUpdate batch)
 {
     _Updates = batch;
 }
 public GenerationCompleteEventArgs(FederationUpdate batch)
 {
     _Updates = batch;
 }
예제 #5
0
		/// Delete a content base (kills all .wiki and .awiki files; removed the dir if empty)
		/// </summary>
		override public void Delete()
		{
			FederationUpdate update = new FederationUpdate();
			foreach (AbsoluteTopicName topic in AllTopics(false))
				if (!IsBackingTopic(topic.LocalName))
					update.RecordDeletedTopic(topic);

			DirectoryInfo dir = new DirectoryInfo(Root);
			foreach (FileInfo each in dir.GetFiles("*.wiki"))
				each.Delete();
			foreach (FileInfo each in dir.GetFiles("*.awiki"))
				each.Delete();
			if (dir.GetFiles().Length == 0)
				dir.Delete(true);

			OnFederationUpdated(new FederationUpdateEventArgs(update));
		}
예제 #6
0
		/// <summary>
		/// Delete a topic
		/// </summary>
		/// <param name="topic"></param>
		override public void DeleteTopic(LocalTopicName topic)
		{
			string path = TopicPath(topic);
			if (!File.Exists(path))
				return;

			// Delete the sucker!
			File.Delete(path);

			// Fire the event
			FederationUpdate update = new FederationUpdate();
			update.RecordDeletedTopic(topic.AsAbsoluteTopicName(Namespace));
			OnFederationUpdated(new FederationUpdateEventArgs(update));
		}
예제 #7
0
		void ProcessChangedTopics(FederationUpdate updates)
		{
			Set topics = new Set();
			topics.AddRange(updates.CreatedTopics);
			topics.AddRange(updates.UpdatedTopics);
			topics.AddRange(updates.DeletedTopics);

			foreach (AbsoluteTopicName topic in topics)
			{
				IList keysToInvalidate = KeysToInvalidateForTopic(topic);
				foreach (string each in keysToInvalidate)
					Remove(each);
				keysToInvalidate.Clear();
			}

			// if the list of topics in the namespace changed, invalidate appropriate keys
			Set namespaces = new Set();
			foreach (AbsoluteTopicName each in updates.CreatedTopics)
				namespaces.Add(each.Namespace);
			foreach (AbsoluteTopicName each in updates.DeletedTopics)
				namespaces.Add(each.Namespace);
			foreach (string each in namespaces)
			{
				// get the list of keys to invalidate for this namespace when its topic list changes
				IEnumerable list = (IEnumerable)(KeysToInvalidateOnTopicsInNamespaceChange[each]);
				if (list != null)
				{
					foreach (string k in list)
						Remove(k);
					KeysToInvalidateOnTopicsInNamespaceChange[each] = new Set();
				}
			}
		}
예제 #8
0
		/// Delete a content base (kills everything inside recursively).  Note that this does *not* include unregistering
		/// the content base within the federation.
		/// </summary>
		public override void Delete()
		{
			FederationUpdate update = new FederationUpdate();
			foreach (AbsoluteTopicName topic in AllTopics(false))
				if (!IsBackingTopic(topic.LocalName))
					update.RecordDeletedTopic(topic);

			SqlHelper.DeleteNamespace(Namespace, _ConnectionString);
			OnFederationUpdated(new FederationUpdateEventArgs(update));
		}
예제 #9
0
		void ProcessChangedProperties(FederationUpdate updates)
		{
			foreach (string propertyName in updates.AllAddedOrDeletedProperties)
			{
				string key = KeyForProperty(propertyName);
				Remove(key);		
				IList list = KeysToInvalidateForProperty(propertyName);
				foreach (string innerKey in list)
					Remove(innerKey);
				list.Clear();
			}
		}
예제 #10
0
		/// <summary>
		/// Delete a topic
		/// </summary>
		/// <param name="topic"></param>
		public override void DeleteTopic(LocalTopicName topic)
		{
			if( !SqlHelper.TopicExists(Namespace, topic.Name, _ConnectionString) )
			{
				return;
			}

			SqlHelper.DeleteTopic(Namespace, topic.Name, _ConnectionString);

			// Fire the event
			FederationUpdate update = new FederationUpdate();
			update.RecordDeletedTopic(topic.AsAbsoluteTopicName(Namespace));
			OnFederationUpdated(new FederationUpdateEventArgs(update));
		}
예제 #11
0
 public void AddUpdatesFrom(FederationUpdate src)
 {
     foreach (QualifiedTopicRevision top in src.CreatedTopics)
         RecordCreatedTopic(top);
     foreach (QualifiedTopicRevision top in src.DeletedTopics)
         RecordDeletedTopic(top);
     foreach (QualifiedTopicRevision top in src.UpdatedTopics)
         RecordUpdatedTopic(top);
     foreach (DictionaryEntry e in src._addedPropertiesByTopic)
         _addedPropertiesByTopic[e.Key] = e.Value;
     foreach (DictionaryEntry e in src._removedPropertiesByTopic)
         _removedPropertiesByTopic[e.Key] = e.Value;
     foreach (DictionaryEntry e in src._changedPropertiesByTopic)
         _changedPropertiesByTopic[e.Key] = e.Value;
     foreach (DictionaryEntry e in src._addedPropertiesByProperty)
         _addedPropertiesByProperty[e.Key] = e.Value;
     foreach (DictionaryEntry e in src._removedPropertiesByProperty)
         _removedPropertiesByProperty[e.Key] = e.Value;
     foreach (DictionaryEntry e in src._changedPropertiesByProperty)
         _changedPropertiesByProperty[e.Key] = e.Value;
     if (src.FederationPropertiesChanged)
         RecordFederationPropertiesChanged();
     if (src.NamespaceListChanged)
         RecordNamespaceListChanged();
 }
 /// <summary>
 /// Push a generation context.  If this is the outermost context, start a new FederationUpdate to collect all the changes
 /// </summary>
 public void Push()
 {
     if (_Depth == 0)
         _Update = new FederationUpdate();
     _Depth++;
 }
 public void RecordPropertyChange(QualifiedTopicRevision topic, string propertyName, FederationUpdate.PropertyChangeType aType)
 {
     if (_Update == null)
         ThrowMissingContext();
     _Update.RecordPropertyChange(topic, propertyName, aType);
 }
예제 #14
0
		public void RecordPropertyChange(AbsoluteTopicName topic, string propertyName, FederationUpdate.PropertyChangeType aType)
		{
			if (_Update == null)
				ThrowMissingContext();
			_Update.RecordPropertyChange(topic, propertyName, aType);
		}