*/
public static void validateLabelName(final String labelName, final LabelMap existingLabels)
{
// check total length of label
if (labelName.length() > LabelConstants.MAX_LABEL_NAME_LENGTH) {
throw new IllegalLabelException("Label name exceeds maximum allowed length");
}
// check if label already exists
if (existingLabels.containsName(labelName)) {
throw new ExistingLabelException("Label with this name already exists");
}
// check if starts with reserved label
for (Label l : ReservedLabels.getAll())
{
if (labelName.startsWith(l.getName() + LabelConstants.NESTED_LABEL_SEPARATOR.toString()))
throw new IllegalLabelException("Netsted labels are not allowed under reserved labels");
}
if (labelName.contains(LabelConstants.NESTED_LABEL_SEPARATOR.toString() + LabelConstants.NESTED_LABEL_SEPARATOR.toString()))
{
throw new IllegalLabelException("Illegal use of nested label separator");
}
// check special symbols? for now we allow any symbol
}