Example #1
0
        public void ProcessRead(IPostProcessReader reader)
        {
            reader.NextTag();

            ICommandTypeRegistry   commandTypeRegistry   = reader.CommandTypeRegistry;
            ICommandTypeExtendable commandTypeExtendable = reader.CommandTypeExtendable;

            commandTypeExtendable.RegisterOverridingCommandType(typeof(MergeArraySetterCommand), typeof(ArraySetterCommand));
            Object result = reader.ReadObject();

            commandTypeExtendable.UnregisterOverridingCommandType(typeof(MergeArraySetterCommand), typeof(ArraySetterCommand));

            if (!(result is CUDResult))
            {
                throw new Exception("Can only handle results of type '" + typeof(CUDResult).Name + "'. Result of type '"
                                    + result.GetType().Name + "' given.");
            }

            ICommandBuilder          commandBuilder           = CommandBuilder;
            Member                   directObjRefDirectMember = this.directObjRefDirectMember;
            CUDResult                cudResult = (CUDResult)result;
            IList <IChangeContainer> changes   = cudResult.AllChanges;

            for (int i = 0, size = changes.Count; i < size; i++)
            {
                IChangeContainer changeContainer = changes[i];
                if (!(changeContainer is CreateContainer))
                {
                    continue;
                }

                IObjRef ori = changeContainer.Reference;
                if (ori == null)
                {
                    continue;
                }
                else if (ori is DirectObjRef)
                {
                    IObjectFuture  objectFuture  = new ObjRefFuture(ori);
                    IObjectCommand setterCommand = commandBuilder.Build(commandTypeRegistry, objectFuture, ori, directObjRefDirectMember);
                    reader.AddObjectCommand(setterCommand);
                    IObjectCommand mergeCommand = commandBuilder.Build(commandTypeRegistry, objectFuture, changeContainer);
                    reader.AddObjectCommand(mergeCommand);
                }
                else
                {
                    throw new Exception("Not implemented yet");
                }
            }
        }
Example #2
0
 protected virtual Object PostProcess(Object obj, IPostProcessReader postProcessReader)
 {
     if (obj is IObjectFuture)
     {
         IObjectFuture        objectFuture        = (IObjectFuture)obj;
         ICommandTypeRegistry commandTypeRegistry = postProcessReader.CommandTypeRegistry;
         IObjectCommand       objectCommand       = CommandBuilder.Build(commandTypeRegistry, objectFuture, null);
         postProcessReader.AddObjectCommand(objectCommand);
         postProcessReader.ExecuteObjectCommands();
         obj = objectFuture.Value;
     }
     else
     {
         postProcessReader.ExecuteObjectCommands();
     }
     return(obj);
 }
Example #3
0
        protected Object PostProcess(Object obj, IPostProcessReader pullParserReader)
        {
            HandlePostProcessingTag(pullParserReader);

            if (obj is IObjectFuture)
            {
                IObjectFuture        objectFuture        = (IObjectFuture)obj;
                ICommandTypeRegistry commandTypeRegistry = pullParserReader.CommandTypeRegistry;
                IObjectCommand       objectCommand       = CommandBuilder.Build(commandTypeRegistry, objectFuture, null);
                pullParserReader.AddObjectCommand(objectCommand);
                pullParserReader.ExecuteObjectCommands();
                obj = objectFuture.Value;
            }
            else
            {
                pullParserReader.ExecuteObjectCommands();
            }

            return(obj);
        }