public virtual void ManageUpdateTriggerAfter(string className, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                              oldNnoi, object newObject, NeoDatis.Odb.OID oid)
 {
     if (HasUpdateTriggersFor(className))
     {
         NeoDatis.Odb.Core.Trigger.UpdateTrigger trigger  = null;
         System.Collections.IEnumerator          iterator = GetListOfUpdateTriggersFor(className).GetEnumerator
                                                                ();
         while (iterator.MoveNext())
         {
             trigger = (NeoDatis.Odb.Core.Trigger.UpdateTrigger)iterator.Current;
             if (trigger.GetOdb() == null)
             {
                 trigger.SetOdb(new NeoDatis.Odb.Impl.Main.ODBForTrigger(storageEngine));
             }
             try
             {
                 trigger.AfterUpdate(new NeoDatis.Odb.Impl.Core.Server.Trigger.DefaultObjectRepresentation
                                         (oldNnoi), Transform(newObject), oid);
             }
             catch (System.Exception e)
             {
                 NeoDatis.Odb.Core.IError warning = NeoDatis.Odb.Core.NeoDatisError.AfterUpdateTriggerHasThrownException
                                                    .AddParameter(trigger.GetType().FullName).AddParameter(NeoDatis.Tool.Wrappers.OdbString
                                                                                                           .ExceptionToString(e, false));
                 if (NeoDatis.Odb.OdbConfiguration.DisplayWarnings())
                 {
                     NeoDatis.Tool.DLogger.Info(warning);
                 }
             }
         }
     }
 }
Beispiel #2
0
 public virtual NeoDatis.Tool.Wrappers.OdbComparable BuildOrderByKey(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                     nnoi)
 {
     // TODO cache the attributes ids to compute them only once
     return(NeoDatis.Odb.Core.Query.Execution.IndexTool.BuildIndexKey("OrderBy", nnoi,
                                                                      NeoDatis.Odb.Core.Query.QueryManager.GetOrderByAttributeIds(classInfo, query)));
 }
		public StoreMessage(string baseId, string connectionId, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
			 nnoi, NeoDatis.Odb.OID[] localOids) : base(NeoDatis.Odb.Core.Server.Layers.Layer3.Engine.Command
			.Store, baseId, connectionId)
		{
			this.nnoi = nnoi;
			this.clientIds = localOids;
		}
Beispiel #4
0
 public StoreMessage(string baseId, string connectionId, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                     nnoi, NeoDatis.Odb.OID[] localOids) : base(NeoDatis.Odb.Core.Server.Layers.Layer3.Engine.Command
                                                                .Store, baseId, connectionId)
 {
     this.nnoi      = nnoi;
     this.clientIds = localOids;
 }
 public override NeoDatis.Odb.OID UpdateNonNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                            nnoi, bool forceUpdate)
 {
     // To enable object auto-reconnect on the server side
     if (NeoDatis.Odb.OdbConfiguration.ReconnectObjectsToSession() && nnoi.GetHeader()
         .GetOid() != null)
     {
         NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession
                                                                            )sessionManager.GetSession(storageEngine.GetBaseIdentification().GetIdentification
                                                                                                           (), true);
         NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = session.GetCache().GetObjectInfoHeaderFromOid
                                                                         (nnoi.GetOid(), false);
         // only add in th cache if object does not exist in the cache
         if (oih == null)
         {
             session.GetCache().AddObjectInfo(nnoi.GetHeader());
         }
     }
     NeoDatis.Odb.OID roid = base.UpdateNonNativeObjectInfo(nnoi, forceUpdate);
     if (nnoi is NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo)
     {
         NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo cnnoi = (NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo
                                                                                        )nnoi;
         NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession
                                                                            )GetSession();
         session.AssociateIds(cnnoi.GetOid(), cnnoi.GetLocalOid());
     }
     return(roid);
 }
Beispiel #6
0
 public virtual object Instantiate(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                   nnoi)
 {
     NeoDatis.Odb.Test.Performance.SimpleObject so = new NeoDatis.Odb.Test.Performance.SimpleObject
                                                         ();
     return(so);
 }
