class PDSServerIdentifierValidator {

    public String createValidationErrorMessage(String serverId) {
        if (serverId == null || serverId.trim().isEmpty()) {
            return "server identifier not set!";
        }
        if (serverId.length() > 30) {
            return "server identifier length too big:" + serverId.length() + ", allowed is only 30";
        }
        for (char c : serverId.toCharArray()) {
            if (Character.isAlphabetic(c)) {
                continue;
            }
            if (Character.isDigit(c)) {
                continue;
            }
            if (c == '_') {
                continue;
            }
            return "unexpected char inside server identifier found:" + c + ", allowed is only [a-zA-Z0-9_]";
        }
        return null;
    }

}