コード例 #1
0
	}//list
	
	 
	/*public void insert(AbstractComponent ac){
	   
	   
	    
	   IDbConnection dbcon = Connector.getConnection();
	   dbcon.Open();
       IDbCommand dbcmd = dbcon.CreateCommand();
       string sql =
           "INSERT INTO AbstractComponent (id_abstract_component, id_abstract_supertype, name)" + 
           "VALUES ("+ac.Id_abstract_component+","+ac.Id_abstract_supertype+",'"+ac.Name+"')";
       dbcmd.CommandText = sql;
       
       dbcmd.ExecuteNonQuery();
       
 
       dbcmd.Dispose();
       dbcmd = null;
       dbcon.Close();
       dbcon = null;
       
	}*/


    internal InnerComponent retrieve2(int id_abstract, int id_functor_app)
    {
        InnerComponent ic = null;

        IDbConnection dbcon = Connector.DBcon;
        IDbCommand dbcmd = dbcon.CreateCommand();
        string sql =
            "SELECT id_abstract_owner, id_inner, id_functor_app, id_abstract_inner, parameter_top, transitive, public, multiple " +
            "FROM innercomponent " +
            "WHERE id_abstract_owner=" + id_abstract + " AND " +
                  "id_functor_app like '" + id_functor_app + "'";
        dbcmd.CommandText = sql;
        IDataReader reader = dbcmd.ExecuteReader();
        if (reader.Read())
        {
            ic = new InnerComponent();

            ic.Id_abstract_owner = (int)reader["id_abstract_owner"];
            ic.Id_inner = (string)reader["id_inner"];
            ic.Id_functor_app = (int)reader["id_functor_app"];
            ic.Id_abstract_inner = (int)reader["id_abstract_inner"];
            ic.Parameter_top = (string)reader["parameter_top"];
            ic.Transitive = ((int)reader["transitive"]) == 0 ? false : true;
            ic.IsPublic = ((int)reader["public"]) == 0 ? false : true;
			ic.Multiple = ((int)reader["multiple"]) == 0 ? false : true;
        }//if
        // clean up
        reader.Close();
        reader = null;
        dbcmd.Dispose();
        dbcmd = null;
        return ic;
    }
コード例 #2
0
    }//retrieve


    public IList<InnerComponent> list(int id_abstract_start)
    {
	
	   IDictionary<string,InnerComponent> list = new Dictionary<string,InnerComponent>();
			
	   int id_abstract = id_abstract_start;
		
	   while (id_abstract > 0) 
	   {			
		   IDbConnection dbcon = Connector.DBcon;
	       IDbCommand dbcmd = dbcon.CreateCommand();
	       string sql =
	           "SELECT id_abstract_owner, id_inner, id_functor_app, id_abstract_inner, parameter_top, transitive, public, multiple " +
	           "FROM innercomponent " +
	           "WHERE id_abstract_owner="+id_abstract + " " +
			   "ORDER BY transitive";
	       dbcmd.CommandText = sql;
	       IDataReader reader = dbcmd.ExecuteReader();
	       while(reader.Read()) {
	       		InnerComponent ic = new InnerComponent();
	       		ic.Id_abstract_owner = (int)reader["id_abstract_owner"];
	       		ic.Id_inner = (string)reader["id_inner"];
	       		ic.Id_functor_app = (int)reader["id_functor_app"];
	       		ic.Id_abstract_inner = (int)reader["id_abstract_inner"];
	            ic.Parameter_top = (string)reader["parameter_top"];
	            ic.Transitive = ((int)reader["transitive"]) == 0 ? false : true;
	            ic.IsPublic = ((int)reader["public"]) == 0 ? false : true;
				ic.Multiple = ((int)reader["multiple"]) == 0 ? false : true;
				if (!list.ContainsKey (ic.Id_inner))
					list.Add (ic.Id_inner, ic);
				else
					Console.Error.WriteLine ("InnerComponentDAT-list: inner component {0} already exists", ic.Id_inner);
	       }//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);
			   id_abstract = acfa.Id_abstract;
		   }
		   else 
			   id_abstract = -1;			
	   }

	   IList<InnerComponent> list_return = new List<InnerComponent> (list.Values);

	   return list_return;
       
	}//list
