Ejemplo n.º 1
0
		public override void Defrag(ClassMetadata classMetadata, ClassAspect aspect, LatinStringIO
			 sio, DefragmentContextImpl context)
		{
			base.Defrag(classMetadata, aspect, sio, context);
			if (!(aspect is FieldMetadata))
			{
				return;
			}
			FieldMetadata field = (FieldMetadata)aspect;
			if (field.IsVirtual())
			{
				return;
			}
			if (field.HasIndex())
			{
				BTree index = field.GetIndex(context.SystemTrans());
				int targetIndexID = context.CopyID();
				if (targetIndexID != 0)
				{
					index.DefragBTree(context.Services());
				}
			}
			else
			{
				context.WriteInt(0);
			}
		}
Ejemplo n.º 2
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));
		}
Ejemplo n.º 3
0
		public virtual void ProcessAspect(ClassAspect aspect, int currentSlot)
		{
			if (aspect is FieldMetadata)
			{
				Process((FieldMetadata)aspect);
			}
		}
		public virtual void ProcessAspect(ClassAspect aspect, int currentSlot)
		{
			if (Accept(aspect))
			{
				ProcessAspect(aspect, currentSlot, _marshallingInfo.IsNull(currentSlot));
			}
			_marshallingInfo.BeginSlot();
		}
Ejemplo n.º 5
0
			protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
				)
			{
				if (!isNull)
				{
					aspect.DefragAspect(context);
				}
			}
		public virtual void ProcessAspectOnMissingClass(ClassAspect aspect, int currentSlot
			)
		{
			if (_marshallingInfo.IsNull(currentSlot))
			{
				return;
			}
			aspect.IncrementOffset(_marshallingInfo.Buffer());
		}
Ejemplo n.º 7
0
		public override int MarshalledLength(ObjectContainerBase stream, ClassAspect aspect
			)
		{
			int len = base.MarshalledLength(stream, aspect);
			if (!(aspect is FieldMetadata))
			{
				return len;
			}
			FieldMetadata field = (FieldMetadata)aspect;
			if (!HasBTreeIndex(field))
			{
				return len;
			}
			return len + Const4.IdLength;
		}
Ejemplo n.º 8
0
		public override void Write(Transaction trans, ClassMetadata clazz, ClassAspect aspect
			, ByteArrayBuffer writer)
		{
			base.Write(trans, clazz, aspect, writer);
			if (!(aspect is FieldMetadata))
			{
				return;
			}
			FieldMetadata field = (FieldMetadata)aspect;
			if (!HasBTreeIndex(field))
			{
				return;
			}
			writer.WriteIDOf(trans, field.GetIndex(trans));
		}
Ejemplo n.º 9
0
		public override int MarshalledLength(ObjectContainerBase stream, ClassAspect aspect
			)
		{
			int len = stream.StringIO().ShortLength(aspect.GetName());
			if (aspect is FieldMetadata)
			{
				FieldMetadata field = (FieldMetadata)aspect;
				if (field.NeedsArrayAndPrimitiveInfo())
				{
					len += 1;
				}
				if (!(field is VirtualFieldMetadata))
				{
					len += Const4.IdLength;
				}
			}
			return len;
		}
Ejemplo n.º 10
0
 private ClassAspect[] ToClassAspectArray(Collection4 aspects)
 {
     var array = new ClassAspect[aspects.Size()];
     aspects.ToArray(array);
     for (var i = 0; i < array.Length; i++)
     {
         array[i].SetHandle(i);
     }
     return array;
 }
Ejemplo n.º 11
0
 // do nothing
 public void ProcessAspect(ClassAspect aspect, int currentSlot)
 {
     if (aspect.IsEnabledOn(AspectVersionContextImpl.CheckAlwaysEnabled))
     {
         aspect.Deactivate(context);
     }
 }
Ejemplo n.º 12
0
 public void ProcessAspectOnMissingClass(ClassAspect aspect, int currentSlot)
 {
 }
Ejemplo n.º 13
0
 // do nothing
 public void ProcessAspect(ClassAspect aspect, int currentSlot)
 {
     aspect.CascadeActivation(context);
 }
Ejemplo n.º 14
0
			protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
				)
			{
				if (isNull)
				{
					return;
				}
				if (predicate.Match(aspect))
				{
					aspect.CollectIDs(context);
				}
				else
				{
					aspect.IncrementOffset(context, context);
				}
			}
Ejemplo n.º 15
0
 public bool SeekToField(ObjectHeaderContext context, ClassAspect field)
 {
     if (!StandardReferenceTypeHandlerIsUsed())
     {
         return false;
     }
     return Handlers4.FieldAwareTypeHandler(CorrectHandlerVersion(context)).SeekToField
         (context, field);
 }
Ejemplo n.º 16
0
			public override void ProcessAspectOnMissingClass(ClassAspect aspect, int currentSlot
				)
			{
				((MarshallingContext)context).IsNull(currentSlot, true);
			}
