/** * Get the Accumulo username from the configuration object that is meant to * be used when connecting a {@link Connector} to Accumulo. * * @return The username if one could be found; otherwise {@code null}. */ public String getAccumuloUser(){ return get(CLOUDBASE_USER); }
AccumuloRdfConfiguration aConf = (AccumuloRdfConfiguration) conf; Instance instance; String instanceName = aConf.get("sc.cloudbase.instancename"); String user = aConf.get("sc.cloudbase.username"); String password = aConf.get("sc.cloudbase.password"); if(aConf.getBoolean(".useMockInstance", false)) { instance = new MockInstance(instanceName); } else { String zookeepers = aConf.get("sc.cloudbase.zookeepers"); instance = new ZooKeeperInstance(instanceName, zookeepers);
/** * Get a comma delimited list of the names of the Zookeeper servers from * the configuration object that is meant to be used when connecting a * {@link Connector} to Accumulo. * * @return The zookeepers list if one could be found; otherwise {@code null}. */ public String getAccumuloZookeepers() { return get(CLOUDBASE_ZOOKEEPERS); }
AccumuloRdfConfiguration aConf = (AccumuloRdfConfiguration) conf; Instance instance; String instanceName = aConf.get("sc.cloudbase.instancename"); String user = aConf.get("sc.cloudbase.username"); String password = aConf.get("sc.cloudbase.password"); if(aConf.getBoolean(".useMockInstance", false)) { instance = new MockInstance(instanceName); } else { String zookeepers = aConf.get("sc.cloudbase.zookeepers"); instance = new ZooKeeperInstance(instanceName, zookeepers);
/** * Get the Accumulo instance name from the configuration object that is * meant to be used when connecting a {@link Connector} to Accumulo. * * @return The instance name if one could be found; otherwise {@code null}. */ public String getAccumuloInstance() { return get(CLOUDBASE_INSTANCE); }
/** * Get the Accumulo username from the configuration object that is meant to * be used when connecting a {@link Connector} to Accumulo. * * @return The username if one could be found; otherwise {@code null}. */ public String getAccumuloUser(){ return get(CLOUDBASE_USER); }
/** * Get the Accumulo password from the configuration object that is meant to * be used when connecting a {@link Connector} to Accumulo. * * @return The password if one could be found; otherwise an empty string. */ public String getAccumuloPassword() { return get(CLOUDBASE_PASSWORD); }
/** * Get the Accumulo instance name from the configuration object that is * meant to be used when connecting a {@link Connector} to Accumulo. * * @return The instance name if one could be found; otherwise {@code null}. */ public String getAccumuloInstance() { return get(CLOUDBASE_INSTANCE); }
/** * Get a comma delimited list of the names of the Zookeeper servers from * the configuration object that is meant to be used when connecting a * {@link Connector} to Accumulo. * * @return The zookeepers list if one could be found; otherwise {@code null}. */ public String getAccumuloZookeepers() { return get(CLOUDBASE_ZOOKEEPERS); }
/** * Get the Accumulo password from the configuration object that is meant to * be used when connecting a {@link Connector} to Accumulo. * * @return The password if one could be found; otherwise an empty string. */ public String getAccumuloPassword() { return get(CLOUDBASE_PASSWORD); }
public IteratorSetting[] getAdditionalIterators(){ int size = Integer.valueOf(this.get(ITERATOR_SETTINGS_SIZE, "0")); if(size == 0) { return new IteratorSetting[0]; } IteratorSetting[] settings = new IteratorSetting[size]; for(int i = 0; i < size; i++) { String name = this.get(String.format(ITERATOR_SETTINGS_NAME, i)); String iteratorClass = this.get(String.format(ITERATOR_SETTINGS_CLASS, i)); int priority = Integer.valueOf(this.get(String.format(ITERATOR_SETTINGS_PRIORITY, i))); int optionsSize = Integer.valueOf(this.get(String.format(ITERATOR_SETTINGS_OPTIONS_SIZE, i))); Map<String, String> options = new HashMap<>(optionsSize); for(int j = 0; j < optionsSize; j++) { String key = this.get(String.format(ITERATOR_SETTINGS_OPTIONS_KEY, i, j)); String value = this.get(String.format(ITERATOR_SETTINGS_OPTIONS_VALUE, i, j)); options.put(key, value); } settings[i] = new IteratorSetting(priority, name, iteratorClass, options); } return settings; } }
public IteratorSetting[] getAdditionalIterators(){ final int size = Integer.valueOf(this.get(ITERATOR_SETTINGS_SIZE, "0")); if(size == 0) { return new IteratorSetting[0]; } final IteratorSetting[] settings = new IteratorSetting[size]; for(int i = 0; i < size; i++) { final String name = this.get(String.format(ITERATOR_SETTINGS_NAME, i)); final String iteratorClass = this.get(String.format(ITERATOR_SETTINGS_CLASS, i)); final int priority = Integer.valueOf(this.get(String.format(ITERATOR_SETTINGS_PRIORITY, i))); final int optionsSize = Integer.valueOf(this.get(String.format(ITERATOR_SETTINGS_OPTIONS_SIZE, i))); final Map<String, String> options = new HashMap<>(optionsSize); for(int j = 0; j < optionsSize; j++) { final String key = this.get(String.format(ITERATOR_SETTINGS_OPTIONS_KEY, i, j)); final String value = this.get(String.format(ITERATOR_SETTINGS_OPTIONS_VALUE, i, j)); options.put(key, value); } settings[i] = new IteratorSetting(priority, name, iteratorClass, options); } return settings; } }
/** * Creates an AccumuloRyaDAO after updating the AccumuloRdfConfiguration so that it is consistent * with the configuration of the RyaInstance that the user is trying to connect to. This ensures * that user configuration aligns with Rya instance configuration and prevents the creation of * new index tables based on a user's query configuration. This method requires the {@link AccumuloRyaInstanceDetailsRepository} * to exist. * * @param config - user's query configuration * @return - AccumuloRyaDAO with an updated configuration that is consistent with the Rya instance configuration * @throws AccumuloException * @throws AccumuloSecurityException * @throws RyaDAOException */ public static AccumuloRyaDAO getAccumuloDAOWithUpdatedConfig(final AccumuloRdfConfiguration config) throws AccumuloException, AccumuloSecurityException, RyaDAOException { final String ryaInstance = config.get(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX); Objects.requireNonNull(ryaInstance, "RyaInstance or table prefix is missing from configuration."+RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX); final String user = config.get(AccumuloRdfConfiguration.CLOUDBASE_USER); final String pswd = config.get(AccumuloRdfConfiguration.CLOUDBASE_PASSWORD); Objects.requireNonNull(user, "Accumulo user name is missing from configuration."+AccumuloRdfConfiguration.CLOUDBASE_USER); Objects.requireNonNull(pswd, "Accumulo user password is missing from configuration."+AccumuloRdfConfiguration.CLOUDBASE_PASSWORD); config.setTableLayoutStrategy( new TablePrefixLayoutStrategy(ryaInstance) ); updateAccumuloConfig(config, user, pswd, ryaInstance); return getAccumuloDAO(config); }
/** * Creates an AccumuloRyaDAO after updating the AccumuloRdfConfiguration so that it is consistent * with the configuration of the RyaInstance that the user is trying to connect to. This ensures * that user configuration aligns with Rya instance configuration and prevents the creation of * new index tables based on a user's query configuration. This method requires the {@link AccumuloRyaInstanceDetailsRepository} * to exist. * * @param config - user's query configuration * @return - AccumuloRyaDAO with an updated configuration that is consistent with the Rya instance configuration * @throws AccumuloException * @throws AccumuloSecurityException * @throws RyaDAOException */ public static AccumuloRyaDAO getAccumuloDAOWithUpdatedConfig(final AccumuloRdfConfiguration config) throws AccumuloException, AccumuloSecurityException, RyaDAOException { final String ryaInstance = config.get(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX); Objects.requireNonNull(ryaInstance, "RyaInstance or table prefix is missing from configuration."+RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX); final String user = config.get(AccumuloRdfConfiguration.CLOUDBASE_USER); final String pswd = config.get(AccumuloRdfConfiguration.CLOUDBASE_PASSWORD); Objects.requireNonNull(user, "Accumulo user name is missing from configuration."+AccumuloRdfConfiguration.CLOUDBASE_USER); Objects.requireNonNull(pswd, "Accumulo user password is missing from configuration."+AccumuloRdfConfiguration.CLOUDBASE_PASSWORD); config.setTableLayoutStrategy( new TablePrefixLayoutStrategy(ryaInstance) ); updateAccumuloConfig(config, user, pswd, ryaInstance); return getAccumuloDAO(config); }
/** * Prints the table with the specified config and additional settings. * @param tableName the name of the table to print. * @param config the {@link AccumuloRdfConfiguration}. * @param shouldAddCommonIterators {@code true} to add the common iterators to the table scanner. * {@code false} otherwise. * @param settings the additional {@link IteratorSetting}s to add besides the common ones. * @throws IOException */ public static void printTable(final String tableName, final AccumuloRdfConfiguration config, final boolean shouldAddCommonIterators, final IteratorSetting... settings) throws IOException { final Scanner scanner = AccumuloRyaUtils.getScanner(tableName, config, shouldAddCommonIterators); for (final IteratorSetting setting : settings) { scanner.addScanIterator(setting); } final Iterator<Entry<Key, Value>> iterator = scanner.iterator(); final String instance = config.get(MRUtils.AC_INSTANCE_PROP); log.info("=================="); log.info("TABLE: " + tableName + " INSTANCE: " + instance); log.info("------------------"); while (iterator.hasNext()) { final Entry<Key, Value> entry = iterator.next(); final Key key = entry.getKey(); final Value value = entry.getValue(); final String keyString = getFormattedKeyString(key); log.info(keyString + " - " + value); } log.info("=================="); }
/** * Prints the table with the specified config and additional settings. * @param tableName the name of the table to print. * @param config the {@link AccumuloRdfConfiguration}. * @param shouldAddCommonIterators {@code true} to add the common iterators to the table scanner. * {@code false} otherwise. * @param settings the additional {@link IteratorSetting}s to add besides the common ones. * @throws IOException */ public static void printTable(final String tableName, final AccumuloRdfConfiguration config, final boolean shouldAddCommonIterators, final IteratorSetting... settings) throws IOException { final Scanner scanner = AccumuloRyaUtils.getScanner(tableName, config, shouldAddCommonIterators); for (final IteratorSetting setting : settings) { scanner.addScanIterator(setting); } final Iterator<Entry<Key, Value>> iterator = scanner.iterator(); final String instance = config.get(MRUtils.AC_INSTANCE_PROP); log.info("=================="); log.info("TABLE: " + tableName + " INSTANCE: " + instance); log.info("------------------"); while (iterator.hasNext()) { final Entry<Key, Value> entry = iterator.next(); final Key key = entry.getKey(); final Value value = entry.getValue(); final String keyString = getFormattedKeyString(key); log.info(keyString + " - " + value); } log.info("=================="); }
/** * Prints the table with the specified config and additional settings. * @param tableName the name of the table to print. * @param config the {@link AccumuloRdfConfiguration}. * @param shouldAddCommonIterators {@code true} to add the common iterators to the table scanner. * {@code false} otherwise. * @param settings the additional {@link IteratorSetting}s to add besides the common ones. * @throws IOException */ public static void printTable(final String tableName, final AccumuloRdfConfiguration config, final boolean shouldAddCommonIterators, final IteratorSetting... settings) throws IOException { final Scanner scanner = AccumuloRyaUtils.getScanner(tableName, config, shouldAddCommonIterators); for (final IteratorSetting setting : settings) { scanner.addScanIterator(setting); } final Iterator<Entry<Key, Value>> iterator = scanner.iterator(); final String instance = config.get(MRUtils.AC_INSTANCE_PROP); log.info("=================="); log.info("TABLE: " + tableName + " INSTANCE: " + instance); log.info("------------------"); while (iterator.hasNext()) { final Entry<Key, Value> entry = iterator.next(); final Key key = entry.getKey(); final Value value = entry.getValue(); final String keyString = getFormattedKeyString(key); log.info(keyString + " - " + value); } log.info("=================="); }
private void createTableIfNeeded() throws MergerException { try { if (!doesMetadataTableExist()) { log.debug("Creating table: " + mergeParentMetadataTableName); connector.tableOperations().create(mergeParentMetadataTableName); log.debug("Created table: " + mergeParentMetadataTableName); log.debug("Granting authorizations to table: " + mergeParentMetadataTableName); final String username = accumuloRyaDao.getConf().get(MRUtils.AC_USERNAME_PROP); connector.securityOperations().grantTablePermission(username, mergeParentMetadataTableName, TablePermission.WRITE); log.debug("Granted authorizations to table: " + mergeParentMetadataTableName); } } catch (final TableExistsException | AccumuloException | AccumuloSecurityException e) { throw new MergerException("Could not create a new MergeParentMetadata table named: " + mergeParentMetadataTableName, e); } }
private void createTableIfNeeded() throws MergerException { try { if (!doesMetadataTableExist()) { log.debug("Creating table: " + mergeParentMetadataTableName); connector.tableOperations().create(mergeParentMetadataTableName); log.debug("Created table: " + mergeParentMetadataTableName); log.debug("Granting authorizations to table: " + mergeParentMetadataTableName); final String username = accumuloRyaDao.getConf().get(MRUtils.AC_USERNAME_PROP); connector.securityOperations().grantTablePermission(username, mergeParentMetadataTableName, TablePermission.WRITE); log.debug("Granted authorizations to table: " + mergeParentMetadataTableName); } } catch (final TableExistsException | AccumuloException | AccumuloSecurityException e) { throw new MergerException("Could not create a new MergeParentMetadata table named: " + mergeParentMetadataTableName, e); } }
final String authsStr = conf.get(ConfigUtils.CLOUDBASE_AUTHS); if(authsStr == null || authsStr.isEmpty()) { auths = new Authorizations();