mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
allow specification of workspaces directory
This commit is contained in:
parent
f16f3fb325
commit
f6108fef14
@ -1,5 +1,6 @@
|
|||||||
package io.nosqlbench.docsys.core;
|
package io.nosqlbench.docsys.core;
|
||||||
|
|
||||||
|
import io.nosqlbench.docsys.endpoints.DocsysMarkdownEndpoint;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@ -88,7 +89,7 @@ public class DocServerApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void runServer(String[] serverArgs) {
|
private static void runServer(String[] serverArgs) {
|
||||||
DocServer server = new DocServer();
|
NBWebServer server = new NBWebServer();
|
||||||
for (int i = 0; i < serverArgs.length; i++) {
|
for (int i = 0; i < serverArgs.length; i++) {
|
||||||
String arg = serverArgs[i];
|
String arg = serverArgs[i];
|
||||||
if (arg.matches(".*://.*")) {
|
if (arg.matches(".*://.*")) {
|
||||||
|
@ -41,9 +41,9 @@ import java.util.stream.Collectors;
|
|||||||
/**
|
/**
|
||||||
* For examples, see <a href="https://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/examples/embedded/src/main/java/org/eclipse/jetty/embedded/">embedded examples</a>
|
* For examples, see <a href="https://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/examples/embedded/src/main/java/org/eclipse/jetty/embedded/">embedded examples</a>
|
||||||
*/
|
*/
|
||||||
public class DocServer implements Runnable {
|
public class NBWebServer implements Runnable {
|
||||||
|
|
||||||
private final static Logger logger = LogManager.getLogger(DocServer.class);
|
private final static Logger logger = LogManager.getLogger(NBWebServer.class);
|
||||||
|
|
||||||
private final List<Path> basePaths = new ArrayList<>();
|
private final List<Path> basePaths = new ArrayList<>();
|
||||||
private final List<Class> servletClasses = new ArrayList<>();
|
private final List<Class> servletClasses = new ArrayList<>();
|
||||||
@ -55,17 +55,29 @@ public class DocServer implements Runnable {
|
|||||||
private String bindHost = "localhost";
|
private String bindHost = "localhost";
|
||||||
private int bindPort = 12345;
|
private int bindPort = 12345;
|
||||||
|
|
||||||
public DocServer withHost(String bindHost) {
|
private Map<String,Object> contextParams = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
public NBWebServer withContextParams(Map<String,Object> cp) {
|
||||||
|
this.contextParams.putAll(cp);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBWebServer withContextParam(String name, Object object) {
|
||||||
|
this.contextParams.put(name, object);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBWebServer withHost(String bindHost) {
|
||||||
this.bindHost = bindHost;
|
this.bindHost = bindHost;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DocServer withPort(int bindPort) {
|
public NBWebServer withPort(int bindPort) {
|
||||||
this.bindPort = bindPort;
|
this.bindPort = bindPort;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DocServer withURL(String urlSpec) {
|
public NBWebServer withURL(String urlSpec) {
|
||||||
try {
|
try {
|
||||||
URL url = new URL(urlSpec);
|
URL url = new URL(urlSpec);
|
||||||
this.bindPort = url.getPort();
|
this.bindPort = url.getPort();
|
||||||
@ -81,7 +93,7 @@ public class DocServer implements Runnable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DocServer withScheme(String scheme) {
|
public NBWebServer withScheme(String scheme) {
|
||||||
this.bindScheme = scheme;
|
this.bindScheme = scheme;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -129,7 +141,7 @@ public class DocServer implements Runnable {
|
|||||||
return servletHolder;
|
return servletHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DocServer addPaths(Path... paths) {
|
public NBWebServer addPaths(Path... paths) {
|
||||||
for (Path path : paths) {
|
for (Path path : paths) {
|
||||||
try {
|
try {
|
||||||
path.getFileSystem().provider().checkAccess(path, AccessMode.READ);
|
path.getFileSystem().provider().checkAccess(path, AccessMode.READ);
|
||||||
@ -216,6 +228,7 @@ public class DocServer implements Runnable {
|
|||||||
|
|
||||||
|
|
||||||
ResourceConfig rc = new ResourceConfig();
|
ResourceConfig rc = new ResourceConfig();
|
||||||
|
rc.addProperties(contextParams);
|
||||||
rc.property("server", this);
|
rc.property("server", this);
|
||||||
|
|
||||||
ServletContainer container = new ServletContainer(rc);
|
ServletContainer container = new ServletContainer(rc);
|
@ -2,11 +2,8 @@ package io.nosqlbench.engine.cli;
|
|||||||
|
|
||||||
import ch.qos.logback.classic.Level;
|
import ch.qos.logback.classic.Level;
|
||||||
import io.nosqlbench.engine.api.metrics.IndicatorMode;
|
import io.nosqlbench.engine.api.metrics.IndicatorMode;
|
||||||
import io.nosqlbench.engine.api.scenarios.NBCLIScenarioParser;
|
|
||||||
import io.nosqlbench.engine.api.util.Unit;
|
import io.nosqlbench.engine.api.util.Unit;
|
||||||
import io.nosqlbench.engine.core.script.Scenario;
|
import io.nosqlbench.engine.core.script.Scenario;
|
||||||
import io.nosqlbench.nb.api.content.Content;
|
|
||||||
import io.nosqlbench.nb.api.content.NBIO;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -54,6 +51,7 @@ public class NBCLIOptions {
|
|||||||
|
|
||||||
private static final String SESSION_NAME = "--session-name";
|
private static final String SESSION_NAME = "--session-name";
|
||||||
private static final String LOGS_DIR = "--logs-dir";
|
private static final String LOGS_DIR = "--logs-dir";
|
||||||
|
private static final String WORKSPACES_DIR = "--workspaces-dir";
|
||||||
private static final String LOGS_MAX = "--logs-max";
|
private static final String LOGS_MAX = "--logs-max";
|
||||||
private static final String LOGS_LEVEL = "--logs-level";
|
private static final String LOGS_LEVEL = "--logs-level";
|
||||||
private static final String DASH_V_INFO = "-v";
|
private static final String DASH_V_INFO = "-v";
|
||||||
@ -99,6 +97,7 @@ public class NBCLIOptions {
|
|||||||
private final List<String> classicHistoConfigs = new ArrayList<>();
|
private final List<String> classicHistoConfigs = new ArrayList<>();
|
||||||
private String progressSpec = "console:1m";
|
private String progressSpec = "console:1m";
|
||||||
private String logsDirectory = "logs";
|
private String logsDirectory = "logs";
|
||||||
|
private String workspacesDirectory = "workspaces";
|
||||||
private boolean wantsInputTypes = false;
|
private boolean wantsInputTypes = false;
|
||||||
private boolean wantsMarkerTypes = false;
|
private boolean wantsMarkerTypes = false;
|
||||||
private String[] rleDumpOptions = new String[0];
|
private String[] rleDumpOptions = new String[0];
|
||||||
@ -209,6 +208,10 @@ public class NBCLIOptions {
|
|||||||
arglist.removeFirst();
|
arglist.removeFirst();
|
||||||
logsDirectory = readWordOrThrow(arglist, "a log directory");
|
logsDirectory = readWordOrThrow(arglist, "a log directory");
|
||||||
break;
|
break;
|
||||||
|
case WORKSPACES_DIR:
|
||||||
|
arglist.removeFirst();
|
||||||
|
workspacesDirectory = readWordOrThrow(arglist, "a workspaces directory");
|
||||||
|
break;
|
||||||
case HDR_DIGITS:
|
case HDR_DIGITS:
|
||||||
arglist.removeFirst();
|
arglist.removeFirst();
|
||||||
hdr_digits = Integer.parseInt(readWordOrThrow(arglist, "significant digits"));
|
hdr_digits = Integer.parseInt(readWordOrThrow(arglist, "significant digits"));
|
||||||
|
Loading…
Reference in New Issue
Block a user