private void CheckFileAccess(bool canWrite, string fileName) { lock (this) { if (fsi == null) { NeoDatis.Odb.Core.Layers.Layer3.IBaseIdentification p = null; // to unable direct junit test of FileSystemInterface if (fsiToApplyWriteActions == null) { p = new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter(fileName, canWrite, null, null); } else { p = GetParameters(canWrite); } // To enable unit test if (session != null) { isLocal = session.GetStorageEngine().IsLocal(); } fsi = new NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.LocalFileSystemInterface("transaction" , session, p, false, NeoDatis.Odb.OdbConfiguration.GetDefaultBufferSizeForTransaction ()); } } }
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); }
internal virtual NeoDatis.Odb.Core.Layers.Layer3.IBaseIdentification GetParameters (bool canWrite) { NeoDatis.Odb.Core.Layers.Layer3.IBaseIdentification p = fsiToApplyWriteActions.GetParameters (); if (p is NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter) { NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter ifp = (NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter )fsiToApplyWriteActions.GetParameters(); System.Text.StringBuilder buffer = new System.Text.StringBuilder(ifp.GetDirectory ()).Append("/").Append(ifp.GetCleanFileName()).Append("-").Append(creationDateTime ).Append("-").Append(session.GetId()).Append(".transaction"); return(new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter(buffer.ToString(), canWrite , ifp.GetUserName(), ifp.GetPassword())); } if (p is NeoDatis.Odb.Core.Layers.Layer3.IOSocketParameter) { NeoDatis.Odb.Core.Layers.Layer3.IOSocketParameter sp = (NeoDatis.Odb.Core.Layers.Layer3.IOSocketParameter )fsiToApplyWriteActions.GetParameters(); return(new NeoDatis.Odb.Core.Layers.Layer3.IOSocketParameter(sp.GetDestinationHost (), sp.GetPort(), sp.GetBaseIdentifier(), NeoDatis.Odb.Core.Layers.Layer3.IOSocketParameter .TypeTransaction, creationDateTime, null, null)); } throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.UnsupportedIoType .AddParameter(p.GetType().FullName)); }
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); }
// 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(); }
public virtual string GetName() { NeoDatis.Odb.Core.Layers.Layer3.IBaseIdentification p = fsiToApplyWriteActions.GetParameters (); if (p is NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter) { NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter ifp = (NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter )fsiToApplyWriteActions.GetParameters(); System.Text.StringBuilder buffer = new System.Text.StringBuilder(ifp.GetCleanFileName ()).Append("-").Append(creationDateTime).Append("-").Append(session.GetId()).Append (".transaction"); return(buffer.ToString()); } if (p is NeoDatis.Odb.Core.Layers.Layer3.IOSocketParameter) { NeoDatis.Odb.Core.Layers.Layer3.IOSocketParameter sp = (NeoDatis.Odb.Core.Layers.Layer3.IOSocketParameter )fsiToApplyWriteActions.GetParameters(); return(sp.GetBaseIdentifier()); } throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.UnsupportedIoType .AddParameter(p.GetType().FullName)); }