コード例 #1
0
        public AssemblyResolver NewAssemblyResolver(LoggerSetter loggerSetter)
        {
            AssemblyResolverImpl assemblyResolver = new AssemblyResolverImpl();

            loggerSetter.Add(assemblyResolver);
            return(assemblyResolver);
        }
コード例 #2
0
ファイル: AssemblyMainAbst.cs プロジェクト: VinceIborra/ser
        /// <summary>
        /// Todo
        /// </summary>
        private void BootstrapAssembly()
        {
            // Get a way to create the top level objects
            Log4netFactory      log4netFactory      = new Log4netFactoryImpl();
            BootstrapperFactory bootstrapperFactory = new BootstrapperFactoryImpl();

            // Initialise the individual bootstrappers
            CommonLoggingBootstrapper commonLoggingBootstrapper = bootstrapperFactory.NewCommonLoggingBootstrapper();
            LogBootstrapper           logBootstrapper           = bootstrapperFactory.NewLogBootstrapper(Log4NetAssembly, Log4NetAssemblyName, Log4NetXmlCfgFPathFile);
            LoggerSetter loggerSetter = log4netFactory.NewBootstrapDependentLoggerSetter(logBootstrapper);
            //AssemblyResolver assemblyResolver = bootstrapperFactory.NewAssemblyResolver(loggerSetter);
            SpringBootstrapper springBootstrapper = bootstrapperFactory.NewSpringBootstrapper(loggerSetter, SpringContextPathFile);

            // Combine them into a composite
            IList <Bootstrapper> bootstrappers = new List <Bootstrapper>();

            bootstrappers.Add(commonLoggingBootstrapper);
            bootstrappers.Add(logBootstrapper);
            bootstrappers.Add(loggerSetter);
            //bootstrappers.Add(assemblyResolver);
            bootstrappers.Add(springBootstrapper);
            Bootstrapper bootstrapper = bootstrapperFactory.NewCompositeBootstrapper(loggerSetter, bootstrappers);

            // Bootstrap
            bootstrapper.Bootstrap();

            // Set the main object
            AddinMain = (AddinMain)springBootstrapper.Ctx.GetObject("AddinMainObj");
        }
コード例 #3
0
        public SpringBootstrapper NewSpringBootstrapper(LoggerSetter loggerSetter)
        {
            SpringBootstrapperImpl springBootstrapper = new SpringBootstrapperImpl();

            loggerSetter.Add(springBootstrapper);
            return(springBootstrapper);
        }
コード例 #4
0
 public BootstrapLog4netAttribute()
 {
     Log4netFactory      = new Log4netFactoryImpl();
     BootstrapperFactory = new BootstrapperFactoryImpl();
     LogBootstrapper     = BootstrapperFactory.NewLogBootstrapper();
     LoggerSetter        = Log4netFactory.NewBootstrapDependentLoggerSetter(LogBootstrapper);
 }
コード例 #5
0
        public void TestInitialize()
        {
            Log4netFactory log4netFactory = new Log4netFactoryImpl();

            BootstrapperFactory = new BootstrapperFactoryImpl();
            LoggerSetter        = log4netFactory.NewLoggerSetter();
        }
コード例 #6
0
        public Runner NewSpringRunner(LoggerSetter loggerSetter, SpringBootstrapper springBootstrapper)
        {
            SpringRunnerImpl runner = new SpringRunnerImpl();

            runner.SpringBootstrapper = springBootstrapper;
            loggerSetter.Add(runner);
            return(runner);
        }
コード例 #7
0
        public CompositeBootstrapper NewCompositeBootstrapper(LoggerSetter loggerSetter, IList <Bootstrapper> bootstrappers)
        {
            CompositeBootstrapperImpl compositeBootstrapper = new CompositeBootstrapperImpl();

            compositeBootstrapper.SubBootstrappers = bootstrappers;
            loggerSetter.Add(compositeBootstrapper);
            return(compositeBootstrapper);
        }
コード例 #8
0
        //public AssemblyResolver NewAssemblyResolver(LoggerSetter loggerSetter) {
        //    AssemblyResolverImpl assemblyResolver = new AssemblyResolverImpl();
        //    loggerSetter.Add(assemblyResolver);
        //    return assemblyResolver;
        //}

        public SpringBootstrapper NewSpringBootstrapper(LoggerSetter loggerSetter, string xmlFile = null)
        {
            SpringBootstrapperImpl springBootstrapper = new SpringBootstrapperImpl();

            springBootstrapper.XmlFile = xmlFile;
            loggerSetter.Add(springBootstrapper);
            return(springBootstrapper);
        }
