Codota Logo
ThriftUtil
Code IndexAdd Codota to your IDE (free)

How to use
ThriftUtil
in
org.apache.sentry.core.common.utils

Best Java code snippets using org.apache.sentry.core.common.utils.ThriftUtil (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: apache/sentry

 @Override
 public boolean process(TProtocol in, TProtocol out) throws TException {
  ThriftUtil.setIpAddress(in);
  ThriftUtil.setImpersonator(in);
  return super.process(in, out);
 }
}
origin: apache/sentry

public static void setIpAddress(final TProtocol in) {
 try {
  TTransport transport = in.getTransport();
  TSocket tSocket = getUnderlyingSocketFromTransport(transport);
  if (tSocket != null) {
   setIpAddress(tSocket.getSocket().getInetAddress().toString());
  } else {
   LOGGER.warn("Unknown Transport, cannot determine ipAddress");
  }
 } catch (Exception e) {
  // If there has exception when get impersonator info, log the error information.
  LOGGER.warn("There is an error when get the client's ip address:" + e.getMessage());
 }
}
origin: apache/sentry

public static void setImpersonator(final TProtocol in) {
 try {
  TTransport transport = in.getTransport();
  if (transport instanceof TSaslServerTransport) {
   String impersonator = ((TSaslServerTransport) transport).getSaslServer()
     .getAuthorizationID();
   setImpersonator(impersonator);
  }
 } catch (Exception e) {
  // If there has exception when get impersonator info, log the error information.
  LOGGER.warn("There is an error when get the impersonator:" + e.getMessage());
 }
}
origin: apache/sentry

private void setCommAttrForAMLE(AuditMetadataLogEntity amle, Configuration conf,
  TSentryResponseStatus responseStatus, String userName, String operationType, String objectType) {
 amle.setUserName(userName);
 amle.setServiceName(conf.get(ServerConfig.SENTRY_SERVICE_NAME,
   ServerConfig.SENTRY_SERVICE_NAME_DEFAULT).trim());
 amle.setImpersonator(ThriftUtil.getImpersonator());
 amle.setIpAddress(ThriftUtil.getIpAddress());
 amle.setOperation(operationType);
 amle.setEventTime(Long.toString(System.currentTimeMillis()));
 amle.setAllowed(isAllowed(responseStatus));
 amle.setObjectType(objectType);
}
origin: apache/sentry

HostAndPort endpoint = ThriftUtil.parseAddress(addr, serverPort);
LOGGER.info("Adding endpoint {}", endpoint);
endpoints.add(endpoint);
origin: apache/sentry

 @Override
 public boolean process(TProtocol in, TProtocol out) throws TException {
  // set the ip and impersonator for audit log
  ThriftUtil.setIpAddress(in);
  ThriftUtil.setImpersonator(in);
  return super.process(in, out);
 }
}
origin: apache/sentry

@BeforeClass
public static void init() {
 conf = new Configuration();
 conf.set(ServerConfig.SENTRY_SERVICE_NAME,
   ServerConfig.SENTRY_SERVICE_NAME_DEFAULT);
 ThriftUtil.setIpAddress(TEST_IP);
 ThriftUtil.setImpersonator(TEST_IMPERSONATOR);
}
origin: apache/sentry

@BeforeClass
public static void init() {
 conf = new Configuration();
 conf.set(ServerConfig.SENTRY_SERVICE_NAME, ServerConfig.SENTRY_SERVICE_NAME_DEFAULT);
 ThriftUtil.setIpAddress(TEST_IP);
 ThriftUtil.setImpersonator(TEST_IMPERSONATOR);
 TEST_PRIVILEGES_MAP.put("resourceType1", "resourceName1");
 TEST_PRIVILEGES_MAP.put("resourceType2", "resourceName2");
 TEST_PRIVILEGES_MAP.put("resourceType3", "resourceName3");
}
org.apache.sentry.core.common.utilsThriftUtil

Most used methods

  • setImpersonator
  • setIpAddress
  • getImpersonator
  • getIpAddress
  • getUnderlyingSocketFromTransport
    Returns the underlying TSocket from the transport, or null of the transport type is unknown.
  • parseAddress
    Utility function for parsing host and port strings. Expected form should be (host:port). The hostnam

Popular in Java

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • getSystemService (Context)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now