Example #1
0
        public AssemblyResolver NewAssemblyResolver(LoggerSetter loggerSetter)
        {
            AssemblyResolverImpl assemblyResolver = new AssemblyResolverImpl();

            loggerSetter.Add(assemblyResolver);
            return(assemblyResolver);
        }
Example #2
0
        /// <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");
        }
Example #3
0
        public SpringBootstrapper NewSpringBootstrapper(LoggerSetter loggerSetter)
        {
            SpringBootstrapperImpl springBootstrapper = new SpringBootstrapperImpl();

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

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

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

            compositeBootstrapper.SubBootstrappers = bootstrappers;
            loggerSetter.Add(compositeBootstrapper);
            return(compositeBootstrapper);
        }
        //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);
        }
Example #9
0
        public void TestBootstrap()
        {
            BootstrapperFactory bootstrapperFactory = new BootstrapperFactoryImpl();
            LoggerSetter        loggerSetter        = Log4netFactory.NewLoggerSetter();

            loggerSetter.Add(MockLoggerRecipient);
            loggerSetter.Bootstrap();
            Assert.IsNotNull(MockLoggerRecipient);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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;
        }
Example #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();
        }