public static boolean isValidMultilines(final CsvDatastore datastore) { final CsvConfiguration csvConfiguration = datastore.getCsvConfiguration(); if (csvConfiguration.isMultilineValues()) { return false; } return true; }
public static boolean isValidEnconding(final CsvDatastore datastore) { final CsvConfiguration csvConfiguration = datastore.getCsvConfiguration(); final String encoding = csvConfiguration.getEncoding(); if (!encoding.equals(FileHelper.UTF_8_ENCODING)) { return false; } return true; }
@Override protected UsageAwareDatastoreConnection<UpdateableDataContext> createDatastoreConnection() { final UpdateableDataContext dataContext; final Resource resource = getResource(); if (resource == null) { logger.warn("Resource was not available, a local file reference will be created with path: {}", _filename); dataContext = new CsvDataContext(new File(_filename), getCsvConfiguration()); } else { dataContext = new CsvDataContext(resource, getCsvConfiguration()); } return new UpdateableDatastoreConnectionImpl<>(dataContext, this); }
/** * Creates a {@link Datastore} replacement to use for configured properties * * @param cb * @param datastore * @param replacementResource * @return a replacement datastore, or null if it shouldn't be replaced */ private ResourceDatastore createReplacementDatastore(final ComponentBuilder cb, final ResourceDatastore datastore, final Resource replacementResource) { final String name = datastore.getName(); if (datastore instanceof CsvDatastore) { final CsvConfiguration csvConfiguration = ((CsvDatastore) datastore).getCsvConfiguration(); return new CsvDatastore(name, replacementResource, csvConfiguration); } if (datastore instanceof JsonDatastore) { return new JsonDatastore(name, replacementResource, ((JsonDatastore) datastore).getSchemaBuilder()); } logger.warn("Could not replace datastore '{}' because it is of an unsupported type: ", name, datastore.getClass().getSimpleName()); return datastore; }
final String datastorePath = resource.getQualifiedPath(); final CsvConfiguration csvConfiguration = csvDatastore.getCsvConfiguration();