org.apache.hadoop.security.proto.SecurityProtos.CancelDelegationTokenRequestProto Java Examples

The following examples show how to use org.apache.hadoop.security.proto.SecurityProtos.CancelDelegationTokenRequestProto. 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: TestYarnApiClasses.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
* Test CancelDelegationTokenRequestPBImpl.
* Test a transformation to prototype and back
*/
@Test
public void testCancelDelegationTokenRequestPBImpl() {

  Token token = getDelegationToken();

  CancelDelegationTokenRequestPBImpl original = new CancelDelegationTokenRequestPBImpl();
  original.setDelegationToken(token);
  CancelDelegationTokenRequestProto protoType = original.getProto();

  CancelDelegationTokenRequestPBImpl copy = new CancelDelegationTokenRequestPBImpl(protoType);
  assertNotNull(copy.getDelegationToken());
  //compare source and converted
  assertEquals(token, copy.getDelegationToken());

}
 
Example #2
Source File: TestYarnApiClasses.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
* Test CancelDelegationTokenRequestPBImpl.
* Test a transformation to prototype and back
*/
@Test
public void testCancelDelegationTokenRequestPBImpl() {

  Token token = getDelegationToken();

  CancelDelegationTokenRequestPBImpl original = new CancelDelegationTokenRequestPBImpl();
  original.setDelegationToken(token);
  CancelDelegationTokenRequestProto protoType = original.getProto();

  CancelDelegationTokenRequestPBImpl copy = new CancelDelegationTokenRequestPBImpl(protoType);
  assertNotNull(copy.getDelegationToken());
  //compare source and converted
  assertEquals(token, copy.getDelegationToken());

}
 
Example #3
Source File: OzoneManagerProtocolClientSideTranslatorPB.java    From hadoop-ozone with Apache License 2.0 6 votes vote down vote up
/**
 * Cancel an existing delegation token.
 *
 * @param token delegation token
 */
@Override
public void cancelDelegationToken(Token<OzoneTokenIdentifier> token)
    throws OMException {
  CancelDelegationTokenRequestProto req = CancelDelegationTokenRequestProto
      .newBuilder()
      .setToken(OMPBHelper.convertToTokenProto(token))
      .build();

  OMRequest omRequest = createOMRequest(Type.CancelDelegationToken)
      .setCancelDelegationTokenRequest(req)
      .build();

  final CancelDelegationTokenResponseProto resp;
  try {
    handleError(submitRequest(omRequest));
  } catch (IOException e) {
    if(e instanceof OMException) {
      throw (OMException)e;
    }
    throw new OMException("Cancel delegation token failed.", e,
        TOKEN_ERROR_OTHER);
  }
}
 
