@Test public void test_isAllPossibleValues() { RangerAbstractResourceMatcher matcher = new AbstractMatcherWrapper(); for (String resource : new String[] { null, "", "*"}) { assertTrue(matcher.isAllValuesRequested(resource)); } for (String resource : new String[] { " ", "\t", "\n", "foo"}) { assertFalse(matcher.isAllValuesRequested(resource)); } }
boolean isAllValuesRequested(Object resource) { final boolean result; if (resource == null) { result = true; } else if (resource instanceof String) { result = StringUtils.isEmpty((String) resource) || WILDCARD_ASTERISK.equals(resource); } else { result = false; } if (LOG.isDebugEnabled()) { LOG.debug("isAllValuesRequested(" + resource + "): " + result); } return result; }
RangerAbstractResourceMatcher implements RangerResourceMatcher { boolean isAllValuesRequested(Object resource) { final boolean result; if (resource == null) { result = true; } else if (resource instanceof String) { result = StringUtils.isEmpty((String) resource) || WILDCARD_ASTERISK.equals(resource); } else { result = false; } if (LOG.isDebugEnabled()) { LOG.debug("isAllValuesRequested(" + resource + "): " + result); } return result; } }
RangerAbstractResourceMatcher implements RangerResourceMatcher { boolean isAllValuesRequested(Object resource) { final boolean result; if (resource == null) { result = true; } else if (resource instanceof String) { result = StringUtils.isEmpty((String) resource) || WILDCARD_ASTERISK.equals(resource); } else { result = false; } if (LOG.isDebugEnabled()) { LOG.debug("isAllValuesRequested(" + resource + "): " + result); } return result; }  }
RangerAbstractResourceMatcher implements RangerResourceMatcher { boolean isAllValuesRequested(Object resource) { final boolean result; if (resource == null) { result = true; } else if (resource instanceof String) { result = StringUtils.isEmpty((String) resource) || WILDCARD_ASTERISK.equals(resource); } else { result = false; } if (LOG.isDebugEnabled()) { LOG.debug("isAllValuesRequested(" + resource + "): " + result); } return result; }  @Override void setResourceDef(RangerResourceDef resourceDef); @Override void setPolicyResource(RangerPolicyResource policyResource); @Override void init(); @Override boolean isMatchAny(); boolean getNeedsDynamicEval(); static boolean getOptionIgnoreCase(Map<String, String> options); static boolean getOptionWildCard(Map<String, String> options); static boolean getOptionReplaceTokens(Map<String, String> options); static char getOptionDelimiterStart(Map<String, String> options); static char getOptionDelimiterEnd(Map<String, String> options); static char getOptionDelimiterEscape(Map<String, String> options); static String getOptionDelimiterPrefix(Map<String, String> options); @Override boolean isCompleteMatch(String resource, Map<String, Object> evalContext); @Override String toString( ); StringBuilder toString(StringBuilder sb); boolean applyExcludes(boolean allValuesRequested, boolean resultWithoutExcludes); }
RangerAbstractResourceMatcher implements RangerResourceMatcher { boolean isAllValuesRequested(Object resource) { final boolean result; if (resource == null) { result = true; } else if (resource instanceof String) { result = StringUtils.isEmpty((String) resource) || WILDCARD_ASTERISK.equals(resource); } else { result = false; } if (LOG.isDebugEnabled()) { LOG.debug("isAllValuesRequested(" + resource + "): " + result); } return result; }  @Override void setResourceDef(RangerResourceDef resourceDef); @Override void setPolicyResource(RangerPolicyResource policyResource); @Override void init(); @Override boolean isMatchAny(); boolean getNeedsDynamicEval(); static boolean getOptionIgnoreCase(Map<String, String> options); static boolean getOptionWildCard(Map<String, String> options); static boolean getOptionReplaceTokens(Map<String, String> options); static char getOptionDelimiterStart(Map<String, String> options); static char getOptionDelimiterEnd(Map<String, String> options); static char getOptionDelimiterEscape(Map<String, String> options); static String getOptionDelimiterPrefix(Map<String, String> options); @Override boolean isCompleteMatch(String resource, Map<String, Object> evalContext); @Override String toString( ); StringBuilder toString(StringBuilder sb); boolean applyExcludes(boolean allValuesRequested, boolean resultWithoutExcludes); final static String WILDCARD_ASTERISK; final static String OPTION_IGNORE_CASE; final static String OPTION_WILD_CARD; final static String OPTION_REPLACE_TOKENS; final static String OPTION_TOKEN_DELIMITER_START; final static String OPTION_TOKEN_DELIMITER_END; final static String OPTION_TOKEN_DELIMITER_ESCAPE; final static String OPTION_TOKEN_DELIMITER_PREFIX; }