private RoutingAppender(final String name, final Filter filter, final boolean ignoreExceptions, final Routes routes, final RewritePolicy rewritePolicy, final Configuration config) { super(name, filter, null, ignoreExceptions); this.routes = routes; this.config = config; this.rewritePolicy = rewritePolicy; Route defRoute = null; for (final Route route : routes.getRoutes()) { if (route.getKey() == null) { if (defRoute == null) { defRoute = route; } else { error("Multiple default routes. Route " + route.toString() + " will be ignored"); } } } defaultRoute = defRoute; }
/** * Create a RoutingAppender. * @param name The name of the Appender. * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise * they are propagated to the caller. * @param routes The routing definitions. * @param config The Configuration (automatically added by the Configuration). * @param rewritePolicy A RewritePolicy, if any. * @param filter A Filter to restrict events processed by the Appender or null. * @return The RoutingAppender */ @PluginFactory public static RoutingAppender createAppender( @PluginAttribute("name") final String name, @PluginAttribute("ignoreExceptions") final String ignore, @PluginElement("Routes") final Routes routes, @PluginConfiguration final Configuration config, @PluginElement("RewritePolicy") final RewritePolicy rewritePolicy, @PluginElement("Filters") final Filter filter) { final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true); if (name == null) { LOGGER.error("No name provided for RoutingAppender"); return null; } if (routes == null) { LOGGER.error("No routes defined for RoutingAppender"); return null; } return new RoutingAppender(name, filter, ignoreExceptions, routes, rewritePolicy, config); }
private RoutingAppender(final String name, final Filter filter, final boolean ignoreExceptions, final Routes routes, final RewritePolicy rewritePolicy, final Configuration configuration, final PurgePolicy purgePolicy, final AbstractScript defaultRouteScript) { super(name, filter, null, ignoreExceptions); this.routes = routes; this.configuration = configuration; this.rewritePolicy = rewritePolicy; this.purgePolicy = purgePolicy; if (this.purgePolicy != null) { this.purgePolicy.initialize(this); } this.defaultRouteScript = defaultRouteScript; Route defRoute = null; for (final Route route : routes.getRoutes()) { if (route.getKey() == null) { if (defRoute == null) { defRoute = route; } else { error("Multiple default routes. Route " + route.toString() + " will be ignored"); } } } defaultRoute = defRoute; }
/** * Creates a RoutingAppender. * @param name The name of the Appender. * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise * they are propagated to the caller. * @param routes The routing definitions. * @param config The Configuration (automatically added by the Configuration). * @param rewritePolicy A RewritePolicy, if any. * @param filter A Filter to restrict events processed by the Appender or null. * @return The RoutingAppender * @deprecated Since 2.7; use {@link #newBuilder()} */ @Deprecated public static RoutingAppender createAppender( final String name, final String ignore, final Routes routes, final Configuration config, final RewritePolicy rewritePolicy, final PurgePolicy purgePolicy, final Filter filter) { final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true); if (name == null) { LOGGER.error("No name provided for RoutingAppender"); return null; } if (routes == null) { LOGGER.error("No routes defined for RoutingAppender"); return null; } return new RoutingAppender(name, filter, ignoreExceptions, routes, rewritePolicy, config, purgePolicy, null); }
@Override public RewritePolicy getRewritePolicy() { return TestRewritePolicy.createPolicy(); }
@Override public abstract RewritePolicy getRewritePolicy();
@Override public RewritePolicy getRewritePolicy() { return PassThroughAuditRewritePolicy.createPolicy(); }
@Override public RewritePolicy getRewritePolicy() { return null; }
public RewritePolicy getRewritePolicy() { return rewritePolicy; }
public B withRewritePolicy(@SuppressWarnings("hiding") final RewritePolicy rewritePolicy) { this.rewritePolicy = rewritePolicy; return asBuilder(); }
RewritePolicy getRewritePolicy();