public LazyClientQueryResult(Transaction trans, ClientObjectContainer client, int
			 queryResultID) : base(trans)
		{
			_client = client;
			_queryResultID = queryResultID;
			_iterator = new LazyClientIdIterator(this);
		}
Ejemplo n.º 2
0
 public override int InstanceCount(ClassMetadata clazz, Transaction trans)
 {
     lock (Lock())
     {
         return clazz.IndexEntryCount(trans);
     }
 }
Ejemplo n.º 3
0
		public override void Write(Transaction trans, ClassMetadata clazz, ClassAspect aspect
			, ByteArrayBuffer writer)
		{
			writer.WriteShortString(trans, aspect.GetName());
			if (!(aspect is FieldMetadata))
			{
				return;
			}
			FieldMetadata field = (FieldMetadata)aspect;
			field.Alive();
			if (field.IsVirtual())
			{
				return;
			}
			ITypeHandler4 handler = field.GetHandler();
			if (handler is StandardReferenceTypeHandler)
			{
				// TODO: ensure there is a test case, to make this happen 
				if (((StandardReferenceTypeHandler)handler).ClassMetadata().GetID() == 0)
				{
					trans.Container().NeedsUpdate(clazz);
				}
			}
			writer.WriteInt(field.FieldTypeID());
			BitMap4 bitmap = new BitMap4(3);
			bitmap.Set(0, field.IsPrimitive());
			bitmap.Set(1, Handlers4.HandlesArray(handler));
			bitmap.Set(2, Handlers4.HandlesMultidimensionalArray(handler));
			// keep the order
			writer.WriteByte(bitmap.GetByte(0));
		}
		public virtual void Release(ShutdownMode mode, Transaction transaction, bool rollbackOnClose
			)
		{
			lock (_mainContainer.Lock())
			{
				ClientTransactionPool.ContainerCount entry = (ClientTransactionPool.ContainerCount
					)_transaction2Container.Get(transaction);
				entry.Container().CloseTransaction(transaction, false, mode.IsFatal() ? false : rollbackOnClose
					);
				_transaction2Container.Remove(transaction);
				entry.Release();
				if (entry.IsEmpty())
				{
					_fileName2Container.Remove(entry.FileName());
					try
					{
						entry.Close(mode);
					}
					catch (Exception t)
					{
						// If we are in fatal ShutdownMode close will
						// throw but we want to continue shutting down
						// all entries.
						Sharpen.Runtime.PrintStackTrace(t);
					}
				}
			}
		}
Ejemplo n.º 5
0
 public StatefulBuffer(Transaction trans, int initialBufferSize
     )
 {
     _trans = trans;
     _length = initialBufferSize;
     _buffer = new byte[_length];
 }
Ejemplo n.º 6
0
		public override object GetOrCreate(Transaction a_trans, object a_OnObject)
		{
			// This is the first part of marshalling
			// Virtual fields do it all in #marshall(), the object is never used.
			// Returning any object here prevents triggering null handling.
			return AnyObject;
		}
Ejemplo n.º 7
0
			public virtual bool Dispatch(Transaction trans, object obj, int eventID)
			{
				if (methods[eventID] == null)
				{
					return true;
				}
				object[] parameters = new object[] { trans.ObjectContainer() };
				ObjectContainerBase container = trans.Container();
				int stackDepth = container.StackDepth();
				int topLevelCallId = container.TopLevelCallId();
				container.StackDepth(0);
				try
				{
					object res = methods[eventID].Invoke(obj, parameters);
					if (res is bool)
					{
						return ((bool)res);
					}
				}
				finally
				{
					container.StackDepth(stackDepth);
					container.TopLevelCallId(topLevelCallId);
				}
				return true;
			}
