Example #1
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 PendingReading(int id, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci,
                       NeoDatis.Odb.OID attributeOID) : base()
 {
     this.id           = id;
     this.ci           = ci;
     this.attributeOID = attributeOID;
 }
Example #3
0
 public ChangedObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo oldCi, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
                          newCi, int fieldIndex, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                          oldValue, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo newValue, int
                          objectRecursionLevel) : this(oldCi, newCi, fieldIndex, oldValue, newValue, null,
                                                       objectRecursionLevel)
 {
 }
Example #4
0
 public virtual void Test1()
 {
     if (!isLocal)
     {
         return;
     }
     DeleteBase("unconnected");
     NeoDatis.Odb.ODB odb = Open("unconnected");
     NeoDatis.Odb.OID oid = odb.Store(new NeoDatis.Odb.Test.VO.Login.Function("f1"));
     odb.Close();
     Println("Oid=" + oid);
     odb = Open("unconnected");
     NeoDatis.Odb.Test.VO.Login.Function f2 = (NeoDatis.Odb.Test.VO.Login.Function)odb
                                              .GetObjectFromId(oid);
     f2.SetName("New Function");
     odb.Store(f2);
     NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine storageEngine = NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.Dummy
                                                                    .GetEngine(odb);
     // retrieve the class info to check connected and unconnected zone
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = storageEngine.GetSession(true
                                                                                  ).GetMetaModel().GetClassInfo(typeof(NeoDatis.Odb.Test.VO.Login.Function).FullName
                                                                                                                , true);
     odb.Close();
     AssertEquals(1, ci.GetCommitedZoneInfo().GetNbObjects());
     AssertNotNull(ci.GetCommitedZoneInfo().first);
     AssertNotNull(ci.GetCommitedZoneInfo().last);
     AssertEquals(0, ci.GetUncommittedZoneInfo().GetNbObjects());
     AssertNull(ci.GetUncommittedZoneInfo().first);
     AssertNull(ci.GetUncommittedZoneInfo().last);
     odb = Open("unconnected");
     AssertEquals(1, odb.GetObjects <Function>().Count
                  );
     odb.Close();
 }
Example #5
0
        public virtual void TestDirectSave()
        {
            if (!isLocal)
            {
                return;
            }
            NeoDatis.Odb.OdbConfiguration.SetSaveHistory(true);
            DeleteBase("btree.neodatis");
            NeoDatis.Odb.ODB odb      = Open("btree.neodatis");
            Function         function = new Function
                                            ("f1");

            odb.Store(function);
            for (int i = 0; i < 2; i++)
            {
                function.SetName(function.GetName() + function.GetName() + function.GetName() + function
                                 .GetName());
                odb.Store(function);
            }
            NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.Dummy
                                                                    .GetEngine(odb);
            if (isLocal)
            {
            }

            NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = engine.GetSession(true).GetMetaModel
                                                                    ().GetClassInfo(typeof(Function).FullName, true);
            Println(ci);
            AssertEquals(null, ci.GetCommitedZoneInfo().first);
            AssertEquals(null, ci.GetCommitedZoneInfo().last);
            AssertEquals(1, ci.GetUncommittedZoneInfo().GetNbObjects());
            odb.Close();
        }
		public PendingReading(int id, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci, 
			NeoDatis.Odb.OID attributeOID) : base()
		{
			this.id = id;
			this.ci = ci;
			this.attributeOID = attributeOID;
		}
 public CIZoneInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci, NeoDatis.Odb.OID
                   first, NeoDatis.Odb.OID last, long nbObjects) : base()
 {
     this.first     = first;
     this.last      = last;
     this.nbObjects = nbObjects;
     this.ci        = ci;
 }
		public CIZoneInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci, NeoDatis.Odb.OID
			 first, NeoDatis.Odb.OID last, long nbObjects) : base()
		{
			this.first = first;
			this.last = last;
			this.nbObjects = nbObjects;
			this.ci = ci;
		}
		public CriteriaQueryExecutionPlan(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo 
			classInfo, NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery query)
		{
			this.classInfo = classInfo;
			this.query = query;
			this.query.SetExecutionPlan(this);
			Init();
		}
Example #10
0
 public NativeQueryExecutionPlan(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo
                                 , NeoDatis.Odb.Core.Query.IQuery query)
 {
     this.classInfo = classInfo;
     this.query     = query;
     query.SetExecutionPlan(this);
     Init();
 }
