use of com.hazelcast.jet.pipeline.file.impl.FileSourceFactory in project hazelcast by hazelcast.
the class FileSourceBuilder method buildMetaSupplier.
/**
* Builds a {@link ProcessorMetaSupplier} based on the current state of the
* builder. Use for integration with the Core API.
* <p>
* This method is a part of Core API and has lower backward-compatibility
* guarantees (we can change it in minor version).
*/
@Nonnull
public ProcessorMetaSupplier buildMetaSupplier() {
if (path == null) {
throw new IllegalStateException("Parameter 'path' is required");
}
if (format == null) {
throw new IllegalStateException("Parameter 'format' is required");
}
FileSourceConfiguration<T> fsc = new FileSourceConfiguration<>(path, glob, format, sharedFileSystem, ignoreFileNotFound, options);
if (shouldUseHadoop()) {
ServiceLoader<FileSourceFactory> loader = ServiceLoader.load(FileSourceFactory.class);
// Only one implementation is expected to be present on classpath
Iterator<FileSourceFactory> iterator = loader.iterator();
if (!iterator.hasNext()) {
throw new JetException("No suitable FileSourceFactory found. " + "Do you have Jet's Hadoop module on classpath?");
}
FileSourceFactory fileSourceFactory = iterator.next();
if (iterator.hasNext()) {
throw new JetException("Multiple FileSourceFactory implementations found");
}
return fileSourceFactory.create(fsc);
}
return new LocalFileSourceFactory().create(fsc);
}
Aggregations