Ejemplo n.º 8
0
		public virtual object CreateDefault(Transaction a_trans)
		{
			BlobImpl bi = null;
			bi = (BlobImpl)this.MemberwiseClone();
			bi.SetTrans(a_trans);
			return bi;
		}
			private void EnsureSingleOccurence(Transaction trans, IObjectInfoCollection col)
			{
				IEnumerator i = col.GetEnumerator();
				while (i.MoveNext())
				{
					IObjectInfo objectInfo = (IObjectInfo)i.Current;
					if (this.ReflectClass() != this._enclosing.ReflectorFor(trans, objectInfo.GetObject
						()))
					{
						continue;
					}
					object obj = this.ObjectFor(trans, objectInfo);
					object fieldValue = this.FieldMetadata().GetOn(trans, obj);
					if (fieldValue == null)
					{
						continue;
					}
					IBTreeRange range = this.FieldMetadata().Search(trans, fieldValue);
					if (range.Size() > 1)
					{
						throw new UniqueFieldValueConstraintViolationException(this.ClassMetadata().GetName
							(), this.FieldMetadata().GetName());
					}
				}
			}
Ejemplo n.º 10
0
		internal QConClass(Transaction trans, QCon parent, QField field, IReflectClass claxx
			) : base(trans, parent, field, null)
		{
			// C/S
			if (claxx != null)
			{
				ObjectContainerBase container = trans.Container();
				_classMetadata = container.ClassMetadataForReflectClass(claxx);
				if (_classMetadata == null)
				{
					// could be an aliased class, try to resolve.
					string className = claxx.GetName();
					string aliasRunTimeName = container.Config().ResolveAliasStoredName(className);
					if (!className.Equals(aliasRunTimeName))
					{
						_classMetadata = container.ClassMetadataForName(aliasRunTimeName);
					}
				}
				if (claxx.Equals(container._handlers.IclassObject))
				{
					_classMetadata = (ClassMetadata)_classMetadata.TypeHandler();
				}
			}
			_claxx = claxx;
		}
Ejemplo n.º 11
0
 protected virtual void Remove(Transaction transaction, int[] keys)
 {
     for (var i = 0; i < keys.Length; i++)
     {
         Remove(transaction, keys[i]);
     }
 }
Ejemplo n.º 12
0
 public StatefulBuffer(Db4objects.Db4o.Internal.Transaction trans, int initialBufferSize
                       )
 {
     _trans  = trans;
     _length = initialBufferSize;
     _buffer = new byte[_length];
 }
Ejemplo n.º 13
0
			public _IRunnable_50(EventRegistryImpl _enclosing, Transaction transaction, IQuery
				 query)
			{
				this._enclosing = _enclosing;
				this.transaction = transaction;
				this.query = query;
			}
Ejemplo n.º 14
0
		public override void TraverseAll(Transaction ta, IVisitor4 command)
		{
			if (_btreeIndex != null)
			{
				_btreeIndex.TraverseKeys(ta, command);
			}
		}
Ejemplo n.º 15
0
		public BTree(Transaction trans, BTreeConfiguration config, int id, IIndexable4 keyHandler
			, int treeNodeSize) : base(config._idSystem)
		{
			_config = config;
			if (null == keyHandler)
			{
				throw new ArgumentNullException();
			}
			_nodeSize = treeNodeSize;
			_nodeCache = CacheFactory.NewLRUIntCache(config._cacheSize);
			_halfNodeSize = _nodeSize / 2;
			_nodeSize = _halfNodeSize * 2;
			_keyHandler = keyHandler;
			SetID(id);
			if (IsNew())
			{
				SetStateDirty();
				_root = new BTreeNode(this, 0, true, 0, 0, 0);
				_root.Write(trans.SystemTransaction());
				AddNode(_root);
				Write(trans.SystemTransaction());
			}
			else
			{
				SetStateDeactivated();
			}
		}
Ejemplo n.º 16
0
 public MsgD GetWriterForByte(Transaction trans
     , byte b)
 {
     var msg = GetWriterForLength(trans, 1);
     msg._payLoad.WriteByte(b);
     return msg;
 }