Example #11
0
 public CriteriaQueryExecutionPlan(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
                                   classInfo, NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery query)
 {
     this.classInfo = classInfo;
     this.query     = query;
     this.query.SetExecutionPlan(this);
     Init();
 }
		public NativeQueryExecutionPlan(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo
			, NeoDatis.Odb.Core.Query.IQuery query)
		{
			this.classInfo = classInfo;
			this.query = query;
			query.SetExecutionPlan(this);
			Init();
		}
		public ClassInfoList(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo mainClassInfo
			)
		{
			this.classInfos = new NeoDatis.Tool.Wrappers.Map.OdbHashMap<string, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
				>();
			this.classInfos[mainClassInfo.GetFullClassName()] = mainClassInfo;
			this.mainClassInfo = mainClassInfo;
		}
 public ClassInfoList(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo mainClassInfo
                      )
 {
     this.classInfos = new NeoDatis.Tool.Wrappers.Map.OdbHashMap <string, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
                                                                  >();
     this.classInfos[mainClassInfo.GetFullClassName()] = mainClassInfo;
     this.mainClassInfo = mainClassInfo;
 }
Example #15
0
 /// <exception cref="System.IO.IOException"></exception>
 public virtual void RenameClass(string fullClassName, string newFullClassName)
 {
     NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = storageEngine.GetSession
                                                                    (true).GetMetaModel();
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = metaModel.GetClassInfo(fullClassName
                                                                                , true);
     ci.SetFullClassName(newFullClassName);
     storageEngine.GetObjectWriter().UpdateClassInfo(ci, true);
 }
Example #16
0
 public virtual void SetClassInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo
                                  )
 {
     if (classInfo != null)
     {
         this.classInfo = classInfo;
         this.objectHeader.SetClassInfoId(classInfo.GetId());
     }
 }
Example #17
0
 public DefaultClassRepresentation(NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine
                                   storageEngine, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo) : base(
         )
 {
     this.storageEngine     = storageEngine;
     this.classInfo         = classInfo;
     this.classIntrospector = NeoDatis.Odb.OdbConfiguration.GetCoreProvider().GetClassIntrospector
                                  ();
 }
		public DefaultClassRepresentation(NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine 
			storageEngine, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo) : base(
			)
		{
			this.storageEngine = storageEngine;
			this.classInfo = classInfo;
			this.classIntrospector = NeoDatis.Odb.OdbConfiguration.GetCoreProvider().GetClassIntrospector
				();
		}
Example #19
0
 /// <summary>Take the fields of the index and take value from the query</summary>
 /// <param name="ci">The class info involved</param>
 /// <param name="index">The index</param>
 /// <param name="query"></param>
 /// <returns>The key of the index</returns>
 public static NeoDatis.Tool.Wrappers.OdbComparable ComputeKey(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
                                                               ci, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoIndex index, NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
                                                               query)
 {
     string[] attributesNames = ci.GetAttributeNames(index.GetAttributeIds());
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap values = query.GetCriteria
                                                                          ().GetValues();
     return(BuildIndexKey(index.GetName(), values, attributesNames));
 }
Example #20
0
 /// <exception cref="System.IO.IOException"></exception>
 public virtual NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo AddClass(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
                                                                        newClassInfo, bool addDependentClasses)
 {
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = GetObjectWriter().AddClass(newClassInfo
                                                                                    , addDependentClasses);
     NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession lsession = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession
                                                                         )GetSession(true);
     lsession.SetClassInfoId(newClassInfo.GetFullClassName(), ci.GetId());
     return(ci);
 }
Example #21
0
        /// <exception cref="System.Exception"></exception>
        public virtual void TestNonNativeAttributes()
        {
            TestClass tc = new TestClass
                               ();

            NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo = NeoDatis.Odb.OdbConfiguration
                                                                       .GetCoreProvider().GetClassIntrospector().Introspect(tc.GetType(), true).GetMainClassInfo
                                                                           ();
            AssertEquals(0, classInfo.GetAllNonNativeAttributes().Count);
        }
