示例#1
0
 private void ConvertCatalogue(IPolicyCatalogueCache policyCatalogue)
 {
     policyCatalogue.Content = policyCatalogue.Content.Replace("RoutingTable", "MockTable");
     foreach (IPolicyLanguageTableCache language in policyCatalogue.Languages)
     {
         language.Content = language.Content.Replace("PolicySetLanguage", "MockLanguage");
     }
 }
        private void ConvertCatalogue(IPolicyCatalogueCache policyCatalogue)
        {
            if (null == policyCatalogue)
                return;

            System.Xml.XmlDocument catalogueXml = new XmlDocument();
            catalogueXml.LoadXml(policyCatalogue.Content);

            ConvertRoutingTables(catalogueXml);

            policyCatalogue.Content = catalogueXml.OuterXml;
        }
        private void ConvertCatalogue(IPolicyCatalogueCache policyCatalogue)
        {
            if (null == policyCatalogue)
                return;

            // Just replace the classes for the routing (assemblies are the same)
            string updatedContent = policyCatalogue.Content;
            updatedContent = updatedContent.Replace("\"Workshare.InternalExternalResolver\"", "\"Workshare.Policy.Routing.InternalExternalRouter\"");
            updatedContent = updatedContent.Replace("\"Workshare.DirectorySearcher.DirectoryAnalyzer\"", "\"Workshare.Policy.Routing.LDAPRouter\"");

            policyCatalogue.Content = updatedContent;
        }
        private void ConvertCatalogue(IPolicyCatalogueCache policyCatalogue)
        {
            System.Xml.XmlDocument catalogueXml = new XmlDocument();
            catalogueXml.LoadXml(policyCatalogue.Content);
            XmlNode routingTablesNode = catalogueXml.SelectSingleNode("/PolicySetCatalogue/RoutingTables");

            for (int index = 0; index < routingTablesNode.ChildNodes.Count; ++index)
            {
                XmlNode routingTable = routingTablesNode.ChildNodes[index];
                if (0 == string.Compare("RoutingTable", routingTable.Name))
                    continue;

                XmlNode convertedRoutingTable = ConvertRoutingTable(routingTable);
                routingTablesNode.ReplaceChild(convertedRoutingTable, routingTable);
            }

            policyCatalogue.Content = catalogueXml.OuterXml;
        }
		internal LocalPolicySetVersionCache(LocalPolicySetVersionCache existing, string version, bool latest, PolicySetVersionStatus status)
		{
			m_name = existing.m_name;
			m_version = version;
			m_content = existing.Content;
			m_Status = status;


            if (existing.MasterCatalogue != null)
            {
                LocalPolicyCatalogueCache master = new LocalPolicyCatalogueCache(existing.MasterCatalogue as LocalPolicyCatalogueCache);
                master.ObjectModified += new ObjectModifiedEventHandler(OnObjectModified);
                m_masterCatalogue = master;
            }


			if (existing.m_refCatalogues != null)
			{
				foreach (LocalPolicyCatalogueCache existingCat in existing.m_refCatalogues)
				{
					LocalPolicyCatalogueCache newCat = new LocalPolicyCatalogueCache(existingCat);
                    newCat.ObjectModified += new ObjectModifiedEventHandler(OnObjectModified);
					m_refCatalogues.Add(newCat);
				}
			}


			if (existing.m_compiledSets != null)
			{
				foreach (LocalCompiledPolicySetCache existingCPS in existing.m_compiledSets)
				{
					LocalCompiledPolicySetCache newCPS = new LocalCompiledPolicySetCache(existingCPS);
                    newCPS.ObjectModified += new ObjectModifiedEventHandler(OnObjectModified);
					m_compiledSets.Add(newCPS);
				}
			}

			Latest = latest;
		}
        private void ConvertCatalogue(IPolicyCatalogueCache catalogue)
        {
            System.Xml.XmlDocument catalogueXml = new XmlDocument();
            catalogueXml.LoadXml(catalogue.Content);

            foreach (KeyValuePair<string, string> nodeIdPair in m_catalogueNodes)
            {
                string searchKey = string.Format(System.Globalization.CultureInfo.InvariantCulture, "//{0}[@id='{1}']", nodeIdPair.Value, nodeIdPair.Key);
                XmlNode node = catalogueXml.SelectSingleNode(searchKey);
                if (null == node)
                    continue;

                if (node.HasChildNodes)
                    RemoveChildrenFromCatalogue(node);

                if (null != node.ParentNode)
                    node.ParentNode.RemoveChild(node);
            }

            RemoveExceptionAttributeFromActions(catalogueXml);
            InsertExceptionAttribute(catalogueXml);

            catalogue.Content = catalogueXml.OuterXml;
        }
