Class Main


public class Main extends MainCommandLineSupport
A Main class for booting up Camel in standalone mode.
  • Field Details

    • instance

      protected static Main instance
    • registry

      protected final MainRegistry registry
    • mainClass

      protected Class<?> mainClass
  • Constructor Details

    • Main

      public Main()
      Camel main application It is recommended to use Main(Class) to specify the main class.
    • Main

      public Main(Class<?> mainClass)
      Camel main application
      Parameters:
      mainClass - the main class
    • Main

      @SafeVarargs public Main(Class<?> mainClass, Class<org.apache.camel.CamelConfiguration>... configurationClasses)
      Camel main application
      Parameters:
      mainClass - the main class
      configurationClasses - additional camel configuration classes
  • Method Details

    • main

      public static void main(String... args) throws Exception
      Throws:
      Exception
    • getInstance

      public static Main getInstance()
      Returns the currently executing main
      Returns:
      the current running instance
    • bind

      public void bind(String name, Object bean)
      Binds the given name to the bean object, so that it can be looked up inside the CamelContext this command line tool runs with.
      Parameters:
      name - the used name through which we do bind
      bean - the object to bind
    • lookup

      public Object lookup(String name)
      Using the given name does lookup for the bean being already bound using the bind(String, Object) method.
      See Also:
      • BeanRepository.lookupByName(String)
    • lookup

      public <T> T lookup(String name, Class<T> type)
      Using the given name and type does lookup for the bean being already bound using the bind(String, Object) method.
      See Also:
      • BeanRepository.lookupByNameAndType(String, Class)
    • lookupByType

      public <T> Map<String,T> lookupByType(Class<T> type)
      Using the given type does lookup for the bean being already bound using the bind(String, Object) method.
      See Also:
      • BeanRepository.findByTypeWithName(Class)
    • doInit

      protected void doInit() throws Exception
      Overrides:
      doInit in class MainSupport
      Throws:
      Exception
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class MainSupport
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class MainSupport
      Throws:
      Exception
    • findOrCreateCamelTemplate

      protected org.apache.camel.ProducerTemplate findOrCreateCamelTemplate()
      Specified by:
      findOrCreateCamelTemplate in class MainSupport
    • createCamelContext

      protected org.apache.camel.CamelContext createCamelContext()
      Specified by:
      createCamelContext in class MainSupport