Ejemplo n.º 17
0
		public Db4objects.Db4o.CS.Internal.Messages.MsgD GetWriterForByte(Transaction trans
			, byte b)
		{
			Db4objects.Db4o.CS.Internal.Messages.MsgD msg = GetWriterForLength(trans, 1);
			msg._payLoad.WriteByte(b);
			return msg;
		}
Ejemplo n.º 18
0
		public static void AssertEmpty(Transaction transaction, BTree tree)
		{
			ExpectingVisitor visitor = new ExpectingVisitor(new object[0]);
			tree.TraverseKeys(transaction, visitor);
			visitor.AssertExpectations();
			Assert.AreEqual(0, tree.Size(transaction));
		}
Ejemplo n.º 19
0
 protected virtual void Rename(Transaction transaction, string from, string to)
 {
     var item = Query(transaction, from);
     Assert.IsNotNull(item);
     item.name = to;
     Container().Store(transaction, item);
 }
Ejemplo n.º 20
0
 public virtual Db4objects.Db4o.Internal.VirtualAttributes VirtualAttributes(Db4objects.Db4o.Internal.Transaction
                                                                             trans, bool lastCommitted)
 {
     if (trans == null)
     {
         return(_virtualAttributes);
     }
     lock (trans.Container().Lock())
     {
         if (_virtualAttributes == null)
         {
             if (_class.HasVirtualAttributes())
             {
                 _virtualAttributes = new Db4objects.Db4o.Internal.VirtualAttributes();
                 _class.ReadVirtualAttributes(trans, this, lastCommitted);
             }
         }
         else
         {
             if (!_virtualAttributes.SuppliesUUID())
             {
                 if (_class.HasVirtualAttributes())
                 {
                     _class.ReadVirtualAttributes(trans, this, lastCommitted);
                 }
             }
         }
         return(_virtualAttributes);
     }
 }
Ejemplo n.º 21
0
 public FrozenObjectInfo(Transaction trans, ObjectReference @ref, bool committed) :
     this(@ref, IsInstantiatedReference(@ref)
         ? @ref.VirtualAttributes(trans, committed
             )
         : null)
 {
 }
Ejemplo n.º 22
0
		public StatefulBuffer(Db4objects.Db4o.Internal.Transaction trans, int initialBufferSize
			)
		{
			_trans = trans;
			_length = initialBufferSize;
			_buffer = new byte[_length];
		}
Ejemplo n.º 23
0
		public virtual void InitOnUp(Transaction systemTrans, FieldMetadata fieldMetadata
			)
		{
			ObjectContainerBase anyStream = systemTrans.Container();
			if (!anyStream.MaintainsIndices())
			{
				return;
			}
			if (!fieldMetadata.SupportsIndex())
			{
				Indexed(false);
			}
			TernaryBool indexedFlag = _config.GetAsTernaryBool(IndexedKey);
			if (indexedFlag.DefiniteNo())
			{
				fieldMetadata.DropIndex((LocalTransaction)systemTrans);
				return;
			}
			if (UseExistingIndex(systemTrans, fieldMetadata))
			{
				return;
			}
			if (!indexedFlag.DefiniteYes())
			{
				return;
			}
			fieldMetadata.CreateIndex();
		}
Ejemplo n.º 24
0
 private void UnmarshallParent(Db4objects.Db4o.Internal.Transaction a_trans)
 {
     if (i_parent != null)
     {
         i_parent.Unmarshall(a_trans);
     }
 }
Ejemplo n.º 25
0
		public virtual void ReadTypeInfo(Transaction trans, IReadBuffer buffer, ArrayInfo
			 info, int classID)
		{
			BitMap4 typeInfoBitmap = new BitMap4(buffer.ReadByte());
			info.Primitive(typeInfoBitmap.IsTrue(0));
			info.Nullable(typeInfoBitmap.IsTrue(1));
		}
