use of org.opennms.core.utils.ReplaceFirstOperation in project opennms by OpenNMS.
the class SiblingColumnStorageStrategy method setParameters.
/**
* {@inheritDoc}
*/
@Override
public void setParameters(List<Parameter> parameterCollection) throws IllegalArgumentException {
if (parameterCollection == null) {
final String msg = "Got a null parameter list, but need one containing a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter.";
LOG.error(msg);
throw new IllegalArgumentException(msg);
}
for (Parameter param : parameterCollection) {
if (PARAM_SIBLING_COLUMN_NAME.equals(param.getKey())) {
m_siblingColumnName = param.getValue();
} else if (PARAM_REPLACE_FIRST.equals(param.getKey())) {
m_replaceOps.add(new ReplaceFirstOperation(param.getValue()));
} else if (PARAM_REPLACE_ALL.equals(param.getKey())) {
m_replaceOps.add(new ReplaceAllOperation(param.getValue()));
} else {
if (param.getKey().equals("sibling-column-oid")) {
final String msg = "The parameter 'sibling-column-oid' has been deprecated and it is no longer used. You should configure 'sibling-column-name' instead. For this parameter, you should use the name of any MibObj defined as string for the same resource type.";
LOG.error(msg);
throw new IllegalArgumentException(msg);
} else {
LOG.warn("Encountered unsupported parameter key=\"{}\". Can accept: {}, {}, {}", param.getKey(), PARAM_SIBLING_COLUMN_NAME, PARAM_REPLACE_FIRST, PARAM_REPLACE_ALL);
}
}
}
if (m_siblingColumnName == null) {
final String msg = "The provided parameter list must contain a '" + PARAM_SIBLING_COLUMN_NAME + "' parameter.";
LOG.error(msg);
throw new IllegalArgumentException(msg);
}
}
Aggregations