コード例 #1
0
    internal IList<SupplyParameterParameter> listFreeVariables(AbstractComponentFunctor absC)
    {
        IList<SupplyParameterParameter> spp_List = new List<SupplyParameterParameter>();
        IDbConnection dbcon = Connector.DBcon;
        IDbCommand dbcmd = dbcon.CreateCommand();
        string sql =
            "SELECT ss.id_abstract, s.id_parameter, s.id_functor_app, s.id_parameter_actual, s.freevariable " +
            "FROM supplyparameterparameter s, supplyparameter ss, innercomponent i " +
            "WHERE  s.id_functor_app = i.id_functor_app AND " +
                    "s.id_functor_app = ss.id_functor_app AND " + 
                    "s.id_parameter = ss.id_parameter AND " +
                    "i.id_abstract_owner = " + absC.Id_abstract + " AND " +
                    "s.freeVariable = 1";
                    
        dbcmd.CommandText = sql;
        IDataReader reader = dbcmd.ExecuteReader();
        while (reader.Read())
        {
            SupplyParameterParameter spc = new SupplyParameterParameter();
            spc.Id_abstract = (int)reader["id_abstract"];
            spc.Id_parameter = (string)reader["id_parameter"];
            spc.Id_functor_app = (int)reader["id_functor_app"];
            spc.Id_argument = (string)reader["id_parameter_actual"];
            spc.FreeVariable = ((int)reader["freeVariable"]) == 0 ? false : true;
            spp_List.Add(spc);

        }//while
        // clean up
        reader.Close();
        reader = null;
        dbcmd.Dispose();
        dbcmd = null;
        return spp_List;
    }
コード例 #2
0
	public IList<AbstractComponentFunctor> listByKind(string kind)
	{
		IList<AbstractComponentFunctor> acfaList = new List<AbstractComponentFunctor>();
		IDbConnection dbcon = Connector.DBcon;
		IDbCommand dbcmd = dbcon.CreateCommand();
		string sql =
			"SELECT id_abstract, id_functor_app_supertype, library_path, hash_component_UID, kind " +
			"FROM abstractcomponentfunctor " +
			"WHERE kind like '" + kind + "'";
		dbcmd.CommandText = sql;

			Console.WriteLine ("listByKind ****** : " + sql);

		IDataReader reader = dbcmd.ExecuteReader();
		while (reader.Read())
		{
			AbstractComponentFunctor acf = new AbstractComponentFunctor();
			acf.Hash_component_UID = (string)reader["hash_component_UID"]; /* LINE ADDED BY HERON (new field in abstractcomponentfunctor) */
			acf.Id_abstract = (int)reader["id_abstract"];
			acf.Id_functor_app_supertype = (int)reader["id_functor_app_supertype"];
			acf.Library_path = (string)reader["library_path"];
			acf.Kind = (string)reader["kind"];
			acfaList.Add(acf);
			if (!cache_acf.ContainsKey(acf.Id_abstract)) 
					cache_acf.Add(acf.Id_abstract, acf);
		}//if

		// clean up
		reader.Close();
		reader = null;
		dbcmd.Dispose();
		dbcmd = null;
		return acfaList;
	}
コード例 #3
0
    public AbstractComponentFunctor retrieve_libraryPath(string library_path)
    {
        AbstractComponentFunctor acf = null;
        IDbConnection dbcon = Connector.DBcon;
        IDbCommand dbcmd = dbcon.CreateCommand();
        string sql =
             "SELECT hash_component_UID, id_abstract, id_functor_app_supertype, library_path, kind " +
             "FROM abstractcomponentfunctor " +
             "WHERE library_path like '" + library_path + "'";
        dbcmd.CommandText = sql;
        IDataReader reader = dbcmd.ExecuteReader();
        while (reader.Read())
        {
            acf = new AbstractComponentFunctor();
            acf.Hash_component_UID = (string)reader["hash_component_UID"];
            acf.Id_abstract = (int)reader["id_abstract"];
            acf.Id_functor_app_supertype = (int)reader["id_functor_app_supertype"];
            acf.Library_path = (string)reader["library_path"];
            acf.Kind = (string)reader["kind"];
            if (!cache_acf.ContainsKey(acf.Id_abstract)) cache_acf.Add(acf.Id_abstract, acf);
        }


        //while
        // clean up
        reader.Close();
        reader = null;
        dbcmd.Dispose();
        dbcmd = null;
        return acf;
    }
