You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, it is possible to define specialized resources, EjbJarXml is an example.
These resources might not use the parsing result created by OpenRewrite but a custom representation like a JAXB-generated object model.
Current implementation
ProjectContextInitializer scans the given project dir
The scanned resources are parsed by MavenProjectParser and wrapped in RewriteSourceFileHoldes
The RewriteSourceFileHoldes are added to the ProjectResourceSet
ProjectContextInitializer then calls applyProjectResourceWrappers(ProjectResourceSet)
Another loop over all resources in ProjectResourceSet trying to find a matching ProjectResourceWrapper to replace RewriteSourceFileHolder with a more "speciaized resource", e.g. EjbJarXml (which inherits from RewriteSourceFileHolder)
Problems with this implementation
All resources get parsed by OpenRewrite (currently in MavenProjectParser) and in case a ProjectResourceWrapper is found it "parses" the resource again, e.g. by parsing the XML file with JAXB. => All specialized resources are parsed twice
Because of this implementation two models of a resource exist in parallel. In the given example OpenRewrite created an Xml.Document after parsing the JAXB model representation is kept in a separate variable. => This allows for concurrent modifications and wastes memory
Some specialized resources might require access to other resources, e.g. Java classes to provide a complete API. Think of a representation of SpringBootRestController
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently, it is possible to define specialized resources,
EjbJarXml
is an example.These resources might not use the parsing result created by OpenRewrite but a custom representation like a JAXB-generated object model.
Current implementation
ProjectContextInitializer
scans the given project dirMavenProjectParser
and wrapped inRewriteSourceFileHolde
sRewriteSourceFileHolde
s are added to theProjectResourceSet
ProjectContextInitializer
then callsapplyProjectResourceWrappers(ProjectResourceSet)
ProjectResourceSet
trying to find a matchingProjectResourceWrapper
to replaceRewriteSourceFileHolder
with a more "speciaized resource", e.g.EjbJarXml
(which inherits fromRewriteSourceFileHolder
)Problems with this implementation
MavenProjectParser
) and in case aProjectResourceWrapper
is found it "parses" the resource again, e.g. by parsing the XML file with JAXB. => All specialized resources are parsed twiceXml.Document
after parsing the JAXB model representation is kept in a separate variable. => This allows for concurrent modifications and wastes memorySpringBootRestController
Beta Was this translation helpful? Give feedback.
All reactions