use of com.cubrid.cubridmanager.ui.monitoring.editor.count.CounterType in project cubrid-manager by CUBRID.
the class HistoryFileHelp method createOrOpenHistoryFile.
/**
*
* Create or Open a history file when the history data should be restored.
*
* @param typeNames the array of type names
* @return the instance of CounterFile
*/
private CounterFile createOrOpenHistoryFile(String[] typeNames) {
File counter = new File(historyPath);
if (counter.exists() && counter.isFile()) {
try {
countFile = new BasicCounterFile(counter, null);
} catch (IOException ex) {
LOGGER.error(ex.getMessage());
}
} else {
List<CounterType> counterLst = new ArrayList<CounterType>();
for (String type : typeNames) {
CounterType counterType = new CounterType(type, true, false, RangeType.INT);
counterLst.add(counterType);
}
CounterType[] types = counterLst.toArray(new CounterType[counterLst.size()]);
Properties props = new Properties();
try {
countFile = new BasicCounterFile(counter, types, maxCount, interval, 0, props);
} catch (IOException ex) {
LOGGER.error(ex.getMessage());
}
}
return countFile;
}
use of com.cubrid.cubridmanager.ui.monitoring.editor.count.CounterType in project cubrid-manager by CUBRID.
the class ChartCompositePart method createOrOpenHistoryFile.
/**
* Create or Open a history file when the history data should be restored.
*
*
* @param <T> the generic type which is the sub type of IDiagPara
* @param ts the instance of generic array
* @param dbName the database name
* @return the instance of CounterFile
*/
private <T extends IDiagPara> CounterFile createOrOpenHistoryFile(T[] ts, String dbName) {
File counter = new File(historyPath);
if (counter.exists() && counter.isFile()) {
try {
countFile = new BasicCounterFile(counter, null);
} catch (IOException ex) {
LOGGER.error(ex.getMessage());
}
} else {
List<CounterType> counterLst = new ArrayList<CounterType>();
for (T diagName : ts) {
String type = diagName.getName();
if (dbName != null) {
type = dbName + "_" + type;
}
CounterType counterType = new CounterType(type, true, false, RangeType.INT);
counterLst.add(counterType);
}
CounterType[] types = counterLst.toArray(new CounterType[counterLst.size()]);
Properties props = new Properties();
try {
countFile = new BasicCounterFile(counter, types, 36000, 3, 0, props);
} catch (IOException ex) {
LOGGER.error(ex.getMessage());
}
}
return countFile;
}
Aggregations