public ClientInfoImpl(Path propertiesFile) { this(ClientInfoImpl.toProperties(propertiesFile)); }
/** * @return ClientInfo given properties */ static ClientInfo from(Properties properties) { return new ClientInfoImpl(properties); }
@Override public String getInstanceName() { return getString(ClientProperty.INSTANCE_NAME); }
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "code runs in same security context as user who provided propertiesFilePath") public static Properties toProperties(String propertiesFilePath) { return toProperties(Paths.get(propertiesFilePath)); }
/** * @return ClientInfo given path to client config file */ static ClientInfo from(Path propertiesFile) { return new ClientInfoImpl(propertiesFile); } }
@Override public String getZooKeepers() { return getString(ClientProperty.INSTANCE_ZOOKEEPERS); }
@Override public FromOptions<T> from(Path propertiesFile) { return from(ClientInfoImpl.toProperties(propertiesFile)); }
/** * @return ClientInfo given properties and token */ static ClientInfo from(Properties properties, AuthenticationToken token) { return new ClientInfoImpl(properties, token); }
@Override public String getPrincipal() { return getString(ClientProperty.AUTH_PRINCIPAL); }
@Override public FromOptions<T> from(String propertiesFilePath) { return from(ClientInfoImpl.toProperties(propertiesFilePath)); }
private ClientInfo getClientInfo() { if (token != null) { ClientProperty.validate(properties, false); return new ClientInfoImpl(properties, token); } ClientProperty.validate(properties); return new ClientInfoImpl(properties); }
@Override public boolean saslEnabled() { return Boolean.valueOf(getString(ClientProperty.SASL_ENABLED)); }
public Properties getClientProperties() { Properties props = new Properties(); if (getClientPropertiesFile() != null) { props = ClientInfoImpl.toProperties(getClientPropertiesFile()); } for (Map.Entry<String,String> entry : commandLineProperties.entrySet()) { props.setProperty(entry.getKey(), entry.getValue()); } if (useSsl) { props.setProperty(ClientProperty.SSL_ENABLED.getKey(), "true"); } if (useSasl) { props.setProperty(ClientProperty.SASL_ENABLED.getKey(), "true"); } if (!zooKeeperInstance.isEmpty()) { String instanceName = zooKeeperInstance.get(0); String hosts = zooKeeperInstance.get(1); props.setProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(), hosts); props.setProperty(ClientProperty.INSTANCE_NAME.getKey(), instanceName); } // If the user provided the hosts, set the ZK for tracing too if (zooKeeperHosts != null && !zooKeeperHosts.isEmpty()) { props.setProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(), zooKeeperHosts); } if (zooKeeperInstanceName != null && !zooKeeperInstanceName.isEmpty()) { props.setProperty(ClientProperty.INSTANCE_NAME.getKey(), zooKeeperInstanceName); } return props; }
@Override public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException { Properties properties = ClientConfConverter.toProperties(clientConf); properties.setProperty(ClientProperty.AUTH_PRINCIPAL.getKey(), principal); properties.setProperty(ClientProperty.INSTANCE_NAME.getKey(), getInstanceName()); return new org.apache.accumulo.core.clientImpl.ConnectorImpl( new ClientContext(new ClientInfoImpl(properties, token))); }
cachedProps = new Properties(); if (getClientConfigFile() != null) { cachedProps = ClientInfoImpl.toProperties(getClientConfigFile());