Esempio n. 1
0
 public IAmbethPlatformContext CreatePlatformContext()
 {
     return(AmbethPlatformContext.Create(properties, providerModuleTypes.ToArray(),
                                         frameworkModuleTypes.ToArray(),
                                         bootstrapModuleTypes.ToArray(),
                                         providerModules.ToArray(),
                                         frameworkModules.ToArray(),
                                         bootstrapModules.ToArray()));
 }
Esempio n. 2
0
        public IRelationUpdateItem CreateRUI(String memberName, IList <IObjRef> oldOriList, IList <IObjRef> newOriList)
        {
            if (oldOriList.Count == 0 && newOriList.Count == 0)
            {
                return(null);
            }
            IISet <IObjRef> oldSet = oldOriList.Count > 0 ? new CHashSet <IObjRef>(oldOriList) : EmptySet.Empty <IObjRef>();
            IISet <IObjRef> newSet = newOriList.Count > 0 ? new CHashSet <IObjRef>(newOriList) : EmptySet.Empty <IObjRef>();

            IISet <IObjRef> smallerSet = ((ICollection)oldSet).Count > ((ICollection)newSet).Count ? newSet : oldSet;
            IISet <IObjRef> greaterSet = ((ICollection)oldSet).Count > ((ICollection)newSet).Count ? oldSet : newSet;

            // Check unchanged ORIs
            Iterator <IObjRef> smallerIter = smallerSet.Iterator();

            while (smallerIter.MoveNext())
            {
                // Old ORIs, which exist as new ORIs, too, are unchanged
                IObjRef objRef = smallerIter.Current;
                if (greaterSet.Remove(objRef))
                {
                    smallerIter.Remove();
                }
            }
            if (((ICollection)oldSet).Count == 0 && ((ICollection)newSet).Count == 0)
            {
                return(null);
            }
            // Old ORIs are now handled as REMOVE, New ORIs as ADD
            RelationUpdateItem rui = new RelationUpdateItem();

            rui.MemberName = memberName;
            if (((ICollection)oldSet).Count > 0)
            {
                rui.RemovedORIs = oldSet.ToArray();
            }
            if (((ICollection)newSet).Count > 0)
            {
                rui.AddedORIs = newSet.ToArray();
            }
            return(rui);
        }