summaryrefslogtreecommitdiff
path: root/configmgr/source/tree/updatehelper.cxx
blob: 011d6353265113f46bec824c7958560fded78263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"

#include <stdio.h>

#include "updatehelper.hxx"
#include "change.hxx"
#include "nodeconverter.hxx"
#include "treeactions.hxx"
#include "treechangefactory.hxx"
#include "treenodefactory.hxx"

// -----------------------------------------------------------------------------	
#include "node.hxx"
#include "treefragment.hxx"
#include "builddata.hxx"
#include "nodevisitor.hxx"
// -----------------------------------------------------------------------------	
#include "tracer.hxx"
#include <osl/diagnose.h>


//..........................................................................
namespace configmgr
{
// -----------------------------------------------------------------------------	
//==========================================================================
//= AdjustUpdate
//==========================================================================
//= This class tests changes on an existing tree and drops them if they 
//= are not need anymore or alters add nodes in node changes and vice versa
//==========================================================================
class AdjustUpdate : ChangeTreeModification
{
    SubtreeChange&      m_rChangeList;	// list which containes changes merged with the existing nodes
    sharable::Node * m_refNode; // reference node needed for merging
    OTreeNodeConverter  m_aNodeConverter;
public:
    static bool adjust(SubtreeChange& _rResultTree, SubtreeChange& _aUpdateTree, 
                       sharable::Node * targetNode)
    {
        return AdjustUpdate(_rResultTree, targetNode).impl_adjust(_aUpdateTree);
    }
    static bool adjust(SubtreeChange& _rResultTree, SubtreeChange& _aUpdateTree, 
                       sharable::Node * targetNode, 
                        OTreeNodeFactory& _rNodeFactory)
    {
        return AdjustUpdate(_rResultTree, targetNode, _rNodeFactory).impl_adjust(_aUpdateTree);
    }
private:
    AdjustUpdate(SubtreeChange& rList, sharable::Node * node)
        :m_rChangeList(rList)
        ,m_refNode(node)
        ,m_aNodeConverter()
    {}
    
    AdjustUpdate(SubtreeChange& rList, sharable::Node * node, OTreeNodeFactory& _rNodeFactory)
        :m_rChangeList(rList)
        ,m_refNode(node)
        ,m_aNodeConverter(_rNodeFactory)
    {}
    
    void handle(ValueChange& aValueNode);
    void handle(AddNode& aAddNode);
    void handle(RemoveNode& aRemoveNode);
    void handle(SubtreeChange& aSubtree);

    bool impl_adjust(SubtreeChange& _aUpdateTree);
private:
    // ensuring the correct state
    bool checkNode() const;
};

// --------------------------------- ApplyUpdate ---------------------------------

class ApplyUpdate : public ChangeTreeModification
{
    sharable::Node *           m_aCurrentNode;
public:
    ApplyUpdate(sharable::Node * _aNode) 
    : m_aCurrentNode(_aNode) 
    {}
    
