Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

4.1.10.6.8 AddObject

procedure AddObject(
  replEntinfList: REPLENTINFLIST,
  sourcePrefixTable: PrefixTable,
  nc: DSName,
  attributesAndStamps: set of AttributeAndStamp): DWORD

Informative summary of behavior: The AddObject procedure performs a replicated update by adding an object to the NC replica. This procedure has the following input parameters:

  • replEntinfList: The replicated update to be applied.

  • sourcePrefixTable: The prefix table from the server to translate attribute IDs.

  • nc: The root of the NC replica that is replicated.

  • attributesAndStamps: The AttributeAndStamp set that corresponds to the replicated update.

The procedure returns a Windows error code if it encounters an error while adding the object.

newObject: DSName
dwResult: DWORD
objectClassAttr: ATTRVAL
isDeletedAttr: ATTRVAL
isDeletedValue: boolean
ncNameValue: DSName
ncNameAtt: ATTRVAL
partitionsContainer: DSName
parentObject: DSName

/*  Find an appropriate and unused name for the object, updating
 * replEntInfList as appropriate */
dwResult := NameObject(replEntInfList, nc, sourcePrefixTable, attributeAndStamps)

if dwResult ≠ ERROR_SUCCESS then
  return dwResult
endif

/* Check if this is a cross-ref in the partitions container replicating in.*/
objectClassAttr := ENTINF_GetValue(
                          replEntinfList.Entinf, 
                          objectClass, 
                          sourcePrefixTable)
ncNameAtt := ENTINF_GetValue(
              replEntinfList.Entinf, 
              ncName, 
              sourcePrefixTable)
ncNameVal := ValueFromATTRVal(ncNameAtt,Syntax(ncNameAtt),sourcePrefixTable)

partitionsContainer:= DescendantObject(ConfigNC(), "CN=Partitions,")
parentObject := replEntinfList.Entinf.pName^ stripped of the first RDN.

if(crossRef in ObjectClassAttr and parentObject = partitionsContainer)
    dwResult := AddSubRef(ncNameVal)
    if dwResult ≠ 0 then
       return dwResult
    endif

    isDeletedAttr := ENTINF_GetValue(
                       replEntinfList.Entinf, 
                       isDeleted, 
                       sourcePrefixTable)

    if (isDeletedAttr = null) then
      isDeletedValue := false
    else
      isDeletedValue :=
        ValueFromATTRVal(isDeletedAttr,Syntax(isDeleted),sourcePrefixTable)
    endif

    If(isDeleted Value)
        DelSubRef(ncNameVal)
    endif
endif

dwResult := PerformAddOperation(replEntinfList.Entinf, newObject,
    sourcePrefixTable, FALSE)

/* Update attribute stamps. */
if (dwResult = 0) then
  for each e in attributesAndStamps do
    SetAttrStamp(newObject, e.attribute, e.stamp)
  endfor
endif

return dwResult
 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.