コード例 #4
0
    public int insert(AbstractComponentFunctor ac)
    {

        int nextKey = ac.Id_abstract;
        if (nextKey <= 0)
            nextKey = Connector.nextKey("id_abstract", "abstractcomponentfunctor");

        String sql =
            "INSERT INTO abstractcomponentfunctor (id_abstract, id_functor_app_supertype, library_path, hash_component_UID, kind)" +
            " VALUES (" + nextKey + ","
            + ac.Id_functor_app_supertype + "," 
            + (ac.Library_path == null ? "null" : ("'" + ac.Library_path + "'")) + ","
            + (ac.Hash_component_UID == null ? "null" : ("'" + ac.Hash_component_UID + "'")) + ",'" + ac.Kind + "')";

     	Console.WriteLine("AbstractComponentFunctor.cs: TRY INSERT: " + sql);

        Connector.performSQLUpdate(sql);

        if (cache_acf.ContainsKey(ac.Id_abstract))
        {
            cache_acf.Remove(ac.Id_abstract);
            cache_acf.Add(ac.Id_abstract, ac);
        }

        return nextKey;
    }
コード例 #5
0
        }//list

        public IList <Slice> listByInner(int id_abstract_start, string id_inner)
        {
            IList <Slice> list  = new List <Slice>();
            IDbConnection dbcon = Connector.getConnection();

            dbcon.Open();
            IDbCommand dbcmd = dbcon.CreateCommand();

            int id_abstract = id_abstract_start;

            while (id_abstract > 0)
            {
                string sql =
                    "SELECT id_abstract, " +
                    "id_inner, " +
                    "id_interface_slice, " +
                    "id_interface, " +
                    "transitive, " +
                    "property_name " +
                    "FROM slice " +
                    "WHERE id_abstract=" + id_abstract + " and id_inner like '" + id_inner + "'";
                dbcmd.CommandText = sql;
                Console.WriteLine(sql);
                IDataReader reader = dbcmd.ExecuteReader();
                if (reader.Read())
                {
                    do
                    {
                        Slice s = new Slice();
                        s.Id_abstract        = (int)reader ["id_abstract"];
                        s.Id_inner           = (string)reader ["id_inner"];
                        s.Id_interface_slice = (string)reader ["id_interface_slice"];
                        s.Id_interface       = (string)reader ["id_interface"];
                        s.Transitive         = ((int)reader ["transitive"]) == 0 ? false : true;
                        s.PortName           = (string)reader ["property_name"];
                        list.Add(s);
                    } while (reader.Read());
                    id_abstract = 0;
                }
                else
                {
                    AbstractComponentFunctor acf = BackEnd.acfdao.retrieve(id_abstract);
                    id_abstract = acf.Id_functor_app_supertype > 0 ? BackEnd.acfadao.retrieve(acf.Id_functor_app_supertype).Id_abstract : 0;
                }
                // clean up
                reader.Close();
                reader = null;
            }
            dbcmd.Dispose();
            dbcmd = null;
            dbcon.Close();
            dbcon = null;
            return(list);
        }//list2
コード例 #6
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
コード例 #7
0
        //returns an icollection of
        public static IList <InfoCompile> getReferences_Abstract(int id_abstract)
        {
            IList <InfoCompile> referencesSet = new List <InfoCompile>();
            IList <Interface>   iList         = br.ufc.pargo.hpe.backend.DGAC.BackEnd.idao.list(id_abstract);

            foreach (Interface i in iList)
            {
                IList <string> referencesArrayAll_list = new List <string> ();

                foreach (string reference in i.References)
                {
                    Console.WriteLine("REFERENCE: " + id_abstract + " - " + i.Class_name + " -- " + reference);
                    referencesArrayAll_list.Add(reference);
                }

                IList <SourceCode> scList = br.ufc.pargo.hpe.backend.DGAC.BackEnd.scdao.list('i', i.Id_abstract, i.Id_interface);

                InfoCompile info = new InfoCompile();

                info.sourceContents = new Tuple <string, string> [scList.Count];

                int source_counter = 0;
                foreach (SourceCode sc in scList)
                {
                    IList <string> sourceRefs = sc.ExternalReferences;
                    foreach (string sourceRef in sourceRefs)
                    {
                        referencesArrayAll_list.Add(sourceRef);
                    }
                    info.sourceContents [source_counter] = new Tuple <string, string> (sc.File_name.Split('.')[0], sc.Contents);
                    source_counter++;
                }

                string[] referencesArrayAll = new string[referencesArrayAll_list.Count];
                referencesArrayAll_list.CopyTo(referencesArrayAll, 0);

                AbstractComponentFunctor acf1 = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(id_abstract);
                info.moduleName = i.Class_name;
                info.unitId     = i.Id_interface;
                //	info.partition_index = i.Unit_replica;
                info.cuid         = acf1.Hash_component_UID;
                info.library_path = acf1.Library_path;
                info.id           = acf1.Id_abstract;
                info.references   = referencesArrayAll;

                referencesSet.Add(info);
                // libRefs.Add(buildDllName(acf1.Library_path, acf1.Library_path + "." + info.sourceName.Split('.')[0])); // DESNECESSÁRIO, pois agora tudo vai ser compilado junto
                info.output_type = /*sc.File_type.Equals("exe") ? Constants.EXE_OUT : */ Constants.DLL_OUT;
            }//foreach

            return(referencesSet);
        }
