Ejemplo n.º 1
0
 public Implementation(IHangfireContext hangfireContext, ConfigImpl configImpl, PersistenceSettings persistenceSettings, IBuilderSerializer deserializer, IEventWaitHandle waitHandle)
     : this(hangfireContext, configImpl)
 {
     _persistence             = persistenceSettings;
     _deserializer            = deserializer;
     _eventWaitHandlerFactory = waitHandle;
 }
 private void NewSystemData(byte freespaceSystemType, byte idSystemType)
 {
     _systemData = new Db4objects.Db4o.Internal.SystemData();
     _systemData.StringEncoding(ConfigImpl.Encoding());
     _systemData.FreespaceSystem(freespaceSystemType);
     _systemData.IdSystemType(idSystemType);
 }
Ejemplo n.º 3
0
 private void Form1_Load(object sender, EventArgs e)
 {
     try
     {
         this.configFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "pocgen.config");
         this._config    = ConfigFactory.GetConfigFromFile(this.configFile);
         this._config.SetXpathRoot("/pocgen/db-settings/");
         this.SetDDLValue(ref this.cbDBDriver, this._config.GetConfigString("driver"));
         this.SetDDLValue(ref this.cbConnStr, this._config.GetConfigString("connectionString"));
         this._config.SetXpathRoot("/pocgen/generator/");
         this.SetTextBoxValue(ref this.tbDstDir, this._config.GetConfigString("dst-dir"));
         this.SetTextBoxValue(ref this.tbPrefix, this._config.GetConfigString("skip-prefix"));
         this.SetTextBoxValue(ref this.txtDAONS, this._config.GetConfigString("dao-namespace"));
         this.SetTextBoxValue(ref this.txtVONS, this._config.GetConfigString("vo-namespace"));
         this.SetTextBoxValue(ref this.txtCommonNS, this._config.GetConfigString("common-namespace"));
         this.chkGenVO.Checked  = this._config.GetConfigBool("gen-value-object");
         this.chkDAO.Checked    = this._config.GetConfigBool("gen-dao-class");
         this.chkXSD.Checked    = this._config.GetConfigBool("gen-xsd");
         this.chkASP.Checked    = this._config.GetConfigBool("gen-asp");
         this.chkCommon.Checked = this._config.GetConfigBool("gen-db-helper");
     }
     catch (Exception)
     {
         int num = (int)MessageBox.Show("Unable to locate config file 'pocgen.config'", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         this.Close();
     }
 }
Ejemplo n.º 4
0
 public Implementation(IHangfireContext hangfireContext, ConfigImpl implConfig)
 {
     _logger          = implConfig.ExecutionLoggerFactory.New(new JsonSerializer(), new WebSocketPool());
     _writer          = implConfig.Writer;
     _pause           = implConfig.PauseHelper;
     _hangfireContext = hangfireContext;
     _persistence     = Config.Persistence;
     _deserializer    = new Dev2JsonSerializer();
     _eventWaitHandlerFactory.New();
 }
Ejemplo n.º 5
0
 private void InitalizeClientSlotCache()
 {
     ConfigImpl.PrefetchSettingsChanged += new System.EventHandler <EventArgs>(new _IEventListener4_145
                                                                                   (this).OnEvent);
     if (ConfigImpl.PrefetchSlotCacheSize() > 0)
     {
         _clientSlotCache = new ClientSlotCacheImpl(this);
         return;
     }
     _clientSlotCache = new NullClientSlotCache();
 }
        private void MigrateFreespace(IFreespaceManager oldFreespaceManager)
        {
            IFreespaceManager newFreespaceManager = AbstractFreespaceManager.CreateNew(this,
                                                                                       ConfigImpl.FreespaceSystem());

            newFreespaceManager.Start(0);
            SystemData().FreespaceSystem(ConfigImpl.FreespaceSystem());
            InstallFreespaceManager(newFreespaceManager);
            AbstractFreespaceManager.Migrate(oldFreespaceManager, newFreespaceManager);
            _fileHeader.WriteVariablePart(this);
        }
