示例#1
0
 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
                                                                                                ());
         }
     }
 }
示例#2
0
文件: AllIDs.cs 项目: ekicyou/pasta
        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);
		}
示例#3
0
 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));
 }
示例#4
0
文件: AllIDs.cs 项目: ekicyou/pasta
 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);
 }
示例#5
0
		// 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();
		}
示例#6
0
        // 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();
        }
示例#7
0
 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));
 }
		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
						());
				}
			}
		}