Example #22
0
 public virtual NeoDatis.Odb.Objects <T> Execute <T>(bool inMemory, int startIndex,
                                                     int endIndex, bool returnObjects, NeoDatis.Odb.Core.Query.Execution.IMatchingObjectAction
                                                     queryResultAction)
 {
     if (storageEngine.IsClosed())
     {
         throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.OdbIsClosed
                                                    .AddParameter(storageEngine.GetBaseIdentification().GetIdentification()));
     }
     if (session.IsRollbacked())
     {
         throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.OdbHasBeenRollbacked
                                                    );
     }
     // When used as MultiClass Executor, classInfo is already set
     if (classInfo == null)
     {
         // Class to execute query on
         string fullClassName = NeoDatis.Odb.Core.Query.QueryManager.GetFullClassName(query
                                                                                      );
         // If the query class does not exist in meta model, return an empty
         // collection
         if (!session.GetMetaModel().ExistClass(fullClassName))
         {
             queryResultAction.Start();
             queryResultAction.End();
             query.SetExecutionPlan(new NeoDatis.Odb.Core.Query.Execution.EmptyExecutionPlan()
                                    );
             return(queryResultAction.GetObjects <T>());
         }
         classInfo = session.GetMetaModel().GetClassInfo(fullClassName, true);
     }
     // Get the query execution plan
     NeoDatis.Odb.Core.Query.Execution.IQueryExecutionPlan plan = GetExecutionPlan();
     plan.Start();
     try
     {
         if (plan.UseIndex() && NeoDatis.Odb.OdbConfiguration.UseIndex())
         {
             return(ExecuteUsingIndex <T>(plan.GetIndex(), inMemory, startIndex, endIndex, returnObjects
                                          , queryResultAction));
         }
         // When query must be applied to a single object
         if (query.IsForSingleOid())
         {
             return(ExecuteForOneOid <T>(inMemory, returnObjects, queryResultAction));
         }
         return(ExecuteFullScan <T>(inMemory, startIndex, endIndex, returnObjects, queryResultAction
                                    ));
     }
     finally
     {
         plan.End();
     }
 }
Example #23
0
        /// <exception cref="System.Exception"></exception>
        public virtual void TestSaveIndex()
        {
            string baseName = GetBaseName();

            DeleteBase(baseName);
            NeoDatis.Odb.ODB @base = Open(baseName);
            NeoDatis.Odb.ClassRepresentation clazz = @base.GetClassRepresentation(typeof(NeoDatis.Odb.Test.Index.IndexedObject3
                                                                                         ));
            string[] indexFields1 = new string[] { "i1", "i2", "i3" };
            clazz.AddUniqueIndexOn("index1", indexFields1, true);
            string[] indexFields2 = new string[] { "s1", "s2", "s3" };
            clazz.AddUniqueIndexOn("index2", indexFields2, true);
            string[] indexFields3 = new string[] { "dt1", "dt2", "dt3" };
            clazz.AddUniqueIndexOn("index3", indexFields3, true);
            string[] indexFields4 = new string[] { "i1", "i2", "i3", "s1", "s2", "s3", "dt1",
                                                   "dt2", "dt3" };
            clazz.AddUniqueIndexOn("index4", indexFields4, true);
            @base.Close();
            @base = Open(baseName);
            NeoDatis.Odb.Core.Transaction.ISession session = NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.Dummy
                                                             .GetEngine(@base).GetSession(true);
            NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = session.GetStorageEngine
                                                                           ().GetSession(true).GetMetaModel();
            NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = metaModel.GetClassInfo(typeof(
                                                                                           NeoDatis.Odb.Test.Index.IndexedObject3).FullName, true);
            AssertEquals(4, ci.GetNumberOfIndexes());
            AssertEquals(ci.GetIndex(0).GetName(), "index1");
            AssertEquals(3, ci.GetIndex(0).GetAttributeIds().Length);
            AssertEquals(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoIndex.Enabled, ci.GetIndex
                             (0).GetStatus());
            AssertEquals(ci.GetIndex(1).GetName(), "index2");
            AssertEquals(3, ci.GetIndex(1).GetAttributeIds().Length);
            AssertEquals(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoIndex.Enabled, ci.GetIndex
                             (1).GetStatus());
            AssertEquals(ci.GetIndex(2).GetName(), "index3");
            AssertEquals(3, ci.GetIndex(2).GetAttributeIds().Length);
            AssertEquals(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoIndex.Enabled, ci.GetIndex
                             (2).GetStatus());
            AssertEquals(ci.GetIndex(3).GetName(), "index4");
            AssertEquals(9, ci.GetIndex(3).GetAttributeIds().Length);
            AssertEquals(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoIndex.Enabled, ci.GetIndex
                             (3).GetStatus());
            @base.Close();
            @base = Open(baseName);
            for (int i = 0; i < 10; i++)
            {
                NeoDatis.Odb.Test.Index.IndexedObject3 io = new NeoDatis.Odb.Test.Index.IndexedObject3
                                                                (1 + i, 2, 3, "1" + i, "2", "3", new System.DateTime(2009, i, 1), new System.DateTime
                                                                    (), new System.DateTime());
                @base.Store(io);
            }
            @base.Close();
            DeleteBase(baseName);
        }
