}//list2 public IList <Slice> listByInterface(int id_abstract_start, string id_interface_start) { IList <Tuple <int, string> > queue = new List <Tuple <int, string> > (); queue.Add(new Tuple <int, string> (id_abstract_start, id_interface_start)); IDictionary <string, string> mem = new Dictionary <string, string>(); IList <Slice> list = new List <Slice>(); while (queue.Count > 0) { int id_abstract = queue[0].Item1; string id_interface = queue[0].Item2; queue.RemoveAt(0); IDbConnection dbcon = Connector.DBcon; IDbCommand dbcmd = dbcon.CreateCommand(); string sql = "SELECT id_abstract, " + "id_interface, " + "id_interface_slice, " + "id_inner, " + "transitive, " + "property_name " + "FROM slice " + "WHERE id_abstract=" + id_abstract + " and id_interface like '" + id_interface + "'"; dbcmd.CommandText = sql; Console.WriteLine(sql); IDataReader reader = dbcmd.ExecuteReader(); while (reader.Read()) { Slice s = new Slice(); s.Id_abstract = (int)reader["id_abstract"]; s.Id_interface = (string)reader["id_interface"]; s.Id_interface_slice = (string)reader["id_interface_slice"]; s.Id_inner = (string)reader["id_inner"]; s.Transitive = ((int)reader["transitive"]) == 0 ? false : true; s.PortName = (string)reader["property_name"]; //if (!mem.ContainsKey(s.Id_inner)) //{ // mem.Add(s.Id_inner, s.Id_inner); list.Add(s); //} } //while // clean up reader.Close(); reader = null; dbcmd.Dispose(); dbcmd = null; AbstractComponentFunctor acf = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(id_abstract); if (acf.Id_functor_app_supertype > 0) { AbstractComponentFunctorApplication acfa = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.retrieve(acf.Id_functor_app_supertype); Interface i = br.ufc.pargo.hpe.backend.DGAC.BackEnd.idao.retrieve(id_abstract, id_interface); id_abstract = acfa.Id_abstract; string[] id_interface_super_list = Interface.splitIDs(i.Id_interface_super); foreach (string id_interface_super in id_interface_super_list) { queue.Add(new Tuple <int, string> (id_abstract, id_interface_super)); } } else { id_abstract = -1; } } return(list); }//list
public IList <string> fetchReferences(IDictionary <string, AbstractComponentFunctorApplication> pars) { Console.WriteLine("ENTER fetchReferences - id_abstract=" + this.Id_abstract + ", id_interface=" + this.Id_interface); foreach (KeyValuePair <string, AbstractComponentFunctorApplication> y in pars) { if (y.Key != null && y.Value != null) { Console.WriteLine("key=" + y.Key + ", value=" + y.Value.Id_abstract); } else { Console.WriteLine("somthing strange : " + (y.Key == null ? "null" : y.Key.ToString()) + " , " + (y.Value == null ? "null" : y.Value.ToString())); } } IList <string> refs = new List <string>(); AbstractComponentFunctor cThis = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(this.Id_abstract); AbstractComponentFunctorApplication cSuperApp = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.retrieve(cThis.Id_functor_app_supertype); if (cSuperApp != null) { AbstractComponentFunctor acfsuper = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(cSuperApp.Id_abstract); IDictionary <string, AbstractComponentFunctorApplication> parsSuper = null; collectParameters(pars, cSuperApp, out parsSuper); string[] id_interface_super_list = Interface.splitIDs(this.Id_interface_super); Console.WriteLine("fetchReferences: id_interface_super_list.Length = " + id_interface_super_list.Length + ", this.Id_Interface_super=" + this.Id_interface_super); foreach (string sss in id_interface_super_list) { Console.WriteLine("fetchReference - SUPER: " + sss); } foreach (string id_interface_super in id_interface_super_list) { Interface iSuper = br.ufc.pargo.hpe.backend.DGAC.BackEnd.idao.retrieve(cSuperApp.Id_abstract, id_interface_super); foreach (string iref in iSuper.fetchReferences(parsSuper)) { refs.Add(iref); } string refname = LoaderApp.buildDllName(acfsuper.Library_path, iSuper.Assembly_string); if (!refs.Contains(refname)) { refs.Add(refname); } } } // Traverse slices. IList <Slice> slices = br.ufc.pargo.hpe.backend.DGAC.BackEnd.sdao.listByInterface(Id_abstract, Id_interface); foreach (Slice s in slices) { Console.WriteLine("SLICE (fetchReference): " + Id_abstract + ":" + Id_interface + ":" + s.Id_inner + " - " + s.PortName); InnerComponent ic = br.ufc.pargo.hpe.backend.DGAC.BackEnd.icdao.retrieve(Id_abstract, s.Id_inner); if (ic != null) { AbstractComponentFunctorApplication acfa = null; IDictionary <string, AbstractComponentFunctorApplication> parsSlice = null; // --------------------------------------------------------------------------------------- if (!ic.Parameter_top.Equals("")) { if (!pars.TryGetValue(ic.Parameter_top, out acfa)) { acfa = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.retrieve(ic.Id_functor_app); Console.WriteLine("fetchReferences - TRACE 1.1 - ic.Parameter_top=" + ic.Parameter_top + ", acfa.Id_abstract=" + acfa.Id_abstract); } else { Console.WriteLine("fetchReferences - TRACE 1.2 - ic.Parameter_top=" + ic.Parameter_top + ", acfa.Id_abstract=" + acfa.Id_abstract + ", ic.id_inner=" + ic.Id_inner); } } else { acfa = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.retrieve(ic.Id_functor_app); Console.WriteLine("fetchReferences - TRACE 2 - acfa.Id_abstract=" + acfa.Id_abstract); } collectParameters(pars, acfa, out parsSlice); Console.WriteLine("RETRIEVE BY MATCHING: " + acfa.Id_abstract + "," + ic.Id_abstract_inner + "," + s.Id_interface_slice); Interface[] i_list = br.ufc.pargo.hpe.backend.DGAC.BackEnd.idao.retrieveByMatching(acfa.Id_abstract, ic.Id_abstract_inner, s.Id_interface_slice); if (i_list == null || i_list.Length == 0) { Console.WriteLine("i is null : " + acfa.Id_abstract + "," + ic.Id_abstract_inner + "," + s.Id_interface_slice); } AbstractComponentFunctor acfSlice = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(acfa.Id_abstract); foreach (Interface i in i_list) { IList <string> refsSlice = i.fetchReferences(parsSlice); foreach (string r in refsSlice) { if (!refs.Contains(r)) { refs.Add(r); } } string refname = LoaderApp.buildDllName(acfSlice.Library_path, i.Assembly_string); if (!refs.Contains(refname)) { refs.Add(refname); } } } } Console.WriteLine("EXIT fetchReferences - id_abstract=" + this.Id_abstract + ", id_interface=" + this.Id_interface); return(refs); }