public static Dictionary <String, ActionMappingEntry> getEntries(Property pProperty)
        {
            var dEntries = new Dictionary <String, ActionMappingEntry>();

            if (pProperty.sName == "actionMappings" && pProperty.xnlChildNodes != null)
            {
                foreach (XmlNode xnChildNode_map in pProperty.xnlChildNodes)
                {
                    if (xnChildNode_map.Name == "map" && xnChildNode_map.ChildNodes != null)
                    {
                        foreach (XmlNode xnChildNode_entry in xnChildNode_map.ChildNodes)
                        {
                            if (xnChildNode_entry.Name == "entry")
                            {
                                if (xnChildNode_entry.Attributes["key"] != null)
                                {
                                    var eEntry = new ActionMappingEntry(xnChildNode_entry.Attributes["key"].Value);
                                    if (xnChildNode_entry["bean"] != null)
                                    {
                                        if (xnChildNode_entry["bean"].Attributes["class"] != null)
                                        {
                                            eEntry.sClass = xnChildNode_entry["bean"].Attributes["class"].Value;
                                        }
                                        if (xnChildNode_entry["bean"].Attributes["parent"] != null)
                                        {
                                            eEntry.sParent = xnChildNode_entry["bean"].Attributes["parent"].Value;
                                        }

                                        // if (xnChildNode_entry["bean"]
                                        eEntry.dProperties = Property.getProperties(xnChildNode_entry["bean"]);
                                    }
                                    if (xnChildNode_entry.Attributes["value-ref"] != null)
                                    {
                                        eEntry.sValue_Ref = xnChildNode_entry.Attributes["value-ref"].Value;
                                    }
                                    dEntries.Add(eEntry.sKey, eEntry);
                                }
                            }
                        }
                    }
                }
                //eEntry.sKey = "cc" + .Count.ToString();
            }

            /*
             * XmlElement xeXmlElement = (XmlElement)xnXmlDataToProcess;
             * foreach(XmlNode xnXmlNode in xeXmlElement.GetElementsByTagName("property"))
             * {
             *  if (xnXmlNode
             * }*/

            return(dEntries);
        }
