List of usage examples for java.util Properties toString
@Override public synchronized String toString()
From source file:com.smartmarmot.orabbix.Configurator.java
private static Query getQueryProperties(Properties _propsq, String _queryName) throws Exception { try {//from w w w .j a va 2 s . c o m String query = ""; try { query = new String(_propsq.getProperty(_queryName + "." + Constants.QUERY_POSTFIX)); } catch (Exception ex) { SmartLogger.logThis(Level.ERROR, "Error while getting " + _queryName + "." + Constants.QUERY_POSTFIX + " " + ex.getMessage()); } String noDataFound = ""; try { noDataFound = new String(_propsq.getProperty(_queryName + "." + Constants.QUERY_NO_DATA_FOUND)); } catch (Exception ex) { SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.QUERY_NO_DATA_FOUND + " null or not present " + ex.getMessage()); } String raceCondQuery = ""; try { raceCondQuery = new String(_propsq.getProperty(_queryName + "." + Constants.RACE_CONDITION_QUERY)); } catch (Exception ex) { SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.RACE_CONDITION_QUERY + " null or not present " + ex.getMessage()); } String raceCondValue = ""; try { raceCondValue = new String(_propsq.getProperty(_queryName + "." + Constants.RACE_CONDITION_VALUE)); } catch (Exception ex) { SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.RACE_CONDITION_VALUE + " null or not present " + ex.getMessage()); } /** * set Period if not defined period =2 min. */ int period = -1; try { period = new Integer(_propsq.getProperty(_queryName + "." + Constants.QUERY_PERIOD)); } catch (Exception ex) { SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.QUERY_PERIOD + " null or not present " + ex.getMessage()); try { period = new Integer(_propsq.getProperty(Constants.QUERY_DEFAULT_PERIOD)); } catch (Exception ex1) { SmartLogger.logThis(Level.DEBUG, "Note: " + Constants.QUERY_DEFAULT_PERIOD + " null or not present using default values 2 min."); period = 2; } } Boolean active = true; try { String active_str = _propsq.getProperty(_queryName + "." + Constants.QUERY_ACTIVE); if (active_str != null) { if (active_str.equalsIgnoreCase("false")) { active = false; } } } catch (Exception ex) { SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.QUERY_ACTIVE + " null or not present " + ex.getMessage()); SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.QUERY_ACTIVE + " null or not present using default values TRUE"); } Boolean trim = true; try { String trim_str = _propsq.getProperty(_queryName + "." + Constants.QUERY_TRIM); if (trim_str != null) { if (trim_str.equalsIgnoreCase("false")) { trim = false; } } } catch (Exception ex) { SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.QUERY_TRIM + " null or not present " + ex.getMessage()); SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.QUERY_TRIM + " null or not present using default values TRUE"); } Boolean space = true; try { String space_str = _propsq.getProperty(_queryName + "." + Constants.QUERY_SPACE); if (space_str != null) { if (space_str.equalsIgnoreCase("false")) { space = false; } } } catch (Exception ex) { SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.QUERY_SPACE + " null or not present " + ex.getMessage()); SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.QUERY_SPACE + " null or not present using default values TRUE"); } List<Integer> excludeColumns = new ArrayList<Integer>(); try { String excludeColumnsList = new String( _propsq.getProperty(_queryName + "." + Constants.QUERY_EXCLUDE_COLUMNS)); StringTokenizer st = new StringTokenizer(excludeColumnsList, Constants.DELIMITER); while (st.hasMoreTokens()) { String token = st.nextToken().toString(); Integer tmpInteger = new Integer(token); excludeColumns.add(tmpInteger); } } catch (Exception ex) { SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.QUERY_EXCLUDE_COLUMNS + " error " + ex.getMessage()); } List<Integer> raceExcludeColumns = new ArrayList<Integer>(); try { String excludeColumnsList = new String( _propsq.getProperty(_queryName + "." + Constants.RACE_CONDITION_EXCLUDE_COLUMNS)); StringTokenizer st = new StringTokenizer(excludeColumnsList, Constants.DELIMITER); while (st.hasMoreTokens()) { String token = st.nextToken().toString(); Integer tmpInteger = new Integer(token); excludeColumns.add(tmpInteger); } } catch (Exception ex) { SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.RACE_CONDITION_EXCLUDE_COLUMNS + " error " + ex.getMessage()); } List<String> itemColumns = new ArrayList<String>(); try { String itemColumnsList = new String( _propsq.getProperty(_queryName + "." + Constants.QUERY_ITEM_COLUMNS)); StringTokenizer st = new StringTokenizer(itemColumnsList, Constants.DELIMITER); while (st.hasMoreTokens()) { String token = st.nextToken().toString(); itemColumns.add(token); space = true; } } catch (Exception ex) { SmartLogger.logThis(Level.DEBUG, "Note: " + _queryName + "." + Constants.QUERY_ITEM_COLUMNS + " error " + ex.getMessage()); } Query q = new Query(query, _queryName, noDataFound, raceCondQuery, raceCondValue, period, active, trim, space, excludeColumns, raceExcludeColumns, itemColumns); return q; } catch (Exception ex) { SmartLogger.logThis(Level.ERROR, "Error on Configurator on getQueryProperties(" + _propsq.toString() + ") " + ex.getMessage()); return null; } }