Skip to content

Commit

Permalink
Merge branch 'master' of github.com:apache/accumulo
Browse files Browse the repository at this point in the history
  • Loading branch information
keith-turner committed Feb 14, 2019
2 parents 20bea33 + c966961 commit 6ab7569
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
Expand Up @@ -102,7 +102,7 @@ void pageHeader() {

@Override
void property(ClientProperty prop) {
Objects.nonNull(prop);
Objects.requireNonNull(prop);
doc.print("| <a name=\"" + prop.getKey().replace(".", "_") + "\" class=\"prop\"></a> "
+ prop.getKey() + " | ");
String defaultValue = sanitize(prop.getDefaultValue()).trim();
Expand Down Expand Up @@ -163,7 +163,7 @@ void property(ClientProperty prop) {
private final TreeMap<String,ClientProperty> sortedProps = new TreeMap<>();

private ClientConfigGenerate(PrintStream doc) {
Objects.nonNull(doc);
Objects.requireNonNull(doc);
this.doc = doc;
for (ClientProperty prop : ClientProperty.values()) {
this.sortedProps.put(prop.getKey(), prop);
Expand All @@ -190,14 +190,15 @@ private void generateConfigFile() {
public static void main(String[] args)
throws FileNotFoundException, UnsupportedEncodingException {
if (args.length == 2) {
ClientConfigGenerate clientConfigGenerate = new ClientConfigGenerate(
new PrintStream(args[1], UTF_8.name()));
if (args[0].equals("--generate-markdown")) {
clientConfigGenerate.generateMarkdown();
return;
} else if (args[0].equals("--generate-config")) {
clientConfigGenerate.generateConfigFile();
return;
try (PrintStream stream = new PrintStream(args[1], UTF_8.name())) {
ClientConfigGenerate clientConfigGenerate = new ClientConfigGenerate(stream);
if (args[0].equals("--generate-markdown")) {
clientConfigGenerate.generateMarkdown();
return;
} else if (args[0].equals("--generate-config")) {
clientConfigGenerate.generateConfigFile();
return;
}
}
}
throw new IllegalArgumentException("Usage: " + ClientConfigGenerate.class.getName()
Expand Down
15 changes: 5 additions & 10 deletions proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java
Expand Up @@ -136,12 +136,6 @@ public void execute(final String[] args) throws Exception {
boolean useMini = Boolean
.parseBoolean(proxyProps.getProperty(USE_MINI_ACCUMULO_KEY, USE_MINI_ACCUMULO_DEFAULT));

if (!useMini && clientProps == null) {
System.err.println("The '-c' option must be set with an accumulo-client.properties file or"
+ " proxy.properties must contain either useMiniAccumulo=true");
System.exit(1);
}

if (!proxyProps.containsKey("port")) {
System.err.println("No port property");
System.exit(1);
Expand All @@ -152,10 +146,7 @@ public void execute(final String[] args) throws Exception {
final File folder = Files.createTempDirectory(System.currentTimeMillis() + "").toFile();
final MiniAccumuloCluster accumulo = new MiniAccumuloCluster(folder, "secret");
accumulo.start();
clientProps.setProperty(ClientProperty.INSTANCE_NAME.getKey(),
accumulo.getConfig().getInstanceName());
clientProps.setProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(),
accumulo.getZooKeepers());
clientProps = accumulo.getClientProperties();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void start() {
Expand All @@ -169,6 +160,10 @@ public void start() {
}
}
});
} else if (clientProps == null) {
System.err.println("The '-c' option must be set with an accumulo-client.properties file or"
+ " proxy.properties must contain either useMiniAccumulo=true");
System.exit(1);
}

Class<? extends TProtocolFactory> protoFactoryClass = Class
Expand Down
Expand Up @@ -298,7 +298,7 @@ public List<Short> check(Environment env, Mutation mutation) {
}

protected Arbitrator getArbitrator(ServerContext context) {
Objects.nonNull(context);
Objects.requireNonNull(context);
return new ZooArbitrator(context);
}

Expand Down
2 changes: 1 addition & 1 deletion shell/src/main/java/org/apache/accumulo/shell/Shell.java
Expand Up @@ -657,7 +657,7 @@ public void printVerboseInfo() throws IOException {
}

public String getDefaultPrompt() {
Objects.nonNull(accumuloClient);
Objects.requireNonNull(accumuloClient);
ClientInfo info = ClientInfo.from(accumuloClient.properties());
return accumuloClient.whoami() + "@" + info.getInstanceName()
+ (getTableName().isEmpty() ? "" : " ") + getTableName() + "> ";
Expand Down

0 comments on commit 6ab7569

Please sign in to comment.