Search in sources :

Example 1 with DocsBinder

use of io.nosqlbench.docapi.DocsBinder in project nosqlbench by nosqlbench.

the class BundledMarkdownZipExporter method exportDocs.

public void exportDocs(Path out) {
    ZipOutputStream zipstream;
    try {
        OutputStream stream = Files.newOutputStream(out, StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
        zipstream = new ZipOutputStream(stream);
        zipstream.setMethod(ZipOutputStream.DEFLATED);
        zipstream.setLevel(9);
        DocsBinder docsNameSpaces = BundledMarkdownLoader.loadBundledMarkdown();
        for (DocsNameSpace docs_ns : docsNameSpaces) {
            for (Path p : docs_ns) {
                addEntry(p, p.getParent(), zipstream);
            }
        }
        zipstream.finish();
        stream.close();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : Path(java.nio.file.Path) DocsNameSpace(io.nosqlbench.docapi.DocsNameSpace) ZipOutputStream(java.util.zip.ZipOutputStream) OutputStream(java.io.OutputStream) ZipOutputStream(java.util.zip.ZipOutputStream) IOException(java.io.IOException) DocsBinder(io.nosqlbench.docapi.DocsBinder)

Example 2 with DocsBinder

use of io.nosqlbench.docapi.DocsBinder in project nosqlbench by nosqlbench.

the class BundledDriverAdapterDocs method getDocs.

@Override
public DocsBinder getDocs() {
    Docs docs = new Docs().namespace("adapter-docs");
    SimpleServiceLoader<DriverAdapter> loader = new SimpleServiceLoader<>(DriverAdapter.class, Maturity.Any);
    List<SimpleServiceLoader.Component<? extends DriverAdapter>> namedProviders = loader.getNamedProviders();
    for (SimpleServiceLoader.Component<? extends DriverAdapter> namedProvider : namedProviders) {
        DriverAdapter driverAdapter = namedProvider.provider.get();
        DocsBinder bundledDocs = driverAdapter.getBundledDocs();
        docs.merge(bundledDocs);
    }
    return docs;
}
Also used : SimpleServiceLoader(io.nosqlbench.nb.api.spi.SimpleServiceLoader) Docs(io.nosqlbench.docapi.Docs) DocsBinder(io.nosqlbench.docapi.DocsBinder)

Aggregations

DocsBinder (io.nosqlbench.docapi.DocsBinder)2 Docs (io.nosqlbench.docapi.Docs)1 DocsNameSpace (io.nosqlbench.docapi.DocsNameSpace)1 SimpleServiceLoader (io.nosqlbench.nb.api.spi.SimpleServiceLoader)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 Path (java.nio.file.Path)1 ZipOutputStream (java.util.zip.ZipOutputStream)1