Ejemplo n.º 26
0
		protected virtual void Add(Transaction transaction, int[] keys)
		{
			for (int i = 0; i < keys.Length; i++)
			{
				Add(transaction, keys[i]);
			}
		}
		public UnmarshallingContext(Transaction transaction, ByteArrayBuffer buffer, ObjectReference
			 @ref, int addToIDTree, bool checkIDTree) : base(transaction, buffer, null, @ref
			)
		{
			_addToIDTree = addToIDTree;
			_checkIDTree = checkIDTree;
		}
Ejemplo n.º 28
0
		public override object Rollback(Transaction trans, BTree btree)
		{
			if (_transaction == trans)
			{
				return RolledBack(btree);
			}
			return this;
		}
Ejemplo n.º 29
0
		internal QConPath(Transaction a_trans, QCon a_parent, QField a_field) : base(a_trans
			, a_parent, a_field, null)
		{
			if (a_field != null)
			{
				_classMetadata = a_field.GetFieldType();
			}
		}
Ejemplo n.º 30
0
        protected virtual bool ObjectCanUpdate(Db4objects.Db4o.Internal.Transaction transaction
                                               , object obj)
        {
            ObjectContainerBase container = transaction.Container();

            return(container.Callbacks().ObjectCanUpdate(transaction, this) && _class.DispatchEvent
                       (transaction, obj, EventDispatchers.CanUpdate));
        }
Ejemplo n.º 31
0
			public _IProcedure4_39(ClassMarshaller _enclosing, Transaction trans, ClassMetadata
				 clazz, ByteArrayBuffer writer)
			{
				this._enclosing = _enclosing;
				this.trans = trans;
				this.clazz = clazz;
				this.writer = writer;
			}
Ejemplo n.º 32
0
 public Transaction(ObjectContainerBase container, Db4objects.Db4o.Internal.Transaction
                    systemTransaction, IReferenceSystem referenceSystem)
 {
     // contains DeleteInfo nodes
     _container         = container;
     _systemTransaction = systemTransaction;
     _referenceSystem   = referenceSystem;
 }
Ejemplo n.º 33
0
        private void ObjectOnNew(Db4objects.Db4o.Internal.Transaction transaction, object
                                 obj)
        {
            ObjectContainerBase container = transaction.Container();

            container.Callbacks().ObjectOnNew(transaction, this);
            _class.DispatchEvent(transaction, obj, EventDispatchers.New);
        }
Ejemplo n.º 34
0
		public Db4objects.Db4o.CS.Internal.Messages.MsgD GetWriterForBuffer(Transaction trans
			, ByteArrayBuffer buffer)
		{
			Db4objects.Db4o.CS.Internal.Messages.MsgD writer = GetWriterForLength(trans, buffer
				.Length());
			writer.WriteBytes(buffer._buffer);
			return writer;
		}
Ejemplo n.º 35
0
        public virtual void Activate(Db4objects.Db4o.Internal.Transaction ta, object obj,
                                     IActivationDepth depth)
        {
            ObjectContainerBase container = ta.Container();

            ActivateInternal(container.ActivationContextFor(ta, obj, depth));
            container.ActivatePending(ta);
        }
Ejemplo n.º 36
0
		public override object Key(Transaction trans)
		{
			if (_transaction != trans)
			{
				return No4.Instance;
			}
			return GetObject();
		}
Ejemplo n.º 37
0
		public virtual void SetTransaction(Transaction trans)
		{
			if (trans != null)
			{
				_trans = trans;
				_stream = trans.Container();
			}
		}
Ejemplo n.º 38
0
 protected QQueryBase(Db4objects.Db4o.Internal.Transaction a_trans, QQuery a_parent
                      , string a_field)
 {
     _this    = Cast(this);
     _trans   = a_trans;
     i_parent = a_parent;
     i_field  = a_field;
 }
