Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Dynamic Unawareness of an extension point
Dynamic Unawareness of an extension point [message #126036] Fri, 20 February 2009 13:33 Go to next message
Siddharth is currently offline SiddharthFriend
Messages: 3
Registered: July 2009
Junior Member
Hi,

We have a RCP which was based on eclipse 3.0 which is being migrated to
eclipse 3.4 . During the migration, we removed the deprecated
getNamespace() method of the IConfigurationElement to
getDeclaringExtension().getNamespaceIdentifier().

We are now running into InvalidRegistryObjectException frequently and the
stack trace points to the above call. We read the extensions upfront and
store up all the IConfigurationElement objects. I understand that this
means the extension point is not dynamic aware and since we do not have a
scenario of dynamically contributing to the extension point, we have not
made it dynamically aware. Is this going to pose a problem?

Can an extension which is not dynamically aware survive in the platform
without throwing unexpected errors, if none of the dynamic awareness
capabilities are used on it?

Please help.

Thanks,
Siddharth
Re: Dynamic Unawareness of an extension point [message #126114 is a reply to message #126036] Fri, 20 February 2009 15:25 Go to previous messageGo to next message
Oleg Besedin is currently offline Oleg BesedinFriend
Messages: 41
Registered: July 2009
Member
Hi Siddharth,
The IConfigurationElement is a handle to a "real" registry element and best
not be cached precisely for the reasons you describe - the "real" registry
element can be modified or removed.

If you do need to cache IConfigurationElement's when your best bet is to
create a listener on the extension registry:

IExtensionRegistry#addListener(IRegistryEventListener listener)

and process registry events.

Sincerely,
Oleg Besedin


"Siddharth " <siddharth.cr@in.ibm.com> wrote in message
news:9d6a1d1a485975967fb24476f62fd9be$1@www.eclipse.org...
> Hi,
>
> We have a RCP which was based on eclipse 3.0 which is being migrated to
> eclipse 3.4 . During the migration, we removed the deprecated
> getNamespace() method of the IConfigurationElement to
> getDeclaringExtension().getNamespaceIdentifier().
>
> We are now running into InvalidRegistryObjectException frequently and the
> stack trace points to the above call. We read the extensions upfront and
> store up all the IConfigurationElement objects. I understand that this
> means the extension point is not dynamic aware and since we do not have a
> scenario of dynamically contributing to the extension point, we have not
> made it dynamically aware. Is this going to pose a problem?
> Can an extension which is not dynamically aware survive in the platform
> without throwing unexpected errors, if none of the dynamic awareness
> capabilities are used on it?
>
> Please help.
>
> Thanks,
> Siddharth
>
>
Re: Dynamic Unawareness of an extension point [message #126243 is a reply to message #126114] Mon, 23 February 2009 13:31 Go to previous messageGo to next message
Siddharth is currently offline SiddharthFriend
Messages: 3
Registered: July 2009
Junior Member
Hi Oleg,

Since we do not plan to make our extensions dynamic aware, is there any
way we can get around this exception? I mean, is there any general
practice for extensions that do not want to be dynamic aware?

Are we risking anything by not making our extensions dynamic aware?

Can any contribution to any extension point lead to InvalidRegistryObject
on the configuration elements of my extension.

Please excuse me if my questions are basic. I am still understanding about
extensions.

Thanks,
Siddharth
Re: Dynamic Unawareness of an extension point [message #126408 is a reply to message #126243] Wed, 25 February 2009 13:37 Go to previous messageGo to next message
Siddharth is currently offline SiddharthFriend
Messages: 3
Registered: July 2009
Junior Member
Hi Oleg,

Since we have no plans to make our extension points dynamic aware, as a
work around, can we do something like the following:

Do not hold on to any of the registry elements and extract all the data
needed from them while reading the registry for the first time.

Is this correct?

Please help.

Thanks,
Siddharth
Re: Dynamic Unawareness of an extension point [message #126841 is a reply to message #126408] Mon, 02 March 2009 21:32 Go to previous message
Oleg Besedin is currently offline Oleg BesedinFriend
Messages: 41
Registered: July 2009
Member
Hi Siddharth,
I imagine there are two situations possible:
a) you cache extension registry elements for the duration of the session;
b) you cache extension registry elements between running sessions.

The approach would be different depending on either you have (a) or (b). To
see why, let's consider when handles to the registry elements become
invalid.

The registry has its own cache that gets populated by gathering information
from all plugin.xml files included in the configuration. The handles to
registry elements are formed based on that internal cache.

This internal cache is created during the initial run and re-created either
when Eclipse is run with "-clean" option, or when the running instance
detects that cache no longer fits: bundles have been added or removed,
language or some other OS option changed.

Say, you cache registry elements. The elements you get remains valid as long
as either the bundle that contributed those elements remain valid, or until
the "internal" registry cache gets regenerated.

This is where the distinction between (a) and (b) comes in. For the case (a)
as long as the originating bundle is not modified, your cached values remain
valid. The recommended approach in this case would be to create a listener
on the extension point; make the listener discard your cache on any changes;
structure code to re-create your cache lazily when it is asked to provide
information.

For the case (b) things are going to be more complicated. I am not sure it
can be done properly without using internal registry methods to determine if
it is using its internal cache and recreated it from plugin.xml files. Some
situations could be tracked by checking for "-clean" runtime option and its
derivative, but it is possible that registry internal cache would be
re-created for other reasons on startup.

So, the recommended approach:
- Do no cache registry elements between Eclipse runs
- When you cache registry elements for the duration of the session:
- Create a listener on the extension point
- Make the listener invalidate your cache
- If possible, organize the cache to be re-filled lazily

If, as you say, "we have no plans to make our extension points dynamic
aware", when you can just keep the cache for the duration of the running
session and hope the user does not run an update and choose to apply changes
(rather then restart).

Hope this helps.

Sincerely,
Oleg Besedin


"Siddharth " <siddharth.cr@in.ibm.com> wrote in message
news:c3008dbfe9b8172cb17d5d1e7a8fcce1$1@www.eclipse.org...
> Hi Oleg,
>
> Since we have no plans to make our extension points dynamic aware, as a
> work around, can we do something like the following:
>
> Do not hold on to any of the registry elements and extract all the data
> needed from them while reading the registry for the first time.
>
> Is this correct?
>
> Please help.
>
> Thanks,
> Siddharth
>
Previous Topic:Cannot find a solution satisfying the following requirements org.eclipse.equinox.preferences [3.2.30
Next Topic:secure storage preference ui features
Goto Forum:
  


Current Time: Tue Mar 19 04:12:14 GMT 2024

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

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

Back to the top