    void handle(ValueChange& aValueNode);
    void handle(AddNode& aAddNode);
    void handle(RemoveNode& aRemoveNode);
    void handle(SubtreeChange& aSubtree);
};
//--------------------------------------------------------------------------
class ApplyValueChange
{
    static 
    void adjust(uno::Any& aActual, uno::Any const& aTarget);

public:
    static 
    void apply(ValueChange& _rValueChange, sharable::ValueNode * valueNode);
};
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------

// apply a already matching set of changes to the target tree
    void applyUpdateToTree(SubtreeChange& _anUpdateTree, sharable::Node * _aRootNode)
    {
        ApplyUpdate aUpdater(_aRootNode);
        _anUpdateTree.forEachChange(aUpdater);
    }
//--------------------------------------------------------------------------
// apply a set of changes to the target tree
    void applyUpdateWithAdjustmentToTree(SubtreeChange& _anUpdateTree, sharable::Node * _aRootNode)
    {
    // POST: pSubtree = pSubtree + aChangeList
    SubtreeChange aActualChanges(_anUpdateTree, treeop::NoChildCopy());
        
        if ( AdjustUpdate::adjust(aActualChanges,_anUpdateTree, _aRootNode) )
        {
        applyUpdateToTree(aActualChanges, _aRootNode);
        }    
        _anUpdateTree.swap(aActualChanges);
        
    }
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------

static inline
rtl::OUString getNodeName(INode const & _aNode)
{
    return _aNode.getName();
}
//--------------------------------------------------------------------------

static inline
rtl::OUString getChangeNodeName(Change const & _aChange)
{
    return _aChange.getNodeName();
}
//--------------------------------------------------------------------------

bool AdjustUpdate::impl_adjust(SubtreeChange& _aUpdateTree)
{
    // first check the changes
    this->applyToChildren(_aUpdateTree);				

    // now check whether there are real modifications
    OChangeActionCounter aChangeCounter;
    aChangeCounter.handle(m_rChangeList);
    CFG_TRACE_INFO_NI("cache manager: counted changes : additions: %i , removes: %i, value changes: %i", aChangeCounter.nAdds, aChangeCounter.nRemoves, aChangeCounter.nValues);
    
    return !! aChangeCounter.hasChanges();
}
// -----------------------------------------------------------------------------

inline bool AdjustUpdate::checkNode() const
{
    // Change a Value
    OSL_ENSURE(m_refNode != 0, "AdjustUpdate: no data");

    return m_refNode != 0;
}
//--------------------------------------------------------------------------

void AdjustUpdate::handle(ValueChange& _rChange)
{
    if (checkNode())
    {
        // We need to find the element in the tree
        sharable::Node * childNode = m_refNode->getSubnode(getChangeNodeName(_rChange));		
        
        // We have a node so we can keep the Change and the values do not differ
        if (childNode != 0)
        {
            bool bIsValue = childNode->isValue();
            OSL_ENSURE(bIsValue, "AdjustUpdate : node must be a value node!");

            if (bIsValue && _rChange.isChange())
            {
                std::auto_ptr<Change> pChange( new ValueChange(_rChange) );
                m_rChangeList.addChange(pChange);
            }
        }
        else
        {
            std::auto_ptr<ValueNode> pNode = m_aNodeConverter.createCorrespondingNode(_rChange);

            OSL_ENSURE(m_rChangeList.isSetNodeChange(), "Adding a new value to a non-set node");
            rtl::OUString sTypeName = m_rChangeList.getElementTemplateName();

            rtl::Reference< data::TreeSegment > aNewTree = data::TreeSegment::create(base_ptr(pNode),sTypeName);
            // add the tree to the change list
            std::auto_ptr<Change> pChange( new AddNode( aNewTree,_rChange.getNodeName(), _rChange.isToDefault()) );
            m_rChangeList.addChange(pChange);		
        }
    }
}
//--------------------------------------------------------------------------

void AdjustUpdate::handle(SubtreeChange& _rChange)
{
    if (checkNode())
    {
        // We need to find the element in the tree
        sharable::Node * childNode = m_refNode->getSubnode(getChangeNodeName(_rChange));
        
        // if there is a node we continue
        if (childNode != 0) 
        {
            bool bIsSubtree = childNode->isGroup() || childNode->isSet();
            OSL_ENSURE(bIsSubtree, "AdjustUpdate : node must be a inner node!");

            if (bIsSubtree)
            {		
                // generate a new change
                std::auto_ptr<SubtreeChange> pChange( new SubtreeChange(_rChange, treeop::NoChildCopy()) );			

                // recurse
                if ( adjust(*pChange,_rChange,childNode,m_aNodeConverter.nodeFactory()) )
                    m_rChangeList.addChange(base_ptr(pChange));
            }
            else
                OSL_ENSURE(false, "Inconsistent data: Subtree Change is merged into non-subtree node.");
        }
        // otherwise we have to create the node
        else 
        {
            std::auto_ptr<ISubtree> pNode = m_aNodeConverter.createCorrespondingTree(_rChange);
            OSL_ASSERT(pNode.get() != NULL);

            // set the level
            pNode->setLevels(treeop::ALL_LEVELS,treeop::ALL_LEVELS);	

            OSL_ENSURE(m_rChangeList.isSetNodeChange(), "Adding a new value to a non-set node");
            rtl::OUString sTypeName = m_rChangeList.getElementTemplateName();

            rtl::Reference< data::TreeSegment > aNewTree = data::TreeSegment::create(base_ptr(pNode), sTypeName);

            // add the tree to the change list
            std::auto_ptr<Change> pChange( new AddNode(aNewTree,_rChange.getNodeName(), _rChange.isToDefault()) );
            m_rChangeList.addChange( pChange );		
        }
    }
}
//--------------------------------------------------------------------------

void AdjustUpdate::handle(RemoveNode& _rChange)
{
    if (checkNode())
    {
        // We need to find the element in the tree
        sharable::Node * childNode = m_refNode->getSubnode(getChangeNodeName(_rChange));		
        
        // only if there is a node, we will keep the change
        if (childNode != 0) 
        {
            // generate a new change
            std::auto_ptr<Change> pChange( new RemoveNode(_rChange.getNodeName(),_rChange.isToDefault()) );
            m_rChangeList.addChange(pChange);
        }
    }
}
//--------------------------------------------------------------------------

void AdjustUpdate::handle(AddNode& _rChange)
{
    if (checkNode())
    {
        // We need to find the element in the tree
        sharable::Node * childNode = m_refNode->getSubnode(getChangeNodeName(_rChange));
        
        rtl::Reference< data::TreeSegment > aNewNode = _rChange.getNewTree();
        std::auto_ptr<AddNode> pChange( new AddNode(aNewNode,_rChange.getNodeName(),_rChange.isToDefault()) );
        if (childNode != 0)
        {
            pChange->setReplacing();
        }
        m_rChangeList.addChange(base_ptr(pChange));
    }
}
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------

inline 
void ApplyValueChange::adjust(uno::Any& aActual, uno::Any const& aTarget)
{
    // If set - it should already match
    OSL_ASSERT(!aActual.hasValue() || aTarget == aActual);
    aActual = aTarget;
}

//--------------------------------------------------------------------------
// _rValueChange.applyTo(_aValueNode)
void ApplyValueChange::apply(ValueChange& _rValueChange, sharable::ValueNode * valueNode)
{
    switch (_rValueChange.getMode())
    {
    case ValueChange::wasDefault:
        OSL_ASSERT(valueNode->info.isDefault());

    case ValueChange::changeValue:
        adjust( _rValueChange.m_aOldValue, valueNode->getValue());
        valueNode->setValue(_rValueChange.getNewValue());
        break;

    case ValueChange::setToDefault:
        adjust(_rValueChange.m_aOldValue, valueNode->getValue());
        adjust(_rValueChange.m_aValue, valueNode->getDefaultValue());
        valueNode->setToDefault();
        break;

    case ValueChange::changeDefault:
        adjust(_rValueChange.m_aOldValue, valueNode->getDefaultValue());
        valueNode->changeDefault(_rValueChange.getNewValue());
        break;

    default:
        OSL_ENSURE(0, "Unknown mode found for ValueChange");
        break;
    }
}
//--------------------------------------------------------------------------

void ApplyUpdate::handle(ValueChange& _rChange)
{
    // Change a Value
    OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply ValueChange without node");

    sharable::Node * childNode = m_aCurrentNode->getSubnode(getChangeNodeName(_rChange));		
    OSL_ENSURE(childNode != 0, "Cannot apply Change: No node to change");

    sharable::ValueNode * aValueAddr = childNode->valueData();
    OSL_ENSURE(aValueAddr != NULL,"Cannot apply ValueChange: Node is not a value");

    if (aValueAddr != NULL)
    ApplyValueChange::apply(_rChange,aValueAddr);
}
//--------------------------------------------------------------------------
    
void ApplyUpdate::handle(SubtreeChange& _rChange)
{
    // handle traversion
    OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply SubtreeChange without node");

    sharable::Node * childNode = m_aCurrentNode->getSubnode(getChangeNodeName(_rChange));		
    OSL_ENSURE(childNode != 0, "Cannot apply Change: No node to change");

    OSL_ENSURE( childNode->isGroup() || childNode->isSet(),
                "Cannot Apply SubtreeChange: Node is not an inner node");

    if (childNode != 0)
    {
        childNode->info.markAsDefault( _rChange.isToDefault() );

        sharable::Node * aOldNode = m_aCurrentNode;
        m_aCurrentNode = childNode;

        _rChange.forEachChange(*this);

        m_aCurrentNode = aOldNode;
    }
}
//--------------------------------------------------------------------------

void ApplyUpdate::handle(AddNode& _rChange)
{
    OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply AddNode without node");

    sharable::SetNode * aSetNodeAddr = sharable::SetNode::from(m_aCurrentNode);
    OSL_ENSURE(aSetNodeAddr != NULL,"Cannot apply AddNode: Node is not a set node");

    // Add a new element
    if (aSetNodeAddr != NULL)
    {
    if (_rChange.isReplacing())
    {
        sharable::TreeFragment * old = aSetNodeAddr->removeElement(getChangeNodeName(_rChange));
        OSL_ASSERT(old != 0);
        _rChange.takeReplacedTree(data::TreeSegment::create(old));
    }

    sharable::TreeFragment * aNewAddress = data::buildTree(_rChange.getNewTree()->fragment);
        OSL_ENSURE(aNewAddress != NULL, "ApplyUpdate: AddNode: could not create new element");

        aSetNodeAddr->addElement(aNewAddress);

        _rChange.setInsertedAddress( aNewAddress );
    }	
}
//--------------------------------------------------------------------------
    
void ApplyUpdate::handle(RemoveNode& _rChange)
{
    OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply RemoveNode without node");

    sharable::SetNode * aSetNodeAddr = sharable::SetNode::from(m_aCurrentNode);
    OSL_ENSURE(aSetNodeAddr != NULL,"Cannot apply RemoveNode: Node is not a set node");

    // Remove an element
    if (aSetNodeAddr != NULL)
    {
        sharable::TreeFragment * old = aSetNodeAddr->removeElement(getChangeNodeName(_rChange));
        OSL_ASSERT(old != 0);
        _rChange.takeRemovedTree(data::TreeSegment::create(old));
    }
}
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// -----------------------------------------------------------------------------
    struct ForwardTreeDifferenceBuilder : NodeAction
    {
    protected:
        SubtreeChange&      m_rChangeList;
        sharable::Node * m_cacheNode;