Ejemplo n.º 39
0
        public void UseTransaction(MUseTransaction message)
        {
            int threadID = message.ReadInt();

            Db4objects.Db4o.Internal.Transaction transToUse = _server.FindTransaction(threadID
                                                                                      );
            _transactionHandle.Transaction(transToUse);
        }
Ejemplo n.º 40
0
        public virtual object ReadPrefetch(Db4objects.Db4o.Internal.Transaction trans, ByteArrayBuffer
                                           buffer, int addToIDTree)
        {
            UnmarshallingContext context = new UnmarshallingContext(trans, buffer, this, addToIDTree
                                                                    , false);

            context.ActivationDepth(new FixedActivationDepth(1, ActivationMode.Prefetch));
            return(context.Read());
        }
Ejemplo n.º 41
0
        private void UnmarshallChildren(Db4objects.Db4o.Internal.Transaction a_trans)
        {
            IEnumerator i = IterateChildren();

            while (i.MoveNext())
            {
                ((Db4objects.Db4o.Internal.Query.Processor.QCon)i.Current).Unmarshall(a_trans);
            }
        }
Ejemplo n.º 42
0
 public virtual void PurgeFieldIndexEntriesOnUpdate(Db4objects.Db4o.Internal.Transaction
                                                    transaction, ArrayType arrayType)
 {
     if (!UpdateDepth().CanSkip(_reference))
     {
         transaction.WriteUpdateAdjustIndexes(_reference.GetID(), _reference.ClassMetadata
                                                  (), arrayType);
     }
 }
Ejemplo n.º 43
0
 public BigSet(LocalObjectContainer db)
 {
     if (db == null)
     {
         return;
     }
     _transaction = db.Transaction;
     _bTree       = BTreeManager().NewBTree();
 }
Ejemplo n.º 44
0
 protected Db4objects.Db4o.Internal.Transaction CheckParentTransaction(Db4objects.Db4o.Internal.Transaction
                                                                       a_trans, ByteArrayBuffer reader)
 {
     if (reader.ReadByte() == Const4.SystemTrans && a_trans.ParentTransaction() != null)
     {
         return(a_trans.ParentTransaction());
     }
     return(a_trans);
 }
Ejemplo n.º 45
0
 private IActivator ActivatorForObject(Db4objects.Db4o.Internal.Transaction transaction
                                       , ObjectReference objectReference)
 {
     if (IsEmbeddedClient(transaction))
     {
         return(new TransactionalActivator(transaction, objectReference));
     }
     return(objectReference);
 }
Ejemplo n.º 46
0
        public object Read(Db4objects.Db4o.Internal.Transaction trans, ByteArrayBuffer buffer
                           , object obj, IActivationDepth instantiationDepth, int addToIDTree, bool checkIDTree
                           )
        {
            UnmarshallingContext context = new UnmarshallingContext(trans, buffer, this, addToIDTree
                                                                    , checkIDTree);

            context.PersistentObject(obj);
            context.ActivationDepth(instantiationDepth);
            return(context.Read());
        }
Ejemplo n.º 47
0
 internal virtual void Unmarshall(Db4objects.Db4o.Internal.Transaction a_trans)
 {
     if (i_trans != null)
     {
         return;
     }
     i_trans = a_trans;
     UnmarshallParent(a_trans);
     UnmarshallJoins(a_trans);
     UnmarshallChildren(a_trans);
 }
Ejemplo n.º 48
0
 public ActivationContext4(Db4objects.Db4o.Internal.Transaction transaction, object
                           obj, IActivationDepth depth)
 {
     if (null == obj)
     {
         throw new ArgumentNullException();
     }
     _transaction  = transaction;
     _targetObject = obj;
     _depth        = depth;
 }
