Java Code Examples for org.apache.yetus.audience.InterfaceAudience#Private

The following examples show how to use org.apache.yetus.audience.InterfaceAudience#Private . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientTokenUtil.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Obtain and return an authentication token for the current user.
 * @param conn The async HBase cluster connection
 * @return the authentication token instance, wrapped by a {@link CompletableFuture}.
 */
@InterfaceAudience.Private
public static CompletableFuture<Token<AuthenticationTokenIdentifier>> obtainToken(
    AsyncConnection conn) {
  CompletableFuture<Token<AuthenticationTokenIdentifier>> future = new CompletableFuture<>();
  if (injectedException != null) {
    future.completeExceptionally(ProtobufUtil.handleRemoteException(injectedException));
    return future;
  }
  AsyncTable<?> table = conn.getTable(TableName.META_TABLE_NAME);
  table.<AuthenticationProtos.AuthenticationService.Interface,
      AuthenticationProtos.GetAuthenticationTokenResponse> coprocessorService(
    AuthenticationProtos.AuthenticationService::newStub,
        (s, c, r) -> s.getAuthenticationToken(c,
            AuthenticationProtos.GetAuthenticationTokenRequest.getDefaultInstance(), r),
    HConstants.EMPTY_START_ROW).whenComplete((resp, error) -> {
      if (error != null) {
        future.completeExceptionally(ProtobufUtil.handleRemoteException(error));
      } else {
        future.complete(toToken(resp.getToken()));
      }
    });
  return future;
}
 
Example 2
Source File: RegionInfo.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the table name from the specified region name.
 * @param regionName to extract the table name from
 * @return Table name
 */
@InterfaceAudience.Private
// This method should never be used. Its awful doing parse from bytes.
// It is fallback in case we can't get the tablename any other way. Could try removing it.
// Keeping it Audience Private so can remove at later date.
static TableName getTable(final byte [] regionName) {
  int offset = -1;
  for (int i = 0; i < regionName.length; i++) {
    if (regionName[i] == HConstants.DELIMITER) {
      offset = i;
      break;
    }
  }
  if (offset <= 0) {
    throw new IllegalArgumentException("offset=" + offset);
  }
  byte[] buff  = new byte[offset];
  System.arraycopy(regionName, 0, buff, 0, offset);
  return TableName.valueOf(buff);
}
 
Example 3
Source File: HBCKMetaTableAccessor.java    From hbase-operator-tools with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a {@link ServerName} from catalog table {@link Result}.
 * (Copied from MetaTableAccessor)
 * @param r Result to pull from
 * @return A ServerName instance or null if necessary fields not found or empty.
 */