コード例 #8
0
		internal IList<InnerComponentExposed> retrieveContainerList(int id_abstract_start, string id_inner_owner, string id_inner)
		{
			int id_abstract = id_abstract_start;
			IList<InnerComponentExposed> iceList = new List<InnerComponentExposed>();
            InnerComponentExposed ice = null;

			while (id_abstract > 0)
			{
				IDbConnection dbcon = Connector.DBcon;
				IDbCommand dbcmd = dbcon.CreateCommand();
				string sql =
					"SELECT id_abstract, id_inner_rename, id_inner_owner, id_inner " +
					"FROM innercomponentexposed " +
					"WHERE id_abstract=" + id_abstract + " AND " +
						  "id_inner like '" + id_inner + "' AND " +
						  "id_inner_owner like '" + id_inner_owner + "'";
				Console.WriteLine("retrieveContainer: " + sql);
				dbcmd.CommandText = sql;
				IDataReader reader = dbcmd.ExecuteReader();
				while (reader.Read())
				{
					ice = new InnerComponentExposed();
					ice.Id_abstract = (int)reader["id_abstract"];
					ice.Id_inner_rename = (string)reader["id_inner_rename"];
					ice.Id_inner_owner = (string)reader["id_inner_owner"];
					ice.Id_inner = (string)reader["id_inner"];
                    iceList.Add(ice);
				}//while
				 // clean up
				reader.Close();
				reader = null;
				dbcmd.Dispose();
				dbcmd = null;

				if (ice == 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;
				}
				else
					id_abstract = -1;
			}

			return iceList;
		}
コード例 #9
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);
        }
コード例 #10
0
        internal Interface retrieveSuper(int id_abstract, string id_interface)
        {
            Console.WriteLine("retrieveSuper - BEGIN 1 " + id_abstract + "/" + id_interface);
            bool loop;
            AbstractComponentFunctor acf = DGAC.BackEnd.acfdao.retrieve(id_abstract);

            IList <Interface> iList = BackEnd.idao.list(id_abstract);

            Console.WriteLine("retrieveSuper - BEGIN 2 " + iList.Count);
            foreach (Interface i in iList)
            {
                IList <Tuple <AbstractComponentFunctor, Interface> > queue = new List <Tuple <AbstractComponentFunctor, Interface> > ();
                queue.Add(new Tuple <AbstractComponentFunctor, Interface> (acf, i));
                while (queue.Count > 0)
                {
                    AbstractComponentFunctor acfCurr = queue[0].Item1;
                    Interface iCurr = queue[0].Item2;
                    queue.RemoveAt(0);
                    Console.WriteLine("retrieveSuper - DEQUEUE - id_abstract=" + acfCurr.Id_abstract + " / id_interface=" + iCurr.Id_interface);
                    if (iCurr.Id_interface.Equals(id_interface))
                    {
                        Console.WriteLine("retrieveSuper: found id_abstract=" + acfCurr.Id_abstract + " / id_interface=" + iCurr.Id_interface);
                        return(i);
                    }
                    else if (loop = acfCurr.Id_functor_app_supertype > 0)
                    {
                        AbstractComponentFunctorApplication acfaSuper = DGAC.BackEnd.acfadao.retrieve(acfCurr.Id_functor_app_supertype);
                        acfCurr = DGAC.BackEnd.acfdao.retrieve(acfaSuper.Id_abstract);
                        string[] id_interface_super_list = Interface.splitIDs(iCurr.Id_interface_super);
                        foreach (string id_interface_super in id_interface_super_list)
                        {
                            Console.WriteLine("retrieveSuper: id_abstract=" + acfCurr.Id_abstract + " / id_interface=" + iCurr.Id_interface);
                            iCurr = DGAC.BackEnd.idao.retrieve(acfaSuper.Id_abstract, id_interface_super);
                            queue.Add(new Tuple <AbstractComponentFunctor, Interface> (acfCurr, iCurr));
                        }
                    }
                }
            }

            Console.WriteLine("retrieveSuper - END NULL");
            return(null);
        }
