Esempio n. 1
0
        public db4oDataStore(db4oDbEngine engine, ExtObjectContainer container, String path, ILoggerFactory factory)
        {
            _engine = engine;
            _container = container;
            _path = path;

            _typeProcessor = new db4oTypeProcessor(this);

            //Here at load time, process the type information for all the types currently
            //stored in the container
            foreach (StoredClass sc in _container.storedClasses()) {
                Type storedType = Type.GetType(sc.getName());

                if (storedType != null) {
                    if (!_typeProcessor.IsAssemblyProcessed(storedType.Assembly)) {
                        _typeProcessor.ProcessAssembly(storedType.Assembly);
                    }
                }
            }

            _recursor = new ObjectRecursor(this);

            _logger = new LoggerHelper(factory.GetLogger(typeof(db4oDataStore)), Assembly.GetExecutingAssembly(), "StringConstants");

            _logger.Debug("LogMsg.DataStoreConstructed", path);
        }
Esempio n. 2
0
 private TestConsole(IDbEngine engine, ILoggerFactory loggerFactory)
 {
     _engine = engine;
     _logger = new LoggerHelper(loggerFactory.GetLogger(typeof(TestConsole)),
         Assembly.GetExecutingAssembly(),
         "StringConstants");
 }
Esempio n. 3
0
        public db4oDbEngine(ILoggerFactory factory)
        {
            _logFactory = factory;
            _logger = new LoggerHelper(factory.GetLogger(typeof(db4oDbEngine)),
                Assembly.GetExecutingAssembly(),
                "StringConstants");
            _dataStores = new ArrayList();

            _logger.Info("LogMsg.Initializing", Db4o.version());

            //Set initial container configuration
            //activation depth is 1 (meaining primitive types only), since
            //this assembly handles activation of all objects in a persistence
            //boundary manually.
            Db4o.configure().activationDepth(1);

            //The content model objects do not know about db4o, therefore
            //they can't possibly implement the callback interface.  Thus, save
            //some compute cycles and don't even check
            Db4o.configure().callbacks(false);

            //Don't call constructors when instantiating objects
            Db4o.configure().callConstructors(false);

            //Throw an exception when storing a type that is not storable
            //Usually this is due to a missing default ctor, but attempting to
            //save event objects also causes this problem
            Db4o.configure().exceptionsOnNotStorable(true);

            //Tell db4o that the NotPersisted attribute decorates those
            //fields that shouldn't be stored
            Db4o.configure().markTransient(typeof(NotPersistedAttribute).FullName);

            //Create a logger object for db4o's log messages, then use
            //a db4oPrintStreamLogger to adapt the logger object's interface
            //to the PrintStream that db4o expects.

            ILogger db4oLogger = factory.GetLogger(typeof(db4oPrintStreamLogger));
            db4oPrintStreamLogger ps = new db4oPrintStreamLogger(db4oLogger);
            Db4o.configure().setOut(ps);

            //Based on the log levels of the logger object, set db4o's log level
            if (db4oLogger.IsDebugEnabled) {
                //Debug level, so enable all the log messages
                Db4o.configure().messageLevel(3);
            } else if (db4oLogger.IsInfoEnabled) {
                //Include new/update/delete msgs, but no activation details
                Db4o.configure().messageLevel(2);
            } else {
                //No extra logging.  Just report open and close
                Db4o.configure().messageLevel(1);
            }

            _logger.Info("LogMsg.Initialized");
        }
 /// <summary>
 /// Creates a new file system monitor object using a caller-defined logger factory
 /// </summary>
 /// <param name="logger"></param>
 public FrameworkFileSystemMonitor(ILoggerFactory loggerFactory)
 {
     _logger = new LoggerHelper(loggerFactory.GetLogger(this.GetType()), "StringConstants");
 }