Skip to content

Commit

Permalink
Add basic docs on plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
seadowg committed Jul 1, 2024
1 parent 320ff4e commit 0cd7d38
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
31 changes: 31 additions & 0 deletions PLUGINS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Plugins

Various use cases of JavaRosa can be extended with plugins.

## Parse

Intercept parts of the process and attach data to the created `FormDef` through its extras.

### API
- `XFormParser#addProcessor`
- `FormDef#getExtras`

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.

## Finalization

Inspect the `FormEntryModel` after finalization (or "post processing") and attach data via its extras.

### API
- `FormEntryController#addPostProcessor`
- `FormEntryModel#getExtras`

## Instance

Inspect external instances (their ID and parsed XML) after parsing or provide custom parsers for specific instances or file types.

### API
- `ExternalInstanceParser#addFileInstanceParser`
- `ExternalInstanceparsser#addProcessor`

The default `ExternalInstanceParser` can be overridden by creating an implementation of `ExternalInstanceParserFactory` and calling `XFormUtils.setExternalInstanceParserFactory` with it.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Snapshots versions are also published for each commit to `master` and are availa

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

## Extending

JavaRosa is intended be extended to support extra features through a "plugin" approach documented [here](PLUGINS.md) .

## Development

### Setting up your development environment
Expand Down

0 comments on commit 0cd7d38

Please sign in to comment.