Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Invoke/Load/Launch a particular version of the plugin programatically/dynamicall
Invoke/Load/Launch a particular version of the plugin programatically/dynamicall [message #335334] Wed, 01 April 2009 15:45 Go to next message
Eclipse UserFriend
Hi,

I have a usecase where I need to load / launch /invoke a particular
version of my plugin depending on some criteria at runtime programatically
/ dynamically. My eclipse package will contain multiple versions of the
same plugin, and I need to invoke a particular version depending on some
criteria programatically. Is there a way to do this? could some one please
throw some light into this.

Thanks much in advance,
Nitha
Re: Invoke/Load/Launch a particular version of the plugin programatically/dynamicall [message #335355 is a reply to message #335334] Fri, 03 April 2009 12:03 Go to previous messageGo to next message
Eclipse UserFriend
You would need to use another plugin to co-ordinate that. Then you can
use your BundleContext and the PackageAdmin service to install the
specific version of your bundle and "start" it.

As an aside, unless you need to provide Eclipse extensions, you can have
multiple versions of the same bundle active in the system at the same
time (useful for bundles that package up libraries, but have no
behaviour of their own).

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm
Re: Invoke/Load/Launch a particular version of the plugin programatically/dynamicall [message #335414 is a reply to message #335355] Mon, 06 April 2009 16:33 Go to previous messageGo to next message
Eclipse UserFriend
Thanks much Paul. I have a follow up question: How do I discover other
versions of the plugin lying around? Is there a way do this?

The problem Background that I am trying to solve is:
I need to install a bunch of a particular version of plugins depeneding on
the inputted version. If version 2 is inputted I need to install a whole
set of version 2 plugins, and if version 3 is inputted I need to install a
whole set of version 3 plugins. I was thinking along the lines of making
these set of plugins a feature. In this approach (of if you have other
suggestions...) is there a way to install and unintall a feature?

Appreciate your help.
Nitha



Paul Webster wrote:

> You would need to use another plugin to co-ordinate that. Then you can
> use your BundleContext and the PackageAdmin service to install the
> specific version of your bundle and "start" it.

> As an aside, unless you need to provide Eclipse extensions, you can have
> multiple versions of the same bundle active in the system at the same
> time (useful for bundles that package up libraries, but have no
> behaviour of their own).

> PW
Re: Invoke/Load/Launch a particular version of the plugin programatically/dynamicall [message #335419 is a reply to message #335414] Tue, 07 April 2009 07:58 Go to previous messageGo to next message
Eclipse UserFriend
Nitha wrote:
> Thanks much Paul. I have a follow up question: How do I discover other
> versions of the plugin lying around? Is there a way do this?
>
> The problem Background that I am trying to solve is:
> I need to install a bunch of a particular version of plugins depeneding
> on the inputted version. If version 2 is inputted I need to install a
> whole set of version 2 plugins, and if version 3 is inputted I need to
> install a whole set of version 3 plugins. I was thinking along the lines
> of making these set of plugins a feature. In this approach (of if you
> have other suggestions...) is there a way to install and unintall a
> feature?

With features, you're going through the update manager API (or the p2
non-API) ... it's possible to load a feature into the running eclipse,
but you don't have control over the plugin lifecycles then as you do
with OSGi Bundle/BundleContext.

I'm just saying that while OSGi has API that supports dynamically
loading/starting/stopping/unloading plugins, at the feature level
there's no such granularity, and often it would require a restart of
your app.

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm
Re: Invoke/Load/Launch a particular version of the plugin programatically/dynamicall [message #335427 is a reply to message #335419] Tue, 07 April 2009 20:38 Go to previous messageGo to next message
Eclipse UserFriend
Hi Paul,

Thanks for your quick reply.
It doesn't look like enabling/disabling would work out for my problem....

I am looking at other options like different configurations for different
versions of the plugin:
I try to create c1, c2, c3 configuration folders which are just a copy of
default configuration folder that came with eclipse. Then I edit the
bundle.info from sampleconfigurator in each config folder to pick a
version1, version2, version3 respectively of helloworld plugin. However
this doesn't seem to work. I launch eclipse using eclipse -configuration
<path for c1> does not even load my plugin? Isn't this the way to use
-configuration. Could you please clarify.

Thanks,
Nitha
Re: Invoke/Load/Launch a particular version of the plugin programatically/dynamicall [message #335442 is a reply to message #335427] Wed, 08 April 2009 10:00 Go to previous messageGo to next message
Eclipse UserFriend
Nitha wrote:
> Hi Paul,
>
> Thanks for your quick reply.
> It doesn't look like enabling/disabling would work out for my problem....

You mean dynamically installing/starting the plugins won't work? You
have complete control over whether your app can see your plugins, that's
as good as it gets. Or do you mean it's not clear how to do this?

As for using different config areas: You would need different
configuration directories and different p2 profiles. Adding the plugins
to the different p2 profiles can be done using the p2 Directory app
(editing the bundles.info directly is not recommended, as that's only
part of what p2 needs). See
http://wiki.eclipse.org/Equinox_p2_director_application As I understand
it, you would need 3 different profiles (for each set of plugins) and 3
different configuration areas.


Maybe you need to describe your original usecase again. You need to
launch "different versions" of your plugin. What makes the versions
different (do they contain different versions of a lib, do they contain
any extensions, etc)? What is the criteria for picking a different
version (user preference, license, functionality, other software that's
installed, etc)?

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm
Re: Invoke/Load/Launch a particular version of the plugin programatically/dynamicall [message #335447 is a reply to message #335442] Wed, 08 April 2009 15:32 Go to previous messageGo to next message
Eclipse UserFriend
Paul Webster wrote:

> Nitha wrote:
>> Hi Paul,
>>
>> Thanks for your quick reply.
>> It doesn't look like enabling/disabling would work out for my problem....

> You mean dynamically installing/starting the plugins won't work? You
> have complete control over whether your app can see your plugins, that's
> as good as it gets. Or do you mean it's not clear how to do this?

I am guessing that programatically installing/starting a version and
stopping all other verions of the plugins might effect the perfomance as
there could be many plugins that need this install->start and
stop->uninstall. Say our product has about 50 plugins(with extensions and
extension points), and if we were to support 3 versions of each plugin for
a release, and depending on the version of our product customer has we
want to enable that version set of plugins. Also, I did not find a way to
get hold of Inactive plugins, i.e. if I have version 1, 2, 3 of "plugin A"
deployed in plugins folder, is there an API to get hold of all the 3
versions of this plugin. BundleContext or Bundle API gives only the latest
installed version altough it returns an array, it contains only one
plugin, the ACTIVE plugin i.e the latest version. (By the way this is for
our Headless product) Please Let me know if the problem usecase is still
not clear.

> As for using different config areas: You would need different
> configuration directories and different p2 profiles. Adding the plugins
> to the different p2 profiles can be done using the p2 Directory app
> (editing the bundles.info directly is not recommended, as that's only
> part of what p2 needs). See
> http://wiki.eclipse.org/Equinox_p2_director_application As I understand
> it, you would need 3 different profiles (for each set of plugins) and 3
> different configuration areas.

I am not very familiar with P2, Started looking into it this week. Yes, I
am thinking of different configuration directories (not sure what p2
profies are will read up on that...) I am thinking along the lines of each
bundle.info will define a particular version of plugins to load. I do have
concerns:
1) about whether bundles.info is modified/overwritten by eclipse starup
and in which cases does it do so.
2) If I need to replicate configuration folder for each version, do I need
all the content under default configuration folder or could I just have
subset of these for configuration1, configuration2, congiuration3
folders....


> Maybe you need to describe your original usecase again. You need to
In the first paragraph I restated the usecase, I hope it is better put
now, but please let me know if I am not clear...

> launch "different versions" of your plugin. What makes the versions
> different (do they contain different versions of a lib, do they contain
Different versions of the plugins may have libraries, bug fixes, new
features, new extensions etc...

> any extensions, etc)? What is the criteria for picking a different
> version (user preference, license, functionality, other software that's
> installed, etc)?
The criteria is the version of our product customer has. He could be on
older version of our product but need to install a pacakage(generated by
our product) created by newer version of our product or vice versa.


> PW
Re: Invoke/Load/Launch a particular version of the plugin programatically/dynamicall [message #335464 is a reply to message #335447] Thu, 09 April 2009 09:41 Go to previous messageGo to next message
Eclipse UserFriend
Nitha wrote:
> I am guessing that programatically installing/starting a version and
> stopping all other verions of the plugins might effect the perfomance as
> there could be many plugins that need this install->start and
> stop->uninstall. Say our product has about 50 plugins(with extensions
> and extension points), and if we were to support 3 versions of each
> plugin for a release, and depending on the version of our product
> customer has we want to enable that version set of plugins. Also, I did
> not find a way to get hold of Inactive plugins, i.e. if I have version
> 1, 2, 3 of "plugin A" deployed in plugins folder, is there an API to get
> hold of all the 3 versions of this plugin. BundleContext or Bundle API
> gives only the latest installed version altough it returns an array, it
> contains only one plugin, the ACTIVE plugin i.e the latest version. (By
> the way this is for our Headless product) Please Let me know if the
> problem usecase is still not clear.

Thank you for the explanation, that helps.

If you have extensions (if your bundles are singletons) then you will
only ever see the highest installed version ... that is the nature of
singletons. Library bundles (bundles that are not singletons) can have
multiple versions installed, resolved, and active at the same time. The
PackageAdmin service can be used to get references to the multiple
versions using
org.osgi.service.packageadmin.PackageAdmin.getBundles(String , String)

If it is really about running one of 3 different versions of your
product, then using multiple configuration areas (as they really are 3
different versions of your application) might be the best bet. But
changing between them will require a restart.

The performance of dynamically swapping plugins is not particularly bad,
as it's not something that happens a lot (it's a configuration step).
It's useful for selecting between say, 3 versions of 5 core plugins ...
but not for swapping most of your application plugins.

Let us know how it goes.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm
Re: Invoke/Load/Launch a particular version of the plugin programatically/dynamicall [message #335466 is a reply to message #335447] Thu, 09 April 2009 12:02 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Paul.

Could you clarify the below questiions.

>> (editing the bundles.info directly is not recommended, as that's only
>> part of what p2 needs). See
what are the implications of editing bundles.info directly? Are there
other ways to do it or alternatives to this?

Also could you provide some light into questions 1) and 2) below
> bundle.info will define a particular version of plugins to load. I do have
> concerns:
> 1) about whether bundles.info is modified/overwritten by eclipse starup
> and in which cases does it do so.
> 2) If I need to replicate configuration folder for each version, do I need
> all the content under default configuration folder or could I just have
> subset of these for configuration1, configuration2, congiuration3
> folders....

Thanks much,
Nitha
Re: Invoke/Load/Launch a particular version of the plugin programatically/dynamicall [message #335468 is a reply to message #335466] Thu, 09 April 2009 13:47 Go to previous message
Eclipse UserFriend
I'm not sure what you are asking here.

For the configuration directory, it used to be enough that each one
contain a config.ini. Now there's a little more to it.

You would need to use the director app to create different profiles, one
per config area, and use the director app to put the different versions
of your plugins in each profile (and hence in each config area).

The starting point for all this is http://wiki.eclipse.org/p2

You can also ask p2 questions on eclipse.technology.equinox. Your first
one would probably be "how do I create and run 3 different apps using
different configuration areas but from the same install (bundle pool)?"

I know it is possible, but I don't know how (I've never done it).

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm
Previous Topic:[Compare Editor] DiffViewer doesn't refresh with custom CompareEditorInput
Next Topic:Lost in eclipse dowloads space
Goto Forum:
  


Current Time: Fri May 09 18:51:06 EDT 2025

Powered by FUDForum. Page generated in 0.05835 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top