public virtual void Test1() { if (!isLocal) { return; } DeleteBase(FileName); NeoDatis.Odb.Core.Layers.Layer3.IBaseIdentification parameter = new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter (NeoDatis.Odb.Test.ODBTest.Directory + FileName, true, null, null); NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetClientStorageEngine(parameter); NeoDatis.Odb.Test.VO.Login.Function function1 = new NeoDatis.Odb.Test.VO.Login.Function ("login"); engine.Store(function1); NeoDatis.Odb.Test.VO.Login.Function function2 = new NeoDatis.Odb.Test.VO.Login.Function ("login2"); engine.Store(function2); engine.Commit(); engine.Close(); engine = NeoDatis.Odb.OdbConfiguration.GetCoreProvider().GetClientStorageEngine(parameter ); System.Collections.Generic.IList <long> l = engine.GetAllObjectIds(); AssertEquals(2, l.Count); engine.Close(); DeleteBase(FileName); }
public virtual void Close() { if (NeoDatis.Odb.OdbConfiguration.IsInfoEnabled(LogId)) { NeoDatis.Tool.DLogger.Info("ODBServer:Shutting down ODB Server"); } try { isRunning = false; socketServer.Close(); System.Collections.IEnumerator iterator = bases.Keys.GetEnumerator(); string baseIdentifier = null; NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = null; while (iterator.MoveNext()) { baseIdentifier = (string)iterator.Current; engine = (NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine)bases[baseIdentifier]; if (NeoDatis.Odb.OdbConfiguration.IsInfoEnabled(LogId)) { NeoDatis.Tool.DLogger.Info("ODBServer:Closing Base " + baseIdentifier); } engine.Close(); } if (thread != null) { thread.Interrupt(); } } catch (System.Exception e) { throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.Error.ServerError.AddParameter ("While closing server"), e); } }
public virtual void TestSize() { DeleteBase("writing.neodatis"); DeleteBase("writing"); DeleteBase("reserving.neodatis"); DeleteBase("reserving"); NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine1 = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetClientStorageEngine(new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter (NeoDatis.Odb.Test.ODBTest.Directory + "writing.neodatis", true, null, null)); NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine2 = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetClientStorageEngine(new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter (NeoDatis.Odb.Test.ODBTest.Directory + "reserving.neodatis", true, null, null)); NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface writingFsi = engine1. GetObjectWriter().GetFsi(); NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface reservingFsi = engine2 .GetObjectWriter().GetFsi(); AssertEquals(writingFsi.GetLength(), reservingFsi.GetLength()); Write(writingFsi, false); Write(reservingFsi, true); AssertEquals(writingFsi.GetLength(), reservingFsi.GetLength()); engine1.Commit(); engine1.Close(); engine2.Commit(); engine2.Close(); DeleteBase("writing.neodatis"); DeleteBase("reserving.neodatis"); }
// TODO Auto-generated constructor stub /// <exception cref="System.Exception"></exception> public static void Main(string[] args) { //LogUtil.allOn(true); NeoDatis.Odb.Configuration.SetCheckModelCompatibility(false); string fileName = "array1.odb"; string user = "******"; string password = "******"; NeoDatis.Odb.Core.Layers.Layer3.IBaseIdentification parameter = new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter (fileName, false); //IStorageEngine engine = StorageEngineFactory.get(parameter,user,password); NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = NeoDatis.Odb.Configuration .GetCoreProvider().GetClientStorageEngine(parameter, null, null); System.Collections.IList l = engine.GetAllObjectIdInfos(null, true); //"br.com.ccr.sct.dav.vo.RelFunctionProfile",true); NeoDatis.Tool.DisplayUtility.Display("All ids", l); engine.Close(); }
/// <exception cref="System.Exception"></exception> public virtual void Close() { Persist(); engine.Commit(); engine.Close(); }
public virtual void CommitAndClose() { storageEngine.Commit(); storageEngine.Close(); }
public virtual void DefragmentTo(string newFileName) { long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); long totalNbObjects = 0; NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine newStorage = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetClientStorageEngine(new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter (newFileName, true, baseIdentification.GetUserName(), baseIdentification.GetPassword ())); NeoDatis.Odb.Objects <object> defragObjects = null; int j = 0; NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = null; // User classes System.Collections.IEnumerator iterator = GetMetaModel().GetUserClasses().GetEnumerator (); while (iterator.MoveNext()) { ci = (NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator.Current; if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { NeoDatis.Tool.DLogger.Debug("Reading " + ci.GetCommitedZoneInfo().GetNbObjects() + " objects of type " + ci.GetFullClassName()); } defragObjects = GetObjects <object>(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (ci.GetFullClassName()), true, -1, -1); while (defragObjects.HasNext()) { newStorage.Store(defragObjects.Next()); totalNbObjects++; if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { if (j % 10000 == 0) { NeoDatis.Tool.DLogger.Info("\n" + totalNbObjects + " objects saved."); } } j++; } } // System classes iterator = GetMetaModel().GetSystemClasses().GetEnumerator(); while (iterator.MoveNext()) { ci = (NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator.Current; if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { NeoDatis.Tool.DLogger.Debug("Reading " + ci.GetCommitedZoneInfo().GetNbObjects() + " objects of type " + ci.GetFullClassName()); } defragObjects = GetObjects <object>(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (ci.GetFullClassName()), true, -1, -1); while (defragObjects.HasNext()) { newStorage.Store(defragObjects.Next()); totalNbObjects++; if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { if (j % 10000 == 0) { NeoDatis.Tool.DLogger.Info("\n" + totalNbObjects + " objects saved."); } } j++; } } newStorage.Commit(); newStorage.Close(); long time = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs() - start; if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { NeoDatis.Tool.DLogger.Info("New storage " + newFileName + " created with " + totalNbObjects + " objects in " + time + " ms."); } }