Ejemplo n.º 7
0
        public override bool CreateClassMetadata(ClassMetadata clazz, IReflectClass claxx
                                                 , ClassMetadata superClazz)
        {
            Write(Msg.CreateClass.GetWriterForString(SystemTransaction(), Config().ResolveAliasRuntimeName
                                                         (claxx.GetName())));
            Msg resp = GetResponse();

            if (resp == null)
            {
                return(false);
            }
            if (resp.Equals(Msg.Failed))
            {
                // if the class can not be created on the server, send class meta to the server.
                SendClassMeta(claxx);
                resp = GetResponse();
            }
            if (resp.Equals(Msg.Failed))
            {
                if (ConfigImpl.ExceptionsOnNotStorable())
                {
                    throw new ObjectNotStorableException(claxx);
                }
                return(false);
            }
            if (!resp.Equals(Msg.ObjectToClient))
            {
                return(false);
            }
            MsgObject      message = (MsgObject)resp;
            StatefulBuffer bytes   = message.Unmarshall();

            if (bytes == null)
            {
                return(false);
            }
            bytes.SetTransaction(SystemTransaction());
            if (!base.CreateClassMetadata(clazz, claxx, superClazz))
            {
                return(false);
            }
            clazz.SetID(message.GetId());
            clazz.ReadName1(SystemTransaction(), bytes);
            ClassCollection().AddClassMetadata(clazz);
            ClassCollection().ReadClassMetadata(clazz, claxx);
            return(true);
        }
        /// <exception cref="Db4objects.Db4o.Ext.OldFormatException"></exception>
        internal virtual void ReadThis()
        {
            NewSystemData(AbstractFreespaceManager.FmLegacyRam, StandardIdSystemFactory.Legacy
                          );
            BlockSizeReadFromFile(1);
            _fileHeader = FileHeader.Read(this);
            if (Config().GenerateCommitTimestamps().IsUnspecified())
            {
                Config().GenerateCommitTimestamps(_systemData.IdToTimestampIndexId() != 0);
            }
            CreateStringIO(_systemData.StringEncoding());
            CreateIdSystem();
            InitializeClassMetadataRepository();
            InitalizeWeakReferenceSupport();
            SetNextTimeStampId(SystemData().LastTimeStampID());
            ClassCollection().SetID(_systemData.ClassCollectionID());
            ClassCollection().Read(SystemTransaction());
            Converter.Convert(new ConversionStage.ClassCollectionAvailableStage(this));
            _fileHeader.ReadIdentity(this);
            if (_config.IsReadOnly())
            {
                return;
            }
            if (!ConfigImpl.CommitRecoveryDisabled())
            {
                _fileHeader.CompleteInterruptedTransaction(this);
            }
            IFreespaceManager blockedFreespaceManager = AbstractFreespaceManager.CreateNew(this
                                                                                           , _systemData.FreespaceSystem());

            InstallFreespaceManager(blockedFreespaceManager);
            blockedFreespaceManager.Read(this, _systemData.InMemoryFreespaceSlot());
            blockedFreespaceManager.Start(_systemData.BTreeFreespaceId());
            _fileHeader = _fileHeader.Convert(this);
            if (FreespaceMigrationRequired(blockedFreespaceManager))
            {
                MigrateFreespace(blockedFreespaceManager);
            }
            WriteHeader(true, false);
            if (Converter.Convert(new ConversionStage.SystemUpStage(this)))
            {
                _systemData.ConverterVersion(Converter.Version);
                _fileHeader.WriteVariablePart(this);
                Transaction.Commit();
            }
        }
        private bool FreespaceMigrationRequired(IFreespaceManager freespaceManager)
        {
            if (freespaceManager == null)
            {
                return(false);
            }
            byte readSystem       = _systemData.FreespaceSystem();
            byte configuredSystem = ConfigImpl.FreespaceSystem();

            if (freespaceManager.SystemType() == configuredSystem)
            {
                return(false);
            }
            if (configuredSystem != 0)
            {
                return(true);
            }
            return(AbstractFreespaceManager.MigrationRequired(readSystem));
        }
        internal virtual void ConfigureNewFile()
        {
            BlockSize(ConfigImpl.BlockSize());
            _fileHeader = FileHeader.NewCurrentFileHeader();
            SetRegularEndAddress(_fileHeader.Length());
            NewSystemData(ConfigImpl.FreespaceSystem(), ConfigImpl.IdSystemType());
            SystemData().ConverterVersion(Converter.Version);
            CreateStringIO(_systemData.StringEncoding());
            CreateIdSystem();
            InitializeClassMetadataRepository();
            InitalizeWeakReferenceSupport();
            GenerateNewIdentity();
            AbstractFreespaceManager blockedFreespaceManager = AbstractFreespaceManager.CreateNew
                                                                   (this);

            InstallFreespaceManager(blockedFreespaceManager);
            InitNewClassCollection();
            InitializeEssentialClasses();
            _fileHeader.InitNew(this);
            blockedFreespaceManager.Start(0);
        }
Ejemplo n.º 11
0
        private bool GrowDatabaseByConfiguredSize()
        {
            var reservedStorageSpace = ConfigImpl.DatabaseGrowthSize();

            if (reservedStorageSpace <= 0)
            {
                return(false);
            }
            var reservedBlocks = _blockConverter.BytesToBlocks(reservedStorageSpace);
            var reservedBytes  = _blockConverter.BlocksToBytes(reservedBlocks);
            var slot           = new Slot(_blockEndAddress, reservedBlocks);

            if (Debug4.xbytes && Deploy.overwrite)
            {
                OverwriteDeletedBlockedSlot(slot);
            }
            WriteBytes(new ByteArrayBuffer(reservedBytes), _blockEndAddress, 0);
            _freespaceManager.Free(_blockConverter.ToNonBlockedLength(slot));
            _blockEndAddress += reservedBlocks;
            return(true);
        }
Ejemplo n.º 12
0
 protected sealed override void OpenImpl()
 {
     InitializeClassMetadataRepository();
     InitalizeWeakReferenceSupport();
     InitalizeClientSlotCache();
     _singleThreaded = ConfigImpl.SingleThreadedClient();
     // TODO: Experiment with packet size and noDelay
     // socket.setSendBufferSize(100);
     // socket.setTcpNoDelay(true);
     // System.out.println(socket.getSendBufferSize());
     if (_login)
     {
         LoginToServer(_socket);
     }
     if (!_singleThreaded)
     {
         StartDispatcherThread(_socket, _userName);
     }
     LogMsg(36, ToString());
     StartHeartBeat();
     ReadThis();
 }
Ejemplo n.º 13
0
 internal virtual int Timeout()
 {
     return(ConfigImpl.TimeoutClientSocket());
 }
Ejemplo n.º 14
0
 public virtual IUpdateDepthProvider UpdateDepthProvider()
 {
     return(ConfigImpl.UpdateDepthProvider());
 }