Example #24
0
 // TODO Auto-generated method stub
 /// <exception cref="System.IO.IOException"></exception>
 public virtual void RemoveField(string className, string attributeName)
 {
     NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = storageEngine.GetSession
                                                                    (true).GetMetaModel();
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = metaModel.GetClassInfo(className
                                                                                , true);
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassAttributeInfo cai2 = ci.GetAttributeInfoFromName
                                                                        (attributeName);
     ci.RemoveAttribute(cai2);
     storageEngine.GetObjectWriter().UpdateClassInfo(ci, true);
 }
Example #25
0
 public static int[] GetOrderByAttributeIds(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
                                            classInfo, NeoDatis.Odb.Core.Query.IQuery query)
 {
     string[] fieldNames = query.GetOrderByFieldNames();
     int[]    fieldIds   = new int[fieldNames.Length];
     for (int i = 0; i < fieldNames.Length; i++)
     {
         fieldIds[i] = classInfo.GetAttributeId(fieldNames[i]);
     }
     return(fieldIds);
 }
Example #26
0
 public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo GetMetaRepresentation
     (object @object, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci, bool recursive
     , System.Collections.Generic.IDictionary <object, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                               > alreadyReadObjects, NeoDatis.Odb.Core.Layers.Layer1.Introspector.IIntrospectionCallback
     callback)
 {
     clientOids.Clear();
     aois.Clear();
     objects.Clear();
     return(base.GetObjectInfo(@object, ci, recursive, alreadyReadObjects, callback));
 }
		public ChangedObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo oldCi, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
			 newCi, int fieldIndex, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo 
			oldValue, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo newValue, string
			 message, int objectRecursionLevel) : base()
		{
			this.oldCi = oldCi;
			this.newCi = newCi;
			this.fieldIndex = fieldIndex;
			this.oldValue = oldValue;
			this.newValue = newValue;
			this.message = message;
			this.objectRecursionLevel = objectRecursionLevel;
		}
Example #28
0
 public virtual void AddField(string className, System.Type fieldType, string fieldName
                              )
 {
     NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = storageEngine.GetSession
                                                                    (true).GetMetaModel();
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = metaModel.GetClassInfo(className
                                                                                , true);
     // The real attribute id (-1) will be set in the ci.addAttribute
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassAttributeInfo cai = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassAttributeInfo
                                                                       (-1, fieldName, fieldType.FullName, ci);
     ci.AddAttribute(cai);
     storageEngine.GetObjectWriter().UpdateClassInfo(ci, true);
 }
Example #29
0
 public ChangedObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo oldCi, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
                          newCi, int fieldIndex, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                          oldValue, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo newValue, string
                          message, int objectRecursionLevel) : base()
 {
     this.oldCi                = oldCi;
     this.newCi                = newCi;
     this.fieldIndex           = fieldIndex;
     this.oldValue             = oldValue;
     this.newValue             = newValue;
     this.message              = message;
     this.objectRecursionLevel = objectRecursionLevel;
 }
Example #30
0
 public virtual void AddClass(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo
                              )
 {
     if (classInfo.IsSystemClass())
     {
         rapidAccessForSystemClassesByName.Add(classInfo.GetFullClassName(), classInfo);
     }
     else
     {
         rapidAccessForUserClassesByName.Add(classInfo.GetFullClassName(), classInfo);
     }
     rapidAccessForClassesByOid.Add(classInfo.GetId(), classInfo);
     allClassInfos.Add(classInfo);
 }