Ejemplo n.º 17
0
			protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
				)
			{
				if (isNull)
				{
					if (aspect is FieldMetadata)
					{
						FieldMetadata field = (FieldMetadata)aspect;
						field.RemoveIndexEntry(context.Transaction(), context.ObjectId(), null);
					}
					return;
				}
				aspect.Delete(context, isUpdate);
			}
Ejemplo n.º 18
0
			public override bool Accept(ClassAspect aspect)
			{
				return aspect.IsEnabledOn(context);
			}
Ejemplo n.º 19
0
			protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
				)
			{
				if (aspect is FieldMetadata)
				{
					FieldMetadata field = (FieldMetadata)aspect;
					if (isNull)
					{
						field.AddIndexEntry(context.Transaction(), context.ObjectId(), null);
					}
					else
					{
						field.AddFieldIndex(context);
					}
				}
				else
				{
					aspect.IncrementOffset(context.Buffer(), context);
				}
			}
Ejemplo n.º 20
0
			protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
				)
			{
				if (!isNull)
				{
					if (aspect is VirtualFieldMetadata)
					{
						((VirtualFieldMetadata)aspect).ReadVirtualAttribute(context);
					}
					else
					{
						aspect.IncrementOffset(context, context);
					}
				}
			}
Ejemplo n.º 21
0
		private bool IsCollectIdTypehandlerAspect(ClassAspect aspect)
		{
			if (!(aspect is TypeHandlerAspect))
			{
				return false;
			}
			ITypeHandler4 typehandler = ((TypeHandlerAspect)aspect)._typeHandler;
			return Handlers4.IsCascading(typehandler);
		}
Ejemplo n.º 22
0
 private bool InstallTranslatorOnExistingAspect(IObjectTranslator translator, ClassAspect
     existingAspect, Collection4 aspects)
 {
     if (existingAspect is TranslatedAspect)
     {
         var translatedAspect = (TranslatedAspect) existingAspect;
         translatedAspect.InitializeTranslator(translator);
         _translator = translatedAspect;
         return false;
     }
     // older versions didn't store the aspect type properly
     _translator = new TranslatedAspect(this, translator);
     aspects.ReplaceByIdentity(existingAspect, _translator);
     return true;
 }
Ejemplo n.º 23
0
 private bool ReplaceAspectByName(Collection4 aspects, ClassAspect aspect)
 {
     var existing = AspectByName(aspects, aspect.GetName());
     if (existing == null)
     {
         return false;
     }
     aspects.ReplaceByIdentity(existing, aspect);
     return true;
 }
Ejemplo n.º 24
0
			public override bool Accept(ClassAspect aspect)
			{
				return aspect.IsEnabledOn(this._marshallingInfo);
			}
			public void Process(ITraverseAspectCommand command, ClassAspect currentAspect, int
				 currentSlot)
			{
				command.ProcessAspectOnMissingClass(currentAspect, currentSlot);
			}
Ejemplo n.º 26
0
			protected override void ProcessAspect(ClassAspect curField, int currentSlot, bool
				 isNull)
			{
				if (curField == aspect)
				{
					found.value = !isNull;
					this.Cancel();
					return;
				}
				if (!isNull)
				{
					curField.IncrementOffset(this._marshallingInfo.Buffer(), context);
				}
			}
Ejemplo n.º 27
0
		public virtual bool SeekToField(ObjectHeaderContext context, ClassAspect aspect)
		{
			BooleanByRef found = new BooleanByRef(false);
			ITraverseAspectCommand command = new _MarshallingInfoTraverseAspectCommand_456(aspect
				, found, context, EnsureFieldList(context));
			TraverseAllAspects(context, command);
			return found.value;
		}
Ejemplo n.º 28
0
			protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
				)
			{
				if (isNull)
				{
					return;
				}
				if (this._enclosing.IsCollectIdTypehandlerAspect(aspect))
				{
					aspectFound.value = true;
					aspect.CollectIDs(subContext);
				}
				else
				{
					aspect.IncrementOffset(subContext, subContext);
				}
			}
Ejemplo n.º 29
0
		private ClassAspect[] ReadAspects(ObjectContainerBase stream, ByteArrayBuffer reader
			, ClassMetadata clazz)
		{
			ClassAspect[] aspects = new ClassAspect[reader.ReadInt()];
			for (int i = 0; i < aspects.Length; i++)
			{
				aspects[i] = _family._field.Read(stream, clazz, reader);
				aspects[i].SetHandle(i);
			}
			return aspects;
		}
Ejemplo n.º 30
0
			public _MarshallingInfoTraverseAspectCommand_456(ClassAspect aspect, BooleanByRef
				 found, ObjectHeaderContext context, IMarshallingInfo baseArg1) : base(baseArg1)
			{
				this.aspect = aspect;
				this.found = found;
				this.context = context;
			}