Community
Participate
Working Groups
It would be nice if RAP would create the IEntryPoint object with the Eclipse org.eclipse.core.runtime.IConfigurationElement.createExecutableExtension(String) Method. The current implementation creates it with Class.newInstance(). Therefor it is not possible to use a Eclipse IExecutableExtensionFactory to create the entry point instance. I'd like to use the SpringExtensionFactory from Martin Lippert to instantiate it and use the Spring dependency injection. I have created a small patch for org.eclipse.rap.rwt and org.eclipse.rap.ui.workbench projects to show how it could work.
Created attachment 126852 [details] org.eclipse.rap.rwt patch
Created attachment 126853 [details] org.eclipse.rap.ui.workbench patch
Thanks for the patch. However, there is one thing I don't like: the RWT patch introduces a dependency on core.runtime. Can you come up with a solution that does not make RWT depend on core.runtiome?
To avoid the new dependency on core.runtime we could introduce a factory interface IEntyPontFactory in org.eclipse.rap.rwt with the method createEntryPont(). Instead of registering the IConfigurationElement with the EntryPointManager we register an implementation of the new factory interface, which wraps the IConfigurationElement object. class EntryPointFactory implements IEntryPointFactory { private final IConfigurationElement entryPointConfig; EntryPointFactory(IConfigurationElement entryPointConfig) { this.entryPointConfig = entryPointConfig; } public IEntryPoint createEntryPoint() { try { return ( IEntryPoint ) entryPointConfig.createExecutableExtension("class"); } catch (CoreException e) { throw new RuntimeException(e); } } } What to you think about this solution?
Created attachment 129188 [details] Patch for org.eclipse.rap.rwt and org.eclipse.rap.ui.workbench Patch for the new suggestion.
Thanks for the patch Norbert. Though I don't have time to take a closer look right now (EclipseCon), the general solution to use a factory sounds feasible. I will have a closer look at the patch after EclioseCon (~ first/second week of April) In the meanwhile you might want to check that * RWT standalone still works (see here http://wiki.eclipse.org/RAP/FAQ#How_do_I_use_a_RWT_standalone_application_in_Tomcat for a short howto) * all RWT unit tests run
Thanks for the patch, these are my concerns/ideas: * the RWT test suite does not comple (minor problem) * test cases for IEntryPointFactory are missing * how about changing IEntryPointFactory#createEntryPoint() to throw EntryPointInstantiationException? This could simplfy exception handling in EntryPointManager#createUI() * For the sake of completeness, the patch holds long-term references to IConfigurationElement while these objects are inteded for short-term use. From the JavaDoc: These registry objects are intended for relatively short-term use. Clients that deal with these objects must be aware that they may become invalid if the declaring plug-in is updated or uninstalled. [ ... ]
Norbert, any interests to update the patch to current CVS HEAD so we can take a look at this for 1.3?