Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » using ecore in an equinox runtime
using ecore in an equinox runtime [message #70219] Tue, 18 July 2006 13:07 Go to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Moving a question posted on osgi-dev@bundles.osgi.org mailing list at
http://www.mail-archive.com/osgi-dev@bundles.osgi.org/msg001 29.html

Posted from David Kemper:

I'm trying to use ecore in an Equinox OSGi environment. I'll try
first to state the problem and the symptoms without going deep into
details, and provide any additional info in any follow-ups.

I am installing a fairly large set of required bundles...about a
hundred. This is the result of analyzing all the bundle dependencies
of my client bundle. My client bundle has a dependency on the
org.eclipse.emf.ecore, and all of the hundred bundles that I install
get resolved, including my client bundle.

I explicitly start my client bundle. When I try to use ecore as a
result of my client bundle activator, I get a class not found error
on org.eclipse.em.ecore.EObject, which is in the ecore bundle.

Now here's the rub: If I explicitly start the
org.eclipse.equinox.common bundle before I start my client bundle, my
code works.

My underlying question is: How do I know what bundles need to be
explicitly started in any given configuration? In other words, what
makes org.eclipse.equinox.common special in that I need to explicitly
start it? In my mental OSGi model, a bundle that has an activator
will be started by the framework when its code gets referenced for
the first time (barring explicit calls using the bundle context). Is
this in error? Are there other bundles that I need to start
explicitly, even though their code gets referenced? If so, how do I
know? I'm wondering if there is a set of equinox bundles that I
really should start in my runtime to get a properly functional OSGi
runtime (Current the only such bundle is the org.eclipse.osgi
framework bundle, which gets started implicitly, as it is the
framework bundle).

As always, thanks for any pointers, or for sending me to a more
appropriate list...

/djk
Re: using ecore in an equinox runtime [message #70240 is a reply to message #70219] Tue, 18 July 2006 14:43 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
In equinox we have a concept of lazy activation. This is not an OSGi
spec'ed feature. When bundles are marked for lazy activation (using the
Eclipse-LazyStart header) they will be activated upon the first class
load. In Eclipse 3.2 we have a bug in org.eclipse.equinox.common, this
bundle was not marked for lazy start. See
https://bugs.eclipse.org/bugs/show_bug.cgi?id=143038 this bug is fixed
for 3.3.

Eclipse is normally launched with a config.ini file that contains an
osgi.bundles property to list the initial bundles that should be
installed into the framework. This list also specifies whether the
bundle should be started and at what start-level this bundle should be
started. The reason the we do not see this problem in a "normal"
eclipse launch is because this property is set to the following in a
default eclipse installation ...


osgi.bundles=
org.eclipse.equinox.common@2:start,
org.eclipse.update.configurator@3:start,
org.eclipse.core.runtime@start

This specifies that the common bundle should be install and started at
start-level 2. So we explicitly start this bundle in a typical eclipse
configuration.

HTH

Tom
Re: using ecore in an equinox runtime [message #71391 is a reply to message #70240] Thu, 03 August 2006 17:34 Go to previous messageGo to next message
David Kemper is currently offline David KemperFriend
Messages: 8
Registered: July 2009
Junior Member
Tom,

Thanks for the response; it took me a while to get back to this issue,
and I want to be sure I understand its implications.

For various reasons the project that I'm working on launches an Equinox
OSGi runtime with our own bundle that performs functions similar to the
Eclipse Update Configurator. That bundle is explicitly started, and its
bundle activator determines what other bundles need to be installed and
optionally started.

Would you explain why it was necessary to create Eclipse-LazyStart? Its
requirement doesn't mesh with my mental model of OSGi. I thought that
if a bundle has an activator, its start method is called the first time
that code is loaded from that bundle.

If that is *not* the case, then in "pure" OSGi is it up to the operator
(a person or some controller code) to ensure that a given bundle is
explicitly started before its code is used? That would mean that when
starting some bundle X, the operator needs to know which of bundle X's
dependencies need to be explicitly started first, which seems *really*
onerous. It implies an intimate knowledge of the internals of a bundle
and all its dependencies.

If this is why Eclipse-LazyStart was created, I'm surprised it was
missing from OSGi to begin with.

Any insights into this issue, when to start bundles, bundle activators,
and related topics would be much appreciated.

/djk

Tom Watson wrote:
> In equinox we have a concept of lazy activation. This is not an OSGi
> spec'ed feature. When bundles are marked for lazy activation (using the
> Eclipse-LazyStart header) they will be activated upon the first class
> load. In Eclipse 3.2 we have a bug in org.eclipse.equinox.common, this
> bundle was not marked for lazy start. See
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=143038 this bug is fixed
> for 3.3.
>
> Eclipse is normally launched with a config.ini file that contains an
> osgi.bundles property to list the initial bundles that should be
> installed into the framework. This list also specifies whether the
> bundle should be started and at what start-level this bundle should be
> started. The reason the we do not see this problem in a "normal"
> eclipse launch is because this property is set to the following in a
> default eclipse installation ...
>
>
> osgi.bundles=
> org.eclipse.equinox.common@2:start,
> org.eclipse.update.configurator@3:start,
> org.eclipse.core.runtime@start
>
> This specifies that the common bundle should be install and started at
> start-level 2. So we explicitly start this bundle in a typical eclipse
> configuration.
>
> HTH
>
> Tom
Re: using ecore in an equinox runtime [message #71411 is a reply to message #71391] Thu, 03 August 2006 18:13 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Many of the issues you state are the reason we added the
Eclipse-LazyStart header. In a typical OSGi environment (not eclipse)
ALL bundles are activated by an operator (or install agent). When an
install agent installs a bundle it usually will start the bundle. Now
there are many different scenarios and policies an agent can apply but
the typical and simplest path is the agent starts every bundle it installs.

That policy was unacceptable for Eclipse. We wanted to have as few
bundles activated initially as possible to reduce startup time and
memory footprint. Then we wanted bundles activated on demand depending
on the actions of the user. Our policy is the Eclipse-LazyStart policy.
For example, when a user clicks on a menu item we load a class from a
bundle that supplies the extension for that menu item. If that bundle
is marked for lazy start and it has not been activated yet then this
causes the activation of the bundle. This type of policy cannot be
built into an agent, instead it is part of the class loaders in the
Equinox framework.

>> I thought that if a bundle has an activator, its start method is
>> called the first time that code is loaded from that bundle.

This is not true. A bundle in OSGi is allowed to load code as long as
it is in the RESOLVED state. The Eclipse-LazyStart header is a way to
get the behavior you are describing. If set to true this will force the
bundle to be activated (and its bundle activator start method called)
before a class is loaded from it.

>> If this is why Eclipse-LazyStart was created, I'm surprised it was
>> missing from OSGi to begin with.

This usecase is very important to Equinox/Eclipse. We are in the
process of proposing this usecase and possible solution
(Eclipse-LazyStart) for the next release of OSGi. But that will be a
long ways off until OSGi R5 is released. The OSGi Alliance is barely
gathering requirements now. So if this is important to you then you
will have to stick with the Equinox implementation for some time ;-)

HTH

Tom
Re: using ecore in an equinox runtime [message #71506 is a reply to message #71411] Thu, 03 August 2006 21:36 Go to previous message
David Kemper is currently offline David KemperFriend
Messages: 8
Registered: July 2009
Junior Member
Tom Watson wrote:
> This usecase is very important to Equinox/Eclipse. We are in the
> process of proposing this usecase and possible solution
> (Eclipse-LazyStart) for the next release of OSGi. But that will be a
> long ways off until OSGi R5 is released. The OSGi Alliance is barely
> gathering requirements now. So if this is important to you then you
> will have to stick with the Equinox implementation for some time ;-)

Oh, the horror! ;-)

Thanks for the background. It gives me exactly the information that I
require.

And good luck with that R5...

/djk
Previous Topic:Export-Package mandatory directive
Next Topic:Configuration Admin service usage example
Goto Forum:
  


Current Time: Thu Apr 25 03:50:07 GMT 2024

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

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

Back to the top