示例#7
0
		private static void CopyLanguages(IPolicyCatalogueCache sourceCatalogue, IPolicyCatalogueCache destinationCatalogue)
		{
			foreach (IPolicyLanguageTableCache languageTableCache in sourceCatalogue.Languages)
			{
				destinationCatalogue.NewLanguage(languageTableCache.Language.Code, languageTableCache.Content, languageTableCache.Language.Default);
			}
		}
示例#8
0
		private void ShowCatalogue(IPolicyCatalogueCache cc)
		{
			Catalogue rcForm = new Catalogue(cc);
			ShowDetail(rcForm);
		}
        private void ConvertCatalogue(IPolicyCatalogueCache policyCatalogue, Dictionary<string, string> channelRoutingTableIds)
        {
            if (null == policyCatalogue)
                return;

            System.Xml.XmlDocument catalogueXml = new XmlDocument();
            catalogueXml.LoadXml(policyCatalogue.Content);

            foreach (KeyValuePair<string, string> channelRoutingTableId in channelRoutingTableIds)
            {
                ConvertChannels(catalogueXml, channelRoutingTableId.Key);
                ConvertRoutingTables(catalogueXml, channelRoutingTableId.Value);
            }

            policyCatalogue.Content = catalogueXml.OuterXml;
        }
		private void LoadPolicySetVersion(string xml)
		{
			XmlDocument xmlDoc = new XmlDocument();
			xmlDoc.LoadXml(xml);

			m_name = xmlDoc.DocumentElement.Attributes.GetNamedItem("name").Value;

            try 
			{ 
				ID = Convert.ToInt64(xmlDoc.DocumentElement.Attributes.GetNamedItem("id").Value, CultureInfo.InvariantCulture);
			}
			catch( Exception ex)
			{
				Logger.LogError("Unable to retrieve id from local policy file");
				Logger.LogError(ex);
			}


			// read all the xml and extract out elements to create catalogues and languages, etc
			m_content = xmlDoc.SelectSingleNode("/PolicySet/Content").InnerXml;

			XmlNodeList catalogues = xmlDoc.SelectNodes("/PolicySet/Catalogues/Catalogue");
			foreach (XmlNode catalogue in catalogues)
			{
				string cat_content = catalogue.SelectSingleNode("Content").InnerXml;

				LocalPolicyCatalogueCache cat = new LocalPolicyCatalogueCache(cat_content);
                cat.ObjectModified += new ObjectModifiedEventHandler(OnObjectModified);

                try 
				{ 
					cat.ID = Convert.ToInt64(catalogue.Attributes.GetNamedItem("id").Value, CultureInfo.InvariantCulture); 
				}
				catch( Exception ex)
				{
	                Logger.LogError("Unable to retrieve id from local policy file");
					Logger.LogError(ex);
				}

                cat.LoadLanguages(catalogue.SelectNodes("Languages/Language"));

                if (catalogue.Attributes.GetNamedItem("master").Value == "true")
                    m_masterCatalogue = cat;
                else
                    m_refCatalogues.Add(cat);
			}
            AddCompiledPolicySets(xmlDoc);
		}
		public IPolicyCatalogueCache NewMasterCatalogue(string content)
		{
            ValidateChanges();
			LocalPolicyCatalogueCache lpc = new LocalPolicyCatalogueCache(content);
            lpc.ObjectModified += new ObjectModifiedEventHandler(OnObjectModified);

			m_masterCatalogue = lpc;
			return m_masterCatalogue;
		}
示例#12
0
		private XmlNode WriteCatalogueInfo(XmlDocument xmlDoc, IPolicyCatalogueCache catalogue, bool isMaster)
		{
			XmlElement cat = xmlDoc.CreateElement("Catalogue");
            XmlAttribute id = xmlDoc.CreateAttribute("id");
            id.Value = Convert.ToString((catalogue as LocalPolicyCatalogueCache).ID, CultureInfo.InvariantCulture);
			XmlAttribute catAtt = xmlDoc.CreateAttribute("master");
			catAtt.Value = isMaster ? "true" : "false";
            cat.Attributes.Append(id);
            cat.Attributes.Append(catAtt);

			XmlElement cat_content = xmlDoc.CreateElement("Content");
			cat_content.InnerXml = catalogue.Content;
			cat.AppendChild(cat_content);

			XmlElement langs = xmlDoc.CreateElement("Languages");
			foreach (IPolicyLanguageTableCache lang in catalogue.Languages)
				langs.AppendChild(WriteLanguageInfo(xmlDoc, lang));

			cat.AppendChild(langs);
			return cat;
		}
示例#13
0
		public Catalogue(IPolicyCatalogueCache cat)
		{
			InitializeComponent();

			xmlTreeView1.Xml = cat.Content;
		}
		private void CheckCatalogueTokens(IPolicyCatalogueCache catalogue, bool doesContain, string[] tokens)
		{
			foreach (string token in tokens)
			{
				if (doesContain)
					Assert.IsTrue(catalogue.Content.Contains(token));
				else
					Assert.IsFalse(catalogue.Content.Contains(token));
			}
		}