com.remondis.limbus.system.ComponentStatus Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of limbus-system Show documentation
Show all versions of limbus-system Show documentation
The Limbus System is a small light-weight CDI framework managing the Limbus Core Components.
The object graph is represented by an XML configuration file or can be build using the Limbus System API.
This module delivers an optional system component that visualizes the object graph and its dependencies after initializing: com.remondis.limbus.system.visualize.LimbusSystemVisualizer
This component can be added to the Limbus System. To keep the dependencies of this module transparent and light-weight, the graph renderer is declared as an optional dependency. Add the following dependencies to your project to use the visualisation component:
<!-- Graph Stream for Visualization feature This is an optional dependency and only required if using the com.remondis.limbus.system.visualize.LimbusSystemVisualizer -->
<dependency>
<groupId>org.graphstream</groupId>
<artifactId>gs-core</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.graphstream</groupId>
<artifactId>gs-ui</artifactId>
<version>1.3</version>
</dependency>
package com.remondis.limbus.system;
import com.remondis.limbus.utils.StringUtil;
/**
* This enumeration defines all statuus a component can have.
*
* @author schuettec
*
*/
public enum ComponentStatus {
INITIALIZED,
FINISHED,
/**
* Set if the component could not be initialized but is a required component.
*/
ERROR,
/**
* Set if the component is an optional component and failed to initialize.
*/
UNAVAILABLE;
private static int maxCharCount = 0;
static {
for (ComponentStatus s : values()) {
maxCharCount = Math.max(s.name()
.length(), maxCharCount);
}
}
/**
* @return Returns the number of characters that are maximal needed to display status names.
*/
public static int getMaxStringLength() {
return maxCharCount;
}
/**
* Does the same like {@link #toString()} but creates a string with as much characters as needed for the longest
* status name.
*
* @return Returns this enum value as string.
*/
public String toFormattedString() {
return StringUtil.center(name(), maxCharCount);
}
}