propsConf.put(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(), org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST .getKey()); propsConf.put(ClientProperty.INSTANCE_ZOOKEEPERS_TIMEOUT.getKey(), org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.INSTANCE_ZK_TIMEOUT .getKey()); propsConf.put(ClientProperty.SSL_ENABLED.getKey(), org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.INSTANCE_RPC_SSL_ENABLED .getKey()); propsConf.put(ClientProperty.SSL_KEYSTORE_PATH.getKey(), org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_PATH .getKey()); propsConf.put(ClientProperty.SSL_KEYSTORE_TYPE.getKey(), org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_TYPE .getKey()); propsConf.put(ClientProperty.SSL_KEYSTORE_PASSWORD.getKey(), org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_PASSWORD .getKey()); propsConf.put(ClientProperty.SSL_TRUSTSTORE_PATH.getKey(), org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_PATH .getKey()); propsConf.put(ClientProperty.SSL_TRUSTSTORE_TYPE.getKey(), org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_TYPE .getKey()); propsConf.put(ClientProperty.SSL_TRUSTSTORE_PASSWORD.getKey(), org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_PASSWORD .getKey()); propsConf.put(ClientProperty.SSL_USE_JSSE.getKey(), org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.RPC_USE_JSSE.getKey());
/** * Show whether SASL has been set on this configuration. * * @since 1.9.0 */ public boolean hasSasl() { return compositeConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), Boolean.parseBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getDefaultValue())); }
clientConf.setProperty(prop, clusterClientConf.get(prop.getKey()));
protected static Map<String,String> getProperties(AccumuloConfiguration conf) { final Map<String,String> clientProperties = new HashMap<>(); // Servers will only have the full principal in their configuration -- parse the // primary and realm from it. final String serverPrincipal = conf.get(Property.GENERAL_KERBEROS_PRINCIPAL); final KerberosName krbName; try { krbName = new KerberosName(serverPrincipal); clientProperties.put(ClientProperty.KERBEROS_SERVER_PRIMARY.getKey(), krbName.getServiceName()); } catch (Exception e) { // bad value or empty, assume we're not using kerberos } HashSet<String> clientKeys = new HashSet<>(); for (ClientProperty prop : ClientProperty.values()) { clientKeys.add(prop.getKey()); } String key; for (Entry<String,String> entry : conf) { key = entry.getKey(); if (clientKeys.contains(key)) { clientProperties.put(key, entry.getValue()); } } return clientProperties; }
if (!clientConfig.containsKey(ClientProperty.INSTANCE_ZK_HOST.getKey())) { AccumuloConfiguration siteConf = SiteConfiguration.getInstance(); clientConfig.withZkHosts(siteConf.get(Property.INSTANCE_ZK_HOST));
/** * Gets all properties under the given prefix in this configuration. * * @param property * prefix property, must be of type PropertyType.PREFIX * @return a map of property keys to values * @throws IllegalArgumentException * if property is not a prefix */ public Map<String,String> getAllPropertiesWithPrefix(ClientProperty property) { checkType(property, PropertyType.PREFIX); Map<String,String> propMap = new HashMap<>(); String prefix = property.getKey(); if (prefix.endsWith(".")) { prefix = prefix.substring(0, prefix.length() - 1); } Iterator<?> iter = this.getKeys(prefix); while (iter.hasNext()) { String p = (String) iter.next(); propMap.put(p, getString(p)); } return propMap; }
/** * Get the ZooKeepers. Use the value passed in (if there was one), then fall back to the * ClientConf, finally trying the accumulo-site.xml. * * @param keepers * ZooKeepers passed to the shell * @param clientConfig * ClientConfiguration instance * @return The ZooKeepers to connect to */ static String getZooKeepers(String keepers, ClientConfiguration clientConfig) { if (null != keepers) { return keepers; } if (clientConfig.containsKey(ClientProperty.INSTANCE_ZK_HOST.getKey())) { return clientConfig.get(ClientProperty.INSTANCE_ZK_HOST); } return SiteConfiguration.getInstance().get(Property.INSTANCE_ZK_HOST); }
public String getZooKeepers() { if (clientConf.containsKey(ClientProperty.INSTANCE_ZK_HOST.getKey())) { return clientConf.get(ClientProperty.INSTANCE_ZK_HOST); } String zookeepers = conf.get(ACCUMULO_STANDALONE_ZOOKEEPERS_KEY); if (null == zookeepers) { zookeepers = ACCUMULO_STANDALONE_ZOOKEEPERS_DEFAULT; } return zookeepers; }
/** * Same as {@link #setProperty(ClientProperty, String)} but returns the ClientConfiguration for * chaining purposes */ public ClientConfiguration with(ClientProperty prop, String value) { return with(prop.getKey(), value); }
public String getInstanceName() { if (clientConf.containsKey(ClientProperty.INSTANCE_NAME.getKey())) { return clientConf.get(ClientProperty.INSTANCE_NAME); } String instanceName = conf.get(ACCUMULO_STANDALONE_INSTANCE_NAME_KEY); if (null == instanceName) { instanceName = ACCUMULO_STANDALONE_INSTANCE_NAME_DEFAULT; } return instanceName; }
@Override public boolean apply(Entry<String,String> v) { return ClientConfiguration.ClientProperty.getPropertyByKey(v.getKey()) != null; } }));
/** * Show whether SASL has been set on this configuration. * * @since 1.9.0 */ public boolean hasSasl() { return getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), Boolean.parseBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getDefaultValue())); }
/** * Returns the value for prop, the default value if not present. * */ public String get(ClientProperty prop) { if (this.containsKey(prop.getKey())) return this.getString(prop.getKey()); else return prop.getDefaultValue(); }