Refactor BpmnXmlConverter to allow dynamic setting of parsers (and with BpmnParse, setting of BpmnXMLConverter)

Description

We are developing custom parsers (extending/adding certain elements). Since all parsers are hardcoded into BpmnXmlConverter, we've had to override the various implementations of convertToBpmnModel(), BpmnParseFactory, BpmnParse so that we can use our custom parsers for these new/modified elements.

To more easily customize such parsers, it would be nice if BpmnXmlConverter allowed custom parsers, and allow association between the tag (matching XMLStreamReader.getLocalName) and the parser so that someone could, say, do this:
MyElementParser myParser = new MyElementParser()
BpmnXmlConverter converter = new BpmnXmlConverter();
converter.registerParser("my-element-tag", myParser);

Would be fine if we also need to pass in the method to be called or if a Parser interface needed to be implemented for any custom parser.

A custom parser should override an existing tag-parser association if one exists (e.g., if we wanted to modify how Start Events are parsed, that should be possible if we registered a custom parser for the "startEvent" tag).

Related to this, would be better if BpmnParse.execute() did not create BpmnXmlConverter internally and then use it; it would be preferable to make the converter a field of the class and pass it in via a constructor arg (or a setter). This would allow customization of the BpmnXmlConverter.

Thanks!

Status

Assignee

Unassigned

Reporter

Kyle Wagner

Labels

None

Components

Priority

Medium
Configure