Exemplo n.º 1
0
        /// <summary>
        /// Reserve space in the file when it is at the end of the file Used in
        /// transaction mode where real write will happen later
        /// </summary>
        /// <param name="quantity">The number of object to reserve space for</param>
        /// <param name="type">The type of the object to reserve space for</param>
        private void EnsureSpaceFor(long quantity, NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
                                    type)
        {
            long space = type.GetSize() * quantity;

            // We are in transaction mode - do not write just reserve space if
            // necessary
            // ensure space will be available when applying transaction
            if (PointerAtTheEndOfTheFile())
            {
                if (space != 1)
                {
                    io.SetCurrentWritePosition(io.GetCurrentPosition() + space - 1);
                }
                io.WriteByte(ReservedSpace);
                if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId) && canLog)
                {
                }
            }
            else
            {
                // DLogger.debug("Reserving " + space + " bytes (" + quantity +
                // " " + type.getName() + ")");
                // We must simulate the move
                io.SetCurrentWritePosition(io.GetCurrentPosition() + space);
            }
        }
 public virtual NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType GetOdbType()
 {
     if (odbType == null)
     {
         odbType = NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.GetFromId(odbTypeId);
     }
     return(odbType);
 }
 public AbstractObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType type)
 {
     if (type != null)
     {
         this.odbTypeId = type.GetId();
     }
     this.odbType = type;
 }
		public virtual NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType GetOdbType()
		{
			if (odbType == null)
			{
				odbType = NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.GetFromId(odbTypeId);
			}
			return odbType;
		}
		public AbstractObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType type)
		{
			if (type != null)
			{
				this.odbTypeId = type.GetId();
			}
			this.odbType = type;
		}
 public ClassAttributeInfo(int attributeId, string name, System.Type nativeClass,
                           string fullClassName, ClassInfo info) : base
         ()
 {
     //private transient static int nb=0;
     this.id          = attributeId;
     this.name        = name;
     this.nativeClass = nativeClass;
     SetFullClassName(fullClassName);
     if (nativeClass != null)
     {
         attributeType = ODBType.GetFromClass(nativeClass
                                              );
     }
     else
     {
         if (fullClassName != null)
         {
             attributeType = ODBType.GetFromName(fullClassName);
         }
     }
     classInfo = info;
     isIndex   = false;
 }
 public NativeObjectInfo(object @object, NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
                         odbType) : base(odbType)
 {
     this.theObject = @object;
 }
 public CollectionObjectInfo(System.Collections.Generic.ICollection <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                     > collection, NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType type, System.Collections.Generic.ICollection
                             <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo> nonNativeObjects) : base
         (collection, type)
 {
     realCollectionClassName = NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.DefaultCollectionClassName;
     SetNonNativeObjects(nonNativeObjects);
 }
 public virtual void SetAttributeType(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
                                      attributeType)
 {
     this.attributeType = attributeType;
 }
 public virtual void SetOdbType(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType odbType
                                )
 {
     this.odbType = odbType;
 }
Exemplo n.º 11
0
 public NullNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType type) :
     base(null, type)
 {
 }
		public virtual void SetOdbType(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType odbType
			)
		{
			this.odbType = odbType;
		}
Exemplo n.º 13
0
 public virtual void EnsureSpaceFor(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType type
                                    )
 {
     EnsureSpaceFor(1, type);
 }
Exemplo n.º 14
0
 public override string ToString()
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder(classInfo.GetFullClassName
                                                                          ()).Append("(").Append(GetOid()).Append(")=");
     if (attributeValues == null)
     {
         buffer.Append("null attribute values");
         return(buffer.ToString());
     }
     for (int i = 0; i < attributeValues.Length; i++)
     {
         if (i != 0)
         {
             buffer.Append(",");
         }
         string attributeName = (classInfo != null ? (classInfo.GetAttributeInfo(i)).GetName
                                     () : "?");
         buffer.Append(attributeName).Append("=");
         object @object = attributeValues[i];
         if (@object == null)
         {
             buffer.Append(" null java object - should not happen , ");
         }
         else
         {
             NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType type = NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
                                                                 .GetFromClass(attributeValues[i].GetType());
             if (@object is NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeNullObjectInfo)
             {
                 buffer.Append("null");
                 continue;
             }
             if (@object is NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeDeletedObjectInfo)
             {
                 buffer.Append("deleted object");
                 continue;
             }
             if (@object is NeoDatis.Odb.Core.Layers.Layer2.Meta.NativeObjectInfo)
             {
                 NeoDatis.Odb.Core.Layers.Layer2.Meta.NativeObjectInfo noi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NativeObjectInfo
                                                                              )@object;
                 buffer.Append(noi.ToString());
                 continue;
             }
             if (@object is NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)
             {
                 NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                  )@object;
                 buffer.Append("@").Append(nnoi.GetClassInfo().GetFullClassName()).Append("(id=").
                 Append(nnoi.GetOid()).Append(")");
                 continue;
             }
             if (@object is NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectReference)
             {
                 buffer.Append(@object.ToString());
                 continue;
             }
             buffer.Append("@").Append(NeoDatis.Tool.Wrappers.OdbClassUtil.GetClassName(type.GetName
                                                                                            ()));
         }
     }
     return(buffer.ToString());
 }
Exemplo n.º 15
0
 public GroupObjectInfo(object @object, NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
                        odbType) : base(@object, odbType)
 {
     this.nonNativeObjects = new System.Collections.Generic.List <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                  >();
 }