public class QueryUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
QueryUtil.ReadCounterSetXMLFileTask
Task reads counters matching a regular expression into the caller's
CounterSet . |
Modifier and Type | Field and Description |
---|---|
protected static org.apache.log4j.Logger |
log |
Constructor and Description |
---|
QueryUtil() |
Modifier and Type | Method and Description |
---|---|
static Collection<File> |
collectFiles(Collection<File> in,
FileFilter filter)
Return the specified files, substituting recursively spanned files when a
given file is a directory.
|
static String[] |
getCapturedGroups(Pattern pattern,
ICounter counter)
Return the data captured by
Pattern from the path of the
specified counter. |
static Pattern |
getPattern(Collection<Pattern> regex)
Generate a
Pattern from the OR of zero or more regular
expressions which must be matched. |
static Pattern |
getPattern(Collection<String> filter,
Collection<String> regex)
Generate a
Pattern from the OR of zero or more strings which must
be matched and zero or more regular expressions which must be matched. |
static Pattern |
getRequiredPerformanceCountersFilter()
Return a
Pattern which will match the minimum set of performance
counters required by the load balancer to perform its function. |
static void |
main(String[] args)
Utility may be used to read the required performance counters for the
load balancer from zero or more files specified on the command line.
|
static void |
readCountersFromFile(File file,
CounterSet counterSet,
Pattern filter,
ICounterSet.IInstrumentFactory instrumentFactory)
Read counters matching the optional filter from the file into the given
CounterSet . |
static void |
readCountersFromFile(File file,
CounterSet counterSet,
Pattern filter,
int nslots,
PeriodEnum unit)
Read counters matching the optional filter from the file into the given
CounterSet . |
static void |
readEvents(DummyEventReportingService service,
File file)
Read in
Event s logged on a file in a tab-delimited format. |
public static String[] getCapturedGroups(Pattern pattern, ICounter counter)
Pattern
from the path of the
specified counter.
Note: This is used to extract the parts of the Pattern
which are
of interest - presuming that you mark some parts with capturing groups
and other parts that you do not care about with non-capturing groups.
Note: There is a presumption that Pattern
was used to select the
counters and that counter is one of the selected counters, in
which case Pattern
is KNOWN to match
ICounterNode.getPath()
.
null
if there are no
capturing groups.public static Pattern getPattern(Collection<String> filter, Collection<String> regex)
Pattern
from the OR of zero or more strings which must
be matched and zero or more regular expressions which must be matched.filter
- A list of strings to be matched (may be null).regex
- A list of regular expressions to be matched (may be null).Pattern
-or- null
if both collects are
empty.public static Pattern getPattern(Collection<Pattern> regex)
Pattern
from the OR of zero or more regular
expressions which must be matched.regex
- A list of regular expressions to be matched (may be null).Pattern
-or- null
if both collects are
empty.public static void readCountersFromFile(File file, CounterSet counterSet, Pattern filter, int nslots, PeriodEnum unit) throws IOException, SAXException, ParserConfigurationException
CounterSet
.file
- The file.counterSet
- The CounterSet
.filter
- An optional filter.nslots
- The #of periods worth of data to be retained. This is used
when a counter not already present in counterSet is
encountered and controls the #of slots to be retained by
History
allocated for that counter.unit
- The unit in which the #of slots was expressed.IOException
SAXException
ParserConfigurationException
public static void readCountersFromFile(File file, CounterSet counterSet, Pattern filter, ICounterSet.IInstrumentFactory instrumentFactory) throws IOException, SAXException, ParserConfigurationException
CounterSet
.file
- The file.counterSet
- The CounterSet
.filter
- An optional filter.instrumentFactory
- IOException
SAXException
ParserConfigurationException
public static void readEvents(DummyEventReportingService service, File file) throws IOException
Event
s logged on a file in a tab-delimited format.service
- The events will be added to this service.file
- The file from which the events will be read.IOException
public static Collection<File> collectFiles(Collection<File> in, FileFilter filter)
in
- A collection of zero or more files.filter
- A filter which will select the files to be accepted.public static Pattern getRequiredPerformanceCountersFilter()
Pattern
which will match the minimum set of performance
counters required by the load balancer to perform its function.public static void main(String[] args) throws IOException, SAXException, ParserConfigurationException
args
- The file(s).IOException
SAXException
ParserConfigurationException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.