コード例 #9
0
        public void TestBootstrap()
        {
            BootstrapperFactory bootstrapperFactory = new BootstrapperFactoryImpl();
            LoggerSetter        loggerSetter        = Log4netFactory.NewLoggerSetter();

            loggerSetter.Add(MockLoggerRecipient);
            loggerSetter.Bootstrap();
            Assert.IsNotNull(MockLoggerRecipient);
        }
コード例 #10
0
        public void TestAdd()
        {
            BootstrapperFactory bootstrapperFactory = new BootstrapperFactoryImpl();
            LoggerSetter        loggerSetter        = Log4netFactory.NewLoggerSetter();
            LoggerSetterImpl    loggerSetterImpl    = (LoggerSetterImpl)loggerSetter;

            Assert.IsTrue(loggerSetterImpl.LoggerRecipients.Count == 0);
            loggerSetter.Add(MockLoggerRecipient);
            Assert.IsTrue(loggerSetterImpl.LoggerRecipients.Count == 1);
        }
コード例 #11
0
        public void TestNewLoggerSetter()
        {
            LoggerSetter loggerSetter = Log4netFactory.NewLoggerSetter();

            Assert.IsNotNull(loggerSetter);
            Assert.IsTrue(loggerSetter is LoggerSetterImpl);
            LoggerSetterImpl loggerSetterImpl = (LoggerSetterImpl)loggerSetter;

            Assert.IsNotNull(loggerSetterImpl.LoggerRecipients);
            Assert.IsTrue(loggerSetterImpl.LoggerRecipients.Count == 0);
        }
コード例 #12
0
        public Bootstrapper NewProgramBootstrapper(LogBootstrapper logBootstrapper, LoggerSetter loggerSetter, AssemblyResolver assemblyResolver, SpringBootstrapper springBootstrapper)
        {
            IList <Bootstrapper> bootstrappers = new List <Bootstrapper>();

            bootstrappers.Add(logBootstrapper);
            bootstrappers.Add(loggerSetter);
            bootstrappers.Add(assemblyResolver);
            bootstrappers.Add(springBootstrapper);
            CompositeBootstrapper compositeBootstrapper = BootstrapperFactory.NewCompositeBootstrapper(loggerSetter, bootstrappers);

            return(compositeBootstrapper);
        }
コード例 #13
0
        public void TestNewBootstrapDependentLoggerSetter()
        {
            LoggerSetter loggerSetter = Log4netFactory.NewBootstrapDependentLoggerSetter(LogBootstrapper);

            Assert.IsNotNull(loggerSetter);
            Assert.IsTrue(loggerSetter is BootstrapDependentLoggerSetterImpl);
            BootstrapDependentLoggerSetterImpl loggerSetterImpl = (BootstrapDependentLoggerSetterImpl)loggerSetter;

            Assert.AreEqual(LogBootstrapper, loggerSetterImpl.LogBootstrapper);
            Assert.IsNotNull(loggerSetterImpl.LoggerRecipients);
            Assert.IsTrue(loggerSetterImpl.LoggerRecipients.Count == 0);
        }
コード例 #14
0
        public void BootstrapStandard()
        {
            Logger.Debug("Bootstrapping Spring.NET...");
            Ctx = ContextRegistry.GetContext();

            Logger.Debug("Setting object loggers.");
            LoggerSetter loggerSetter = (LoggerSetter)Ctx.GetObject("LoggerSetter");

            loggerSetter.SetLoggers();

            Logger.Debug("Bootstrapping Spring.NET - Done.");
            IsDone = true;
        }
コード例 #15
0
        static void Main(string[] args)
        {
            // Get a way to create the top level objects
            Log4netFactory      log4netFactory      = new Log4netFactoryImpl();
            BootstrapperFactory bootstrapperFactory = new BootstrapperFactoryImpl();
            MainFactory         mainFactory         = new MainFactoryClass();

            mainFactory.BootstrapperFactory = bootstrapperFactory;

            // Initialise the individual bootstrappers
            LogBootstrapper    logBootstrapper    = bootstrapperFactory.NewLogBootstrapper();
            LoggerSetter       loggerSetter       = log4netFactory.NewBootstrapDependentLoggerSetter(logBootstrapper);
            AssemblyResolver   assemblyResolver   = bootstrapperFactory.NewAssemblyResolver(loggerSetter);
            SpringBootstrapper springBootstrapper = bootstrapperFactory.NewSpringBootstrapper(loggerSetter);

            // Create the program components
            Bootstrapper bootstrapper = mainFactory.NewProgramBootstrapper(logBootstrapper, loggerSetter, assemblyResolver, springBootstrapper);
            Runner       runner       = bootstrapperFactory.NewSpringRunner(loggerSetter, springBootstrapper);

            // Create and run the program
            Program program = mainFactory.NewProgram(bootstrapper, runner);

            program.Run();
        }