Beispiel #7
0
        /// <summary>It is overiden to manage triggers</summary>
        public override void DeleteObjectWithOid(NeoDatis.Odb.OID oid)
        {
            // Check if oih is in the cache
            NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = GetSession(true).GetCache
                                                                            ().GetObjectInfoHeaderFromOid(oid, false);
            if (oih == null)
            {
                oih = GetObjectReader().ReadObjectInfoHeaderFromOid(oid, true);
            }
            // Only necessary to check if there is some trigger
            NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = GetMetaModel().GetClassInfoFromId
                                                                    (oih.GetClassInfoId());
            string className   = ci.GetFullClassName();
            bool   hasTriggers = triggerManager.HasDeleteTriggersFor(className);

            NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = null;
            if (hasTriggers)
            {
                nnoi = GetObjectReader().ReadNonNativeObjectInfoFromOid(ci, oid, true, false);
                triggerManager.ManageInsertTriggerBefore(className, nnoi);
            }
            base.DeleteObjectWithOid(oid);
            if (hasTriggers)
            {
                triggerManager.ManageInsertTriggerAfter(className, nnoi, oid);
            }
        }
 public override NeoDatis.Odb.OID WriteNonNativeObjectInfo(NeoDatis.Odb.OID existingOid
                                                           , NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo objectInfo, long position
                                                           , bool writeDataInTransaction, bool isNewObject)
 {
     // To enable object auto-reconnect on the server side
     if (NeoDatis.Odb.OdbConfiguration.ReconnectObjectsToSession() && objectInfo.GetHeader
             ().GetOid() != null)
     {
         NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession
                                                                            )sessionManager.GetSession(storageEngine.GetBaseIdentification().GetIdentification
                                                                                                           (), true);
         NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = session.GetCache().GetObjectInfoHeaderFromOid
                                                                         (objectInfo.GetOid(), false);
         // only add in th cache if object does not exist in the cache
         if (oih == null)
         {
             session.GetCache().AddObjectInfo(objectInfo.GetHeader());
         }
     }
     NeoDatis.Odb.OID roid = base.WriteNonNativeObjectInfo(existingOid, objectInfo, position
                                                           , writeDataInTransaction, isNewObject);
     if (objectInfo is NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo)
     {
         NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo cnnoi = (NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo
                                                                                        )objectInfo;
         NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession
                                                                            )GetSession();
         session.AssociateIds(roid, cnnoi.GetLocalOid());
         // Adds the abstract Objectinfo in the cache
         session.GetCache().AddObjectInfo(cnnoi.GetHeader());
     }
     return(roid);
 }
Beispiel #9
0
        public virtual object Instantiate(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                          nnoi)
        {
            User user = new User();

            return(user);
        }
Beispiel #10
0
 /// <summary>Create a copy oh this meta object</summary>
 /// <param name="onlyData">if true, only copy attributes values</param>
 /// <returns></returns>
 public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo CreateCopy
     (System.Collections.Generic.IDictionary <NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                              > cache, bool onlyData)
 {
     NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                      )cache[objectHeader.GetOid()];
     if (nnoi != null)
     {
         return(nnoi);
     }
     if (onlyData)
     {
         NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader
                                                                         ();
         nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo(@object, classInfo
                                                                             , null, oih.GetAttributesIdentification(), oih.GetAttributeIds());
     }
     else
     {
         nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo(@object, classInfo
                                                                             , null, objectHeader.GetAttributesIdentification(), objectHeader.GetAttributeIds
                                                                                 ());
         nnoi.GetHeader().SetOid(GetHeader().GetOid());
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo[] newAttributeValues = new
                                                                                    NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo[attributeValues.Length];
     for (int i = 0; i < attributeValues.Length; i++)
     {
         newAttributeValues[i] = attributeValues[i].CreateCopy(cache, onlyData);
     }
     nnoi.attributeValues = newAttributeValues;
     cache.Add(objectHeader.GetOid(), nnoi);
     return(nnoi);
 }
