Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-core-dev] Can I use Eclipse Platform Core functionalityoutside Eclipse?

Last time I looked, there were also issues about the OSGi framework
wanting to install its own URL handler to multiplex URL handlers
contributed by dynamic bundles. This could make things tricky in a
J2EE environment, which I assume is what Kai is referring to when he
says server-side. Is this still the case? Have there been any
improvements to how bundle resource URL's are constructed and used?

On 4/12/05, Jeff McAffer <Jeff_McAffer@xxxxxxxxxx> wrote:
>  
> This is where it is a bit tricky.  Sitting outside the Eclipse
> infrastructure is not a happy place.  When you start up Eclipse you have to
> give it an "application" to run.  Think of this like the traditional Java
> main().  EclipseStarter sets up all the classloaders etc and then runs your
> application (see IPlatformRunnable). >From then on Eclipse is control.  If
> the application exits then Eclipse exits.  So in this scenario Eclipse wants
> to be in control.  This is one of the reasons I suggested you might want to
> strip out the Extension registry. 
>  
> Beyond that, you can get the various classloaders by grovelling around in
> the OSGi implementation using reflection but that's not alot of fun. 
>  
> Jeff 
>  
>  
>  
>  
>  "Kai Shen" <kshen@xxxxxxxxxxx> 
> Sent by: platform-core-dev-bounces@xxxxxxxxxxx 
> 
> 04/12/2005 09:06 PM 
>  
> Please respond to
>  "Eclipse Platform Core component developers list." 
>  
>  
> To "Eclipse Platform Core component developers list."
> <platform-core-dev@xxxxxxxxxxx> 
>  
> cc 
>  
> Subject RE: [platform-core-dev] Can I use Eclipse Platform Core       
> functionalityoutside Eclipse? 
>  
>  
>  
>  
>  
> Jeff, 
>   
> Thank you very much for the comment. I appreciate it a lot! I'll follow the
> track and try it out. 
>   
> Right now, I have a specific question regarding this approach. I guess
> EclipseStarter will use a separate classloader to load the platform. If so,
> how can I get the classloader in my Java application? I think the main Java
> application can only access the Eclipse platform and runtime functions
> through that classloader. Is it the only way to do it? 
>   
> Thanks, 
> Kai 
>   
>  ________________________________
>  
> From: platform-core-dev-bounces@xxxxxxxxxxx
> [mailto:platform-core-dev-bounces@xxxxxxxxxxx] On Behalf Of
> Jeff McAffer
>  Sent: Tuesday, April 12, 2005 5:24 PM
>  To: Eclipse Platform Core component developers list.
>  Subject: Re: [platform-core-dev] Can I use Eclipse Platform Core
> functionalityoutside Eclipse?
>  
> 
>  Kai, 
>  
>  Sure, I know of several people who are doing this already.  Keep in mind
> that OSGi was originally designed for embedded applications to it is
> eminently suited to this task.  The runtime is not particularly special. 
> The entry points on EclipseStarter are there precisely so you can start
> Eclipse from another Java program so you are on the right track. 
>  
>  Note that you can also consider using the extension registry by itself. 
> The registry has very little dependency on OSGi.  If you look carefully
> through the code you will see only a half handful of references to OSGi API
> (primarliy in ConfigurationElement).  you could strip the extension registry
> code out of the runtime plugin and tweak to suit your needs.  We actually
> wanted to do this in 3.1 but ran out of time.  Perhaps you could contribute
> some ideas? 
>  
>  Someone mentioned issues with allowing other plugins to be installed as
> being a problem for the use of Eclipse on the server.  This would be a
> problem anywhere then I guess.  Eclipse (OSGi and the Runtime) to not enable
> people to just install plugins as they choose.  Some agent always has to
> install plugins.  There is one call in particular
> (BundleContext.installBundle) that does the work.  If no one calls that,
> nothing will be installed.  So, you can setup any system (server, desktop,
> ...) to be locked down simply by not making that function available. 
>  
>  Jeff 
>  
>  
>  
>  "Kai Shen" <kshen@xxxxxxxxxxx> 
>  Sent by: platform-core-dev-bounces@xxxxxxxxxxx 
> 
> 04/12/2005 07:16 PM 
>  
>  
> Please respond to
>  "Eclipse Platform Core component developers list." 
> 
>  
>  
>  
> To "Eclipse Platform Core component developers list."
> <platform-core-dev@xxxxxxxxxxx> 
>  
> cc Kai Shen <kshen@xxxxxxxxxxx> 
>  
> Subject [platform-core-dev] Can I use Eclipse Platform Core functionality   
>     outside Eclipse? 
>  
>  
>  
>  
> 
>  
>  
>  Hi, 
>   
>  We're working on a server side project. In this project, we'd like to
> provide user an extension framework so that user can use Eclipse's extension
> mechanism in server side. Our goal is to allow user to develop their
> plug-ins in Eclipse environment and use those plug-ins directly in server
> side without any modification. 
>   
>  I understand Eclipse use org.eclipse.osgi and org.eclipse.core.runtime to
> manage the bundles, classloaders and extension registry, etc. So, ideally,
> we can use org.eclipse.osgi and org.eclipse.core.runtime in our java
> application. 
>   
>  However, I found the following in the Eclipse on-line help: 
>  The Eclipse Platform makes heavy use of Java class loaders for loading
> plug-ins. Even the Eclipse Runtime itself and the OSGi framework need to be
> loaded by special class loaders. Client programs, such as a Java main
> program or a servlet, cannot directly reference any part of Eclipse
> directly. Instead, a client must use the EclipseStarter class in
> org.eclipse.core.runtime.adaptor to start the platform,
> invoking functionality defined in plug-ins, and shutting down the platform
> when done. 
>  Clients that do not need to access any particular function, but just need
> to start the platform, can use Main.run() in startup.jar. However, clients
> that need to invoke specific function should use EclipseStarter. See the
> javadoc inside this class for details. 
>   
>  It looks like we can NOT use org.eclipse.osgi and org.eclipse.core.runtime
> directly. We need to start the platform by calling EclipseStarter. The
> EclipseStarter will use another classloader to load the Eclipse Platform. 
>   
>  So, I think our solution could be as follow: 
>  1. In the java application, use EclipseStarter to start Eclipse Platform. 
>  2. Configure the Eclipse Platform so that workbench and other UI related
> plug-ins won't be loaded. (Actually, only org.eclipse.osgi and
> org.eclipse.core.runtime are needed). 
>  3. If the Java application needs to use the Eclipse core functionality
> (e.g. Platform.getBundle(symbolicName), platform.getExtensionRegistry(),
> etc.), we need to use the classloader's functions to find the class instance
> and then call the function in the class instance. 
>   
>  Is this solution feasible? Did anyone do it before? I think the extension
> framework is a very nice feature of Eclipse. If we can use it in server
> applications, it will make Eclipse core even greater! Since I'm new to
> Eclipse Platform Core, this idea might be unrealistic. But anyway, I just
> want to start the discussion, because I think the goal is great, it will
> make Eclipse Platform more popular and benefit other developers. Your
> thoughts and comments are highly welcome! 
>   
>  Thanks, 
>  Kai 
>   
>   
>  _______________________________________________
>  platform-core-dev mailing list
>  platform-core-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-core-dev
>  _______________________________________________
>  platform-core-dev mailing list
>  platform-core-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-core-dev
>  
>  
> _______________________________________________
> platform-core-dev mailing list
> platform-core-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-core-dev
> 
> 
> 


-- 
CK.


Back to the top