Example #31
0
 public NonNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader
                            oip, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo) : base(null)
 {
     // private List attributeValues;
     this.classInfo    = classInfo;
     this.objectHeader = oip;
     if (classInfo != null)
     {
         this.maxNbattributes = classInfo.GetMaxAttributeId();
         this.attributeValues = new NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                [maxNbattributes];
     }
     this.allNonNativeObjects = null;
 }
		public NonNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader 
			oip, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo) : base(null)
		{
			// private List attributeValues;
			this.classInfo = classInfo;
			this.objectHeader = oip;
			if (classInfo != null)
			{
				this.maxNbattributes = classInfo.GetMaxAttributeId();
				this.attributeValues = new NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
					[maxNbattributes];
			}
			this.allNonNativeObjects = null;
		}
Example #33
0
 public NonNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo
                            ) : base(null)
 {
     //new OdbArrayList<NonNativeObjectInfo>();
     this.classInfo    = classInfo;
     this.objectHeader = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader(-1,
                                                                                   null, null, (classInfo != null ? classInfo.GetId() : null), null, null);
     if (classInfo != null)
     {
         this.maxNbattributes = classInfo.GetMaxAttributeId();
         this.attributeValues = new NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                [maxNbattributes];
     }
     this.allNonNativeObjects = null;
 }
Example #34
0
 public virtual System.Collections.Generic.IDictionary <string, object> GetHistory(
     )
 {
     System.Collections.Generic.IDictionary <string, object> map = new NeoDatis.Tool.Wrappers.Map.OdbHashMap
                                                                   <string, object>();
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = null;
     System.Collections.Generic.IEnumerator <NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
                                             > iterator = allClassInfos.GetEnumerator();
     while (iterator.MoveNext())
     {
         ci = iterator.Current;
         map.Add(ci.GetFullClassName(), ci.GetHistory());
     }
     return(map);
 }
 public virtual NeoDatis.Odb.ClassRepresentation GetClassRepresentation(string fullClassName
                                                                        )
 {
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo = storageEngine.GetSession
                                                                    (true).GetMetaModel().GetClassInfo(fullClassName, false);
     if (classInfo == null)
     {
         NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoList ciList = classIntrospector.Introspect
                                                                         (fullClassName, true);
         storageEngine.AddClasses(ciList);
         classInfo = ciList.GetMainClassInfo();
     }
     return(new NeoDatis.Odb.Impl.Main.DefaultClassRepresentation(storageEngine, classInfo
                                                                  ));
 }
		public NonNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo
			) : base(null)
		{
			//new OdbArrayList<NonNativeObjectInfo>();
			this.classInfo = classInfo;
			this.objectHeader = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader(-1, 
				null, null, (classInfo != null ? classInfo.GetId() : null), null, null);
			if (classInfo != null)
			{
				this.maxNbattributes = classInfo.GetMaxAttributeId();
				this.attributeValues = new NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
					[maxNbattributes];
			}
			this.allNonNativeObjects = null;
		}
Example #37
0
        /// <summary>
        /// Create objects, then create index, then execute a select with index, then
        /// rebuild index e execute
        /// </summary>
        /// <exception cref="System.Exception">System.Exception</exception>
        public virtual void TestDeleteIndex()
        {
            string baseName = GetBaseName();

            DeleteBase(baseName);
            NeoDatis.Odb.ODB @base = Open(baseName);
            for (int i = 0; i < 2500; i++)
            {
                NeoDatis.Odb.Test.Index.IndexedObject3 io = new NeoDatis.Odb.Test.Index.IndexedObject3
                                                                (1 + i, 2, 3, "1" + i, "2", "3", new System.DateTime(2009, i, 1), new System.DateTime
                                                                    (), new System.DateTime());
                @base.Store(io);
            }
            @base.Close();
            @base = Open(baseName);
            NeoDatis.Odb.ClassRepresentation clazz = @base.GetClassRepresentation(typeof(NeoDatis.Odb.Test.Index.IndexedObject3
                                                                                         ));
            string[] indexFields1 = new string[] { "i1", "i2", "i3" };
            clazz.AddUniqueIndexOn("index1", indexFields1, true);
            @base.Close();
            @base = Open(baseName);
            NeoDatis.Odb.Core.Transaction.ISession session = NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.Dummy
                                                             .GetEngine(@base).GetSession(true);
            NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = session.GetStorageEngine
                                                                           ().GetSession(true).GetMetaModel();
            NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = metaModel.GetClassInfo(typeof(
                                                                                           NeoDatis.Odb.Test.Index.IndexedObject3).FullName, true);
            AssertEquals(1, ci.GetNumberOfIndexes());
            AssertEquals(ci.GetIndex(0).GetName(), "index1");
            AssertEquals(3, ci.GetIndex(0).GetAttributeIds().Length);
            AssertEquals(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoIndex.Enabled, ci.GetIndex
                             (0).GetStatus());
            NeoDatis.Odb.Core.Query.IQuery q = new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
                                                   (typeof(NeoDatis.Odb.Test.Index.IndexedObject3), NeoDatis.Odb.Core.Query.Criteria.Where
                                                   .And().Add(NeoDatis.Odb.Core.Query.Criteria.Where.Equal("i1", 10)).Add(NeoDatis.Odb.Core.Query.Criteria.Where
                                                                                                                          .Equal("i2", 2)).Add(NeoDatis.Odb.Core.Query.Criteria.Where.Equal("i3", 3)));
            NeoDatis.Odb.Objects <NeoDatis.Odb.Test.Index.IndexedObject3> objects = @base.GetObjects
                                                                                        (q);
            AssertEquals(true, q.GetExecutionPlan().UseIndex());
            @base.GetClassRepresentation(typeof(NeoDatis.Odb.Test.Index.IndexedObject3)).DeleteIndex
                ("index1", true);
            @base.Close();
            @base   = Open(baseName);
            objects = @base.GetObjects(q);
            AssertEquals(false, q.GetExecutionPlan().UseIndex());
            @base.Close();
            DeleteBase(baseName);
        }