Beispiel #11
0
        /// <summary>Used to change the value of an attribute</summary>
        /// <param name="attributeName"></param>
        /// <param name="aoi"></param>
        public virtual void SetValueOf(string attributeName, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                       aoi)
        {
            int  attributeId = -1;
            bool isRelation  = attributeName.IndexOf(".") != -1;

            if (!isRelation)
            {
                attributeId = GetClassInfo().GetAttributeId(attributeName);
                SetAttributeValue(attributeId, aoi);
                return;
            }
            int    firstDotIndex      = attributeName.IndexOf(".");
            string firstAttributeName = NeoDatis.Tool.Wrappers.OdbString.Substring(attributeName
                                                                                   , 0, firstDotIndex);

            attributeId = GetClassInfo().GetAttributeId(firstAttributeName);
            object @object = attributeValues[attributeId];

            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;
                nnoi.SetValueOf(NeoDatis.Tool.Wrappers.OdbString.Substring(attributeName, firstDotIndex
                                                                           + 1, attributeName.Length), aoi);
            }
            throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.ClassInfoDoNotHaveTheAttribute
                                                       .AddParameter(GetClassInfo().GetFullClassName()).AddParameter(attributeName));
        }
		public NewNonNativeObjectAction(long position, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
			 nnoi, int recursionLevel, string attributeName)
		{
			this.updatePosition = position;
			this.nnoi = nnoi;
			this.recursionLevel = recursionLevel;
			this.attributeName = attributeName;
		}
Beispiel #13
0
 public NewNonNativeObjectAction(long position, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                 nnoi, int recursionLevel, string attributeName)
 {
     this.updatePosition = position;
     this.nnoi           = nnoi;
     this.recursionLevel = recursionLevel;
     this.attributeName  = attributeName;
 }
Beispiel #14
0
 private bool CheckIfCollectionContainsValue(System.Collections.ICollection c)
 {
     NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = GetQuery().GetStorageEngine
                                                                 ();
     if (engine == null)
     {
         throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.QueryEngineNotSet
                                                    );
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = null;
     System.Collections.IEnumerator iterator = c.GetEnumerator();
     // If the object to compared is native
     if (objectIsNative)
     {
         while (iterator.MoveNext())
         {
             aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)iterator.Current;
             if (aoi == null && criterionValue == null)
             {
                 return(true);
             }
             if (aoi != null && criterionValue == null)
             {
                 return(false);
             }
             if (criterionValue.Equals(aoi.GetObject()))
             {
                 return(true);
             }
         }
         return(false);
     }
     // Object is not native
     while (iterator.MoveNext())
     {
         aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)iterator.Current;
         if (aoi.IsNull() && criterionValue == null && oid == null)
         {
             return(true);
         }
         if (aoi != null & oid != null)
         {
             if (aoi.IsNonNativeObject())
             {
                 NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi1 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                   )aoi;
                 bool isEqual = nnoi1.GetOid() != null && oid != null && nnoi1.GetOid().Equals(oid
                                                                                               );
                 if (isEqual)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Beispiel #15
0
        public virtual bool Match(NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                  aoi)
        {
            NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                             )aoi;
            object aoiValue = nnoi.GetValueOf(attributeName);

            return(Match(aoiValue));
        }
Beispiel #16
0
		public ArrayModifyElement(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
			 nnoi, int attributeId, int index, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
			 newValue, bool supportInPlaceUpdate) : base()
		{
			this.nnoi = nnoi;
			this.attributeId = attributeId;
			this.supportInPlaceUpdate = supportInPlaceUpdate;
			this.newValue = newValue;
			this.arrayElementIndexToChange = index;
		}
Beispiel #17
0
 public ChangedNativeAttributeAction(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                     oldNnoi, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo newNnoi, long
                                     position, NeoDatis.Odb.Core.Layers.Layer2.Meta.NativeObjectInfo newNoi, int recursionLevel
                                     , bool canDoInPlaceUpdate, string attributeName)
 {
     this.oldNnoi                   = oldNnoi;
     this.newNoi                    = newNnoi;
     this.updatePosition            = position;
     this.noiWithNewValue           = newNoi;
     this.recursionLevel            = recursionLevel;
     this.reallyCantDoInPlaceUpdate = canDoInPlaceUpdate;
     this.attributeName             = attributeName;
 }
Beispiel #18
0
 public static NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo GetNnoi(NeoDatis.Odb.ObjectRepresentation
                                                                                objectRepresentation)
 {
     if (objectRepresentation is NeoDatis.Odb.Impl.Core.Server.Trigger.DefaultObjectRepresentation)
     {
         NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = ((NeoDatis.Odb.Impl.Core.Server.Trigger.DefaultObjectRepresentation
                                                                           )objectRepresentation).GetNnoi();
         return(nnoi);
     }
     throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.InternalError
                                                .AddParameter("getNnoi not implemented for " + objectRepresentation.GetType().FullName
                                                              ));
 }
