ractive
Aug 2nd, 2011, 04:49 PM
Hello everyone
The IndexingNodeTypeRepresentationStrategy is using Class.forName() to load classes for which its type is stored in the _type_ property on nodes. Class.forName() has well known limitations in OSGi and J2EE environments. A very nice article with some solutions about this issue can be found in this blog post (http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html).
In this pull-request (https://github.com/SpringSource/spring-data-graph/pull/5) I proposed to use the DynamicImport-Package directive to have the Spring Data Graph framework dynamically import domain classes in OSGi, so that they can be loaded with Class.forName(). I think that this should be seen as a workaround for now and that a more OSGi-friendly solution should be found.
Without knowing the internals of SDG, I could imagine that the class registration solution that is shown in option 2 in the mentioned blog post could be used here quite well. Could maybe the generated repository register its type in the SDG framework upon its creation so that the IndexingNodeTypeRepresentationStrategy could query the registered classes first and then fall back to Class.forName()?
Best regards,
James
The IndexingNodeTypeRepresentationStrategy is using Class.forName() to load classes for which its type is stored in the _type_ property on nodes. Class.forName() has well known limitations in OSGi and J2EE environments. A very nice article with some solutions about this issue can be found in this blog post (http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html).
In this pull-request (https://github.com/SpringSource/spring-data-graph/pull/5) I proposed to use the DynamicImport-Package directive to have the Spring Data Graph framework dynamically import domain classes in OSGi, so that they can be loaded with Class.forName(). I think that this should be seen as a workaround for now and that a more OSGi-friendly solution should be found.
Without knowing the internals of SDG, I could imagine that the class registration solution that is shown in option 2 in the mentioned blog post could be used here quite well. Could maybe the generated repository register its type in the SDG framework upon its creation so that the IndexingNodeTypeRepresentationStrategy could query the registered classes first and then fall back to Class.forName()?
Best regards,
James