Package org.hobbit.core.run
Class ComponentStarter
java.lang.Object
org.hobbit.core.run.ComponentStarter
This class contains the main method starting a given
Component.- Author:
- Michael Röder (roeder@informatik.uni-leipzig.de)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidprivate static voidprivate static voidprivate static ComponentcreateComponentInstance(String className) 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 aComponentinstance.private static booleanstatic voidThis is the main method creating and starting an instance of aComponentwith the given class name.private static void
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
component
-
closed
private static boolean closed
-
-
Constructor Details
-
ComponentStarter
public ComponentStarter()
-
-
Method Details
-
main
This is the main method creating and starting an instance of aComponentwith the given class name.- Parameters:
args- The first element has to be the class name of the component.
-
createComponentInstance
private static Component createComponentInstance(String className) throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException 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 aComponentinstance. 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 theConstructorinterface.- Parameters:
className- the name of the class implementing theComponentinterface.- 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
-
closeComponent
private static void closeComponent() -
addShutdownHook
private static void addShutdownHook() -
forceTermination
private static boolean forceTermination() -
reportErrorIfPossible
-