Class BusWiringValidator

java.lang.Object
org.apache.juneau.console.BusWiringValidator

public final class BusWiringValidator extends Object
Static check of a page contract's message-bus wiring: rule R-10 (every subscription has a publisher), rule R-11 (every publisher:"server" topic rides a bridge downstream), and the E-40..E-54 and E-58 shape rules on topics, bridges, card publishes / subscribes and ribbon target / publish items.

The same rule runs in the browser as JuneauViews.bus.wiring.validate, and both read the shared corpus bus-wiring-corpus.json. The JS side reports the subset that only the running page can act on (E-JS-41, E-JS-47, E-JS-52); this class reports everything.

Every problem is collected; nothing is thrown. Callers decide how loud to be: the page render, the template validator and C3's PageSpec.build() each turn the list into their own failure.

Example:

JsonMap contract = JsonMap.ofString(pageJson); for (var p : BusWiringValidator.validate(contract, CardTypeRegistry.standard())) System.err.println(p.code() + " " + p.message()); // E-41 card 'tasks' subscribes to 'selection:changes' but nothing publishes it; card 'changes' does not enable selection

Since:
10.0.0
  • Field Details

    • E74

      public static final String E74
      E-74 text; Fn, ChartDef and ChartCardType (console-ui-freemarker) throw it too.
      See Also:
    • E77

      public static final String E77
      E-77 text; DashboardSpec, Section and PersistSpec (console-ui-freemarker) throw it too.
      See Also:
    • EXTENSION_NAME

      public static final Pattern EXTENSION_NAME
      Names for $fn, decorators, sections, parsers, builders and transforms (rule R-E5); juneau-charts.js has the same literal.
    • EVENT_NAME

      public static final Pattern EVENT_NAME
      ECharts event names a chart card's on may use.
  • Method Details

    • validate

      public static List<BusWiringValidator.Problem> validate(JsonMap contract, CardTypeRegistry registry)
      Checks a page contract's bus wiring.
      Parameters:
      contract - The page contract (the #juneau-page JSON).
      registry - Card types, for implicit topics, accepted roles and ops. Unregistered types are skipped.
      Returns:
      Every problem, in contract order: topics, then each card, then dataSources (E-74, then E-71 sorted by topic, then derived-source cycles as E-76 sorted by each cycle's smallest id), then ids (E-76/E-77), then bridges, then R-11, then the terminal-input rule (E-58).