synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); return cachedInstance = new ZooKeeperInstance(this.getClientConfiguration()); }
public static boolean isOnline(Connector conn) { return DeprecationUtil.isMockInstance(conn.getInstance()) || TableState.ONLINE == Tables.getTableState(conn.getInstance(), ID); }
/** * Central place to set common split configuration not handled by split constructors. The * intention is to make it harder to miss optional setters in future refactor. */ public static void updateSplit(RangeInputSplit split, Instance instance, InputTableConfig tableConfig, String principal, AuthenticationToken token, Authorizations auths, Level logLevel) { split.setInstanceName(instance.getInstanceName()); split.setZooKeepers(instance.getZooKeepers()); DeprecationUtil.setMockInstance(split, DeprecationUtil.isMockInstance(instance)); split.setPrincipal(principal); split.setToken(token); split.setAuths(auths); split.setFetchedColumns(tableConfig.getFetchedColumns()); split.setIterators(tableConfig.getIterators()); split.setLogLevel(logLevel); split.setSamplerConfiguration(tableConfig.getSamplerConfiguration()); }
/** * Initializes an Accumulo {@link TabletLocator} based on the configuration. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @param tableId * The table id for which to initialize the {@link TabletLocator} * @return an Accumulo tablet locator * @throws TableNotFoundException * if the table name set on the configuration doesn't exist * @since 1.6.0 */ public static TabletLocator getTabletLocator(Class<?> implementingClass, Configuration conf, String tableId) throws TableNotFoundException { String instanceType = conf.get(enumToConfKey(implementingClass, InstanceOpts.TYPE)); if ("MockInstance".equals(instanceType)) return DeprecationUtil.makeMockLocator(); Instance instance = getInstance(implementingClass, conf); ClientConfiguration clientConf = getClientConfiguration(implementingClass, conf); ClientContext context = new ClientContext(instance, new Credentials(getPrincipal(implementingClass, conf), getAuthenticationToken(implementingClass, conf)), clientConf); return TabletLocator.getLocator(context, tableId); }
/** * Initializes an Accumulo {@link Instance} based on the configuration. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @return an Accumulo instance * @since 1.6.0 * @see #setZooKeeperInstance(Class, Configuration, ClientConfiguration) */ public static Instance getInstance(Class<?> implementingClass, Configuration conf) { String instanceType = conf.get(enumToConfKey(implementingClass, InstanceOpts.TYPE), ""); if ("MockInstance".equals(instanceType)) return DeprecationUtil .makeMockInstance(conf.get(enumToConfKey(implementingClass, InstanceOpts.NAME))); else if ("ZooKeeperInstance".equals(instanceType)) { return new ZooKeeperInstance(getClientConfiguration(implementingClass, conf)); } else if (instanceType.isEmpty()) throw new IllegalStateException( "Instance has not been configured for " + implementingClass.getSimpleName()); else throw new IllegalStateException("Unrecognized instance type " + instanceType); }
/** * Get the credentials to use for this instance so it can be passed to the superclass during * construction. */ private static Credentials getCredentials(Instance instance) { if (DeprecationUtil.isMockInstance(instance)) { return new Credentials("mockSystemUser", new PasswordToken("mockSystemPassword")); } return SystemCredentials.get(instance); }
instance = DeprecationUtil.makeMockInstance(this.getClass().getName()); else { ClientConfiguration clientConf;
String tableId; if (DeprecationUtil.isMockInstance(instance)) { tableId = ""; } else { getClientConfiguration(context)); while (!tl.binRanges(clientContext, ranges, binnedRanges).isEmpty()) { if (!DeprecationUtil.isMockInstance(instance)) { if (!Tables.exists(instance, tableId)) throw new TableDeletedException(tableId);
@Override synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } return cachedInstance = new ZooKeeperInstance(this.getClientConfiguration()); }
String tableId; if (DeprecationUtil.isMockInstance(instance)) { tableId = ""; } else { getClientConfiguration(job)); while (!tl.binRanges(context, ranges, binnedRanges).isEmpty()) { if (!DeprecationUtil.isMockInstance(instance)) { if (!Tables.exists(instance, tableId)) throw new TableDeletedException(tableId);
@Override public Instance getInstance() { if (mock) return DeprecationUtil.makeMockInstance(instance); if (instance == null) { return HdfsZooInstance.getInstance(); } return new ZooKeeperInstance(this.getClientConfiguration()); } }
scanner = new OfflineScanner(instance, new Credentials(principal, token), baseSplit.getTableId(), authorizations); } else if (DeprecationUtil.isMockInstance(instance)) { scanner = instance.getConnector(principal, token) .createScanner(baseSplit.getTableName(), authorizations);
@Override synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } return cachedInstance = new ZooKeeperInstance(getClientConfiguration()); } }
scanner = new OfflineScanner(instance, new Credentials(principal, token), split.getTableId(), authorizations); } else if (DeprecationUtil.isMockInstance(instance)) { scanner = instance.getConnector(principal, token).createScanner(split.getTableName(), authorizations);
instance = DeprecationUtil.makeMockInstance("fake"); } else { String instanceName, hosts;
public Instance getInstance(ClientConfiguration base) { if (null == instanceName) { return null; } if (isMockInstance()) { return DeprecationUtil.makeMockInstance(getInstanceName()); } if (null == zooKeepers) { return null; } return new ZooKeeperInstance(base.withInstance(getInstanceName()).withZkHosts(getZooKeepers())); }