When is a dependent Plugin started? [message #293986] |
Thu, 03 November 2005 14:00 |
Eclipse User |
|
|
|
Originally posted by: eclipse.bettsockentraeger.de
I'm kind of getting confused with the way OSGI or Eclipse handles
activation of plugins (Bundles).
I have three plugins
Plugin A provides a basic service which B and C depend on.
Plugin B dependts on Plugin A and Plugin C depends on Plugin B.
Plugin C provides the front end.
When Plugin C gets activated by displaying a view for example it
activates Plugin B but Pluginn A is not activated automatically. I have
to call the start method on the bundle for Plugin A manually in order to
activate it.
I thought that if Plugin C is activated it should activate B and A
respectivly since it depends on both. Is this not correct?
Hope that someone can clear up my confusion
Stefan
|
|
|
|
Re: When is a dependent Plugin started? [message #293989 is a reply to message #293986] |
Thu, 03 November 2005 14:20 |
Eclipse User |
|
|
|
Originally posted by: automatic.javalobby.org
Is there some code in your plugin's start method ? I hope you know that Eclipse does activate bundles in a lazy loaded fashion, exactly when it is needed (OSGi guys will be able to answer class-loading part very well). Generally you don't need to have any code in start method. If there isn't any code, then why does the order of loading matters ? I hope your application behavior should be transparent to plugin load-order.
Most of the code could be organized to lazy load.
Thanks
~Venkat
|
|
|
Re: When is a dependent Plugin started? [message #293990 is a reply to message #293989] |
Thu, 03 November 2005 14:22 |
Eclipse User |
|
|
|
Originally posted by: automatic.javalobby.org
I forgot to pay attention to the word "SERVICE" in your post. Does your plugin wish to start some service when Eclipse starts (I mean user's intervention, the service starts at Eclipse's start courtesy startup extension) ?
Dont mind ! Too many questions ;-)
Thanks
Venkat
|
|
|
Re: When is a dependent Plugin started? [message #293991 is a reply to message #293990] |
Thu, 03 November 2005 14:31 |
Eclipse User |
|
|
|
Originally posted by: eclipse.bettsockentraeger.de
To clear things up.
In Plugin A I initialize a service class (simply creating an object) in
the start method.
In Plugin B I call into Plugin A when the user interacts with the plugin
by calling A.getDefault() which provides me with the singleton instance
of A which is at this time null because Plugin A wasn't activated yet.
To resolve the issue I wrote some code that checks if Plugin A was
started and if it wasn't I start it my self. Now A.getDefault() returns
a non null value.
I thought that when I call A.getDefault() than Plugin A should
automagically be activated and started which is obviously not the case
so my thinking is wrong.
Hope that clears things
Stefan
venkataramana wrote:
> I forgot to pay attention to the word "SERVICE" in your post. Does your plugin wish to start some service when Eclipse starts (I mean user's intervention, the service starts at Eclipse's start courtesy startup extension) ?
>
> Dont mind ! Too many questions ;-)
>
> Thanks
> Venkat
|
|
|
Re: When is a dependent Plugin started? [message #293995 is a reply to message #293991] |
Thu, 03 November 2005 15:09 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
If it is null, then you probably don't have
Eclipse-AutoStart: true
in your plugin A manifest. Depending on what settings you supplied in
the wizard when you created the plugin project for A this setting may
not of been set.
Stefan Langer wrote:
> To clear things up.
>
> In Plugin A I initialize a service class (simply creating an object) in
> the start method.
>
> In Plugin B I call into Plugin A when the user interacts with the plugin
> by calling A.getDefault() which provides me with the singleton instance
> of A which is at this time null because Plugin A wasn't activated yet.
> To resolve the issue I wrote some code that checks if Plugin A was
> started and if it wasn't I start it my self. Now A.getDefault() returns
> a non null value.
> I thought that when I call A.getDefault() than Plugin A should
> automagically be activated and started which is obviously not the case
> so my thinking is wrong.
>
> Hope that clears things
>
> Stefan
>
> venkataramana wrote:
>
>> I forgot to pay attention to the word "SERVICE" in your post. Does
>> your plugin wish to start some service when Eclipse starts (I mean
>> user's intervention, the service starts at Eclipse's start courtesy
>> startup extension) ?
>>
>> Dont mind ! Too many questions ;-)
>>
>> Thanks
>> Venkat
--
Thanks,
Rich Kulp
|
|
|
Re: When is a dependent Plugin started? [message #293998 is a reply to message #293995] |
Thu, 03 November 2005 15:17 |
Eclipse User |
|
|
|
Originally posted by: eclipse.bettsockentraeger.de
but Eclipse-AutoStart: true will start the plugin always at startup.
Isn't this bad since it will provide a performance penalty even if the
plugin is not used?
Rich Kulp wrote:
> If it is null, then you probably don't have
>
> Eclipse-AutoStart: true
>
> in your plugin A manifest. Depending on what settings you supplied in
> the wizard when you created the plugin project for A this setting may
> not of been set.
>
> Stefan Langer wrote:
>
>> To clear things up.
>>
>> In Plugin A I initialize a service class (simply creating an object)
>> in the start method.
>>
>> In Plugin B I call into Plugin A when the user interacts with the
>> plugin by calling A.getDefault() which provides me with the singleton
>> instance of A which is at this time null because Plugin A wasn't
>> activated yet.
>> To resolve the issue I wrote some code that checks if Plugin A was
>> started and if it wasn't I start it my self. Now A.getDefault()
>> returns a non null value.
>> I thought that when I call A.getDefault() than Plugin A should
>> automagically be activated and started which is obviously not the case
>> so my thinking is wrong.
>>
>> Hope that clears things
>>
>> Stefan
>>
>> venkataramana wrote:
>>
>>> I forgot to pay attention to the word "SERVICE" in your post. Does
>>> your plugin wish to start some service when Eclipse starts (I mean
>>> user's intervention, the service starts at Eclipse's start courtesy
>>> startup extension) ?
>>>
>>> Dont mind ! Too many questions ;-)
>>>
>>> Thanks
>>> Venkat
>
>
|
|
|
Re: When is a dependent Plugin started? [message #294004 is a reply to message #293998] |
Thu, 03 November 2005 15:24 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
No, that's not what it means. It means start the plugin (i.e. call the
start method) the first time any class within the plugin is loaded.
To start at Eclipse startup you use the startup extension point.
--
Thanks,
Rich Kulp
|
|
|
|
Re: When is a dependent Plugin started? [message #294007 is a reply to message #294004] |
Thu, 03 November 2005 15:26 |
Eclipse User |
|
|
|
Originally posted by: eclipse.bettsockentraeger.de
Thanks for clearing that up. Now it makes sense. I deleted that entry
since I thought this will actually start the plugin at startup.
Thank you
Stefan
Rich Kulp wrote:
> No, that's not what it means. It means start the plugin (i.e. call the
> start method) the first time any class within the plugin is loaded.
>
> To start at Eclipse startup you use the startup extension point.
>
|
|
|
Re: When is a dependent Plugin started? [message #294020 is a reply to message #293991] |
Thu, 03 November 2005 16:41 |
Eclipse User |
|
|
|
Originally posted by: automatic.javalobby.org
Now that things have been cleared with "Autostart", just a diversion ...
If Autostart="false", then the semantics of that is like Eclipse doesn't load classes part of that plugin if the plugin's state is not yet started. Probably that is required when user's intervention is necessary to start certain plugins which are rather resource-intensive/security-conscious/time-bound services/ etc., May be I need to have a glimpse at OSGi specification to understand the philosophy of bundles ;-)
|
|
|
Re: When is a dependent Plugin started? [message #294076 is a reply to message #293991] |
Thu, 03 November 2005 20:29 |
Eclipse User |
|
|
|
Originally posted by: Lamont_Gilbert.rigidsoftware.com
If you have autostart in your manifest, then your plugin will be started
anytime any class from it is used. That is, if you use any class type
defined in that plugin, when eclipse needs to load that class type,
first it will start your plugin.
If you do not have autostart in your manifest, the plugin will be
started only when you properly request it from the plugin registry.
You should not be asking for your plugin directly like you are actually.
You should expose the resources you want to expose through the
extension mechanism by declaring an extension point. Then Plugin B will
get the implementer of te extension point from the plugin registry.
This is the correct way.
What you are doing is subverting eclipse and subject to cause you some
serious problems in the future. Plus eclipse needs some work in this
area as its sorta 1/2 converted to osgi philosophy. There should not be
any static reference available ourside of the plugin itself anyway!
Especially if your plugin is not a singleton.
Anyway, if you put
Eclipse-AutoStart: true
in your manifest you should be ok with what you are doing for now. But
if you do th eproper thing and use the registry to expose a service,
then you wont need autostart for plugin A, but you wil probably need it
still for the main plugin B in this case.
Stefan Langer wrote:
> To clear things up.
>
> In Plugin A I initialize a service class (simply creating an object) in
> the start method.
>
> In Plugin B I call into Plugin A when the user interacts with the plugin
> by calling A.getDefault() which provides me with the singleton instance
> of A which is at this time null because Plugin A wasn't activated yet.
> To resolve the issue I wrote some code that checks if Plugin A was
> started and if it wasn't I start it my self. Now A.getDefault() returns
> a non null value.
> I thought that when I call A.getDefault() than Plugin A should
> automagically be activated and started which is obviously not the case
> so my thinking is wrong.
>
If you use auto start, as soon as the class in Plugin B is loaded that
contains the A type, plugin A will be loaded...
CL
|
|
|
|
|
Re: When is a dependent Plugin started? [message #294114 is a reply to message #294076] |
Fri, 04 November 2005 08:05 |
Eclipse User |
|
|
|
Originally posted by: eclipse.bettsockentraeger.de
Now this brings me to a nice question. You are saying I should provide
extension points to plugin a to not have a static binding between Plugin
A, B and C.
In case of C and B, C provides the UI for B so C depends on B and its
internals anyway so what is the danger of coupling the two together?
In case of A, A provides a special service by loading some classes for B
and setting them up (IoC). Which classes to load it gets told by A. I
tried to provide an extension point but it doesn't work out properly
because B is not an extension to A but B needs A to do some work for it.
Of course I could move the loading code into B but then other plugins
that need the same functionality would have to provide the same code
again and this clearly violates DRY which in my opinion is worse than
coupling Plugin B to Plugin A which has a dependency anyway.
So please clarify why it is a bad idea to couple the two in this way and
how to provide an extension point for a plugin that is not an extension
but more like a service.
Stefan
CL [dnoyeb] Gilbert wrote:
> If you have autostart in your manifest, then your plugin will be started
> anytime any class from it is used. That is, if you use any class type
> defined in that plugin, when eclipse needs to load that class type,
> first it will start your plugin.
>
> If you do not have autostart in your manifest, the plugin will be
> started only when you properly request it from the plugin registry.
>
> You should not be asking for your plugin directly like you are actually.
> You should expose the resources you want to expose through the
> extension mechanism by declaring an extension point. Then Plugin B will
> get the implementer of te extension point from the plugin registry. This
> is the correct way.
>
> What you are doing is subverting eclipse and subject to cause you some
> serious problems in the future. Plus eclipse needs some work in this
> area as its sorta 1/2 converted to osgi philosophy. There should not be
> any static reference available ourside of the plugin itself anyway!
> Especially if your plugin is not a singleton.
>
> Anyway, if you put
> Eclipse-AutoStart: true
>
> in your manifest you should be ok with what you are doing for now. But
> if you do th eproper thing and use the registry to expose a service,
> then you wont need autostart for plugin A, but you wil probably need it
> still for the main plugin B in this case.
|
|
|
Powered by
FUDForum. Page generated in 0.04651 seconds