Beispiel #19
0
 public static NeoDatis.Tool.Wrappers.OdbComparable BuildIndexKey(string indexName
                                                                  , NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo oi, int[] fieldIds)
 {
     NeoDatis.Tool.Wrappers.OdbComparable[] keys = new NeoDatis.Tool.Wrappers.OdbComparable
                                                   [fieldIds.Length];
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = null;
     System.IComparable o = null;
     for (int i = 0; i < fieldIds.Length; i++)
     {
         // Todo : can we assume that the object is a Comparable
         try
         {
             aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)oi.GetAttributeValueFromId
                       (fieldIds[i]);
             o = (System.IComparable)aoi.GetObject();
             // JDK1.4 restriction: Boolean is not Comparable in jdk1.4
             if (aoi.GetOdbType().IsBoolean())
             {
                 bool b = (bool)o;
                 if (b)
                 {
                     o = (byte)1;
                 }
                 else
                 {
                     o = (byte)0;
                 }
             }
             // If the index is on NonNativeObjectInfo, then the key is the oid
             // of the object
             if (aoi.IsNonNativeObject())
             {
                 NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                  )aoi;
                 o = nnoi.GetOid();
             }
             keys[i] = new NeoDatis.Odb.Core.Query.SimpleCompareKey(o);
         }
         catch (System.Exception)
         {
             throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.IndexKeysMustImplementComparable
                                                        .AddParameter(fieldIds[i]).AddParameter(oi.GetAttributeValueFromId(fieldIds[i]).
                                                                                                GetType().FullName));
         }
     }
     if (keys.Length == 1)
     {
         return(keys[0]);
     }
     return(new NeoDatis.Odb.Core.Query.ComposedCompareKey(keys));
 }
Beispiel #20
0
        public virtual void TestIfInstanceOf()
		{
			long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
			NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
				(null);
			for (int i = 0; i < size; i++)
			{
				if (nnoi is NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)
				{
				}
			}
			// println("time instance of=" + (OdbTime.getCurrentTimeInMs()-start));
			AssertTrue(true);
		}
Beispiel #21
0
        public virtual void TestIfInstanceOf()
        {
            long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                (null);
            for (int i = 0; i < size; i++)
            {
                if (nnoi is NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)
                {
                }
            }
            // println("time instance of=" + (OdbTime.getCurrentTimeInMs()-start));
            AssertTrue(true);
        }
 /// <exception cref="System.Exception"></exception>
 private object LoadObject(NeoDatis.Odb.OID oid)
 {
     // true = to use cache
     NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                      )storageEngine.GetObjectReader().ReadNonNativeObjectInfoFromOid(null, oid, true,
                                                                                                                                      returnObjects);
     if (returnObjects)
     {
         object o = nnoi.GetObject();
         if (o != null)
         {
             return(o);
         }
         return(storageEngine.GetObjectReader().BuildOneInstance(nnoi));
     }
     return(nnoi);
 }
Beispiel #23
0
 public virtual void Test3()
 {
     NeoDatis.Odb.Core.Transaction.ICache cache = NeoDatis.Odb.Impl.Core.Transaction.CacheFactory
                                                  .GetLocalCache(null, "temp");
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
                                                             (this.GetType().FullName);
     ci.SetPosition(1);
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih1 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader
                                                                      ();
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih2 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader
                                                                      ();
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih3 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader
                                                                      ();
     oih1.SetOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID(1));
     oih2.SetOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID(10));
     oih3.SetOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID(100));
     NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi1 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                          (oih1, ci);
     NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi2 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                          (oih2, ci);
     NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi3 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                          (oih3, ci);
     cache.StartReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                             (1), nnoi1);
     cache.StartReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                             (10), nnoi2);
     cache.StartReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                             (100), nnoi3);
     AssertTrue(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                     (1)));
     AssertTrue(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                     (10)));
     AssertTrue(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                     (100)));
     cache.EndReadingObjectInfo(nnoi1.GetOid());
     cache.EndReadingObjectInfo(nnoi2.GetOid());
     cache.EndReadingObjectInfo(nnoi3.GetOid());
     AssertFalse(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                      (1)));
     AssertFalse(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                      (10)));
     AssertFalse(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
                                                      (100)));
 }
