Title: ReadWriteModeValidator Description: Validator for ReadWrite Modes
| 129 | * <p>Description: Validator for ReadWrite Modes</p> |
| 130 | */ |
| 131 | public static class ReadWriteModeValidator implements ArgValueValidator { |
| 132 | /** The supported mode codes */ |
| 133 | private static final Set<String> MODES = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList( |
| 134 | "rw", // READ AND WRITE |
| 135 | "wo", // WRITE ONLY |
| 136 | "ro" // READ ONLY |
| 137 | ))); |
| 138 | /** |
| 139 | * Creates a new ReadWriteModeValidator |
| 140 | */ |
| 141 | public ReadWriteModeValidator() { |
| 142 | |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * {@inheritDoc} |
| 147 | * @see net.opentsdb.tools.ArgValueValidator#validate(net.opentsdb.tools.ConfigArgP.ConfigurationItem) |
| 148 | */ |
| 149 | @Override |
| 150 | public void validate(final ConfigurationItem citem) { |
| 151 | try { |
| 152 | final String _mode = citem.getValue(); |
| 153 | if(!MODES.contains(_mode)) throw new Exception(); |
| 154 | } catch (Exception ex) { |
| 155 | throw new IllegalArgumentException("Invalid ReadWrite Mode [" + citem.getValue() + "] for " + citem.getName()); |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * <p>Title: ClassListValidator</p> |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…