コード例 #3
0
    public void insert(InnerComponent ac)
    {
			
        String sql =
            "INSERT INTO innercomponent (id_abstract_owner, id_functor_app, id_inner, id_abstract_inner, parameter_top, transitive, public, multiple)" +
					" VALUES (" + ac.Id_abstract_owner + "," + ac.Id_functor_app + ",'" + ac.Id_inner + "'," + ac.Id_abstract_inner + ",'"+ ac.Parameter_top + "'," + (ac.Transitive ? -1 : 0) + "," + (ac.IsPublic ? -1 : 0) + "," + (ac.Multiple ? -1 : 0) + ")";

		Console.WriteLine("InnerComponentDAO.cs: TRY INSERT INNER COMPONENT :" + sql);
			
        Connector.performSQLUpdate(sql);
			
    }
コード例 #4
0
        private InnerComponent findInnerComponentOwnerOfSlice(int Id_abstract, string id_inner)
        {
            int            Id_abstract_traverse = Id_abstract;
            InnerComponent ic = null;

            while (ic == null && Id_abstract_traverse != 0)
            {
                ic = br.ufc.pargo.hpe.backend.DGAC.BackEnd.icdao.retrieve(Id_abstract_traverse, id_inner);
                if (ic == null)
                {
                    AbstractComponentFunctor            cTraverse = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(Id_abstract_traverse);
                    AbstractComponentFunctorApplication cSuperApp = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.retrieve(cTraverse.Id_functor_app_supertype);
                    Id_abstract_traverse = cSuperApp.Id_abstract;
                }
            }
            return(ic);
        }
コード例 #5
0
    public InnerComponent retrieve(int id_abstract_start, string id_inner)
    {
    	InnerComponent ic = null;

		int id_abstract = id_abstract_start;
		
		while (id_abstract > 0) 
		{
	        IDbConnection dbcon = Connector.DBcon;
	        IDbCommand dbcmd = dbcon.CreateCommand();
	        string sql =
	            "SELECT id_abstract_owner, id_inner, id_functor_app, id_abstract_inner, parameter_top, transitive, public, multiple " +
	            "FROM innercomponent " +
	            "WHERE id_abstract_owner=" + id_abstract + " AND " +
	                  "id_inner like '" + id_inner + "'";
	        dbcmd.CommandText = sql;
	        IDataReader reader = dbcmd.ExecuteReader();
	        if (reader.Read())
	        {
	            ic = new InnerComponent();
	
	            ic.Id_abstract_owner = (int)reader["id_abstract_owner"];
	            ic.Id_inner = (string)reader["id_inner"];
	            ic.Id_functor_app = (int)reader["id_functor_app"];
	            ic.Id_abstract_inner = (int)reader["id_abstract_inner"];
	            ic.Parameter_top = (string)reader["parameter_top"];
	            ic.Transitive = ((int)reader["transitive"])==0 ? false : true;
	            ic.IsPublic = ((int)reader["public"]) == 0 ? false : true;
				ic.Multiple = ((int)reader["multiple"]) == 0 ? false : true;
	        }//if
	        // clean up
	        reader.Close();
	        reader = null;
	        dbcmd.Dispose();
	        dbcmd = null;
			
			if (ic==null) 
			{				
                AbstractComponentFunctor acf = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(id_abstract);
                //Console.WriteLine("acf is null ? " + (acf==null) + ", " + id_abstract);					
				if (acf == null)
						throw new Exception("ERROR: InnerComponentDAO.cs (retrieve) : id_abstract = " + id_abstract + "NOT FOUND when loonking for supertype ..." );

				if (acf.Id_functor_app_supertype > 0)
				{
				   AbstractComponentFunctorApplication acfa = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.retrieve(acf.Id_functor_app_supertype);
				   
				   id_abstract = acfa.Id_abstract;
				}
				else 
				   id_abstract = -1;
				Console.WriteLine("InnerComponentDAO.cs - GOING TO SUPERTYPE " + id_abstract + " - ACF was null ?" + (acf == null));
			} else
				   id_abstract = -1;
			
		}
			
			if (ic==null) 
			{
				Console.WriteLine("InnerComponentDAO.cs: INNER NOT FOUND " + id_abstract_start + "," + id_inner);
			}
			
        return ic;

    }//retrieve
コード例 #6
0
        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);
        }
コード例 #7
0
    public bool isPublic()
    {
        InnerComponent ic = BackEnd.icdao.retrieve(this.Id_abstract, this.Id_inner);
			//Console.WriteLine("{0}.{1} is {2} !", this.Id_abstract, this.Id_inner, ic.IsPublic ? "public" : "private" );
        return ic.IsPublic;
    }