Beispiel #24
0
        /// <summary>Using Object representation instead of real object</summary>
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="System.Exception"></exception>
        public virtual void Test3()
        {
            int sublistSize = 10000;

            DeleteBase("valuesSubList3");
            NeoDatis.Odb.ODB odb = Open("valuesSubList3");
            NeoDatis.Odb.Test.Query.Values.Handler handler = new NeoDatis.Odb.Test.Query.Values.Handler
                                                                 ();
            for (int i = 0; i < sublistSize; i++)
            {
                handler.AddParameter(new NeoDatis.Odb.Test.Query.Values.Parameter("test " + i, "value "
                                                                                  + i));
            }
            odb.Store(handler);
            odb.Close();
            odb = Open("valuesSubList3");
            long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                         (typeof(NeoDatis.Odb.Test.Query.Values.Handler)).Sublist("parameters", "sub", 9990
                                                                                                                  , 5, true);
            q.SetReturnInstance(false);
            NeoDatis.Odb.Values values = odb.GetValues(q);
            long end = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            Println("time to load sublist of 5 itens from 40000 : " + (end - start));
            Println(values);
            NeoDatis.Odb.ObjectValues ov      = values.NextValues();
            System.Collections.IList  sublist = (System.Collections.IList)ov.GetByAlias("sub");
            AssertEquals(5, sublist.Count);
            NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                             )sublist[0];
            AssertEquals("value 9990", nnoi.GetValueOf("value"));
            NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi2 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                              )sublist[4];
            AssertEquals("value 9994", nnoi2.GetValueOf("value"));
            odb.Close();
        }
Beispiel #25
0
 public DefaultObjectRepresentation(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                    nnoi)
 {
     this.nnoi = nnoi;
 }
		public GetObjectFromIdMessageResponse(string baseId, string connectionId, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
			 metaRepresentation) : base(NeoDatis.Odb.Core.Server.Layers.Layer3.Engine.Command
			.GetObjectFromId, baseId, connectionId)
		{
			this.nnoi = metaRepresentation;
		}
 public override void StartInsertingObjectWithOid(object @object, NeoDatis.Odb.OID
                                                  oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi)
 {
     base.StartInsertingObjectWithOid(@object, oid, nnoi);
     AddOid(oid, nnoi);
 }
 public virtual void AddOid(NeoDatis.Odb.OID oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                            nnoi)
 {
     oidsOfNNoi.Add(oid, nnoi);
 }
 public ObjectReference(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi
                        ) : base(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NonNativeId)
 {
     this.id   = null;
     this.nnoi = nnoi;
 }
		public DefaultObjectRepresentation(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
			 nnoi)
		{
			this.nnoi = nnoi;
		}
		public ObjectReference(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi
			) : base(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NonNativeId)
		{
			this.id = null;
			this.nnoi = nnoi;
		}
		/// <summary>Create a copy oh this meta object</summary>
		/// <param name="onlyData">if true, only copy attributes values</param>
		/// <returns></returns>
		public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo CreateCopy
			(System.Collections.Generic.IDictionary<NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
			> cache, bool onlyData)
		{
			NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
				)cache[objectHeader.GetOid()];
			if (nnoi != null)
			{
				return nnoi;
			}
			if (onlyData)
			{
				NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader
					();
				nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo(@object, classInfo
					, null, oih.GetAttributesIdentification(), oih.GetAttributeIds());
			}
			else
			{
				nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo(@object, classInfo
					, null, objectHeader.GetAttributesIdentification(), objectHeader.GetAttributeIds
					());
				nnoi.GetHeader().SetOid(GetHeader().GetOid());
			}
			NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo[] newAttributeValues = new 
				NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo[attributeValues.Length];
			for (int i = 0; i < attributeValues.Length; i++)
			{
				newAttributeValues[i] = attributeValues[i].CreateCopy(cache, onlyData);
			}
			nnoi.attributeValues = newAttributeValues;
			cache.Add(objectHeader.GetOid(), nnoi);
			return nnoi;
		}
		public SetAttributeToNullAction(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
			 nnoi, int attributeId) : base()
		{
			this.nnoi = nnoi;
			this.attributeId = attributeId;
		}
		public virtual void SetNnoi(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
			 nnoi)
		{
			this.nnoi = nnoi;
		}
