/** Returns a new version based on raw numbers * * @lucene.internal */ public static Version fromBits(int major, int minor, int bugfix) { return new Version(major, minor, bugfix); }
public static String parseDFSURI(String warehouseDir, String uri) throws URISyntaxException { return parseURI(warehouseDir, uri, false); }
private boolean isNULL(String s) { return SentryUtils.isNULL(s); }
public static SqoopAuthorizable from(KeyValue keyValue) { String prefix = keyValue.getKey().toLowerCase(); String name = keyValue.getValue().toLowerCase(); for (AuthorizableType type : AuthorizableType.values()) { if(prefix.equalsIgnoreCase(type.name())) { return from(type, name); } } return null; }
public static SolrModelAuthorizable from(String s) { return from(new KeyValue(s)); } }
@Override public boolean process(TProtocol in, TProtocol out) throws TException { ThriftUtil.setIpAddress(in); ThriftUtil.setImpersonator(in); return super.process(in, out); } }
/** * Check if the action part in a privilege is ALL. Owner privilege is * treated as ALL for authorization * @param actionPart it must be the action of a privilege * @return true if the action is ALL; false otherwise */ private boolean isPrivilegeActionAll(KeyValue actionPart, BitFieldActionFactory bitFieldActionFactory) { return impliesAction(actionPart.getValue(), SentryConstants.PRIVILEGE_WILDCARD_VALUE, bitFieldActionFactory); }
@VisibleForTesting protected static boolean impliesURI(String privilege, String request) { return PathUtils.impliesURI(privilege, request); }
/** * Split path into components on the "/" character. * The path should not start with "/". * This is consumed by Thrift interface, so the return result should be * {@code List<String>} * * @param path input oath e.g. {@code foo/bar} * @return list of components, e.g. [foo, bar] */ private static List<String> splitPath(String path) { return Lists.newArrayList(PathUtils.splitPath(path)); }
/** * Public factory method to guarantee singleton */ public static synchronized PubSub getInstance() { if (instance != null) { LOGGER.info(instance + " requested"); } else { instance = new PubSub(); LOGGER.info(instance + " created"); } return instance; }
/** * Given a collection of MSentryChange instances sorted by ID, return the string that prints in the collapsed format. * <p> * e.g: * <li> Input: [MSentryChange(1), MSentryChange(2), MSentryChange(3), MSentryChange(5), MSentryChange(7)] </li> * <li> Output: "[1-3, 5, 7]" </li> * </p> * @param changes List of {@link MSentryChange} * @return Collapsed string representation of the changeIDs */ public static String collapseChangeIDsToString(Collection<? extends MSentryChange> changes) { return SentryUtils.collapseNumsToString(getChangeIds(changes)); } }
public static void unregisterSigListener(String sigName, SigListener sigListener){ if (StringUtils.isEmpty(sigName)) { throw new IllegalArgumentException("NULL signal name"); } if (sigListener == null) { throw new IllegalArgumentException("NULL signal listener"); } if (!sigHandlerMap.containsKey(sigName)){ sigHandlerMap.get(sigName).removeListener(sigListener); } } }
public static KafkaAuthorizable from(String keyValue) throws ConfigurationException { return from(new KeyValue(keyValue)); }
@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); } }
private boolean impliesResource(ImplyMethodType implyMethodType, String policyValue, String requestValue) { // wildcard support, "*", "+", "all"("+" and "all" are for backward compatibility) are represented as wildcard // if requestValue is wildcard, means privilege request is to match with any value of given resource if (SentryConstants.RESOURCE_WILDCARD_VALUE.equals(policyValue) || SentryConstants.RESOURCE_WILDCARD_VALUE.equals(requestValue) || SentryConstants.RESOURCE_WILDCARD_VALUE_ALL.equalsIgnoreCase(policyValue) || SentryConstants.RESOURCE_WILDCARD_VALUE_ALL.equalsIgnoreCase(requestValue) || SentryConstants.RESOURCE_WILDCARD_VALUE_SOME.equals(requestValue)) { return true; } // compare as the url if (ImplyMethodType.URL == implyMethodType) { return PathUtils.impliesURI(policyValue, requestValue); } else if (ImplyMethodType.STRING_CASE_SENSITIVE == implyMethodType) { // compare as the string case sensitive return policyValue.equals(requestValue); } // default: compare as the string case insensitive return policyValue.equalsIgnoreCase(requestValue); }
/** * <p> * Convert different forms of empty strings to an empty string("") and return all other input strings unmodified. * <p> * Possible empty strings: * <ul> * <li>null</li> * <li>empty string ("")</li> * <li>@NULL_COLL</li> * </ul> * <p> * This function is used to create TSentryPrivilege objects and is essential in maintaining backward compatibility * for reading the data that is saved in the sentry database. And also to ensure the backward compatibility of read the * user passed column data (@see TSentryAuthorizable conversion to TSentryPrivilege) * <p> * @param s string input, and can be null. * @return original string if it is non-empty and "" for empty strings. */ private static String fromNULLCol(String s) { return isNULL(s) ? "" : s; }
public static SqoopAuthorizable from(String keyValue) { return from(new KeyValue(keyValue)); }
@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); }
public static DBModelAuthorizable from(String s) { return from(new KeyValue(s)); }
public static IndexerModelAuthorizable from(String s) { return from(new KeyValue(s)); }