コード例 #11
0
    /*ADDED BY HERON */
    public AbstractComponentFunctor retrieveByUID(string hash_component_UID)
    {

        AbstractComponentFunctor acf = null;
        IDbConnection dbcon = Connector.DBcon;
        IDbCommand dbcmd = dbcon.CreateCommand();
        string sql =
             "SELECT hash_component_UID, id_abstract, id_functor_app_supertype, library_path, kind " +
             "FROM abstractcomponentfunctor " +
             "WHERE hash_component_UID like '" + hash_component_UID + "'";
        dbcmd.CommandText = sql;
        IDataReader reader = dbcmd.ExecuteReader();
			Console.WriteLine ("RETRIEVE BY UID 3" + hash_component_UID);
        if (reader.Read())
        {
            acf = new AbstractComponentFunctor();
            acf.Hash_component_UID = (string)reader["hash_component_UID"];
            acf.Id_abstract = (int)reader["id_abstract"];
            acf.Id_functor_app_supertype = (int)reader["id_functor_app_supertype"];
            acf.Library_path = (string)reader["library_path"];
            acf.Kind = (string)reader["kind"];
            if (!cache_acf.ContainsKey(acf.Id_abstract)) cache_acf.Add(acf.Id_abstract, acf);
        }
        else
        {
            // NOT FOUND !
        }
			Console.WriteLine ("RETRIEVE BY UID 4" + hash_component_UID);
        if (reader.Read())
        {
            throw new Exception("More than one line FOUND for field hash_component_UID (AbastractComponentFunctorDAO)");
        }

        
        //while
        // clean up
        reader.Close();
        reader = null;
        dbcmd.Dispose();
        dbcmd = null;
        return acf;
    }
コード例 #12
0
	public AbstractComponentFunctor retrieve(int id_abstract){

        AbstractComponentFunctor acf = null;
        if (cache_acf.TryGetValue(id_abstract, out acf)) return acf;        
        
	   IDbConnection dbcon = Connector.DBcon;
       IDbCommand dbcmd = dbcon.CreateCommand();
      string sql =
           "SELECT id_abstract, id_functor_app_supertype, library_path, hash_component_UID, kind " +
           "FROM abstractcomponentfunctor " +
           "WHERE id_abstract="+id_abstract;
       dbcmd.CommandText = sql;
       IDataReader reader = dbcmd.ExecuteReader();
       if (reader.Read())
       {
           acf = new AbstractComponentFunctor();
           acf.Hash_component_UID = (string)reader["hash_component_UID"]; /* LINE ADDED BY HERON (new field in abstractcomponentfunctor) */
           acf.Id_abstract = (int)reader["id_abstract"];
           acf.Id_functor_app_supertype = (int)reader["id_functor_app_supertype"];
           acf.Library_path = (string)reader["library_path"];
           acf.Kind = (string)reader["kind"];
           cache_acf.Add(acf.Id_abstract, acf);
       }//if
       else
       {
           // Abstract Component Functor NOT FOUND !
       }
       // clean up
       reader.Close();
       reader = null;
       dbcmd.Dispose();
       dbcmd = null;
			
	   if (acf == null)
				Console.Error.WriteLine("AbstractComponentFunctorDAO.cs: abstract component functor not found ! id_abstract=" + id_abstract);
			
       return acf;
	}
