/** * Check whether a configuration is fully configured to be used with an Accumulo {@link * InputFormat}. * * @param job the Hadoop context for the configured job * @throws java.io.IOException if the context is improperly configured * @since 1.5.0 */ protected static void validateOptions(JobConf job) throws IOException { final Instance inst = InputConfigurator.validateInstance(CLASS, job); String principal = InputConfigurator.getPrincipal(CLASS, job); AuthenticationToken token = InputConfigurator.getAuthenticationToken(CLASS, job); // In secure mode, we need to convert the DelegationTokenStub into a real DelegationToken token = ConfiguratorBase.unwrapAuthenticationToken(job, token); Connector conn; try { conn = inst.getConnector(principal, token); } catch (Exception e) { throw new IOException(e); } InputConfigurator.validatePermissions(CLASS, job, conn); }
/** * Gets the user name from the configuration. * * @param job the Hadoop context for the configured job * @return the user name * @since 1.5.0 * @see #setConnectorInfo(JobConf, String, AuthenticationToken) */ protected static String getPrincipal(JobConf job) { return InputConfigurator.getPrincipal(CLASS, job); }
/** * Gets the user name from the configuration. * * @param context the Hadoop context for the configured job * @return the user name * @since 1.5.0 * @see #setConnectorInfo(Job, String, AuthenticationToken) */ protected static String getPrincipal(JobContext context) { return InputConfigurator.getPrincipal(CLASS, context.getConfiguration()); }