Beispiel #1
0
        public static IAssimilate Riak(this IAssimilate assimilate, Action <RiakConfigurator> configurate)
        {
            var configurator = new RiakConfigurator();

            configurate(configurator);
            Assimilate.Dependencies(x => x.For <IRiakConfiguration>().Use(configurator.Configuration));
            return(assimilate);
        }
Beispiel #2
0
        public static IAssimilate Dependencies(this IAssimilate assimilate, Action <DependencyConfigurator> configurator)
        {
            var config = new DependencyConfigurator();

            configurator(config);
            config.RegisterDependencies(assimilate.DependencyAdapter);
            return(assimilate);
        }
Beispiel #3
0
        public static IAssimilate Daemon(this IAssimilate assimilate, Action <DaemonConfigurator> config)
        {
            var daemonConfiguration = new DaemonConfigurator();

            config(daemonConfiguration);
            assimilate
            .Dependencies(container => container.For <DaemonConfiguration>().Use(daemonConfiguration.Configuration));
            return(assimilate);
        }
Beispiel #4
0
 public static IAssimilate LoadLog4NetConfig(this IAssimilate assimilate, string configFile)
 {
     if (!File.Exists(configFile))
     {
         throw new Exception(string.Format("There was no log4net configuration file found at {0}", configFile));
     }
     XmlConfigurator.Configure(new FileInfo(configFile));
     return(assimilate);
 }
Beispiel #5
0
        public static IAssimilate Couch(this IAssimilate assimilate, Action <CouchConfigurator> configure)
        {
            var config = new CouchConfigurator();

            configure(config);
            var configuration = config.Configuration;

            CouchInit.Configure(configuration);
            return(assimilate);
        }
        public static IAssimilate Lucene(this IAssimilate assimilate, Action <LuceneConfigurator> config)
        {
            var configurator = new LuceneConfigurator();

            config(configurator);
            var configuration = configurator.GetConfiguration();

            Assimilate.Dependencies(x => x.For <ILuceneConfiguration>().Use(configuration));

            return(assimilate);
        }
 public HibernateConfigurator(IAssimilate assimilate)
 {
     _assimilate = assimilate;
     assimilate.Dependencies(x =>
                                 {
                                     x.For<ISessionContext>().Use<InMemoryContext>();
                                     x.For<ISessionManager>().Use<SessionManager>();
                                     x.For<ISessionModule>().Use<SessionModule>();
                                     x.For(typeof (IRepository<>)).Use(typeof (Repository<>));
                                 });
     HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();
 }
Beispiel #8
0
        public static IAssimilate Eidetic(this IAssimilate assimilate, Action <EideticConfigurator> configure)
        {
            var config = new EideticConfigurator();

            configure(config);
            assimilate.Dependencies(x => x.For <IMemcachedClientConfiguration>()
                                    .Use(config.Configuration));

            var clientConfig = Assimilate.GetInstanceOf <IMemcachedClientConfiguration>();

            assimilate.Dependencies(
                x => x.For <MemcachedClient>().Use(new MemcachedClient(clientConfig)).AsSingleton());
            return(assimilate);
        }
Beispiel #9
0
        public static IAssimilate Rabbit(this IAssimilate assimilate, Action <RabbitConfiguration> configurate)
        {
            var configuration = Assimilate.GetInstanceOf <RabbitConfiguration>();

            configurate(configuration);
            //Assimilate.Dependencies( x => x.For<RabbitConfiguration>()
            //                                  .Use( configuration ) );
            if (configuration.AsNode)
            {
                var initializer = Assimilate.GetInstanceOf <INodeChannelManager>();
                initializer.InitializeChannels();
            }
            return(assimilate);
        }
