[
http://jira.jboss.com/jira/browse/GPD-111?page=comments#action_12370695 ]
Koen Aers commented on GPD-111:
-------------------------------
Hi Matthew,
I have worked on this today and I think the feature should be working now. I took the
liberty of changing your approach somewhat.
- I sticked to the changes in your extension point definition
- I changed the interface name to XmlElementMapper, this interface only has the
accept(Node) method
- The registry will register all the possible configuration elements for an xml element in
a set directly sorted according to the specified priority
- The xml adapter factory will iterate through the sorted set and once it finds a mapper
that accepts the dom node create the adapter found in the configuration element
With this approach, I was able to simplify the api (the interface has only one method), to
simplify and optimize the implementation of the adapter creation (sorting does only happen
once) and to get rid of the default implementation of the mapper.
The only thing I do not know is if this approach works for you, so could you please test
it for me? The changes are committed to HEAD
Regards,
Koen
Add ability to forward and reverse map Semantic Elements to/from Dom
Node/Xml Adapters jpdl
-------------------------------------------------------------------------------------------
Key: GPD-111
URL:
http://jira.jboss.com/jira/browse/GPD-111
Project: JBoss jBPM GPD
Issue Type: Feature Request
Components: jpdl
Environment: all? :)
Reporter: Matthew Sandoz
Assigned To: Koen Aers
Fix For: jBPM JPDL Designer 3.1.0.CR
Attachments: solution.zip, solution.zip, solution.zip
Addresses need to add new semantic elements without adding new xml types. Current mapping
forces 1-1 mapping between them.
this change allows one-to-many mapping between elements by introducing a mapping object
for each semantic element.
this mapping object's responsibility is to determine if a chunk of xml should map to
a semantic element and xml adapter or not.
the xml adapter registry holds a set of these mappers and loops through them all, giving
each a chance to accept the xml chunk. all accepting
mappers are then sorted by priority and the lowest priority number is selected. mappings
with no priority are given Integer.MAX priority. Mappings with
no mapperClass are given a default mapper class of ConfiguredSemanticElementDomMapper so
that existing plugin.xml should continue to function
normally.
The priority property allows the maintainer of the plugin.xml to change priorities for
different circumstances, giving different potentially conflicting mappers
a specific preference order.
Details of change:
Added two elements to xmlMappings.exsd: mapperClass and mapperClassPriority
Created interface SemanticElementDomMapper to determine if a given Dom Node can be
assigned to a semantic element
Created class ConfiguredSemanticElementDomMapper as a base implementation of the
SemanticElementDomMapper. This
default implementation checks the current configured xml node name against the node name
of the passed Dom Node. This should
duplicate the existing functionality for existing standard jpdl xml node types.
JythonNodeDomMapper is included as an example but should not be committed to the project
as it is for specialized use.
XmlAdapterRegistry constructs a HashMap of Mappers and has a new
getConfigurationElementByNode method.
XmlAdapter has 2 lines modified in the createSemanticElementFor method to use the new
registry method.
XmlAdapterFactory has modifications in createAdapter and createAdapterFromModel
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira