mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
move some doc apis to core API layer
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package io.nosqlbench.docsys;
|
||||
|
||||
import io.nosqlbench.docsys.api.Docs;
|
||||
import io.nosqlbench.docsys.api.DocsBinder;
|
||||
import io.nosqlbench.docapi.Docs;
|
||||
import io.nosqlbench.docapi.DocsBinder;
|
||||
import io.nosqlbench.docsys.api.DocsysStaticManifest;
|
||||
|
||||
//@Service(DocsysStaticManifest.class)
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
package io.nosqlbench.docsys.api;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* DocsInfo is a manifest view of a set of namespaces and included
|
||||
* paths. The namespaces act as content slots to allow content to be
|
||||
* managed by different layers of artifacts. For example, a downstream
|
||||
* artifact can replace a context by replacing the same-named namespace.
|
||||
*
|
||||
* <pre>{@code
|
||||
* docsinfo = {
|
||||
* 'namespaces': [
|
||||
* {
|
||||
* 'namespace': 'example-namespace-1',
|
||||
* 'paths': ['path1','path2']
|
||||
* },
|
||||
* {
|
||||
* 'namespace': 'example-namespace-2',
|
||||
* 'paths': ['path-foo','other-path']
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* Internally, The namespace entries are represented by {@link DocsNameSpace} types.
|
||||
*/
|
||||
public interface DocsBinder extends Iterable<DocsNameSpace> {
|
||||
|
||||
/**
|
||||
* The result of merging two DocsInfo elements together
|
||||
* is a combined DocsInfo element with all unique namespaces
|
||||
* occurring exactly once, and with the other namespace overwriting
|
||||
* same-named namespaces in the original element.
|
||||
*
|
||||
* @param other The DocsInfo containing namespaces to overlay into this DocsInfo
|
||||
* @return
|
||||
*/
|
||||
DocsBinder merge(DocsBinder other);
|
||||
|
||||
/**
|
||||
* The result of merging a DocPathInfo entry into a DocsInfo element
|
||||
* is the combined DocsInfo element with the added entry overwriting
|
||||
* any namespace of the same name.
|
||||
*
|
||||
* @param other The namespace entry to overlay into this DocsInfo
|
||||
* @return
|
||||
*/
|
||||
DocsBinder merge(DocsNameSpace other);
|
||||
|
||||
/**
|
||||
* The result of removing a set of namespaces from a DocsInfo element
|
||||
* is a new DocsInfo element containing only the namespaces which were
|
||||
* removed. The original DocsInfo element is modified statefully in this
|
||||
* case. It is not an error to remove namespaces which are not present
|
||||
* in the original DocsInfo. If this condition is important, check for it
|
||||
* manually.
|
||||
*
|
||||
* @param namespaces The names of the namespaces to remove, should they
|
||||
* be present.
|
||||
* @return A new DocsInfo object representing what was actually removed.
|
||||
*/
|
||||
DocsBinder remove(Set<String> namespaces);
|
||||
|
||||
/**
|
||||
* @return All paths in all namespaces are returned, in no guaranteed order.
|
||||
*/
|
||||
List<Path> getPaths();
|
||||
|
||||
/**
|
||||
* @return A map of all namespaces to each set of provided paths is returned.
|
||||
*/
|
||||
Map<String, Set<Path>> getPathMap();
|
||||
|
||||
List<DocsNameSpace> getNamespaces();
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package io.nosqlbench.docsys.api;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Doc Path Info represents a readable Path which is part of a well-known
|
||||
* namespace.
|
||||
*
|
||||
* <pre>{@code
|
||||
* docpathinfo = {
|
||||
* 'namespace': 'example-namespace',
|
||||
* 'paths': ['path1', 'path2']
|
||||
* }
|
||||
*
|
||||
* }</pre>
|
||||
*
|
||||
* When callers are using doc paths from this interface, it is an error for
|
||||
* there to be multiple instance of a doc path of the same name in the same
|
||||
* namespace. As long as the root path of a doc tree is unique within the
|
||||
* given namespaces, they may be merged. This is to allow multiple contributors
|
||||
* of detailed docs to a single known namespace.
|
||||
*
|
||||
*/
|
||||
public interface DocsNameSpace extends Iterable<Path> {
|
||||
|
||||
/**
|
||||
* A simple name which can be used to nest the enclosed path within a larger
|
||||
* namespace. Users of this interface should never host content from the path
|
||||
* at a root level separate from the namespace.
|
||||
*
|
||||
* @return A canonical namespace identifier
|
||||
*/
|
||||
String getName();
|
||||
|
||||
List<Path> getPaths();
|
||||
|
||||
boolean isEnabledByDefault();
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package io.nosqlbench.docsys.api;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
|
||||
public class DocsNameSpaceImpl implements DocsNameSpace {
|
||||
|
||||
private final Set<Path> paths = new HashSet<>();
|
||||
private String namespace;
|
||||
private boolean enabledByDefault = false;
|
||||
|
||||
public DocsNameSpaceImpl() {}
|
||||
|
||||
public static DocsNameSpaceImpl of(String descriptiveName, Path path) {
|
||||
return new DocsNameSpaceImpl().setNameSpace(descriptiveName).addPath(path);
|
||||
}
|
||||
|
||||
private DocsNameSpaceImpl setNameSpace(String namespace) {
|
||||
this.namespace = namespace;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DocsNameSpaceImpl(String name) {
|
||||
this.namespace = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Path> getPaths() {
|
||||
return new ArrayList<>(this.paths);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledByDefault() {
|
||||
return enabledByDefault;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DocPath{" +
|
||||
"namespace='" + namespace + '\'' +
|
||||
",paths=" + paths.toString() +
|
||||
'}';
|
||||
}
|
||||
|
||||
public DocsNameSpaceImpl addPath(Path path) {
|
||||
this.paths.add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DocsNameSpaceImpl enabledByDefault() {
|
||||
this.enabledByDefault=true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Path> iterator() {
|
||||
return this.paths.iterator();
|
||||
}
|
||||
|
||||
public DocsNameSpaceImpl setEnabledByDefault(boolean enabledByDefault) {
|
||||
this.enabledByDefault=enabledByDefault;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.nosqlbench.docsys.api;
|
||||
|
||||
import io.nosqlbench.docapi.DocsBinder;
|
||||
import io.nosqlbench.docsys.endpoints.DocsysMarkdownEndpoint;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.nosqlbench.docsys.api;
|
||||
|
||||
import io.nosqlbench.docapi.DocsBinder;
|
||||
|
||||
/**
|
||||
* At runtime, any instances of this service will be used to find
|
||||
* paths to be hosted as static content.
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package io.nosqlbench.docsys.core;
|
||||
|
||||
import io.nosqlbench.docsys.api.*;
|
||||
import io.nosqlbench.docapi.*;
|
||||
import io.nosqlbench.docsys.api.DocsysDynamicManifest;
|
||||
import io.nosqlbench.docsys.api.DocsysStaticManifest;
|
||||
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
@@ -29,4 +31,6 @@ public class DocsysPathLoader {
|
||||
}
|
||||
return docs;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.nosqlbench.docsys.core;
|
||||
|
||||
import io.nosqlbench.docsys.DocsysDefaultAppPath;
|
||||
import io.nosqlbench.docsys.api.Docs;
|
||||
import io.nosqlbench.docapi.Docs;
|
||||
import io.nosqlbench.docsys.api.WebServiceObject;
|
||||
import io.nosqlbench.docsys.handlers.FavIconHandler;
|
||||
import io.nosqlbench.nb.annotations.Maturity;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.nosqlbench.docsys.endpoints;
|
||||
|
||||
import io.nosqlbench.docsys.api.Docs;
|
||||
import io.nosqlbench.docsys.api.DocsBinder;
|
||||
import io.nosqlbench.docsys.api.DocsNameSpace;
|
||||
import io.nosqlbench.docapi.Docs;
|
||||
import io.nosqlbench.docapi.DocsBinder;
|
||||
import io.nosqlbench.docapi.DocsNameSpace;
|
||||
import io.nosqlbench.docsys.api.WebServiceObject;
|
||||
import io.nosqlbench.docsys.core.DocsysPathLoader;
|
||||
import io.nosqlbench.docsys.core.PathWalker;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
## Basic Markdown File
|
||||
|
||||
- item 1.
|
||||
- item 2.
|
||||
|
||||
1. numbered item 1
|
||||
2. numbered item 2
|
||||
|
||||
## a list of files:
|
||||
|
||||
{{files}}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
title: topic1
|
||||
---
|
||||
|
||||
## Topic1 Heading1
|
||||
|
||||
This is a topic at `basics/section1/topic1`
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Section 2 Topic 1
|
||||
---
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,8 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>A title</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Some content in the body.
|
||||
</BODY>
|
||||
</HTML>
|
||||
Reference in New Issue
Block a user