Java 类org.apache.hadoop.hbase.client.security.SecurityCapability 实例源码

项目:ditb    文件:HBaseAdmin.java   
@Override
public List<SecurityCapability> getSecurityCapabilities() throws IOException {
  try {
    return executeCallable(new MasterCallable<List<SecurityCapability>>(getConnection()) {
      @Override
      public List<SecurityCapability> call(int callTimeout) throws ServiceException {
        PayloadCarryingRpcController controller = rpcControllerFactory.newController();
        controller.setCallTimeout(callTimeout);
        SecurityCapabilitiesRequest req = SecurityCapabilitiesRequest.newBuilder().build();
        return ProtobufUtil.toSecurityCapabilityList(
          master.getSecurityCapabilities(controller, req).getCapabilitiesList());
      }
    });
  } catch (IOException e) {
    if (e instanceof RemoteException) {
      e = ((RemoteException)e).unwrapRemoteException();
    }
    throw e;
  }
}
项目:hbase    文件:HBaseAdmin.java   
@Override
public List<SecurityCapability> getSecurityCapabilities() throws IOException {
  try {
    return executeCallable(new MasterCallable<List<SecurityCapability>>(getConnection(),
        getRpcControllerFactory()) {
      @Override
      protected List<SecurityCapability> rpcCall() throws Exception {
        SecurityCapabilitiesRequest req = SecurityCapabilitiesRequest.newBuilder().build();
        return ProtobufUtil.toSecurityCapabilityList(
          master.getSecurityCapabilities(getRpcController(), req).getCapabilitiesList());
      }
    });
  } catch (IOException e) {
    if (e instanceof RemoteException) {
      e = ((RemoteException)e).unwrapRemoteException();
    }
    throw e;
  }
}
项目:ditb    文件:TestVisibilityLabels.java   
@Test
public void testSecurityCapabilities() throws Exception {
  List<SecurityCapability> capabilities = TEST_UTIL.getConnection().getAdmin()
    .getSecurityCapabilities();
  assertTrue("CELL_VISIBILITY capability is missing",
    capabilities.contains(SecurityCapability.CELL_VISIBILITY));
}
项目:ditb    文件:TestAccessController.java   
@Test (timeout=180000)
public void testSecurityCapabilities() throws Exception {
  List<SecurityCapability> capabilities = TEST_UTIL.getConnection().getAdmin()
    .getSecurityCapabilities();
  assertTrue("AUTHORIZATION capability is missing",
    capabilities.contains(SecurityCapability.AUTHORIZATION));
  assertTrue("CELL_AUTHORIZATION capability is missing",
    capabilities.contains(SecurityCapability.CELL_AUTHORIZATION));
}
项目:ditb    文件:ProtobufUtil.java   
/**
 * Convert SecurityCapabilitiesResponse.Capability to SecurityCapability
 * @param capabilities capabilities returned in the SecurityCapabilitiesResponse message
 * @return the converted list of SecurityCapability elements
 */
public static List<SecurityCapability> toSecurityCapabilityList(
    List<MasterProtos.SecurityCapabilitiesResponse.Capability> capabilities) {
  List<SecurityCapability> scList = new ArrayList<>(capabilities.size());
  for (MasterProtos.SecurityCapabilitiesResponse.Capability c: capabilities) {
    try {
      scList.add(SecurityCapability.valueOf(c.getNumber()));
    } catch (IllegalArgumentException e) {
      // Unknown capability, just ignore it. We don't understand the new capability
      // but don't care since by definition we cannot take advantage of it.
    }
  }
  return scList;
}
项目:hbase    文件:TestVisibilityLabels.java   
@Test
public void testSecurityCapabilities() throws Exception {
  List<SecurityCapability> capabilities = TEST_UTIL.getConnection().getAdmin()
    .getSecurityCapabilities();
  assertTrue("CELL_VISIBILITY capability is missing",
    capabilities.contains(SecurityCapability.CELL_VISIBILITY));
}
项目:hbase    文件:TestAccessController.java   
@Test (timeout=180000)
public void testSecurityCapabilities() throws Exception {
  List<SecurityCapability> capabilities = TEST_UTIL.getConnection().getAdmin()
    .getSecurityCapabilities();
  assertTrue("AUTHORIZATION capability is missing",
    capabilities.contains(SecurityCapability.AUTHORIZATION));
  assertTrue("CELL_AUTHORIZATION capability is missing",
    capabilities.contains(SecurityCapability.CELL_AUTHORIZATION));
}
项目:hbase    文件:ProtobufUtil.java   
/**
 * Convert SecurityCapabilitiesResponse.Capability to SecurityCapability
 * @param capabilities capabilities returned in the SecurityCapabilitiesResponse message
 * @return the converted list of SecurityCapability elements
 */
