Search in sources :

Example 1 with DocsNameSpace

use of io.nosqlbench.docapi.DocsNameSpace 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 DocsNameSpace

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

the class DocsysMarkdownEndpoint method enable.

private void enable(Set<String> enabled) {
    for (DocsNameSpace nsinfo : docsinfo) {
        // add namespaces which are neither enabled nor disabled to the default group
        if (nsinfo.isEnabledByDefault()) {
            if (disabled != null && disabled.getPathMap().containsKey(nsinfo.getName())) {
                continue;
            }
            enables.add(nsinfo.getName());
        }
    }
    if (enabled.isEmpty()) {
        // Nothing is enabled or enabled by default, so enable everything
        this.enabled = new Docs().merge(docsinfo);
        this.disabled = new Docs().asDocsBinder();
    } else {
        // At least one thing was enabled by default, or previously enabled specifically
        this.disabled = new Docs().merge(docsinfo);
        this.enabled = disabled.remove(enabled);
    }
}
Also used : DocsNameSpace(io.nosqlbench.docapi.DocsNameSpace) Docs(io.nosqlbench.docapi.Docs)

Aggregations

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