Class ComponentStarter

java.lang.Object
org.hobbit.core.run.ComponentStarter

public class ComponentStarter extends Object
This class contains the main method starting a given Component.
Author:
Michael Röder (roeder@informatik.uni-leipzig.de)
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • component

      private static Component component
    • closed

      private static boolean closed
  • Constructor Details

    • ComponentStarter

      public ComponentStarter()
  • Method Details

    • main

      public static void main(String[] args)
      This is the main method creating and starting an instance of a Component with the given class name.
      Parameters:
      args - The first element has to be the class name of the component.
    • createComponentInstance

      This method simply creates an instance of the given class by calling a constructor that needs no arguments and cats the newly created instance into a Component instance. Note that this method assumes that a) there is a constructor that needs no arguments to be executed and b) the class with the given name is implementing the Constructor interface.
      Parameters:
      className - the name of the class implementing the Component interface.
      Returns:
      an instance of that class.
      Throws:
      ClassNotFoundException - - If the class with the given name can not be found.
      NoSuchMethodException - - If there is no constructor that needs no parameters.
      SecurityException - - If the constructor can not be accessed because of security policies.
      InstantiationException - - If the class with the given class name represents an abstract class.
      IllegalAccessException - - If the Constructor object is enforcing Java language access control and the underlying constructor is inaccessible.
      IllegalArgumentException - - If the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion; if this constructor pertains to an enum type. (Should not occur)
      InvocationTargetException - - If the constructor throws an exception.
    • configure

      private static void configure(Component component)
    • closeComponent

      private static void closeComponent()
    • addShutdownHook

      private static void addShutdownHook()
    • forceTermination

      private static boolean forceTermination()
    • reportErrorIfPossible

      private static void reportErrorIfPossible(Throwable t)