Ejemplo n.º 49
0
        public virtual void Unmarshall(Transaction a_trans)
        {
            _evaluationMode = QueryEvaluationMode.FromInt(_evaluationModeAsInt);
            _trans          = a_trans;
            IEnumerator i = IterateConstraints();

            while (i.MoveNext())
            {
                ((QCon)i.Current).Unmarshall(a_trans);
            }
        }
Ejemplo n.º 50
0
        internal void Store(Db4objects.Db4o.Internal.Transaction trans, Db4objects.Db4o.Internal.ClassMetadata
                            classMetadata, object obj)
        {
            _object = obj;
            _class  = classMetadata;
            int id = trans.Container().IdForNewUserObject(trans);

            SetID(id);
            // will be ended in continueset()
            BeginProcessing();
            BitTrue(Const4.Continue);
        }
Ejemplo n.º 51
0
        private void BindActivatableToActivator(ObjectEventArgs oea)
        {
            object obj = oea.Object;

            if (obj is IActivatable)
            {
                Db4objects.Db4o.Internal.Transaction transaction = (Db4objects.Db4o.Internal.Transaction
                                                                    )oea.Transaction();
                ObjectReference objectReference = transaction.ReferenceForObject(obj);
                Bind(obj, ActivatorForObject(transaction, objectReference));
            }
        }
Ejemplo n.º 52
0
        private void UnbindAll(IInternalObjectContainer container)
        {
            Db4objects.Db4o.Internal.Transaction transaction = container.Transaction;
            // FIXME should that ever happen?
            if (transaction == null)
            {
                return;
            }
            IReferenceSystem referenceSystem = transaction.ReferenceSystem();

            referenceSystem.TraverseReferences(new _IVisitor4_95(this));
        }
Ejemplo n.º 53
0
        public virtual void Read(IReadContext context)
        {
            int id = context.ReadInt();

            if (_bTree != null)
            {
                AssertCurrentBTreeId(id);
                return;
            }
            _transaction = context.Transaction();
            _bTree       = BTreeManager().ProduceBTree(id);
        }
Ejemplo n.º 54
0
 public BTreeRangeSingle(Db4objects.Db4o.Internal.Transaction transaction, BTree btree
                         , BTreePointer first, BTreePointer end)
 {
     if (transaction == null || btree == null)
     {
         throw new ArgumentNullException();
     }
     _transaction = transaction;
     _btree       = btree;
     _first       = first;
     _end         = end;
 }
Ejemplo n.º 55
0
        public virtual void WriteUpdate(Db4objects.Db4o.Internal.Transaction transaction,
                                        IUpdateDepth updatedepth)
        {
            ContinueSet(transaction, updatedepth);
            // make sure, a concurrent new, possibly triggered by objectOnNew
            // is written to the file
            // preventing recursive
            if (!BeginProcessing())
            {
                return;
            }
            object obj = GetObject();

            if (!ObjectCanUpdate(transaction, obj) || !IsActive() || obj == null || !ClassMetadata
                    ().IsModified(obj))
            {
                EndProcessing();
                return;
            }
            MarshallingContext context = new MarshallingContext(transaction, this, updatedepth
                                                                , false);

            if (context.UpdateDepth().Negative())
            {
                EndProcessing();
                return;
            }
            ObjectContainerBase container = transaction.Container();

            LogEvent(container, "update", Const4.State);
            SetStateClean();
            context.PurgeFieldIndexEntriesOnUpdate(transaction, container._handlers.ArrayType
                                                       (obj));
            Handlers4.Write(_class.TypeHandler(), context, obj);
            if (context.UpdateDepth().CanSkip(this))
            {
                EndProcessing();
                return;
            }
            Pointer4        pointer = context.AllocateSlot();
            ByteArrayBuffer buffer  = context.ToWriteBuffer(pointer);

            container.WriteUpdate(transaction, pointer, _class, container._handlers.ArrayType
                                      (obj), buffer);
            if (IsActive())
            {
                SetStateClean();
            }
            EndProcessing();
            container.Callbacks().ObjectOnUpdate(transaction, this);
            ClassMetadata().DispatchEvent(transaction, obj, EventDispatchers.Update);
        }