    public:
        ForwardTreeDifferenceBuilder(SubtreeChange& rList, sharable::Node * cacheNode)
        : m_rChangeList(rList)
        , m_cacheNode(cacheNode)
        {
        }
        
        virtual void handle(ValueNode const& _aNewNode) 
        {
            sharable::Node * childNode = m_cacheNode->getSubnode(getNodeName(_aNewNode));
            if (childNode != 0)
            {
                sharable::ValueNode * valueNode = childNode->valueData();

                OSL_ENSURE(valueNode != 0, "TreeDifferenceBuilder: node must be a value node!");

                // if the values differ add a new change
                if (_aNewNode.getValue() != valueNode->getValue())
                {
                    bool bNewDefault = _aNewNode.isDefault();
                    bool bOldDefault = valueNode->info.isDefault();

                    ValueChange::Mode eMode;
                    if (bNewDefault)
                        if (bOldDefault)
                            eMode =  ValueChange::changeDefault;
                        else
                            eMode =  ValueChange::setToDefault;
                    else
                        if (bOldDefault)
                            eMode =  ValueChange::wasDefault;
                        else
                            eMode =  ValueChange::changeValue;

                    std::auto_ptr<Change> pChange(
                        new ValueChange(_aNewNode.getName(), _aNewNode.getAttributes(), eMode,
                                        _aNewNode.getValue(), valueNode->getValue()) );

                    m_rChangeList.addChange(pChange);
                }
            }
        }
        virtual void handle(ISubtree const& _aNewNode)
        {
            sharable::Node * childNode = m_cacheNode->getSubnode(getNodeName(_aNewNode));

            if (childNode != 0)
            {
                OSL_ENSURE( childNode->isGroup() || childNode->isSet(),
                            "ForwardTreeDifferenceBuilder: Node must be an inner node");

                // generate a new change		
                std::auto_ptr<SubtreeChange> pNewChange( new SubtreeChange(_aNewNode) );

                // .. and recurse
                ForwardTreeDifferenceBuilder aNextLevel(*pNewChange, childNode);
                aNextLevel.applyToChildren(_aNewNode);
                
                // now count if there are any changes
                OChangeActionCounter aCounter;
                aCounter.applyToChange(*pNewChange);
                
                if (aCounter.hasChanges())
                    m_rChangeList.addChange(base_ptr(pNewChange));
            }
            else if (m_cacheNode != 0 && m_cacheNode->isSet())
            {
                // Subtree not in Cache, add in TreeChangeList
                // SubtreeChange* pChange = new SubtreeChange(_rSubtree);
                OSL_ENSURE(m_rChangeList.isSetNodeChange(), "Found newly added node in non-set node");
                rtl::OUString sTypeName = m_rChangeList.getElementTemplateName();

                std::auto_ptr<INode> pSubtree( _aNewNode.clone() );
                rtl::Reference< data::TreeSegment > aNewTree = data::TreeSegment::create(pSubtree,sTypeName);

                std::auto_ptr<Change> pAdd(new AddNode(aNewTree, _aNewNode.getName(), _aNewNode.isDefault()));
                
                m_rChangeList.addChange(pAdd);
            }
            else
                OSL_ENSURE(false, "Found newly added node in group");

        }
    };
// -----------------------------------------------------------------------------
    
class BackwardTreeDifferenceBuilder: public data::SetVisitor {
public:
    BackwardTreeDifferenceBuilder(SubtreeChange & list, ISubtree const * node):
        m_changeList(list), m_newNode(node) {}
        
