Пример #1
0
		protected override IObjectContainer CreateDatabase(IConfiguration config)
		{
			Sharpen.IO.File origFile = new Sharpen.IO.File(GetAbsolutePath());
			if (origFile.Exists())
			{
				try
				{
					string backupFile = GetAbsolutePath() + ".defrag.backup";
					IIdMapping mapping = new InMemoryIdMapping();
					// new
					// BTreeIDMapping(getAbsolutePath()+".defrag.mapping",4096,1,1000);
					DefragmentConfig defragConfig = new DefragmentConfig(GetAbsolutePath(), backupFile
						, mapping);
					defragConfig.ForceBackupDelete(true);
					// FIXME Cloning is ugly - wrap original in Decorator within
					// DefragContext instead?
					IConfiguration clonedConfig = (IConfiguration)((IDeepClone)config).DeepClone(null
						);
					defragConfig.Db4oConfig(clonedConfig);
					Db4objects.Db4o.Defragment.Defragment.Defrag(defragConfig, new _IDefragmentListener_30
						());
				}
				catch (IOException e)
				{
					Sharpen.Runtime.PrintStackTrace(e);
				}
			}
			return base.CreateDatabase(config);
		}
Пример #2
0
 private void Defrag(IConfiguration config)
 {
     var origFile = new File(GetAbsolutePath());
     if (origFile.Exists())
     {
         try
         {
             var backupFile = GetAbsolutePath() + ".defrag.backup";
             IIdMapping mapping = new InMemoryIdMapping();
             // new
             // BTreeIDMapping(getAbsolutePath()+".defrag.mapping",4096,1,1000);
             var defragConfig = new DefragmentConfig(GetAbsolutePath(), backupFile
                 , mapping);
             defragConfig.ForceBackupDelete(true);
             // FIXME Cloning is ugly - wrap original in Decorator within
             // DefragContext instead?
             var clonedConfig = (IConfiguration) ((IDeepClone) config).DeepClone(null
                 );
             defragConfig.Db4oConfig(clonedConfig);
             Db4objects.Db4o.Defragment.Defragment.Defrag(defragConfig, new _IDefragmentListener_64
                 ());
         }
         catch (IOException e)
         {
             Runtime.PrintStackTrace(e);
         }
     }
 }
        public void SetMappingImplementation()
        {
            // #example: Choose a id mapping system
            IIdMapping mapping = new InMemoryIdMapping();
            DefragmentConfig config = new DefragmentConfig("database.db4o", "database.db4o.back", mapping);

            Defragment.Defrag(config);
            // #end example
        }
 public _IVisitable_62(InMemoryIdMapping _enclosing)
 {
     this._enclosing = _enclosing;
 }
			public _IVisitable_62(InMemoryIdMapping _enclosing)
			{
				this._enclosing = _enclosing;
			}