MCPcopy
hub / github.com/OpenTSDB/opentsdb / ReadWriteModeValidator

Class ReadWriteModeValidator

src/tools/ConfigMetaType.java:131–158  ·  view source on GitHub ↗

Title: ReadWriteModeValidator Description: Validator for ReadWrite Modes

Source from the content-addressed store, hash-verified

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>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…