Example #4
Source File: ClientNamenodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void cancelDelegationToken(Token<DelegationTokenIdentifier> token)
    throws IOException {
  CancelDelegationTokenRequestProto req = CancelDelegationTokenRequestProto
      .newBuilder()
      .setToken(PBHelper.convert(token))
      .build();
  try {
    rpcProxy.cancelDelegationToken(null, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example #5
Source File: ClientNamenodeProtocolTranslatorPB.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public void cancelDelegationToken(Token<DelegationTokenIdentifier> token)
    throws IOException {
  CancelDelegationTokenRequestProto req = CancelDelegationTokenRequestProto
      .newBuilder()
      .setToken(PBHelper.convert(token))
      .build();
  try {
    rpcProxy.cancelDelegationToken(null, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example #6
Source File: ClientNamenodeProtocolServerSideTranslatorPB.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenResponseProto cancelDelegationToken(
    RpcController controller, CancelDelegationTokenRequestProto req)
    throws ServiceException {
  try {
    server.cancelDelegationToken(PBHelper.convertDelegationToken(req
        .getToken()));
    return VOID_CANCELDELEGATIONTOKEN_RESPONSE;
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
Example #7
Source File: MRClientProtocolPBClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenResponse cancelDelegationToken(
    CancelDelegationTokenRequest request) throws IOException {
  CancelDelegationTokenRequestProto requestProto =
      ((CancelDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new CancelDelegationTokenResponsePBImpl(
        proxy.cancelDelegationToken(null, requestProto));

  } catch (ServiceException e) {
    throw unwrapAndThrowException(e);
  }
}
 
Example #8
Source File: MRClientProtocolPBServiceImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenResponseProto cancelDelegationToken(
    RpcController controller, CancelDelegationTokenRequestProto proto)
    throws ServiceException {
  CancelDelegationTokenRequestPBImpl request =
      new CancelDelegationTokenRequestPBImpl(proto);
    try {
      CancelDelegationTokenResponse response = real.cancelDelegationToken(request);
      return ((CancelDelegationTokenResponsePBImpl)response).getProto();
    } catch (IOException e) {
      throw new ServiceException(e);
    }
}
 
Example #9
Source File: CancelDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenRequestProto getProto() {
  mergeLocalToProto();
  proto = viaProto ? proto : builder.build();
  viaProto = true;
  return proto;
}
 
Example #10
Source File: ApplicationClientProtocolPBClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenResponse cancelDelegationToken(
    CancelDelegationTokenRequest request) throws YarnException,
    IOException {
  CancelDelegationTokenRequestProto requestProto =
      ((CancelDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new CancelDelegationTokenResponsePBImpl(
        proxy.cancelDelegationToken(null, requestProto));

  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #11
Source File: ApplicationHistoryProtocolPBClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenResponse cancelDelegationToken(
    CancelDelegationTokenRequest request) throws YarnException, IOException {
  CancelDelegationTokenRequestProto requestProto =
      ((CancelDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new CancelDelegationTokenResponsePBImpl(
      proxy.cancelDelegationToken(null, requestProto));

  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #12
Source File: ClientNamenodeProtocolServerSideTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenResponseProto cancelDelegationToken(
    RpcController controller, CancelDelegationTokenRequestProto req)
    throws ServiceException {
  try {
    server.cancelDelegationToken(PBHelper.convertDelegationToken(req
        .getToken()));
    return VOID_CANCELDELEGATIONTOKEN_RESPONSE;
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
Example #13
Source File: MRClientProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenResponse cancelDelegationToken(
    CancelDelegationTokenRequest request) throws IOException {
  CancelDelegationTokenRequestProto requestProto =
      ((CancelDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new CancelDelegationTokenResponsePBImpl(
        proxy.cancelDelegationToken(null, requestProto));

  } catch (ServiceException e) {
    throw unwrapAndThrowException(e);
  }
}
 
Example #14
Source File: ApplicationClientProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenResponse cancelDelegationToken(
    CancelDelegationTokenRequest request) throws YarnException,
    IOException {
  CancelDelegationTokenRequestProto requestProto =
      ((CancelDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new CancelDelegationTokenResponsePBImpl(
        proxy.cancelDelegationToken(null, requestProto));

  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #15
Source File: OMCancelDelegationTokenRequest.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
public Token<OzoneTokenIdentifier> getToken() {
  CancelDelegationTokenRequestProto cancelDelegationTokenRequest =
      getOmRequest().getCancelDelegationTokenRequest();

  return OMPBHelper.convertToDelegationToken(
      cancelDelegationTokenRequest.getToken());
}
 
Example #16
Source File: ApplicationHistoryProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenResponse cancelDelegationToken(
    CancelDelegationTokenRequest request) throws YarnException, IOException {
  CancelDelegationTokenRequestProto requestProto =
      ((CancelDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new CancelDelegationTokenResponsePBImpl(
      proxy.cancelDelegationToken(null, requestProto));

  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #17
Source File: MRClientProtocolPBServiceImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenResponseProto cancelDelegationToken(
    RpcController controller, CancelDelegationTokenRequestProto proto)
    throws ServiceException {
  CancelDelegationTokenRequestPBImpl request =
      new CancelDelegationTokenRequestPBImpl(proto);
    try {
      CancelDelegationTokenResponse response = real.cancelDelegationToken(request);
      return ((CancelDelegationTokenResponsePBImpl)response).getProto();
    } catch (IOException e) {
      throw new ServiceException(e);
    }
}
 
Example #18
Source File: CancelDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public CancelDelegationTokenRequestProto getProto() {
  mergeLocalToProto();
  proto = viaProto ? proto : builder.build();
  viaProto = true;
  return proto;
}
 
Example #19
Source File: CancelDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public CancelDelegationTokenRequestPBImpl() {
  builder = CancelDelegationTokenRequestProto.newBuilder();
}
 
Example #20
Source File: CancelDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public CancelDelegationTokenRequestPBImpl(
    CancelDelegationTokenRequestProto proto) {
  this.proto = proto;
  viaProto = true;
}
 
Example #21
Source File: CancelDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public CancelDelegationTokenRequestProto getProto() {
  mergeLocalToProto();
  proto = viaProto ? proto : builder.build();
  viaProto = true;
  return proto;
}
 
Example #22
Source File: CancelDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private void maybeInitBuilder() {
  if (viaProto || builder == null) {
    builder = CancelDelegationTokenRequestProto.newBuilder(proto);
  }
  viaProto = false;
}
 
Example #23
Source File: CancelDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public CancelDelegationTokenRequestPBImpl() {
  this.builder = CancelDelegationTokenRequestProto.newBuilder();
}
 
Example #24
Source File: CancelDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public CancelDelegationTokenRequestPBImpl (
    CancelDelegationTokenRequestProto proto) {
  this.proto = proto;
  this.viaProto = true;
}
 
Example #25
Source File: CancelDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public CancelDelegationTokenRequestPBImpl() {
  this.builder = CancelDelegationTokenRequestProto.newBuilder();
}
 
Example #26
Source File: CancelDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public CancelDelegationTokenRequestPBImpl (
    CancelDelegationTokenRequestProto proto) {
  this.proto = proto;
  this.viaProto = true;
}
 
Example #27
Source File: CancelDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private void maybeInitBuilder() {
  if (viaProto || builder == null) {
    builder = CancelDelegationTokenRequestProto.newBuilder(proto);
  }
  viaProto = false;
}
 
Example #28
Source File: CancelDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private void maybeInitBuilder() {
  if (viaProto || builder == null) {
    builder = CancelDelegationTokenRequestProto.newBuilder(proto);
  }
  viaProto = false;
}
 
Example #29
Source File: CancelDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public CancelDelegationTokenRequestProto getProto() {
  mergeLocalToProto();
  proto = viaProto ? proto : builder.build();
  viaProto = true;
  return proto;
}
 
Example #30
Source File: CancelDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public CancelDelegationTokenRequestPBImpl(
    CancelDelegationTokenRequestProto proto) {
  this.proto = proto;
  viaProto = true;
}