return !isDirectory && file.endsWith(".properties");
}
@Override
public PropertyFileDescriptor scanFile(Store store, StreamSource streamSource) throws IOException {
PropertyFileDescriptor propertyFileDescriptor = store.create(PropertyFileDescriptor.class);
String filename = streamSource.getSystemId();
propertyFileDescriptor.setFileName(filename);
Properties properties = new Properties();
properties.load(streamSource.getInputStream());
for (String name : properties.stringPropertyNames()) {
String value = properties.getProperty(name);
PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
propertyDescriptor.setName(name);
propertyDescriptor.setValue(value);
propertyFileDescriptor.getProperties().add(propertyDescriptor);
}
return propertyFileDescriptor;
}