Example #38
0
 /// <param name="odbTypeId">The native object type</param>
 /// <param name="value">The real value</param>
 /// <param name="caller">
 /// The caller type , can be one of the constants
 /// ObjectTool.CALLER_IS_
 /// </param>
 /// <param name="ci">
 /// The ClassInfo. It is only used for enum where we need the enum
 /// class info. In other cases, it is null
 /// </param>
 /// <returns>The NativeObjectInfo that represents the specific value</returns>
 /// <exception cref="Java.Lang.NumberFormatException">Java.Lang.NumberFormatException
 ///     </exception>
 /// <exception cref="Java.Text.ParseException">Java.Text.ParseException</exception>
 public static NeoDatis.Odb.Core.Layers.Layer2.Meta.NativeObjectInfo StringToObjectInfo
     (int odbTypeId, string value, int caller, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
     ci)
 {
     if (NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.IsAtomicNative(odbTypeId))
     {
         object theObject = StringToObject(odbTypeId, value, caller);
         return(new NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo(theObject,
                                                                                odbTypeId));
     }
     if (NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.IsEnum(odbTypeId))
     {
         return(new NeoDatis.Odb.Core.Layers.Layer2.Meta.EnumNativeObjectInfo(ci, value));
     }
     return(NeoDatis.Odb.Core.Layers.Layer2.Meta.NullNativeObjectInfo.GetInstance());
 }
Example #39
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)));
 }
		public NonNativeObjectInfo(object @object, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
			 info, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo[] values, long[] 
			attributesIdentification, int[] attributeIds) : base(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
			.GetFromName(info.GetFullClassName()))
		{
			//new OdbArrayList<NonNativeObjectInfo>();
			this.@object = @object;
			this.classInfo = info;
			this.attributeValues = values;
			this.maxNbattributes = classInfo.GetMaxAttributeId();
			if (attributeValues == null)
			{
				this.attributeValues = new NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
					[maxNbattributes];
			}
			this.objectHeader = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader(-1, 
				null, null, (classInfo != null ? classInfo.GetId() : null), attributesIdentification
				, attributeIds);
			this.allNonNativeObjects = new NeoDatis.Tool.Wrappers.List.OdbArrayList<NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
				>();
		}
		public virtual void SetEnumClassInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
			 enumClassInfo)
		{
			this.enumClassInfo = enumClassInfo;
		}
		public EnumNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo
			, string enumName) : base(enumName, NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
			.EnumId)
		{
			this.enumClassInfo = classInfo;
		}
		public virtual void SetClassInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo
			)
		{
			if (classInfo != null)
			{
				this.classInfo = classInfo;
				this.objectHeader.SetClassInfoId(classInfo.GetId());
			}
		}
		public virtual void SetMainClassInfo(ClassInfo classInfo)
		{
			this.mainClassInfo = classInfo;
		}
Example #45
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)));
		}