com.netflix.karyon.server
Class ServerBootstrap

java.lang.Object
  extended by com.netflix.karyon.server.ServerBootstrap

public class ServerBootstrap
extends java.lang.Object

This class is the point where the karyon environment in bootstrapped which more or less is the bootstrapping of Governator.

LifecycleInjector

This class creates a LifecycleInjector for governator to be used by KaryonServer to create a guice injector. The injector is created with the following components:

Extension points

The default behavior of bootstrapping can be extended by extending this class and overriding the following as needed: In case, the above extension is required, the name of the custom class must be specified in a system property named PropertyNames.SERVER_BOOTSTRAP_CLASS_OVERRIDE. eg: -Dcom.netflix.karyon.server.bootstrap.class=com.mycompany.MyBootsrap


Constructor Summary
ServerBootstrap()
           
 
Method Summary
protected  void beforeInjectorCreation(com.netflix.governator.guice.LifecycleInjectorBuilder builderToBeUsed)
          A callback before creating the Injector from LifecycleInjectorBuilder provided by this class to KaryonServer.
protected  void configureBinder(com.google.inject.Binder binder)
          Callback to configure Binder before returning from Module.configure(Binder).
protected  void configureBootstrapBinder(com.netflix.governator.guice.BootstrapBinder bootstrapBinder)
          Callback to configure BootstrapBinder before returning from BootstrapModule.configure(com.netflix.governator.guice.BootstrapBinder).
protected  java.util.Collection<java.lang.String> getBasePackages()
          Specify the base packages to be added for governator classpath scanning.
protected  java.lang.Class<? extends com.netflix.governator.configuration.ConfigurationProvider> getConfigurationProvider()
          Returns the ConfigurationProvider to be used by governator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerBootstrap

public ServerBootstrap()
Method Detail

getConfigurationProvider

protected java.lang.Class<? extends com.netflix.governator.configuration.ConfigurationProvider> getConfigurationProvider()
Returns the ConfigurationProvider to be used by governator. Defaults to ArchaiusConfigurationProvider

Returns:
The class instance of the ConfigurationProvider to be used, this will be instantiated by governator.

beforeInjectorCreation

protected void beforeInjectorCreation(com.netflix.governator.guice.LifecycleInjectorBuilder builderToBeUsed)
A callback before creating the Injector from LifecycleInjectorBuilder provided by this class to KaryonServer.

Default implementation does nothing, so the overridden methods do not need to call super.

Parameters:
builderToBeUsed - The builder to be used for creating an injector. This builder can be modified/configured as required.

configureBinder

protected void configureBinder(com.google.inject.Binder binder)
Callback to configure Binder before returning from Module.configure(Binder). Default implementation does nothing, so the overridden methods do not need to call super.

Parameters:
binder - The binder as passed to the guice module used by karyon.

configureBootstrapBinder

protected void configureBootstrapBinder(com.netflix.governator.guice.BootstrapBinder bootstrapBinder)
Callback to configure BootstrapBinder before returning from BootstrapModule.configure(com.netflix.governator.guice.BootstrapBinder). Default implementation does nothing, so the overridden methods do not need to call super.

Parameters:
bootstrapBinder - The bootstrap binder as passed to BootstrapModule.configure(com.netflix.governator.guice.BootstrapBinder)

getBasePackages

@Nullable
protected java.util.Collection<java.lang.String> getBasePackages()
Specify the base packages to be added for governator classpath scanning. This is in case for any reason one does not want to specify a property PropertyNames.SERVER_BOOTSTRAP_BASE_PACKAGES_OVERRIDE as mentioned in ServerBootstrap.

Returns:
The base package names for governator scanning.