Ejemplo n.º 56
0
 public MarshallingContext(Db4objects.Db4o.Internal.Transaction trans, ObjectReference
                           @ref, IUpdateDepth updateDepth, bool isNew)
 {
     // YapClass ID
     // Marshaller Version
     // number of fields
     _transaction   = trans;
     _reference     = @ref;
     _nullBitMap    = new BitMap4(AspectCount());
     _updateDepth   = ClassMetadata().AdjustUpdateDepth(trans, updateDepth);
     _isNew         = isNew;
     _writeBuffer   = new MarshallingBuffer();
     _currentBuffer = _writeBuffer;
 }
Ejemplo n.º 57
0
        /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
        protected static StatefulBuffer ReadMessageBuffer(Db4objects.Db4o.Internal.Transaction
                                                          trans, Socket4Adapter socket, int length)
        {
            StatefulBuffer buffer = new StatefulBuffer(trans, length);
            int            offset = 0;

            while (length > 0)
            {
                int read = socket.Read(buffer._buffer, offset, length);
                if (read < 0)
                {
                    throw new Db4oIOException();
                }
                offset += read;
                length -= read;
            }
            return(buffer);
        }
Ejemplo n.º 58
0
        public virtual void Deactivate(Db4objects.Db4o.Internal.Transaction trans, IActivationDepth
                                       depth)
        {
            if (!depth.RequiresActivation())
            {
                return;
            }
            object obj = GetObject();

            if (obj == null)
            {
                return;
            }
            ObjectContainerBase container = trans.Container();

            LogActivation(container, "deactivate");
            SetStateDeactivated();
            _class.Deactivate(trans, this, depth);
        }
Ejemplo n.º 59
0
 internal QCon(Db4objects.Db4o.Internal.Transaction a_trans)
 {
     //Used for query debug only.
     // our candidate object tree
     // collection of QCandidates to collect children elements and to
     // execute children. For convenience we hold them in the constraint,
     // so we can do collection and execution in two steps
     // all subconstraints
     // for evaluation
     // ID handling for fast find of QConstraint objects in
     // pending OR evaluations
     // ANDs and ORs on this constraint
     // the parent of this constraint or null, if this is a root
     // our transaction to get a stream object anywhere
     // whether or not this constraint was used to get the initial set
     // in the FieldIndexProcessor
     // C/S only
     i_id    = idGenerator.Next();
     i_trans = a_trans;
 }
Ejemplo n.º 60
0
        /// <summary>return false if class not completely initialized, otherwise true</summary>
        internal virtual bool ContinueSet(Db4objects.Db4o.Internal.Transaction trans, IUpdateDepth
                                          updateDepth)
        {
            if (!BitIsTrue(Const4.Continue))
            {
                return(true);
            }
            if (!_class.StateOK())
            {
                return(false);
            }
            if (!_class.AspectsAreInitialized())
            {
                return(false);
            }
            if (DTrace.enabled)
            {
                DTrace.Continueset.Log(GetID());
            }
            BitFalse(Const4.Continue);
            MarshallingContext context = new MarshallingContext(trans, this, updateDepth, true
                                                                );

            Handlers4.Write(ClassMetadata().TypeHandler(), context, GetObject());
            Pointer4            pointer   = context.AllocateSlot();
            ByteArrayBuffer     buffer    = context.ToWriteBuffer(pointer);
            ObjectContainerBase container = trans.Container();

            container.WriteNew(trans, pointer, _class, buffer);
            object obj = _object;

            ObjectOnNew(trans, obj);
            if (_class.HasIdentity())
            {
                _object = container.NewWeakReference(this, obj);
            }
            SetStateClean();
            EndProcessing();
            return(true);
        }