Beispiel #35
0
        public virtual int CompareField(int fieldIndex, object o1, object o2)
        {
            //Field field2 = getField(o2);
            object oo1 = null;
            object oo2 = null;

            System.Type type = null;
            try
            {
                if (o1 is NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo && o2 is NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)
                {
                    NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi1 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                      )o1;
                    NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi2 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                      )o2;
                    oo1  = nnoi1.GetValueOf(fieldNames[fieldIndex]);
                    oo2  = nnoi2.GetValueOf(fieldNames[fieldIndex]);
                    type = oo1.GetType();
                }
                else
                {
                    System.Reflection.FieldInfo field1 = GetField(fieldIndex, o1);
                    oo1  = field1.GetValue(o1);
                    oo2  = field1.GetValue(o2);
                    type = field1.GetType();
                }
                // if(isNumeric(field1) && isNumeric(field2)){
                if (type == typeof(int))
                {
                    return(way * CompareTo((int)oo1, (int)oo2));
                }
                if (type == typeof(long))
                {
                    return(way * CompareTo((long)oo1, (long)oo2));
                }
                if (type == typeof(short))
                {
                    return(way * CompareTo((short)oo1, (short)oo2));
                }
                if (type == typeof(double))
                {
                    return(way * CompareTo((double)oo1, (double)oo2));
                }
                if (type == typeof(float))
                {
                    return(way * CompareTo((float)oo1, (float)oo2));
                }
                if (type == typeof(byte))
                {
                    return(way * CompareTo((byte)oo1, (byte)oo2));
                }
                if (type == typeof(int))
                {
                    return(way * CompareTo((int)oo1, (int)oo2));
                }
                if (type == typeof(long))
                {
                    return(way * CompareToLong((long)oo1, (long)oo2));
                }
                if (type == typeof(System.DateTime))
                {
                    return(way * CompareTo((System.DateTime)oo1, (System.DateTime)oo2));
                }
                return(way * CompareTo(oo1, oo2));
            }
            catch (System.Exception e)
            {
                throw new System.Exception(e.Message);
            }
        }
Beispiel #36
0
 public SetAttributeToNullAction(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                 nnoi, int attributeId) : base()
 {
     this.nnoi        = nnoi;
     this.attributeId = attributeId;
 }
Beispiel #37
0
		/// <exception cref="System.IO.IOException"></exception>
		public virtual void Test3()
		{
			NeoDatis.Odb.Core.Transaction.ICache cache = NeoDatis.Odb.Impl.Core.Transaction.CacheFactory
				.GetLocalCache(null, "temp");
			NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
				(this.GetType().FullName);
			ci.SetPosition(1);
			NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih1 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader
				();
			NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih2 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader
				();
			NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih3 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader
				();
			oih1.SetOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID(1));
			oih2.SetOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID(10));
			oih3.SetOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID(100));
			NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi1 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
				(oih1, ci);
			NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi2 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
				(oih2, ci);
			NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi3 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
				(oih3, ci);
			cache.StartReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
				(1), nnoi1);
			cache.StartReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
				(10), nnoi2);
			cache.StartReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
				(100), nnoi3);
			AssertTrue(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
				(1)));
			AssertTrue(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
				(10)));
			AssertTrue(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
				(100)));
			cache.EndReadingObjectInfo(nnoi1.GetOid());
			cache.EndReadingObjectInfo(nnoi2.GetOid());
			cache.EndReadingObjectInfo(nnoi3.GetOid());
			AssertFalse(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
				(1)));
			AssertFalse(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
				(10)));
			AssertFalse(cache.IsReadingObjectInfoWithOid(NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID
				(100)));
		}
Beispiel #38
0
 // TODO Auto-generated constructor stub
 protected override bool IsNull(object @object)
 {
     NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                      )@object;
     return(nnoi == null || nnoi.IsNull());
 }
Beispiel #39
0
 public virtual void SetNnoi(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                             nnoi)
 {
     this.nnoi = nnoi;
 }
Beispiel #40
0
 public virtual void MetaObjectHasBeenInserted(long oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                               nnoi)
 {
     NeoDatis.Tool.DLogger.Info("Object " + nnoi + " has been inserted with id " + oid
                                );
 }