ctubbsii commented on a change in pull request #419: #408 - Removed
ClientConfiguration from ClientOpts
URL: https://github.com/apache/accumulo/pull/419#discussion_r180585375
##########
File path: core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
##########
@@ -338,69 +276,66 @@ public void setSecurePassword(Password securePassword) {
this.securePassword = securePassword;
}
- public String getTokenClassName() {
- return tokenClassName;
+ public ConnectionInfo getConnectionInfo() {
+ if (cachedInfo == null) {
+ cachedInfo =
Connector.builder().usingProperties(getClientProperties()).info();
+ }
+ return cachedInfo;
}
public Connector getConnector() throws AccumuloException,
AccumuloSecurityException {
- return getInstance().getConnector(getPrincipal(), getToken());
- }
-
- public ClientConfiguration getClientConfiguration() throws
IllegalArgumentException {
- if (cachedClientConfig != null)
- return cachedClientConfig;
-
- ClientConfiguration clientConfig;
- try {
- if (clientConfigFile == null)
- clientConfig = ClientConfiguration.loadDefault();
- else
- clientConfig = ClientConfiguration.fromFile(new
File(clientConfigFile));
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
+ if (cachedConnector == null) {
+ cachedConnector =
Connector.builder().usingConnectionInfo(getConnectionInfo()).build();
}
- if (sslEnabled)
- clientConfig.setProperty(ClientProperty.INSTANCE_RPC_SSL_ENABLED,
"true");
-
- if (saslEnabled)
- clientConfig.setProperty(ClientProperty.INSTANCE_RPC_SASL_ENABLED,
"true");
+ return cachedConnector;
+ }
- if (siteFile != null) {
- AccumuloConfiguration config = new AccumuloConfiguration() {
- Configuration xml = new Configuration();
- {
- xml.addResource(new Path(siteFile));
+ public String getClientConfigFile() {
+ if (clientConfigFile == null) {
+ List<String> searchPaths = new LinkedList<>();
+ searchPaths.add(System.getProperty("user.home") +
"/.accumulo/accumulo-client.properties");
+ if (System.getenv("ACCUMULO_CONF_DIR") != null) {
Review comment:
This regresses in our attempt to phase out the use of environment variables
in our Java code.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services