コード例 #13
0
        internal SliceExposed retrieveContainerByOriginal(
            string id_inner_original,
            string id_interface_slice_original,
            int id_abstract_start,
            string id_interface_owner,
            string id_inner_owner)
        {
            int          id_abstract = id_abstract_start;
            SliceExposed se          = null;

            while (id_abstract > 0)
            {
                IDbConnection dbcon = Connector.DBcon;
                IDbCommand    dbcmd = dbcon.CreateCommand();
                string        sql   =
                    "SELECT id_abstract, id_inner, id_interface_slice, id_inner_owner, id_interface_slice_owner, id_inner_original, id_interface_slice_original " +
                    "FROM sliceexposed " +
                    "WHERE id_inner_original like '" + id_inner_original + "' and " +
                    "id_interface_slice_original like '" + id_interface_slice_original + "' and " +
                    "id_abstract = " + id_abstract + " and " +
                    "id_interface_slice_owner like '" + id_interface_owner + "' and " +
                    "id_inner_owner like '" + id_inner_owner + "'";
                dbcmd.CommandText = sql;
                Console.WriteLine(sql);
                IDataReader reader = dbcmd.ExecuteReader();
                if (reader.Read())
                {
                    se                    = new SliceExposed();
                    se.Id_inner           = (string)reader["id_inner"];
                    se.Id_abstract        = (int)reader["id_abstract"];
                    se.Id_interface_slice = (string)reader["id_interface_slice"];
//	                se.Slice_replica = (int)reader["slice_replica"];
                    se.Id_inner_owner           = (string)reader["id_inner_owner"];
                    se.Id_interface_slice_owner = (string)reader["id_interface_slice_owner"];
//	                se.Slice_replica_owner = (int)reader["slice_replica_owner"];
                    se.Id_inner_original           = (string)reader["id_inner_original"];
                    se.Id_interface_slice_original = (string)reader["id_interface_slice_original"];
                }
                //if
                // clean up
                reader.Close();
                reader = null;
                dbcmd.Dispose();
                dbcmd = null;

                if (se == 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;
                    }
                }
                else
                {
                    id_abstract = -1;
                }
            }

            return(se);
        }
コード例 #14
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
コード例 #15
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);
        }
コード例 #16
0
        }//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
コード例 #17
0
        }//resolution

        //returns an icollection of
        public static IList <InfoCompile> getReferences_Concrete(int id_concrete)
        {
            Component           component     = br.ufc.pargo.hpe.backend.DGAC.BackEnd.cdao.retrieve(id_concrete);
            IList <InfoCompile> referencesSet = new List <InfoCompile>();
            IList <Unit>        unitList      = br.ufc.pargo.hpe.backend.DGAC.BackEnd.udao.list(id_concrete);

            foreach (br.ufc.pargo.hpe.backend.DGAC.database.Unit unit in unitList)
            {
                Interface interfaceUnit = br.ufc.pargo.hpe.backend.DGAC.BackEnd.idao.retrieve(unit.Id_abstract, unit.Id_interface);

                AbstractComponentFunctor acf = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(interfaceUnit.Id_abstract);

                IList <string> referencesArrayAll_list = new List <string> ();

                IDictionary <string, AbstractComponentFunctorApplication> pars = component.Arguments;

                Console.WriteLine("BEGIN TAKING REFERENCES OF " + (unit.Id_abstract) + ", " + id_concrete);
                foreach (string reference in interfaceUnit.fetchReferences(pars))
                {
                    Console.WriteLine(reference);
                    referencesArrayAll_list.Add(reference);
                }
                Console.WriteLine("END TAKING REFERENCES OF " + (unit.Id_abstract));

                string file_name_Interface = buildDllName(acf.Library_path, interfaceUnit.Assembly_string);
                if (!referencesArrayAll_list.Contains(file_name_Interface))
                {
                    referencesArrayAll_list.Add(file_name_Interface);
                }

                //   string file_name_Interface_base = buildDllNameBase(acf.Library_path, interfaceUnit.Assembly_string);
                //	if (!referencesArrayAll_list.Contains(file_name_Interface_base))
                //	referencesArrayAll_list.Add(file_name_Interface_base);

                IList <SourceCode> scList = br.ufc.pargo.hpe.backend.DGAC.BackEnd.scdao.list('u', unit.Id_concrete, unit.Id_unit);

                InfoCompile info = new InfoCompile();

                IList <Tuple <string, string> > sourceContents_list = new List <Tuple <string, string> > ();

                foreach (SourceCode sc in scList)
                {
                    if (sc.File_type.Equals("dll"))
                    {
                        IList <string> sourceRefs = sc.ExternalReferences;
                        foreach (string sourceRef in sourceRefs)
                        {
                            referencesArrayAll_list.Add(sourceRef);
                        }
                        sourceContents_list.Add(new Tuple <string, string> (sc.File_name.Split('.') [0], sc.Contents));
                    }
                }

                info.sourceContents = new Tuple <string, string> [sourceContents_list.Count];
                sourceContents_list.CopyTo(info.sourceContents, 0);

                string[] referencesArrayAll = new string[referencesArrayAll_list.Count];
                referencesArrayAll_list.CopyTo(referencesArrayAll, 0);

                info.moduleName   = unit.Class_name;
                info.unitId       = unit.Id_unit;
                info.cuid         = component.Hash_component_UID;
                info.library_path = component.Library_path;
                info.id           = component.Id_concrete;
                info.output_type  = Constants.DLL_OUT;
                info.references   = referencesArrayAll;

                referencesSet.Add(info);
            }//foreach

            return(referencesSet);
        }