public static String format(final Date date, final boolean lenient) { return format(date, lenient, null); }
public boolean addRealm(final String newRealm) { return RealmUtils.normalizingAddTo(realms, newRealm); }
public static Set<String> getEffective(final Set<String> allowedRealms, final String requestedRealm) { Set<String> allowed = RealmUtils.normalize(allowedRealms); Set<String> requested = new HashSet<>(); requested.add(requestedRealm); Set<String> effective = new HashSet<>(); effective.addAll(requested.stream().filter(new StartsWithPredicate(allowed)).collect(Collectors.toSet())); effective.addAll(allowed.stream().filter(new StartsWithPredicate(requested)).collect(Collectors.toSet())); // includes dynamic realms if (allowedRealms != null) { effective.addAll(allowedRealms.stream().filter(new DynRealmsPredicate()).collect(Collectors.toSet())); } return effective; }
@Override protected boolean securityChecks(final Set<String> effectiveRealms, final String realm, final String key) { boolean authorized = effectiveRealms.stream().anyMatch(ownedRealm -> realm.startsWith(ownedRealm) || ownedRealm.equals(RealmUtils.getGroupOwnerRealm(realm, key))); if (!authorized) { authorized = groupDAO.findDynRealms(key).stream(). anyMatch(dynRealm -> effectiveRealms.contains(dynRealm)); } if (!authorized) { throw new DelegatedAdministrationException(realm, AnyTypeKind.GROUP.name(), key); } return effectiveRealms.stream().anyMatch(new RealmUtils.DynRealmsPredicate()); }
public static ObjectPoolConfiguration getObjectPoolConfiguration(final ConnPoolConf cpc) { ObjectPoolConfiguration opc = new ObjectPoolConfiguration(); updateObjectPoolConfiguration(opc, cpc); return opc; }
private void init() { if (locations == null) { locations = new ArrayList<>(); for (String location : StringUtils.isBlank(stringLocations) ? new String[0] : stringLocations.split(",")) { try { locations.add(URIUtils.buildForConnId(location)); LOG.info("Valid ConnId location: {}", location.trim()); } catch (Exception e) { LOG.error("Invalid ConnId location: {}", location.trim(), e); } } locations = Collections.unmodifiableList(locations); } }
@Override public void append(final LogEvent event) { LogStatement statement = new LogStatement(); statement.setLevel(LoggerLevel.fromLevel(event.getLevel())); statement.setLoggerName(event.getLoggerName()); Message msg = event.getMessage(); statement.setMessage((msg instanceof ReusableMessage ? ((ReusableMessage) msg).memento() : msg).getFormattedMessage()); statement.setTimeMillis(event.getTimeMillis()); if (event.getThrown() != null) { statement.setStackTrace(ExceptionUtils2.getFullStackTrace(event.getThrown())); } statement.setThreadId(event.getThreadId()); statement.setThreadName(event.getThreadName()); statement.setThreadPriority(event.getThreadPriority()); this.statements.add(statement); }
@Override public void requestDestroyed(final ServletRequestEvent sre) { FormatUtils.clear(); ThreadClassLoaderManager.clearInstance(); CurrentLocale.clear(); } }
public static String format(final Date date) { return format(date, true); }
public static Set<String> getEffective(final Set<String> allowedRealms, final String requestedRealm) { Set<String> allowed = RealmUtils.normalize(allowedRealms); Set<String> requested = new HashSet<>(); requested.add(requestedRealm); Set<String> effective = new HashSet<>(); effective.addAll(requested.stream().filter(new StartsWithPredicate(allowed)).collect(Collectors.toSet())); effective.addAll(allowed.stream().filter(new StartsWithPredicate(requested)).collect(Collectors.toSet())); // includes dynamic realms if (allowedRealms != null) { effective.addAll(allowedRealms.stream().filter(new DynRealmsPredicate()).collect(Collectors.toSet())); } return effective; }
public boolean addRealm(final String newRealm) { return RealmUtils.normalizingAddTo(realms, newRealm); }
public static ObjectPoolConfiguration getObjectPoolConfiguration(final ConnPoolConf cpc) { ObjectPoolConfiguration opc = new ObjectPoolConfiguration(); updateObjectPoolConfiguration(opc, cpc); return opc; }
public static String format(final double number) { return format(number, null); }
public static Set<String> normalize(final Collection<String> realms) { Set<String> normalized = new HashSet<>(); if (realms != null) { realms.forEach(realm -> normalizingAddTo(normalized, realm)); } return normalized; }
public static String format(final double number) { return format(number, null); }
public static Set<String> normalize(final Collection<String> realms) { Set<String> normalized = new HashSet<>(); if (realms != null) { realms.forEach(realm -> normalizingAddTo(normalized, realm)); } return normalized; }
public static String format(final Date date) { return format(date, true); }
public static String format(final long number) { return format(number, null); }
public static String format(final long number) { return format(number, null); }
public static String format(final Date date, final boolean lenient) { return format(date, lenient, null); }