Beispiel #10
0
        private static void Configure <TLog, TConfigurator, TAppender>(this IAssimilate assimilate,
                                                                       Action <TConfigurator> action)
            where TConfigurator : AppenderConfigurator <TAppender, TConfigurator>, new()
            where TAppender : AppenderSkeleton, new()
        {
            string name         = typeof(TLog).FullName;
            var    configurator = new TConfigurator();

            action(configurator);
            configurator.Activate();
            var log    = log4net.LogManager.GetLogger(name);
            var logger = log.Logger as Logger;

            logger.AddAppender(configurator.Appender);
            logger.Repository.Configured = true;
        }
Beispiel #11
0
        public static IAssimilate Messaging(this IAssimilate assimilate, Action <EventChannelConfigurator> eventChannels)
        {
            var publisher = Assimilate.GetInstanceOf <IEventPublisher>() as IObservable <IEvent>;

            if (publisher == null)
            {
                throw new AssimilationException(
                          "You must call the Actor assimilation extension method before setting up event channels in Symbiote.Messaging.");
            }

            var configurator = new EventChannelConfigurator();

            eventChannels(configurator);
            Assimilate.Dependencies(x => x.For <IEventChannelConfiguration>().Use(configurator.Configuration));

            EventSubscription = publisher.Subscribe(Assimilate.GetInstanceOf <EventChannel>());

            Preload();

            return(assimilate);
        }
Beispiel #12
0
 public static void RunDaemon(this IAssimilate assimilate)
 {
     try
     {
         "Waking the Daemon..."
         .ToInfo <IDaemon>();
         var factory = Assimilate.GetInstanceOf <CommandProvider>();
         var command = factory.GetServiceCommand();
         command.Execute();
     }
     catch (ThreadAbortException threadAbortException)
     {
         "The Daemon's thread has been aborted."
         .ToWarn <IDaemon>();
         Thread.ResetAbort(); // Stops propagation here. The Daemon is dead.
     }
     catch (Exception e)
     {
         "No host configured. \r\n\t {0}"
         .ToError <IDaemon>(e);
     }
 }
Beispiel #13
0
        public static IAssimilate HttpServer(this IAssimilate assimilate, Action <HttpServerConfigurator> configure)
        {
            var configurator = new HttpServerConfigurator(new HttpServerConfiguration());

            configure(configurator);

            assimilate
            .Dependencies(x =>
            {
                var config = configurator.GetConfiguration();
                x.For <IHttpServerConfiguration>().Use(config);
                x.For <IHttpServer>().Use <HttpServer>();
                x.For <IAuthenticationValidator>().Use <WorthlessAuthenticationValidator>();

                if (config.AuthSchemes == AuthenticationSchemes.Basic)
                {
                    x.For <IHttpAuthChallenger>().Use <HttpBasicAuthChallenger>();
                }
            });

            return(assimilate);
        }
Beispiel #14
0
 public static IAssimilate Mikado(this IAssimilate assimilate)
 {
     ConfigureStandardDependencies();
     return(assimilate);
 }
Beispiel #15
0
 public HiveConfigurator(IAssimilate assimilate)
 {
     this.assimilate = assimilate;
     _nodeName = new NodeName();
     _queueName = _nodeName.ToString("_");
     _bus = ObjectFactory.GetInstance<IBus>();
 }
Beispiel #16
0
 public static IAssimilate AddColorConsoleLogger <TLog>(this IAssimilate assimilate,
                                                        Action <ColorConsoleConfigurator> configure)
 {
     assimilate.Configure <TLog, ColorConsoleConfigurator, ColoredConsoleAppender>(configure);
     return(assimilate);
 }
Beispiel #17
0
 public static IAssimilate AddRollingFileLogger <TLog>(this IAssimilate assimilate,
                                                       Action <RollingConfiguration> configure)
 {
     assimilate.Configure <TLog, RollingConfiguration, RollingFileAppender>(configure);
     return(assimilate);
 }
Beispiel #18
0
 public static IAssimilate AddFileLogger <TLog>(this IAssimilate assimilate, Action <FileConfigurator> configure)
 {
     assimilate.Configure <TLog, FileConfigurator, FileAppender>(configure);
     return(assimilate);
 }