Class DataSourceDef
java.lang.Object
org.apache.juneau.console.freemarker.DataSourceDef
Declares a console data source: a browser loader that fetches rows from a same-origin URL, builds a columnar frame
and publishes it on the topic data:<id> , which chart cards read with
ChartDef.source(...).
Add it to a page with PageSpec.data(...). The declaration is checked when it is added: a bad URL, mode,
chunking, column type or subscription role is E-76, and a bad parser or builder name is E-74.
Example:
- Since:
- 10.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe aggregate request: a bucket unit, up to 3 groupBy dims, and the measures.static final classWhere closed chunks are kept.static final classHow the window is split into requests; UTC calendar units.static enumThe built-in parser for each wire format.static enumHow the frame is produced. -
Method Summary
Modifier and TypeMethodDescriptionaggregate(DataSourceDef.Aggregate value) aggregateUrl(String value) cache(DataSourceDef.Cache value) chunk(DataSourceDef.Chunking value) concurrency(int value) static DataSourceDefdebounceMs(int value) format(DataSourceDef.Format value) id()maxRows(long value) mode(DataSourceDef.Mode value) params(Subscription... subs) toMap()Thecontract.dataSources[] entry; checks the cross-field rules.
-
Method Details
-
create
- Parameters:
id- The source id; unique across cards, data sources and dashboard sections. The topic isdata:<id> .- Returns:
- A new declaration.
- Throws:
IllegalArgumentException- E-40 if the id is not a valid topic key.
-
id
- Returns:
- The source id.
-
url
- Parameters:
value- A same-origin path;{token} s are filled from params. @return This object.
-
format
- Parameters:
value- The wire format; sets the built-in parser. @return This object.
-
parser
- Parameters:
name- A registered parser: a bare built-in name or a dotted app name. Only the name's shape is checked here; a bare name other than the built-ins (csv ,ndjson ,json ) is resolved only in the browser, where an unknown one is E-JS-92.- Returns:
- This object.
-
builder
- Parameters:
name- A registered builder: a bare built-in name or a dotted app name. Only the name's shape is checked here; a bare name other than the built-incolumnar is resolved only in the browser, where an unknown one is E-JS-93.- Returns:
- This object.
-
columns
- Parameters:
specs- Columns asname:type , type one of number, time, string, bool. @return This object.
-
params
- Parameters:
subs- Subscriptions with roleparams orrefresh . @return This object.
-
chunk
- Parameters:
value- The chunking;DataSourceDef.Chunking.none()by default.- Returns:
- This object.
- Throws:
IllegalArgumentException- E-76 if the value is null, or the window param names are blank or equal.
-
concurrency
- Parameters:
value- Parallel chunk requests, 1..6 (default 1). @return This object.
-
debounceMs
- Parameters:
value- The params-change debounce in ms (default 250). @return This object.
-
cache
- Parameters:
value- The cache;DataSourceDef.Cache.memory()by default. @return This object.
-
epoch
- Parameters:
epochUrl- A same-origin path probed once per load.path- The dotted path of the epoch value in the JSON response.- Returns:
- This object.
-
mode
- Parameters:
value- The mode;DataSourceDef.Mode.RAWby default. @return This object.
-
maxRows
- Parameters:
value- The row count past which AUTO switches to AGGREGATE. @return This object.
-
aggregateUrl
- Parameters:
value- A same-origin path answering the aggregate request. @return This object.
-
aggregate
- Parameters:
value- The aggregate request. @return This object.
-
toMap
Thecontract.dataSources[] entry; checks the cross-field rules.- Returns:
- A new map.
- Throws:
IllegalArgumentException- E-76 if the declaration is incomplete or inconsistent.
-