//ISession session = sessions.remove(id); //session.close(); //session = null; public virtual System.Collections.Generic.IList <string> GetSessionDescriptions(System.Collections.IDictionary connectionManagers) { System.Collections.Generic.IList <string> l = new System.Collections.Generic.List < string>(); System.Collections.Generic.IEnumerator <string> iterator = sessions.Keys.GetEnumerator (); string sid = null; NeoDatis.Odb.Core.Transaction.ISession session = null; NeoDatis.Odb.Core.Server.Connection.ConnectionManager cm = null; System.Text.StringBuilder buffer = null; while (iterator.MoveNext()) { sid = iterator.Current; session = sessions[sid]; cm = (NeoDatis.Odb.Core.Server.Connection.ConnectionManager)connectionManagers[session .GetBaseIdentification()]; buffer = new System.Text.StringBuilder("Session " + sid + " : " + session.ToString ()); if (cm != null) { buffer.Append(" - Number of connections=" + cm.GetNbConnections()); buffer.Append(cm.GetConnectionDescriptions()); } l.Add(buffer.ToString()); } return(l); }
protected virtual void Init(NeoDatis.Odb.Core.Transaction.ISession session, string name) { this.name = name; this.session = session; readingObjectInfo = new OdbHashMap<NeoDatis.Odb.OID, object[]>(); }
public DefaultTransaction(NeoDatis.Odb.Core.Transaction.ISession session, NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface fsiToApplyTransaction) { this.fsiToApplyWriteActions = fsiToApplyTransaction; Init(session); readOnlyMode = false; }
/// <exception cref="System.IO.IOException"></exception> public DefaultTransaction(NeoDatis.Odb.Core.Transaction.ISession session, string overrideTransactionName) { this.overrideTransactionName = overrideTransactionName; Init(session); this.readOnlyMode = true; }
protected virtual void Init(NeoDatis.Odb.Core.Transaction.ISession session, string name) { this.name = name; this.session = session; readingObjectInfo = new OdbHashMap <NeoDatis.Odb.OID, object[]>(); }
public virtual void Clear() { objectReader = null; objectWriter = null; session = null; lastIdPositions = null; lastIds = null; }
public static NeoDatis.Odb.Core.Transaction.ITmpCache GetLocalTmpCache(NeoDatis.Odb.Core.Transaction.ISession session, string name) { if (NeoDatis.Odb.OdbConfiguration.UseLazyCache()) { return(new NeoDatis.Odb.Impl.Core.Transaction.TmpCache(session, name)); } return(new NeoDatis.Odb.Impl.Core.Transaction.TmpCache(session, name)); }
public GenericQueryExecutor(NeoDatis.Odb.Core.Query.IQuery query, NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine) { this.query = query; this.storageEngine = engine; this.objectReader = storageEngine.GetObjectReader(); this.session = storageEngine.GetSession(true); this.callback = NeoDatis.Odb.OdbConfiguration.GetQueryExecutorCallback(); this.executeStartAndEndOfQueryAction = true; }
public virtual int CompareTo(object o) { if (o == null || !(o is NeoDatis.Odb.Impl.Core.Transaction.Session)) { return(-100); } NeoDatis.Odb.Core.Transaction.ISession session = (NeoDatis.Odb.Core.Transaction.ISession )o; return(GetId().CompareTo(session.GetId())); }
public override bool Equals(object obj) { if (obj == null || !(obj is NeoDatis.Odb.Impl.Core.Transaction.Session)) { return(false); } NeoDatis.Odb.Core.Transaction.ISession session = (NeoDatis.Odb.Core.Transaction.ISession )obj; return(GetId().Equals(session.GetId())); }
public static NeoDatis.Odb.Core.Transaction.ICache GetServerCache(NeoDatis.Odb.Core.Transaction.ISession session) { if (NeoDatis.Odb.OdbConfiguration.UseLazyCache()) { return(null); } //new LazyServerCache(session); return(new NeoDatis.Odb.Impl.Core.Transaction.ServerCache(session)); }
/// <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); }
public virtual void AddSession(NeoDatis.Odb.Core.Transaction.ISession session) { string id = NeoDatis.Tool.Wrappers.OdbThread.GetCurrentThreadName() + session.GetBaseIdentification (); sessions.Add(id, session); if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { NeoDatis.Tool.DLogger.Debug("Associating id = " + id + " to session " + session.GetId ()); } }
protected virtual void Init(NeoDatis.Odb.Core.Transaction.ISession session, string name) { this.name = name; this.session = session; objects = new OdbHashMap <object, NeoDatis.Odb.OID>(); oids = new OdbHashMap <NeoDatis.Odb.OID, object>(); unconnectedZoneOids = new OdbHashMap <NeoDatis.Odb.OID, NeoDatis.Odb.OID>(); objectInfoPointersCacheFromOid = new OdbHashMap <NeoDatis.Odb.OID, ObjectInfoHeader>(); insertingObjects = new OdbHashMap <object, ObjectInsertingInfo>(); readingObjectInfo = new OdbHashMap <NeoDatis.Odb.OID, object[]>(); objectPositionsByIds = new OdbHashMap <NeoDatis.Odb.OID, IdInfo>(); }
public override NeoDatis.Odb.Core.Transaction.ISession BuildDefaultSession() { NeoDatis.Odb.Core.ICoreProvider provider = NeoDatis.Odb.OdbConfiguration.GetCoreProvider (); if (sessionManager == null) { sessionManager = provider.GetClientServerSessionManager(); } NeoDatis.Odb.Core.Transaction.ISession session = provider.GetServerSession(this, "default"); //FIXME Remove commented line //session.setBaseIdentification(((ServerFileParameter) this.getBaseIdentification()).getBaseName()); return(session); }
public virtual void Init(NeoDatis.Odb.Core.Transaction.ISession session) { this.provider = NeoDatis.Odb.OdbConfiguration.GetCoreProvider(); this.session = session; this.isCommited = false; creationDateTime = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); writeActions = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Transaction.IWriteAction >(1000); hasAllWriteActionsInMemory = true; numberOfWriteActions = 0; hasBeenPersisted = false; wasRollbacked = false; currentWritePositionInWA = -1; }
/// <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); }
//DLogger.info(StringUtils.exceptionToString(new Exception())); public override string ToString() { System.Text.StringBuilder buffer = new System.Text.StringBuilder(); System.Collections.Generic.IEnumerator <string> iterator = sessions.Keys.GetEnumerator (); string sid = null; NeoDatis.Odb.Core.Transaction.ISession session = null; while (iterator.MoveNext()) { sid = iterator.Current; session = sessions[sid]; buffer.Append(sid).Append(":").Append(session.ToString()).Append("\n"); } return(buffer.ToString()); }
// TODO Nothing to do public virtual NeoDatis.Odb.Core.Transaction.ISession GetSession(string baseIdentification , bool throwExceptionIfDoesNotExist) { string threadName = NeoDatis.Tool.Wrappers.OdbThread.GetCurrentThreadName(); System.Text.StringBuilder id = new System.Text.StringBuilder(threadName).Append(baseIdentification ); NeoDatis.Odb.Core.Transaction.ISession session = sessions[id.ToString()]; if (session == null && throwExceptionIfDoesNotExist) { throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.SessionDoesNotExistForConnection .AddParameter(threadName).AddParameter(baseIdentification).AddParameter(id)); } if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { NeoDatis.Tool.DLogger.Debug("Getting session for base " + baseIdentification + " and thread " + threadName + " = " + id + " - sid=" + session.GetId()); } return(session); }
/// <param name="objectWriter">The object writer</param> /// <param name="objectReader">The object reader</param> /// <param name="currentBlockIdPosition">The position of the current block</param> /// <param name="currentBlockIdNumber">The number of the current block</param> /// <param name="currentMaxId">Maximum Database id</param> public DefaultIdManager(NeoDatis.Odb.Core.Layers.Layer3.IObjectWriter objectWriter , NeoDatis.Odb.Core.Layers.Layer3.IObjectReader objectReader, long currentBlockIdPosition , int currentBlockIdNumber, NeoDatis.Odb.OID currentMaxId) { this.provider = NeoDatis.Odb.OdbConfiguration.GetCoreProvider(); this.objectWriter = objectWriter; this.objectReader = objectReader; this.session = objectWriter.GetSession(); this.currentBlockIdPosition = currentBlockIdPosition; this.currentBlockIdNumber = currentBlockIdNumber; this.maxId = provider.GetObjectOID((long)currentBlockIdNumber * NeoDatis.Odb.OdbConfiguration .GetNB_IDS_PER_BLOCK(), 0); this.nextId = provider.GetObjectOID(currentMaxId.GetObjectId() + 1, 0); lastIds = new NeoDatis.Odb.OID[IdBufferSize]; for (int i = 0; i < IdBufferSize; i++) { lastIds[i] = NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant.NullObjectId; } lastIdPositions = new long[IdBufferSize]; lastIdIndex = 0; }
/// <summary> /// Used to check if object must be reconnected to current session /// <pre> /// An object must be reconnected to session if OdbConfiguration.reconnectObjectsToSession() is true /// and object is not in local cache and is in cross session cache. /// </summary> /// <remarks> /// Used to check if object must be reconnected to current session /// <pre> /// An object must be reconnected to session if OdbConfiguration.reconnectObjectsToSession() is true /// and object is not in local cache and is in cross session cache. In this case /// we had it to local cache /// </pre> /// </remarks> /// <param name="@object"></param> private void CheckIfObjectMustBeReconnected(object @object) { if (engine == null) { // This protection is for JUnit return; } NeoDatis.Odb.Core.Transaction.ISession session = engine.GetSession(true); // If object is in local cache, no need to reconnect it if (session.GetCache().ExistObject(@object)) { return; } NeoDatis.Odb.OID oidCrossSession = crossSessionCache.GetOid(@object); if (oidCrossSession != null) { // reconnect object NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = engine.GetObjectInfoHeaderFromOid (oidCrossSession); session.AddObjectToCache(oidCrossSession, @object, oih); } }
public ServerCache(NeoDatis.Odb.Core.Transaction.ISession session) : base(session , "server") { oidsOfNNoi = new NeoDatis.Tool.Wrappers.Map.OdbHashMap <NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo >(); }
public LocalObjectWriter(NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine) : base(engine) { this.session = engine.GetSession(true); }
public LocalFileSystemInterface(string name, NeoDatis.Odb.Core.Transaction.ISession session, string fileName, bool canWrite, bool canLog, int bufferSize) : base(name , fileName, canWrite, canLog, bufferSize) { this.session = session; }
public virtual void Init(NeoDatis.Odb.Core.Transaction.ISession session) { this.provider = NeoDatis.Odb.OdbConfiguration.GetCoreProvider(); this.session = session; this.isCommited = false; creationDateTime = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); writeActions = new NeoDatis.Tool.Wrappers.List.OdbArrayList<NeoDatis.Odb.Core.Transaction.IWriteAction >(1000); hasAllWriteActionsInMemory = true; numberOfWriteActions = 0; hasBeenPersisted = false; wasRollbacked = false; currentWritePositionInWA = -1; }
public abstract void AddSession(NeoDatis.Odb.Core.Transaction.ISession arg1, bool arg2);
public LocalFileSystemInterface(string name, NeoDatis.Odb.Core.Transaction.ISession session, NeoDatis.Odb.Core.Layers.Layer3.IBaseIdentification parameters, bool canLog , int bufferSize) : base(name, parameters, canLog, bufferSize) { this.session = session; }
public LocalInstanceBuilder(NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine ) : base(engine) { this.session = engine.GetSession(true); }
/// <summary>The main constructor</summary> /// <param name="session">The transaction session</param> /// <exception cref="System.IO.IOException">System.IO.IOException</exception> public DefaultTransaction(NeoDatis.Odb.Core.Transaction.ISession session) { Init(session); }
protected virtual void Init(NeoDatis.Odb.Core.Transaction.ISession session, string name) { this.name = name; this.session = session; objects = new OdbHashMap<object, NeoDatis.Odb.OID>(); oids = new OdbHashMap<NeoDatis.Odb.OID, object>(); unconnectedZoneOids = new OdbHashMap<NeoDatis.Odb.OID, NeoDatis.Odb.OID>(); objectInfoPointersCacheFromOid = new OdbHashMap<NeoDatis.Odb.OID, ObjectInfoHeader>(); insertingObjects = new OdbHashMap<object, ObjectInsertingInfo>(); readingObjectInfo = new OdbHashMap<NeoDatis.Odb.OID, object[]>(); objectPositionsByIds = new OdbHashMap<NeoDatis.Odb.OID,IdInfo>(); }
public override NeoDatis.Odb.Core.Transaction.ISession BuildDefaultSession() { session = NeoDatis.Odb.OdbConfiguration.GetCoreProvider().GetLocalSession(this); return(session); }
public override void AddSession(NeoDatis.Odb.Core.Transaction.ISession session, bool readMetamodel) { sessionManager.AddSession(session); base.AddSession(session, readMetamodel); }
public Cache(NeoDatis.Odb.Core.Transaction.ISession session, string name) { Init(session, name); }
public override NeoDatis.Odb.Core.Transaction.ISession BuildDefaultSession() { session = NeoDatis.Odb.OdbConfiguration.GetCoreProvider().GetLocalSession(this); return session; }