Browse files

Simplified load balancer bootstrapping. Fixed warnings in test project.

  • Loading branch information...
1 parent 4999fde commit 8ea091013b324bc5667384f6485e5ab2453647cd @CoreyKaylor CoreyKaylor committed Jan 31, 2011
View
37 Rhino.ServiceBus.Castle/CastleLoadBalancerBootStrapper.cs
@@ -1,48 +1,13 @@
-using Castle.Windsor;
using Rhino.ServiceBus.Impl;
using Rhino.ServiceBus.LoadBalancer;
namespace Rhino.ServiceBus.Castle
{
- public sealed class CastleLoadBalancerBootStrapper : LoadBalancerBootStrapper
+ public sealed class CastleLoadBalancerBootStrapper : CastleBootStrapper
{
- private IWindsorContainer container;
- private CastleBootStrapper inner;
-
- public override void CreateContainer()
- {
- container = new WindsorContainer();
- inner = new CastleBootStrapper(container);
- }
-
protected override AbstractRhinoServiceBusConfiguration CreateConfiguration()
{
return new LoadBalancerConfiguration();
}
-
- protected override void ConfigureBusFacility(AbstractRhinoServiceBusConfiguration configuration)
- {
- configuration.UseCastleWindsor(container);
- }
-
- public override void ExecuteDeploymentActions(string user)
- {
- inner.ExecuteDeploymentActions(user);
- }
-
- public override void ExecuteEnvironmentValidationActions()
- {
- inner.ExecuteEnvironmentValidationActions();
- }
-
- public override T GetInstance<T>()
- {
- return inner.GetInstance<T>();
- }
-
- public override void Dispose()
- {
- container.Dispose();
- }
}
}
View
34 Rhino.ServiceBus.StructureMap/StructureMapLoadBalancerBootStrapper.cs
@@ -1,43 +1,15 @@
+using System;
using Rhino.ServiceBus.Impl;
using Rhino.ServiceBus.LoadBalancer;
-using StructureMap;
namespace Rhino.ServiceBus.StructureMap
{
- public class StructureMapLoadBalancerBootStrapper : LoadBalancerBootStrapper
+ [CLSCompliant(false)]
+ public class StructureMapLoadBalancerBootStrapper : StructureMapBootStrapper
{
- private IContainer container;
- private StructureMapBootStrapper inner;
-
- public override void CreateContainer()
- {
- container = ObjectFactory.Container;
- inner = new StructureMapBootStrapper(container);
- }
-
protected override AbstractRhinoServiceBusConfiguration CreateConfiguration()
{
return new LoadBalancerConfiguration();
}
-
- public override void ExecuteDeploymentActions(string user)
- {
- inner.ExecuteDeploymentActions(user);
- }
-
- public override void ExecuteEnvironmentValidationActions()
- {
- inner.ExecuteEnvironmentValidationActions();
- }
-
- public override T GetInstance<T>()
- {
- return inner.GetInstance<T>();
- }
-
- public override void Dispose()
- {
- container.Dispose();
- }
}
}
View
2 Rhino.ServiceBus.Tests/Containers/StructureMap/Can_host_in_another_app_domain.cs
@@ -66,13 +66,15 @@ public void Consume(StringMsg message)
}
}
+ [CLSCompliant(false)]
public class SimpleBootStrapper : StructureMapBootStrapper
{
public SimpleBootStrapper(IContainer container) : base(container)
{
}
}
+ [CLSCompliant(false)]
public class TestBootStrapper : StructureMapBootStrapper
{
protected override void ConfigureContainer()
View
9 Rhino.ServiceBus/LoadBalancer/LoadBalancerBootStrapper.cs
@@ -1,9 +0,0 @@
-using Rhino.ServiceBus.Hosting;
-
-namespace Rhino.ServiceBus.LoadBalancer
-{
- public abstract class LoadBalancerBootStrapper : AbstractBootStrapper
- {
-
- }
-}
View
6 Rhino.ServiceBus/LoadBalancer/LoadBalancerHost.cs
@@ -9,7 +9,7 @@ namespace Rhino.ServiceBus.LoadBalancer
{
public class LoadBalancerHost : MarshalByRefObject, IApplicationHost
{
- private LoadBalancerBootStrapper bootStrapper;
+ private AbstractBootStrapper bootStrapper;
private MsmqLoadBalancer loadBalancer;
public override object InitializeLifetimeService()
@@ -55,7 +55,7 @@ private void CreateBootStrapper(string assemblyName)
Type bootStrapperType = GetAutoBootStrapperType(assembly);
try
{
- bootStrapper = (LoadBalancerBootStrapper)Activator.CreateInstance(bootStrapperType);
+ bootStrapper = (AbstractBootStrapper)Activator.CreateInstance(bootStrapperType);
}
catch (Exception e)
{
@@ -72,7 +72,7 @@ public void Dispose()
private static Type GetAutoBootStrapperType(Assembly assembly)
{
var bootStrappers = assembly.GetTypes()
- .Where(x => typeof(LoadBalancerBootStrapper).IsAssignableFrom(x))
+ .Where(x => typeof(AbstractBootStrapper).IsAssignableFrom(x) && x.IsAbstract == false)
.ToArray();
if (bootStrappers.Length == 0)
View
1 Rhino.ServiceBus/Rhino.ServiceBus.csproj
@@ -117,7 +117,6 @@
<Compile Include="Exceptions\MessagePublicationException.cs" />
<Compile Include="Exceptions\SubscriptionException.cs" />
<Compile Include="Exceptions\TransportException.cs" />
- <Compile Include="LoadBalancer\LoadBalancerBootStrapper.cs" />
<Compile Include="LoadBalancer\LoadBalancerHost.cs" />
<Compile Include="LoadBalancer\MsmqLoadBalancer.cs" />
<Compile Include="MessageModules\LoadBalancerMessageModule.cs" />

0 comments on commit 8ea0910

Please sign in to comment.