Bug 266324 - Create IEntryPoint with createExecutableExtension()
Summary: Create IEntryPoint with createExecutableExtension()
Status: ASSIGNED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2009-02-26 10:30 EST by Norbert Bumm CLA
Modified: 2010-09-06 07:11 EDT (History)
1 user (show)

See Also:


Attachments
org.eclipse.rap.rwt patch (4.63 KB, text/plain)
2009-02-26 10:31 EST, Norbert Bumm CLA
no flags Details
org.eclipse.rap.ui.workbench patch (1.47 KB, text/plain)
2009-02-26 10:32 EST, Norbert Bumm CLA
no flags Details
Patch for org.eclipse.rap.rwt and org.eclipse.rap.ui.workbench (7.31 KB, patch)
2009-03-18 06:19 EDT, Norbert Bumm CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Norbert Bumm CLA 2009-02-26 10:30:01 EST
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.
Comment 1 Norbert Bumm CLA 2009-02-26 10:31:50 EST
Created attachment 126852 [details]
org.eclipse.rap.rwt patch
Comment 2 Norbert Bumm CLA 2009-02-26 10:32:41 EST
Created attachment 126853 [details]
org.eclipse.rap.ui.workbench patch
Comment 3 Rüdiger Herrmann CLA 2009-02-27 11:40:59 EST
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?
Comment 4 Norbert Bumm CLA 2009-03-17 13:58:11 EDT
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? 
Comment 5 Norbert Bumm CLA 2009-03-18 06:19:39 EDT
Created attachment 129188 [details]
Patch for org.eclipse.rap.rwt and org.eclipse.rap.ui.workbench

Patch for the new suggestion.
Comment 6 Rüdiger Herrmann CLA 2009-03-18 06:59:01 EDT
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
Comment 7 Rüdiger Herrmann CLA 2009-04-15 05:27:44 EDT
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. [ ... ]
Comment 8 Benjamin Muskalla CLA 2009-07-22 06:07:08 EDT
Norbert, any interests to update the patch to current CVS HEAD so we can take a look at this for 1.3?