public static List<SecurityCapability> toSecurityCapabilityList(
    List<MasterProtos.SecurityCapabilitiesResponse.Capability> capabilities) {
  List<SecurityCapability> scList = new ArrayList<>(capabilities.size());
  for (MasterProtos.SecurityCapabilitiesResponse.Capability c: capabilities) {
    try {
      scList.add(SecurityCapability.valueOf(c.getNumber()));
    } catch (IllegalArgumentException e) {
      // Unknown capability, just ignore it. We don't understand the new capability
      // but don't care since by definition we cannot take advantage of it.
    }
  }
  return scList;
}
项目:hbase    文件:RawAsyncHBaseAdmin.java   
@Override
public CompletableFuture<List<SecurityCapability>> getSecurityCapabilities() {
  return this
      .<List<SecurityCapability>> newMasterCaller()
      .action(
        (controller, stub) -> this
            .<SecurityCapabilitiesRequest, SecurityCapabilitiesResponse, List<SecurityCapability>> call(
              controller, stub, SecurityCapabilitiesRequest.newBuilder().build(), (s, c, req,
                  done) -> s.getSecurityCapabilities(c, req, done), (resp) -> ProtobufUtil
                  .toSecurityCapabilityList(resp.getCapabilitiesList()))).call();
}
项目:aliyun-tablestore-hbase-client    文件:TablestoreAdmin.java   
@Override
public List<SecurityCapability> getSecurityCapabilities() throws IOException {
    throw new UnsupportedOperationException("getSecurityCapabilities");
}
项目:ColumnManagerForHBase    文件:MAdmin.java   
@Override
public List<SecurityCapability> getSecurityCapabilities() throws IOException {
  return wrappedHbaseAdmin.getSecurityCapabilities();
}
项目:hbase    文件:AsyncHBaseAdmin.java   
@Override
public CompletableFuture<List<SecurityCapability>> getSecurityCapabilities() {
  return wrap(rawAdmin.getSecurityCapabilities());
}
项目:ditb    文件:VisibilityClient.java   
/**
 * Return true if cell visibility features are supported and enabled
 * @param connection The connection to use
 * @return true if cell visibility features are supported and enabled, false otherwise
 * @throws IOException
 */
public static boolean isCellVisibilityEnabled(Connection connection) throws IOException {
  return connection.getAdmin().getSecurityCapabilities()
      .contains(SecurityCapability.CELL_VISIBILITY);
}
项目:ditb    文件:AccessControlClient.java   
/**
 * Return true if authorization is supported and enabled
 * @param connection The connection to use
 * @return true if authorization is supported and enabled, false otherwise
 * @throws IOException
 */
public static boolean isAuthorizationEnabled(Connection connection) throws IOException {
  return connection.getAdmin().getSecurityCapabilities()
      .contains(SecurityCapability.AUTHORIZATION);
}
项目:ditb    文件:AccessControlClient.java   
/**
 * Return true if cell authorization is supported and enabled
 * @param connection The connection to use
 * @return true if cell authorization is supported and enabled, false otherwise
 * @throws IOException
 */
public static boolean isCellAuthorizationEnabled(Connection connection) throws IOException {
  return connection.getAdmin().getSecurityCapabilities()
      .contains(SecurityCapability.CELL_AUTHORIZATION);
}
项目:ditb    文件:Admin.java   
/**
 * Return the set of supported security capabilities.
 * @throws IOException
 * @throws UnsupportedOperationException
 */
List<SecurityCapability> getSecurityCapabilities() throws IOException;
项目:hbase    文件:VisibilityClient.java   
/**
 * Return true if cell visibility features are supported and enabled
 * @param connection The connection to use
 * @return true if cell visibility features are supported and enabled, false otherwise
 * @throws IOException
 */
public static boolean isCellVisibilityEnabled(Connection connection) throws IOException {
  return connection.getAdmin().getSecurityCapabilities()
      .contains(SecurityCapability.CELL_VISIBILITY);
}
项目:hbase    文件:AccessControlClient.java   
/**
 * Return true if authorization is supported and enabled
 * @param connection The connection to use
 * @return true if authorization is supported and enabled, false otherwise
 * @throws IOException
 */
public static boolean isAuthorizationEnabled(Connection connection) throws IOException {
  return connection.getAdmin().getSecurityCapabilities()
      .contains(SecurityCapability.AUTHORIZATION);
}
项目:hbase    文件:AccessControlClient.java   
/**
 * Return true if cell authorization is supported and enabled
 * @param connection The connection to use
 * @return true if cell authorization is supported and enabled, false otherwise
 * @throws IOException
 */
public static boolean isCellAuthorizationEnabled(Connection connection) throws IOException {
  return connection.getAdmin().getSecurityCapabilities()
      .contains(SecurityCapability.CELL_AUTHORIZATION);
}
项目:hbase    文件:Admin.java   
/**
 * Return the set of supported security capabilities.
 * @throws IOException
 * @throws UnsupportedOperationException
 */
List<SecurityCapability> getSecurityCapabilities() throws IOException;
项目:hbase    文件:AsyncAdmin.java   
/**
 * @return the list of supported security capabilities. The return value will be wrapped by a
 *         {@link CompletableFuture}.
 */
CompletableFuture<List<SecurityCapability>> getSecurityCapabilities();