    void applyToChildren(sharable::Node * cacheNode) {
        OSL_ASSERT(cacheNode != 0);
        if (cacheNode->isGroup()) {
            OSL_ASSERT(!m_changeList.isSetNodeChange());
            visitChildren(&cacheNode->group);
        } else if (cacheNode->isSet()) {
            OSL_ASSERT(m_changeList.isSetNodeChange());
            visitElements(&cacheNode->set);
        } else {
            OSL_ASSERT(false);
        }
    }

private:
    using NodeVisitor::handle;

    virtual bool handle(sharable::Node * node) {
        OSL_ASSERT(!node->isValue());
        INode const * newChild = m_newNode->getChild(node->getName());
        ISubtree const * newTree = newChild == 0 ? 0 : newChild->asISubtree();
        if (newTree != 0) {
            // Traverse down to next change:
            Change * change = m_changeList.getChange(node->getName());
            std::auto_ptr< Change > newChange;
            SubtreeChange * groupChange = 0;
            if (change == 0) { 
                groupChange = new SubtreeChange(*newTree);
                newChange.reset(groupChange);
            } else {
                groupChange = dynamic_cast< SubtreeChange * >(change);
                OSL_ASSERT(groupChange != 0);
            }
            if (groupChange != 0) {
                BackwardTreeDifferenceBuilder(*groupChange, newTree).
                    applyToChildren(node);
                if (newChange.get() != 0) {
                    // Now count if there are any real changes:
                    OChangeActionCounter counter;
                    counter.applyToChange(*newChange);
                    if (counter.hasChanges()) {
                        m_changeList.addChange(newChange);
                    }
                }
            }
        }
        return false;
    }