Exemple #2
0
        public SpringController(String sId, XmlNode xnData)
        {
            this.sId = sId;
            if (xnData.Attributes["class"] != null)
            {
                sClass = xnData.Attributes["class"].Value;
            }
            if (xnData.Attributes["parent"] != null)
            {
                sParent = xnData.Attributes["parent"].Value;
            }
            sInnerXml = xnData.InnerXml;

            dProperties = Property.getProperties(xnData);

            if (dProperties.ContainsKey("actionMappings"))
            {
                dEntries = ActionMappingEntry.getEntries(dProperties["actionMappings"]);
            }
        }
        public static Dictionary<String, ActionMappingEntry> getEntries(Property pProperty)
        {
            var dEntries = new Dictionary<String, ActionMappingEntry>();
            if (pProperty.sName == "actionMappings" && pProperty.xnlChildNodes != null)
            {
                foreach (XmlNode xnChildNode_map in pProperty.xnlChildNodes)
                    if (xnChildNode_map.Name == "map" && xnChildNode_map.ChildNodes != null)
                        foreach (XmlNode xnChildNode_entry in xnChildNode_map.ChildNodes)
                            if (xnChildNode_entry.Name == "entry")
                                if (xnChildNode_entry.Attributes["key"] != null)
                                {
                                    var eEntry = new ActionMappingEntry(xnChildNode_entry.Attributes["key"].Value);
                                    if (xnChildNode_entry["bean"] != null)
                                    {
                                        if (xnChildNode_entry["bean"].Attributes["class"] != null)
                                            eEntry.sClass = xnChildNode_entry["bean"].Attributes["class"].Value;
                                        if (xnChildNode_entry["bean"].Attributes["parent"] != null)
                                            eEntry.sParent = xnChildNode_entry["bean"].Attributes["parent"].Value;

                                        // if (xnChildNode_entry["bean"]
                                        eEntry.dProperties = Property.getProperties(xnChildNode_entry["bean"]);
                                    }
                                    if (xnChildNode_entry.Attributes["value-ref"] != null)
                                        eEntry.sValue_Ref = xnChildNode_entry.Attributes["value-ref"].Value;
                                    dEntries.Add(eEntry.sKey, eEntry);
                                }
                //eEntry.sKey = "cc" + .Count.ToString();
            }
            /*
            XmlElement xeXmlElement = (XmlElement)xnXmlDataToProcess;
            foreach(XmlNode xnXmlNode in xeXmlElement.GetElementsByTagName("property"))
            {
                if (xnXmlNode	
            }*/

            return dEntries;
        }
        public static void addBeanInfoToTreeNode(TreeNode tnTreeNode, String sBeanName, String sBeanType,
                                                 SpringBeans sbSpringBeans)
        {
            if (sbSpringBeans.dBeans.ContainsKey(sBeanName))
            {
                var spSpringControler = new SpringController(sBeanName, sbSpringBeans.dBeans[sBeanName]);
                //	spSpringControler.ShowDetails();

                var tnNewTreeNode = new TreeNode(sBeanType + "  :  " + sBeanName);
                colorCodeTreeNode(tnNewTreeNode, sBeanName, sBeanType);
                tnNewTreeNode.Tag = spSpringControler;
                tnTreeNode.Nodes.Add(tnNewTreeNode);

                // show class
                if (spSpringControler.sClass != null)
                {
                    colorCodeTreeNode(tnNewTreeNode.Nodes.Add("class:" + spSpringControler.sClass),
                                      spSpringControler.sClass, "class");
                }
                // show parent
                if (spSpringControler.sParent != null)
                {
                    addBeanInfoToTreeNode(tnNewTreeNode, spSpringControler.sParent, "parent", sbSpringBeans);
                }
                // show actionMappings property
                foreach (String sName in spSpringControler.dProperties.Keys)
                {
                    if (sName == "actionMappings")
                    {
                        Dictionary <String, ActionMappingEntry> dEntries =
                            ActionMappingEntry.getEntries(spSpringControler.dProperties["actionMappings"]);
                        // show entries
                        foreach (String sEntry in dEntries.Keys)
                        {
                            TreeNode tnEntry;
                            if (dEntries[sEntry].sClass != null)
                            {
                                //tnEntry.Nodes.Add("class:" + dEntries[sEntry].sClass);
                                tnEntry = new TreeNode("action: " + sEntry + " , class:" + dEntries[sEntry].sClass);
                            }
                            else
                            {
                                tnEntry = new TreeNode("action: " + sEntry);
                            }
                            colorCodeTreeNode(tnEntry, tnEntry.Text, "action");
                            // show entry.class

                            // show entry.value-ref
                            if (dEntries[sEntry].sValue_Ref != null)
                            {
                                //TreeNode tnValueRef = tnEntry.Nodes.Add("value-ref:" + dEntries[sEntry].sValue_Ref);
                                addBeanInfoToTreeNode(tnEntry, dEntries[sEntry].sValue_Ref, "value-ref", sbSpringBeans);
                            }
                            // show entry.parent
                            if (dEntries[sEntry].sParent != null)
                            {
                                addBeanInfoToTreeNode(tnEntry, dEntries[sEntry].sParent, "parent", sbSpringBeans);
                            }

                            //tnNewTreeNode.Nodes.Add("entry: " + sEntry);
                            tnNewTreeNode.Nodes.Add(tnEntry);
                        }
                    }
                }
                //tnNewTreeNode.Nodes.Add(String.Format("property: {0} = {1}" , sName, spSpringControler.dProperties[sName]));
                // DI.log.debug("  Property:  {0}", dProperties[sName]);
                // show entries
                //	foreach(String sName in dEntries.Keys)
                //		 DI.log.debug("  Entry:  {0}",dEntries[sName]);
            }
            else
            {
                tnTreeNode.Nodes.Add(String.Format("ERROR: COULD NOT RESOLVE BEAN: {0} : {1}", sBeanType, sBeanName));
            }
        }