@InterfaceAudience.Private // for use by HMaster#getTableRegionRow which is used for testing only
public static ServerName getServerName(final Result r, final int replicaId) {
  byte[] serverColumn = getServerColumn(replicaId);
  Cell cell = r.getColumnLatestCell(CATALOG_FAMILY, serverColumn);
  if (cell == null || cell.getValueLength() == 0) {
    return null;
  }
  String hostAndPort = Bytes.toString(
    cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
  byte[] startcodeColumn = getStartCodeColumn(replicaId);
  cell = r.getColumnLatestCell(CATALOG_FAMILY, startcodeColumn);
  if (cell == null || cell.getValueLength() == 0) {
    return null;
  }
  try {
    return ServerName.valueOf(hostAndPort,
      Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
  } catch (IllegalArgumentException e) {
    LOG.error("Ignoring invalid region for server " + hostAndPort + "; cell=" + cell, e);
    return null;
  }
}
 
Example 4
Source File: ClientTokenUtil.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * Converts a Token instance (with embedded identifier) to the protobuf representation.
 *
 * @param token the Token instance to copy
 * @return the protobuf Token message
 */
@InterfaceAudience.Private
static AuthenticationProtos.Token toToken(Token<AuthenticationTokenIdentifier> token) {
  AuthenticationProtos.Token.Builder builder = AuthenticationProtos.Token.newBuilder();
  builder.setIdentifier(ByteString.copyFrom(token.getIdentifier()));
  builder.setPassword(ByteString.copyFrom(token.getPassword()));
  if (token.getService() != null) {
    builder.setService(ByteString.copyFromUtf8(token.getService().toString()));
  }
  return builder.build();
}
 
Example 5
Source File: ScheduledChore.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * A summation of this chore in human readable format. Downstream users should not presume
 * parsing of this string can relaibly be done between versions. Instead, they should rely
 * on the public accessor methods to get the information they desire.
 */
@InterfaceAudience.Private
@Override
public String toString() {
  return "ScheduledChore name=" + getName() + ", period=" + getPeriod() +
    ", unit=" + getTimeUnit();
}
 
Example 6
Source File: AuthUtil.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * For kerberized cluster, return login user (from kinit or from keytab if specified).
 * For non-kerberized cluster, return system user.
 * @param conf configuartion file
 * @return user
 * @throws IOException login exception
 */
@InterfaceAudience.Private
public static User loginClient(Configuration conf) throws IOException {
  UserProvider provider = UserProvider.instantiate(conf);
  User user = provider.getCurrent();
  boolean securityOn = provider.isHBaseSecurityEnabled() && provider.isHadoopSecurityEnabled();

  if (securityOn) {
    boolean fromKeytab = provider.shouldLoginFromKeytab();
    if (user.getUGI().hasKerberosCredentials()) {
      // There's already a login user.
      // But we should avoid misuse credentials which is a dangerous security issue,
      // so here check whether user specified a keytab and a principal:
      // 1. Yes, check if user principal match.
      //    a. match, just return.
      //    b. mismatch, login using keytab.
      // 2. No, user may login through kinit, this is the old way, also just return.
      if (fromKeytab) {
        return checkPrincipalMatch(conf, user.getUGI().getUserName()) ? user :
          loginFromKeytabAndReturnUser(provider);
      }
      return user;
    } else if (fromKeytab) {
      // Kerberos is on and client specify a keytab and principal, but client doesn't login yet.
      return loginFromKeytabAndReturnUser(provider);
    }
  }
  return user;
}
 
Example 7
Source File: SyncCoprocessorRpcChannel.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
@InterfaceAudience.Private
public Message callBlockingMethod(Descriptors.MethodDescriptor method, RpcController controller,
  Message request, Message responsePrototype) throws ServiceException {
  try {
    return callExecService(controller, method, request, responsePrototype);
  } catch (IOException ioe) {
    throw new ServiceException("Error calling method " + method.getFullName(), ioe);
  }
}
 
Example 8
Source File: AuthUtil.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the actual name for a group principal (stripped of the
 * group prefix).
 */
@InterfaceAudience.Private
public static String getGroupName(String aclKey) {
  if (!isGroupPrincipal(aclKey)) {
    return aclKey;
  }

  return aclKey.substring(GROUP_PREFIX.length());
}
 
Example 9
Source File: RegionInfo.java    From hbase with Apache License 2.0 4 votes vote down vote up
/**
 * @return A deserialized {@link RegionInfo}
 * or null if we failed deserialize or passed bytes null
 */
@InterfaceAudience.Private
static RegionInfo parseFromOrNull(final byte [] bytes) {
  if (bytes == null) return null;
  return parseFromOrNull(bytes, 0, bytes.length);
}
 
Example 10
Source File: ClusterMetrics.java    From hbase with Apache License 2.0 4 votes vote down vote up
@InterfaceAudience.Private
List<RegionState> getRegionStatesInTransition();
 
Example 11
Source File: LogicalTypeAnnotation.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
@InterfaceAudience.Private
public OriginalType toOriginalType() {
  return OriginalType.DECIMAL;
}
 
Example 12
Source File: Timer.java    From hbase with Apache License 2.0 4 votes vote down vote up
@InterfaceAudience.Private
Meter getMeter();
 
Example 13
Source File: LogicalTypeAnnotation.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
@InterfaceAudience.Private
public OriginalType toOriginalType() {
  return OriginalType.MAP;
}
 
Example 14
Source File: LogicalTypeAnnotation.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
@InterfaceAudience.Private
public OriginalType toOriginalType() {
  return OriginalType.DATE;
}
 
Example 15
Source File: ChoreService.java    From hbase with Apache License 2.0 4 votes vote down vote up
@InterfaceAudience.Private
@Override
public synchronized void cancelChore(ScheduledChore chore) {
  cancelChore(chore, true);
}
 
Example 16
Source File: RegionState.java    From hbase with Apache License 2.0 4 votes vote down vote up
/**
 * Update the duration of region in transition
 * @param previousStamp previous RegionState's timestamp
 */
@InterfaceAudience.Private
void updateRitDuration(long previousStamp) {
  this.ritDuration += (this.stamp - previousStamp);
}
 
Example 17
Source File: LogicalTypeAnnotation.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
@InterfaceAudience.Private
public OriginalType toOriginalType() {
  return OriginalType.JSON;
}
 
Example 18
Source File: WALEdit.java    From hbase with Apache License 2.0 3 votes vote down vote up
/**
 * This is not thread safe.
 * This will change the WALEdit and shouldn't be used unless you are sure that nothing
 * else depends on the contents being immutable.
 *
 * @param cells the list of cells that this WALEdit now contains.
 */
@InterfaceAudience.Private
// Used by replay.
public void setCells(ArrayList<Cell> cells) {
  this.cells = cells;
  this.families = null;
}
 
Example 19
Source File: ReplicationPeerConfigBuilder.java    From hbase with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the serialized peer configuration data
 * @return {@code this}
 */
@InterfaceAudience.Private
ReplicationPeerConfigBuilder putPeerData(byte[] key, byte[] value);
 
Example 20
Source File: ColumnFamilyDescriptorBuilder.java    From hbase with Apache License 2.0 2 votes vote down vote up
/**
 * Construct a column descriptor specifying only the family name The other
 * attributes are defaulted.
 *
 * @param name Column family name. Must be 'printable' -- digit or
 * letter -- and may not contain a <code>:</code>
 * TODO: make this private after the HCD is removed.
 */
@InterfaceAudience.Private
public ModifyableColumnFamilyDescriptor(final byte[] name) {
  this(isLegalColumnFamilyName(name), getDefaultValuesBytes(), Collections.emptyMap());
}