String principal = split.getPrincipal();
if (null == principal) {
principal = getPrincipal(attempt);
}
AuthenticationToken token = split.getToken();
if (null == token) {
String tokenClass = getTokenClass(attempt);
byte[] tokenBytes = getToken(attempt);
try {
token = CredentialHelper.extractToken(tokenClass, tokenBytes);
} catch (AccumuloSecurityException e) {
throw new IOException(e);
}
}
Authorizations authorizations = split.getAuths();
if (null == authorizations) {
authorizations = getScanAuthorizations(attempt);
}
String table = split.getTable();
if (null == table) {
table = getInputTableName(attempt);
}
Boolean isOffline = split.isOffline();
if (null == isOffline) {
isOffline = isOfflineScan(attempt);
}
Boolean isIsolated = split.isIsolatedScan();
if (null == isIsolated) {
isIsolated = isIsolated(attempt);
}
Boolean usesLocalIterators = split.usesLocalIterators();
if (null == usesLocalIterators) {
usesLocalIterators = usesLocalIterators(attempt);
}
List<IteratorSetting> iterators = split.getIterators();
if (null == iterators) {
iterators = getIterators(attempt);
}
Set<Pair<Text,Text>> columns = split.getFetchedColumns();
if (null == columns) {
columns = getFetchedColumns(attempt);
}
try {
log.debug("Creating connector with user: " + principal);
Connector conn = instance.getConnector(principal, token);
log.debug("Creating scanner for table: " + table);
log.debug("Authorizations are: " + authorizations);
if (isOffline) {
String tokenClass = token.getClass().getCanonicalName();
ByteBuffer tokenBuffer = ByteBuffer.wrap(CredentialHelper.toBytes(token));
scanner = new OfflineScanner(instance, new TCredentials(principal, tokenClass, tokenBuffer, instance.getInstanceID()), Tables.getTableId(instance,
table), authorizations);
} else {
scanner = conn.createScanner(table, authorizations);