}// END Method Close public void AddPluginInterface(string pluginInterfaceName) { if (this.web.ContainsKey(Thread.CurrentThread)) { SPWeb web = this.web[Thread.CurrentThread]; XMLDocumentPersistenceDriver p = GetXMLDocumentPersistenceDriver(web); p.AddPluginInterface(pluginInterfaceName); web.Properties[KEY] = p.Document.InnerXml; web.Update(); } else if (this.webApplication.ContainsKey(Thread.CurrentThread)) { SPWebApplication webApplication = this.webApplication[Thread.CurrentThread]; XMLDocumentPersistenceDriver p = GetXMLDocumentPersistenceDriver(webApplication); p.AddPluginInterface(pluginInterfaceName); webApplication.Properties[KEY] = p.Document.InnerXml; webApplication.Update(); } else if (farm.Contains(Thread.CurrentThread)) { SPFarm localFarm = SPFarm.Local; XMLDocumentPersistenceDriver p = GetXMLDocumentPersistenceDriver(localFarm); p.AddPluginInterface(pluginInterfaceName); localFarm.Properties[KEY] = p.Document.InnerXml; localFarm.Update(); } }// END Method AddPluginInterface
}// END Method GetPluginInterfacesNames public IEnumerable <string> GetPluginImplementationsAddresses(string pluginInterfaceName) { IEnumerable <string> rslt = new List <string>(); if (this.web.ContainsKey(Thread.CurrentThread)) { SPWeb web = this.web[Thread.CurrentThread]; XMLDocumentPersistenceDriver p = GetXMLDocumentPersistenceDriver(web); rslt = p.GetPluginImplementationsAddresses(pluginInterfaceName); } else if (this.webApplication.ContainsKey(Thread.CurrentThread)) { SPWebApplication webApplication = this.webApplication[Thread.CurrentThread]; XMLDocumentPersistenceDriver p = GetXMLDocumentPersistenceDriver(webApplication); rslt = p.GetPluginImplementationsAddresses(pluginInterfaceName); } else if (farm.Contains(Thread.CurrentThread)) { SPFarm localFarm = SPFarm.Local; XMLDocumentPersistenceDriver p = GetXMLDocumentPersistenceDriver(localFarm); rslt = p.GetPluginImplementationsAddresses(pluginInterfaceName); } return(rslt); }// END Method GetPluginImplementationsAddresses
}// END Method RemovePluginImplementation public bool ExistPluginImplementation(string pluginInterfaceName, string pluginImplementationAddress) { bool rslt = false; if (this.web.ContainsKey(Thread.CurrentThread)) { SPWeb web = this.web[Thread.CurrentThread]; XMLDocumentPersistenceDriver p = GetXMLDocumentPersistenceDriver(web); rslt = p.ExistPluginImplementation(pluginInterfaceName, pluginImplementationAddress); } else if (this.webApplication.ContainsKey(Thread.CurrentThread)) { SPWebApplication webApplication = this.webApplication[Thread.CurrentThread]; XMLDocumentPersistenceDriver p = GetXMLDocumentPersistenceDriver(webApplication); rslt = p.ExistPluginImplementation(pluginInterfaceName, pluginImplementationAddress); } else if (farm.Contains(Thread.CurrentThread)) { SPFarm localFarm = SPFarm.Local; XMLDocumentPersistenceDriver p = GetXMLDocumentPersistenceDriver(localFarm); rslt = p.ExistPluginImplementation(pluginInterfaceName, pluginImplementationAddress); } return(rslt); }// END Method ExistPluginImplementation
}// END Method GetXMLDocumentPersistenceDriver private XMLDocumentPersistenceDriver GetXMLDocumentPersistenceDriver(SPFarm farm) { XMLDocumentPersistenceDriver rslt; if (farm.Properties.ContainsKey(KEY)) { XmlDocument document = new XmlDocument(); document.LoadXml(farm.Properties[KEY].ToString()); rslt = new XMLDocumentPersistenceDriver(document); } else { rslt = new XMLDocumentPersistenceDriver(); } return(rslt); } // END Method GetXMLDocumentPersistenceDriver