protected IList <AbstractComponentFunctorParameter> loadAbstractComponentFunctorParameters(AbstractComponentFunctor c_) { IList <AbstractComponentFunctorParameter> pars = new List <AbstractComponentFunctorParameter>(); if (parameter != null) { foreach (ParameterType parameter_ in parameter) { Console.WriteLine("loadAbstractComponentFunctorParameters : PARAMETER " + parameter_.componentRef + ":" + parameter_.formFieldId); AbstractComponentFunctorParameter p = new AbstractComponentFunctorParameter(); p.Id_abstract = c_.Id_abstract; p.Id_parameter = parameter_.formFieldId; ComponentInUseType cBound = lookForInnerComponent(parameter_.componentRef); AbstractComponentFunctorApplication cApp = newAbstractComponentFunctorApplication(cBound); if (cApp == null) { throw new Exception("DEPLOY ERROR: Unresolved Dependency for base component (context parameter bound) : " + cBound.name); } p.Bounds_of = cApp.Id_functor_app; p.Variance = parameter_.variance; if (br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfpdao.retrieve(p.Id_abstract, p.Id_parameter) == null) { br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfpdao.insert(p); } pars.Add(p); } } Console.WriteLine("loadAbstractComponentFunctorParameters : END"); return(pars); }
void loadSuppliedParametersOfSupertype(ComponentInUseType c, AbstractComponentFunctorApplication aNew, AbstractComponentFunctorApplication aNew_context) { int id_functor_app_supertype; if (aNew_context.Id_abstract != aNew.Id_abstract) { Console.WriteLine("id_abstract_context != aNew.Id_abstract : " + aNew_context.Id_abstract + " " + aNew.Id_abstract); AbstractComponentFunctor acf = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(aNew_context.Id_abstract); id_functor_app_supertype = acf.Id_functor_app_supertype; } else { Console.WriteLine("id_abstract_context == aNew.Id_abstract : " + aNew_context.Id_abstract + " " + aNew.Id_abstract); AbstractComponentFunctor acf = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(aNew.Id_abstract); id_functor_app_supertype = acf.Id_functor_app_supertype; } while (id_functor_app_supertype > 0) { AbstractComponentFunctorApplication acfa = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.retrieve(id_functor_app_supertype); IList <SupplyParameter> sp_list = br.ufc.pargo.hpe.backend.DGAC.BackEnd.spdao.list(id_functor_app_supertype); foreach (SupplyParameter sp in sp_list) { if (sp is SupplyParameterComponent) { SupplyParameterComponent spc = (SupplyParameterComponent)sp; SupplyParameterComponent spc_new = new SupplyParameterComponent(); spc_new.Id_functor_app = aNew.Id_functor_app; spc_new.Id_abstract = aNew.Id_abstract; spc_new.Id_functor_app_actual = spc.Id_functor_app_actual; spc_new.Id_parameter = spc.Id_parameter; br.ufc.pargo.hpe.backend.DGAC.BackEnd.spdao.insert(spc_new); } else if (sp is SupplyParameterParameter) { } } AbstractComponentFunctor acf = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(acfa.Id_abstract); id_functor_app_supertype = acf.Id_functor_app_supertype; Trace.WriteLineIf(id_functor_app_supertype > 0, "LOOPING TO SUPERTYPE !!!"); } }
protected override HashComponent loadComponent_(ComponentType c) { // CREATE Component ComponentInUseType baseC = null; baseC = c.header.baseType.component; // FOLLOW arrow implements IList <AbstractComponentFunctorApplication> cAppList = newAbstractComponentFunctorApplicationForImplements(baseC); if (cAppList == null || cAppList.Count == 0) { throw new Exception("DEPLOY ERROR: Unresolved Dependency for base component (implements) : " + c.header.baseType.component.name); } Component c_first = null; foreach (AbstractComponentFunctorApplication cApp in cAppList) { Component c_ = new Component(); if (c_first == null) { c_first = c_; } c_.Id_concrete = Connector.nextKey("id_concrete", "component"); c_.Hash_component_UID = c.header.hash_component_UID; c_.Library_path = c.header.packagePath + "." + c.header.name; c_.Id_functor_app = cApp.Id_functor_app; c_.Id_abstract = cApp.Id_abstract; br.ufc.pargo.hpe.backend.DGAC.BackEnd.cdao.insert(c_); loadUnits(c_); } return(c_first); }
protected IList <SupplyParameter> loadAbstractComponentFunctorApplicationParameters(ComponentInUseType c, AbstractComponentFunctorApplication aNew, AbstractComponentFunctorApplication aNew_context) { IList <SupplyParameter> pars = new List <SupplyParameter>(); if (c.parameter != null) { foreach (ParameterRenaming p in c.parameter) { String formFieldId = p.formFieldId; String varName = p.varName; Console.WriteLine("loadAbstractcomponentFunctorApplicationParameters -1 " + varName + "," + formFieldId); SupplyParameter p_ = null; ParameterType topParameter = lookForParameterByVarName(varName); ParameterSupplyType s = lookForSupplyForVarName(varName); if (topParameter != null) { Console.WriteLine("loadAbstractcomponentFunctorApplicationParameters 0 " + topParameter.formFieldId + ", " + varName); p_ = new SupplyParameterParameter(); ((SupplyParameterParameter)p_).Id_argument = topParameter.formFieldId; ((SupplyParameterParameter)p_).FreeVariable = false; } else if (s != null) { Console.WriteLine("loadAbstractcomponentFunctorApplicationParameters 1 " + s.cRef + ", " + varName); String cRef = s.cRef; p_ = new SupplyParameterComponent(); // Look for the inner component that supplies that parameter. InnerComponentType inner = lookForInnerComponent(cRef); AbstractComponentFunctorApplication cPar = newAbstractComponentFunctorApplication(inner); if (cPar == null) { throw new Exception("DEPLOY ERROR: Unresolved Dependency for base component (context actual parameter) : " + inner.name); } ((SupplyParameterComponent)p_).Id_functor_app_actual = cPar.Id_functor_app; } else { Console.WriteLine("loadAbstractcomponentFunctorApplicationParameters 2 " + varName); p_ = new SupplyParameterParameter(); ((SupplyParameterParameter)p_).Id_argument = null; ((SupplyParameterParameter)p_).FreeVariable = true; } p_.Id_functor_app = aNew.Id_functor_app; p_.Id_abstract = aNew.Id_abstract; p_.Id_parameter = formFieldId; // SupplyParameterDAO p_DAO = new SupplyParameterDAO(); br.ufc.pargo.hpe.backend.DGAC.BackEnd.spdao.insert(p_); pars.Add(p_); } } loadSuppliedParametersOfSupertype(c, aNew, aNew_context); return(pars); }
protected IList <AbstractComponentFunctorApplication> newAbstractComponentFunctorApplicationForImplements(ComponentInUseType c) { IList <AbstractComponentFunctor> ancestrals = new List <AbstractComponentFunctor>(); AbstractComponentFunctor a_current = lookForAbstractComponentFunctor(c.package, c.name); if (a_current == null) { return(null); } { AbstractComponentFunctor a = a_current; ancestrals.Add(a); while (a.Id_functor_app_supertype > 0) { AbstractComponentFunctorApplication acfa_ancestral = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.retrieve(a.Id_functor_app_supertype); a = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.retrieve(acfa_ancestral.Id_abstract); ancestrals.Add(a); } } IList <AbstractComponentFunctorApplication> aAppNewList = new List <AbstractComponentFunctorApplication>(); AbstractComponentFunctorApplication aAppNewOld = null; AbstractComponentFunctorApplication aAppNew = null; foreach (AbstractComponentFunctor a in ancestrals) { // CREATE AbstractComponentFunctorApplication aAppNew = new AbstractComponentFunctorApplication(); aAppNew.Id_abstract = a.Id_abstract; aAppNew.Id_functor_app = Connector.nextKey("id_functor_app", "abstractcomponentfunctorapplication"); br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.insert(aAppNew); loadAbstractComponentFunctorApplicationParameters(c, aAppNew, aAppNewOld == null ? aAppNew : aAppNewOld); aAppNewList.Add(aAppNew); if (aAppNewOld != null) { br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.updateIdFunctorAppNext(aAppNewOld, aAppNew.Id_functor_app); } aAppNewOld = aAppNew; } return(aAppNewList); // } }
protected AbstractComponentFunctorApplication newAbstractComponentFunctorApplication(ComponentInUseType c) { AbstractComponentFunctor a = lookForAbstractComponentFunctor(c.package, c.name); if (a == null) { return(null); } // CREATE AbstractComponentFunctorApplication AbstractComponentFunctorApplication aAppNew = new AbstractComponentFunctorApplication(); aAppNew.Id_functor_app = Connector.nextKey("id_functor_app", "abstractcomponentfunctorapplication"); // Console.WriteLine("+++++++++++++++ " + aAppNew.Id_functor_app); aAppNew.Id_abstract = a.Id_abstract; br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.insert(aAppNew); // REGISTER parameters (follow supply-of, configure formal-parameter) loadAbstractComponentFunctorApplicationParameters(c, aAppNew, aAppNew); return(aAppNew); // } }
protected override HashComponent loadComponent_(ComponentType c) { // CREATE Component AbstractComponentFunctor c_ = new AbstractComponentFunctor(); c_.Id_abstract = Connector.nextKey("id_abstract", "abstractcomponentfunctor"); c_.Hash_component_UID = c.header.hash_component_UID; c_.Library_path = c.header.packagePath + "." + c.header.name; c_.Kind = c.header.kind.ToString(); if (c.header.baseType != null) { ExtensionTypeType extType = c.header.baseType.extensionType; ComponentInUseType baseC = null; if (extType.ItemElementName == ItemChoiceType.extends && extType.Item) { baseC = c.header.baseType.component; parameterRenamingSuper = baseC.parameter; AbstractComponentFunctorApplication baseCapp = newAbstractComponentFunctorApplication(baseC); // FOLLOW arrow subtype if (baseCapp == null) { throw new Exception("DEPLOY ERROR: Unresolved Dependency for base component (extends) : " + baseC.name); } c_.Id_functor_app_supertype = baseCapp.Id_functor_app; } br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.insert(c_); // LOAD EXPOSED INNER COMPONENTS OF THE BASE if (baseC.port != null) { foreach (InnerComponentType port in baseC.port) { innerAll.Add(port); InnerComponent iNewPort = new InnerComponent(); iNewPort.Id_abstract_owner = c_.Id_abstract; string old_port_localRef = port.localRef; port.localRef = lookForRenamingNew(baseC.localRef, old_port_localRef, port.index_replica); iNewPort.Id_inner = port.localRef; iNewPort.Parameter_top = port.parameter_id; iNewPort.Transitive = true; iNewPort.IsPublic = true; iNewPort.Multiple = port.multipleSpecified ? port.multiple : false; AbstractComponentFunctorApplication appPort = newAbstractComponentFunctorApplication(port); if (appPort == null) { throw new Exception("DEPLOY ERROR: Unresolved Dependency for base component (public inner component) : " + port.name); } iNewPort.Id_functor_app = appPort.Id_functor_app; iNewPort.Id_abstract_inner = appPort.Id_abstract; InnerComponentExposed ice = new InnerComponentExposed(); ice.Id_abstract = c_.Id_abstract; ice.Id_inner_rename = iNewPort.Id_inner; ice.Id_inner_owner = null; ice.Id_inner = old_port_localRef; br.ufc.pargo.hpe.backend.DGAC.BackEnd.icedao.insert(ice); if (br.ufc.pargo.hpe.backend.DGAC.BackEnd.icdao.retrieve(iNewPort.Id_abstract_owner, iNewPort.Id_inner) == null) { br.ufc.pargo.hpe.backend.DGAC.BackEnd.icdao.insert(iNewPort); } } } } else { br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfdao.insert(c_); } loadAbstractComponentFunctorParameters(c_); return(c_); }