示例#1
0
        public sealed override StatefulBuffer ReadStatefulBufferById(Transaction a_ta, int
                                                                     a_id, bool lastCommitted)
        {
            MsgD msg = Msg.ReadObject.GetWriterForInts(a_ta, new int[] { a_id, lastCommitted ?
                                                                         1 : 0 });

            Write(msg);
            StatefulBuffer bytes = ((MsgObject)ExpectedResponse(Msg.ObjectToClient)).Unmarshall
                                       ();

            if (bytes != null)
            {
                bytes.SetTransaction(a_ta);
            }
            return(bytes);
        }
示例#2
0
        public override bool CreateClassMetadata(ClassMetadata clazz, IReflectClass claxx
                                                 , ClassMetadata superClazz)
        {
            Write(Msg.CreateClass.GetWriterForString(SystemTransaction(), Config().ResolveAliasRuntimeName
                                                         (claxx.GetName())));
            Msg resp = GetResponse();

            if (resp == null)
            {
                return(false);
            }
            if (resp.Equals(Msg.Failed))
            {
                // if the class can not be created on the server, send class meta to the server.
                SendClassMeta(claxx);
                resp = GetResponse();
            }
            if (resp.Equals(Msg.Failed))
            {
                if (ConfigImpl.ExceptionsOnNotStorable())
                {
                    throw new ObjectNotStorableException(claxx);
                }
                return(false);
            }
            if (!resp.Equals(Msg.ObjectToClient))
            {
                return(false);
            }
            MsgObject      message = (MsgObject)resp;
            StatefulBuffer bytes   = message.Unmarshall();

            if (bytes == null)
            {
                return(false);
            }
            bytes.SetTransaction(SystemTransaction());
            if (!base.CreateClassMetadata(clazz, claxx, superClazz))
            {
                return(false);
            }
            clazz.SetID(message.GetId());
            clazz.ReadName1(SystemTransaction(), bytes);
            ClassCollection().AddClassMetadata(clazz);
            ClassCollection().ReadClassMetadata(clazz, claxx);
            return(true);
        }