Skip to content

Commit 0cd7d38

Browse files
committed
Add basic docs on plugins
1 parent 320ff4e commit 0cd7d38

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

PLUGINS.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Plugins
2+
3+
Various use cases of JavaRosa can be extended with plugins.
4+
5+
## Parse
6+
7+
Intercept parts of the process and attach data to the created `FormDef` through its extras.
8+
9+
### API
10+
- `XFormParser#addProcessor`
11+
- `FormDef#getExtras`
12+
13+
The default `XFormParser` can be overridden by creating an implementation of `IXFormParserFactory` (`IXFormParserFactory.Wrapper` if you want to chain multiple plugins) and calling `XFormUtils.setXFormParserFactory` with it.
14+
15+
## Finalization
16+
17+
Inspect the `FormEntryModel` after finalization (or "post processing") and attach data via its extras.
18+
19+
### API
20+
- `FormEntryController#addPostProcessor`
21+
- `FormEntryModel#getExtras`
22+
23+
## Instance
24+
25+
Inspect external instances (their ID and parsed XML) after parsing or provide custom parsers for specific instances or file types.
26+
27+
### API
28+
- `ExternalInstanceParser#addFileInstanceParser`
29+
- `ExternalInstanceparsser#addProcessor`
30+
31+
The default `ExternalInstanceParser` can be overridden by creating an implementation of `ExternalInstanceParserFactory` and calling `XFormUtils.setExternalInstanceParserFactory` with it.

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ Snapshots versions are also published for each commit to `master` and are availa
3030

3131
JavaRosa works on Android API level 21+ (with desugaring enabled) and Java 8+.
3232

33+
## Extending
34+
35+
JavaRosa is intended be extended to support extra features through a "plugin" approach documented [here](PLUGINS.md) .
36+
3337
## Development
3438

3539
### Setting up your development environment

0 commit comments

Comments
 (0)