Ack. Tested previous patch, not tested this one. /AndersBj
-----Original Message----- From: [email protected] [mailto:[email protected]] Sent: den 14 april 2014 08:52 To: Anders Björnerstedt Cc: [email protected] Subject: [PATCH 1 of 1] IMM:Removed Implementer name for config objects while loading [#543] osaf/services/saf/immsv/immloadd/imm_loader.cc | 38 ++++++++++++++++--- osaf/services/saf/immsv/immloadd/imm_loader.hh | 1 + osaf/services/saf/immsv/immloadd/imm_pbe_load.cc | 5 ++ 3 files changed, 38 insertions(+), 6 deletions(-) when the initial cluster is loaded(from xml or db),the implementer name is not nullified when the config objects contains implementer name. With this patch the implementer name is nullified for config objects. diff --git a/osaf/services/saf/immsv/immloadd/imm_loader.cc b/osaf/services/saf/immsv/immloadd/imm_loader.cc --- a/osaf/services/saf/immsv/immloadd/imm_loader.cc +++ b/osaf/services/saf/immsv/immloadd/imm_loader.cc @@ -121,6 +121,8 @@ bool isXsdLoaded; std::string xsddir; std::string xsd; typedef std::set<std::string> AttrFlagSet; +std::set<std::string> runtimeClass; +bool isPersistentRTClass = false; AttrFlagSet attrFlagSet; /* Helper functions */ @@ -1056,6 +1058,11 @@ static void endElementHandler(void* user LOG_ER("Failed to create class %s - exiting",state->className); exit(1); } + /* Insert only runtime persistant class */ + if((state->classCategory == SA_IMM_CLASS_RUNTIME) && isPersistentRTClass) { + runtimeClass.insert(state->className); + isPersistentRTClass = false; + } state->attrFlags = 0; state->attrValueTypeSet = 0; @@ -1081,6 +1088,10 @@ static void endElementHandler(void* user state->attrFlags, state->attrDefaultValueBuffer, &(state->attrDefinitions)); + + if((state->attrFlags & SA_IMM_ATTR_RDN) && (state->attrFlags & SA_IMM_ATTR_PERSISTENT)){ + isPersistentRTClass = true; + } /* Free the default value */ free(state->attrDefaultValueBuffer); @@ -1089,12 +1100,27 @@ static void endElementHandler(void* user else { //addObjectAttributeDefinition(state); - addObjectAttributeDefinition(state->objectClass, - state->attrName, - &(state->attrValueBuffers), - getClassAttrValueType(&(state->classAttrTypeMap), - state->objectClass, state->attrName), - &(state->attrValuesList)); + if((strcmp (state->attrName,"SaImmAttrImplementerName")==0)){ + std::set<std::string>::iterator clit = runtimeClass.find(state->objectClass); + if(clit != runtimeClass.end()){ + addObjectAttributeDefinition(state->objectClass, + state->attrName, + &(state->attrValueBuffers), + getClassAttrValueType(&(state->classAttrTypeMap), + state->objectClass, state->attrName), + &(state->attrValuesList)); + } + } + else + { + addObjectAttributeDefinition(state->objectClass, + state->attrName, + &(state->attrValueBuffers), + getClassAttrValueType(&(state->classAttrTypeMap), + state->objectClass, state->attrName), + &(state->attrValuesList)); + } + } /* </object> */ } diff --git a/osaf/services/saf/immsv/immloadd/imm_loader.hh b/osaf/services/saf/immsv/immloadd/imm_loader.hh --- a/osaf/services/saf/immsv/immloadd/imm_loader.hh +++ b/osaf/services/saf/immsv/immloadd/imm_loader.hh @@ -36,6 +36,7 @@ struct ClassInfo { std::string className; AttrInfoVector attrInfoVector; + SaImmClassCategoryT class_category; }; typedef std::map<std::string, ClassInfo*> ClassInfoMap; diff --git a/osaf/services/saf/immsv/immloadd/imm_pbe_load.cc b/osaf/services/saf/immsv/immloadd/imm_pbe_load.cc --- a/osaf/services/saf/immsv/immloadd/imm_pbe_load.cc +++ b/osaf/services/saf/immsv/immloadd/imm_pbe_load.cc @@ -409,6 +409,7 @@ bool loadClassesFromPbe(void* pbeHandle, class_name = result[r*ncols+2]; class_info = new ClassInfo; class_info->className = std::string(class_name); + class_info->class_category = class_category; if(!loadClassFromPbe(pbeHandle, immHandle, class_name, class_id, class_category, class_info)) { @@ -519,6 +520,10 @@ bool loadObjectFromPbe(void* pbeHandle, ++it; } assert(it != class_info->attrInfoVector.end()); + if((strcmp(resultF[c], "SaImmAttrImplementerName") == 0) && + (class_info->class_category == SA_IMM_CLASS_CONFIG)) + continue; + addObjectAttributeDefinition((char *) class_info->className.c_str(), resultF[c], &attrValueBuffers, ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
