Ack with two minor comments, only one of which requires a small change.
I tested for both config objecs and persistent RTOs and the patch works.
I.e. it removes the implementer-name for config objects and does not 
remove it for PRTOs.

See minor comments below

reddy.neelaka...@oracle.com wrote:
>  osaf/services/saf/immsv/immloadd/imm_loader.cc   |  32 +++++++++++++---
>  osaf/services/saf/immsv/immloadd/imm_loader.hh   |   1 +
>  osaf/services/saf/immsv/immloadd/imm_pbe_load.cc |   5 ++
>  3 files changed, 32 insertions(+), 6 deletions(-)
>
>
> When the loading is done from imm.xml or imm.db which has implementer name 
> for config objects.
> The implementer name is Nullified while loading from imm.xml or imm.db with 
> this patch 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,7 @@ bool isXsdLoaded;
>  std::string xsddir;
>  std::string xsd;
>  typedef std::set<std::string> AttrFlagSet;
> +std::set<std::string> runtimeClass;
>  AttrFlagSet attrFlagSet;
>  
>  /* Helper functions */
> @@ -1056,6 +1057,9 @@ static void endElementHandler(void* user
>                  LOG_ER("Failed to create class %s - 
> exiting",state->className);
>                  exit(1);
>              }
> +         if(state->classCategory == SA_IMM_CLASS_RUNTIME) {
> +                     runtimeClass.insert(state->className);
>   
This creates the set of names for all runtime classes. Ideally one would 
have liked to have
only the subset of the names for all persistent runtime object classes.
But perhaps this is tricky to compute in this context.
Only persistent RTOs get dumped and reloaded.
And only persistent RTOs have a corresponding base table in the PBE 
sqlite representation.
Only if this is simple to fix would I fix it.
> +         }
>              state->attrFlags = 0;
>  
>              state->attrValueTypeSet    = 0;
> @@ -1089,12 +1093,28 @@ static void endElementHandler(void* user
>          else
>          {
>              //addObjectAttributeDefinition(state);
> -            addObjectAttributeDefinition(state->objectClass,
> -                state->attrName,
> -                &(state->attrValueBuffers),
> -                getClassAttrValueType(&(state->classAttrTypeMap),
> -                    state->objectClass, state->attrName),
> -                &(state->attrValuesList));
> +         std::set<std::string>::iterator clit = 
> runtimeClass.find(state->objectClass);
>   
The above line is redundant and I in fact get a compiler warning for it 
(build failed for me on error as warnings).
So just remove the above line.
You are probably using an older GCC that missed this, I am using GCC 4.6.2.

Thanks
/AndersBj
> +         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, 
>   


------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to