    virtual bool handle(sharable::ValueNode *) {
        return false;
    }

    virtual bool handle(sharable::TreeFragment * tree) {
        INode const * newElement = m_newNode->getChild(tree->getName());
        if (newElement == 0) {
            // Remove node:
            std::auto_ptr< Change > remove(
                new RemoveNode(tree->getName(), tree->isNew()));
            m_changeList.addChange(remove);
            return false;
        } else {
            // Handle the root node:
            return SetVisitor::handle(tree);
        }
    }

    SubtreeChange & m_changeList;
    ISubtree const * m_newNode;
};

//--------------------------------------------------------------------------

// apply a set of changes to the target tree, return true, if there are changes found
    bool createUpdateFromDifference(SubtreeChange& _rResultingUpdateTree, sharable::Node * existingData, ISubtree const & _aNewData)
    {
        OSL_ENSURE(existingData != 0, "Trying to create diffrence for empty data");
    // create the differences
        ForwardTreeDifferenceBuilder aForwardTreeDifference(_rResultingUpdateTree, existingData);
        aForwardTreeDifference.applyToChildren(_aNewData);

        BackwardTreeDifferenceBuilder aBackwardTreeDifference(_rResultingUpdateTree, & _aNewData);
        aBackwardTreeDifference.applyToChildren(existingData);

        return true;
    }
//--------------------------------------------------------------------------

//..........................................................................
}	// namespace configmgr
//..........................................................................