205
206 // -- fstypes.properties --
207
208 private static final Object loadLock = new Object();
209 private static volatile Properties props;
210
211 enum FeatureStatus {
212 PRESENT,
213 NOT_PRESENT,
214 UNKNOWN;
215 }
216
217 /**
218 * Returns status to indicate if file system supports a given feature
219 */
220 FeatureStatus checkIfFeaturePresent(String feature) {
221 if (props == null) {
222 synchronized (loadLock) {
223 if (props == null) {
224 props = AccessController.doPrivileged(
225 new PrivilegedAction<Properties>() {
226 @Override
227 public Properties run() {
228 return loadProperties();
229 }});
230 }
231 }
232 }
233
234 String value = props.getProperty(type());
235 if (value != null) {
236 String[] values = value.split("\\s");
237 for (String s: values) {
238 s = s.trim().toLowerCase();
239 if (s.equals(feature)) {
240 return FeatureStatus.PRESENT;
241 }
242 if (s.startsWith("no")) {
243 s = s.substring(2);
244 if (s.equals(feature)) {
245 return FeatureStatus.NOT_PRESENT;
|
205
206 // -- fstypes.properties --
207
208 private static final Object loadLock = new Object();
209 private static volatile Properties props;
210
211 enum FeatureStatus {
212 PRESENT,
213 NOT_PRESENT,
214 UNKNOWN;
215 }
216
217 /**
218 * Returns status to indicate if file system supports a given feature
219 */
220 FeatureStatus checkIfFeaturePresent(String feature) {
221 if (props == null) {
222 synchronized (loadLock) {
223 if (props == null) {
224 props = AccessController.doPrivileged(
225 new PrivilegedAction<>() {
226 @Override
227 public Properties run() {
228 return loadProperties();
229 }});
230 }
231 }
232 }
233
234 String value = props.getProperty(type());
235 if (value != null) {
236 String[] values = value.split("\\s");
237 for (String s: values) {
238 s = s.trim().toLowerCase();
239 if (s.equals(feature)) {
240 return FeatureStatus.PRESENT;
241 }
242 if (s.startsWith("no")) {
243 s = s.substring(2);
244 if (s.equals(feature)) {
245 return FeatureStatus.NOT_PRESENT;
|