Class ConfigHelper
- java.lang.Object
-
- org.eclipse.mosaic.fed.output.ambassador.ConfigHelper
-
public class ConfigHelper extends Object
This class is intended to contain helper methods to read the output generator configuration file.
-
-
Constructor Summary
Constructors Constructor Description ConfigHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getConfigLoader(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
static long
getHandleEndTime(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
Load attribute "end" using helper functionloadAndCheckHandleStartOrEndTime(HierarchicalConfiguration, boolean)
.static long
getHandleStartTime(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
Load attribute "start" using helper functionloadAndCheckHandleStartOrEndTime(HierarchicalConfiguration, boolean)
.static String
getId(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
Load attribute "id" from the given configuration.static Collection<String>
getSubscriptions(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config)
static int
getUpdateInterval(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
Load attribute "update".static boolean
isEnabled(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
Load attribute "enabled".
-
-
-
Method Detail
-
getId
public static String getId(org.apache.commons.configuration2.HierarchicalConfiguration<?> config) throws IllegalArgumentException
Load attribute "id" from the given configuration.- Parameters:
config
- configuration- Returns:
- `id` sent in the configuration
- Throws:
IllegalArgumentException
-
isEnabled
public static boolean isEnabled(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
Load attribute "enabled". If not given, return true by default.- Parameters:
config
- configuration- Returns:
- true, if enabled.
-
getUpdateInterval
public static int getUpdateInterval(org.apache.commons.configuration2.HierarchicalConfiguration<?> config) throws Exception
Load attribute "update". If not given, return defaultUpdate of 1 If the given update is invalid, an exception is thrown- Parameters:
config
- configuration- Returns:
- the update interval as defined in the configuration
- Throws:
Exception
- If less than or equal to 0
-
getHandleStartTime
public static long getHandleStartTime(org.apache.commons.configuration2.HierarchicalConfiguration<?> config) throws Exception
Load attribute "start" using helper functionloadAndCheckHandleStartOrEndTime(HierarchicalConfiguration, boolean)
. If not given return default value of 0. Throws exception if given start value is smaller than 0 or larger than given end value.- Parameters:
config
- configuration- Returns:
- start time
- Throws:
Exception
-
getHandleEndTime
public static long getHandleEndTime(org.apache.commons.configuration2.HierarchicalConfiguration<?> config) throws Exception
Load attribute "end" using helper functionloadAndCheckHandleStartOrEndTime(HierarchicalConfiguration, boolean)
. If not given return default value of Integer.MAX_VALUE. Throws exception if given end value is smaller than 0 or smaller than given start value.- Parameters:
config
- configuration- Returns:
- end time
- Throws:
Exception
-
getConfigLoader
public static String getConfigLoader(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
-
getSubscriptions
public static Collection<String> getSubscriptions(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config)
-
-