public class FileMetric extends Object
You can also adjust the extracted value using an adjustment operation and value. For example, the value in the file
might be the number of 512 byte sectors when you really want the metric to reflect bytes. You could then use the
FileMetric.FileMetricOperation.MULTIPLY
adjustment-operation and an adjustment-value of 512.
Modifier and Type | Class and Description |
---|---|
static class |
FileMetric.FileMetricKind
Kind of metrics that we are processing here.
|
static class |
FileMetric.FileMetricOperation
Adjustment operations that can be used to adjust the extracted value by using
setAdjustmentOperation(FileMetricOperation) . |
Constructor and Description |
---|
FileMetric() |
FileMetric(String metricName,
String metricComponent,
String metricModule,
String description,
File metricFile,
FileMetric.FileMetricKind kind,
int column,
String lineSplit,
String prefix) |
Modifier and Type | Method and Description |
---|---|
ControlledMetric<?,?> |
getMetric()
Get the associated metric whole value is set from the file.
|
void |
initialize()
Should be called after all of the setter methods are called, maybe my Spring init mechanism?
|
boolean |
isInitialized()
If the metric has been initialized with the
initialize() method. |
void |
setAdjustmentOperation(FileMetric.FileMetricOperation adjustmentOperation)
If you need to adjust the extracted value, this sets the operation that will be applied with the
setAdjustmentValue(double) . |
void |
setAdjustmentValue(double adjustmentValueDouble)
Set the adjustment value as a floating point value.
|
void |
setAdjustmentValue(long adjustmentValueLong)
Set the adjustment value as a long integer.
|
void |
setColumn(int column)
The column from a split perspective (0 to N-1) or the matcher.group(column) if using the line-pattern regex.
|
void |
setDecimalNumber(boolean decimalNumber)
Set to true to make this value be represented internally as a long decimal number.
|
void |
setDescription(String description)
The description to be associated with the metric.
|
void |
setKind(FileMetric.FileMetricKind kind)
The kind of the metric.
|
void |
setLineNumber(int lineNumber)
Number of the line in the file to process.
|
void |
setLinePattern(String linePattern)
Set the regex pattern that should match the line.
|
void |
setLineSplit(String lineSplit)
Regex string to use to divide the line up into fields so we can use the column to extract one of the fields.
|
void |
setMetricComponent(String metricComponent)
The component to be associated with the metric.
|
void |
setMetricFile(String metricFile)
The file that we process to find the value.
|
void |
setMetricFiles(String[] metricFiles)
An array of files that that will be looked at.
|
void |
setMetricModule(String metricModule)
The module to be associated with the metric.
|
void |
setMetricName(String metricName)
The name to be associated with the metric.
|
void |
setPrefix(String prefix)
Prefix string to look for in the file.
|
void |
setRequired(boolean required)
Set whether or not this metric is required, default is false.
|
void |
setUnit(String unit)
The unit to be associated with the metric.
|
String |
toString() |
void |
updateValue()
Update the value in the metric.
|
public FileMetric()
public FileMetric(String metricName, String metricComponent, String metricModule, String description, File metricFile, FileMetric.FileMetricKind kind, int column, String lineSplit, String prefix) throws IllegalArgumentException
IllegalArgumentException
public void initialize() throws IllegalArgumentException
IllegalArgumentException
public void updateValue() throws IOException
IOException
public ControlledMetric<?,?> getMetric()
public boolean isInitialized()
initialize()
method.public void setMetricFile(String metricFile)
setMetricFiles(String[])
must be specified.public void setMetricFiles(String[] metricFiles)
setMetricFile(String)
must be specified.public void setMetricName(String metricName)
ControlledMetric.getName()
.public void setMetricComponent(String metricComponent)
ControlledMetric.getComponent()
.public void setMetricModule(String metricModule)
ControlledMetric.getModule()
.public void setDescription(String description)
ControlledMetric.getDescription()
.public void setUnit(String unit)
ControlledMetric.getUnit()
.public void setKind(FileMetric.FileMetricKind kind)
FileMetric.FileMetricKind
.public void setColumn(int column)
public void setLineSplit(String lineSplit)
public void setLinePattern(String linePattern)
public void setPrefix(String prefix)
public void setRequired(boolean required)
public void setAdjustmentValue(long adjustmentValueLong)
setAdjustmentOperation(FileMetricOperation)
method to change the value
after it is extracted from the file. You can also specify it as a double by calling
#setAdjustmentValue(double))
.public void setAdjustmentValue(double adjustmentValueDouble)
setAdjustmentOperation(FileMetricOperation)
method to change the value
after it is extracted from the file. You can also specify it as a long by calling
setAdjustmentValue(long)
.public void setAdjustmentOperation(FileMetric.FileMetricOperation adjustmentOperation)
setAdjustmentValue(double)
.public void setLineNumber(int lineNumber)
public void setDecimalNumber(boolean decimalNumber)
This content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.