Skip to main content



      Home
Home » Eclipse Projects » Equinox » Best way to determine whether Equinox is running
Best way to determine whether Equinox is running [message #75977] Wed, 01 November 2006 10:07 Go to next message
Eclipse UserFriend
Originally posted by: slewis.composent.com

I would like to have some code that would run within Equinox or as java
application. Is there a way this code can query whether Equinox is
running?
Re: Best way to determine whether Equinox is running [message #76034 is a reply to message #75977] Wed, 01 November 2006 11:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: slewis.composent.com

Scott Lewis wrote:
> I would like to have some code that would run within Equinox or as java
> application. Is there a way this code can query whether Equinox is
> running?

Platform.isRunning() duh...sorry for the distraction
Re: Best way to determine whether Equinox is running [message #76065 is a reply to message #76034] Wed, 01 November 2006 11:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jeff_mcaffer.REMOVE.ca.ibm.com

Actually, that tells you if the Eclipse Runtime is running. By
extension that implies that Equinox is running. However, there are many
valid and useful usecases that do involve Equinox and do not involve the
org.eclipse.core.runtime bundle.

As far as I recall, OSGi does not have a generic API that you can query
without actually having OSGi running/present. If OSGi is running you
can, for example, look at the status of bundle 0 (the system bundle).
There are several other things you could look at but it seems like which
is best will depend on your usecase. Can you say more about what you
are trying to do?

Jeff


Scott Lewis wrote:
> Scott Lewis wrote:
>> I would like to have some code that would run within Equinox or as
>> java application. Is there a way this code can query whether Equinox
>> is running?
>
> Platform.isRunning() duh...sorry for the distraction
Re: Best way to determine whether Equinox is running [message #76109 is a reply to message #76065] Wed, 01 November 2006 13:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: slewis.composent.com

Hi Jeff,

Jeff McAffer wrote:
> Actually, that tells you if the Eclipse Runtime is running. By
> extension that implies that Equinox is running. However, there are many
> valid and useful usecases that do involve Equinox and do not involve the
> org.eclipse.core.runtime bundle.
>
> As far as I recall, OSGi does not have a generic API that you can query
> without actually having OSGi running/present. If OSGi is running you
> can, for example, look at the status of bundle 0 (the system bundle).
> There are several other things you could look at but it seems like which
> is best will depend on your usecase. Can you say more about what you
> are trying to do?

We have some API bundles (ECF identity, ECF core, ECF provider for
example) with interfaces as well as a few factory classes.

Ideally, we would like to be able to run code that depends upon these
ECF APIs a) within Eclipse; b) in Equinox-based environments; c) in
other EE server environments (i.e. in eRCP, or non-Equinox OSGi); d) in
simple java applications.

With this query, it's mainly use case d that I'm trying to address (to
run the ECF generic server as a java application...a very simple ECF
server implementation/library), although for 'c' the problem also
exists. The most important ones for us currently are 'a', 'b', and 'd'.

Clearly, for 'd', the setup of the ECF factories, etc has to be done in
code rather than declaratively, but this is fine...we have runtime APIs
for manipulating the ECF factory contents.

We already have a compile-time dependency on IAdaptable, so no matter
which environment is present at runtime we need a few classes from
org.eclipse.core.runtime, but we don't have many of these dependencies
currently, and they are mostly on core interfaces (like
IAdaptable/IAdapterFactory), rather than on classes (like Platform) so
things work just fine in 'd' by adding core runtime jar to classpath.

So I suppose to address all use cases what's needed is either a) some
other consistent interface/way to determine whether the OSGi platform is
running; or b) an indication of the runtime requirements for all the
org.eclipse.ecf.core.runtime classes (if they are going to serve that
role WRT Equinox).

Please let me know if this conclusion/analysis isn't right...or even if
it is!

Thanks,

Scott


>
> Jeff
>
>
> Scott Lewis wrote:
>> Scott Lewis wrote:
>>> I would like to have some code that would run within Equinox or as
>>> java application. Is there a way this code can query whether Equinox
>>> is running?
>>
>> Platform.isRunning() duh...sorry for the distraction
Re: Best way to determine whether Equinox is running [message #76123 is a reply to message #76109] Wed, 01 November 2006 14:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jeff_mcaffer.REMOVE.ca.ibm.com

I guess what I am asking is "what is the question you want to ask in the
code and how would you react depending on the different answers?" some
sample questions

- Is Equionx running?
- Is OSGi running?
- Is an Eclipse application running?
- etc.

all of these are different questions answered in differnet ways by
different people.

Jeff


Scott Lewis wrote:
> Hi Jeff,
>
> Jeff McAffer wrote:
>> Actually, that tells you if the Eclipse Runtime is running. By
>> extension that implies that Equinox is running. However, there are
>> many valid and useful usecases that do involve Equinox and do not
>> involve the org.eclipse.core.runtime bundle.
>>
>> As far as I recall, OSGi does not have a generic API that you can
>> query without actually having OSGi running/present. If OSGi is
>> running you can, for example, look at the status of bundle 0 (the
>> system bundle). There are several other things you could look at but
>> it seems like which is best will depend on your usecase. Can you say
>> more about what you are trying to do?
>
> We have some API bundles (ECF identity, ECF core, ECF provider for
> example) with interfaces as well as a few factory classes.
>
> Ideally, we would like to be able to run code that depends upon these
> ECF APIs a) within Eclipse; b) in Equinox-based environments; c) in
> other EE server environments (i.e. in eRCP, or non-Equinox OSGi); d) in
> simple java applications.
>
> With this query, it's mainly use case d that I'm trying to address (to
> run the ECF generic server as a java application...a very simple ECF
> server implementation/library), although for 'c' the problem also
> exists. The most important ones for us currently are 'a', 'b', and 'd'.
>
> Clearly, for 'd', the setup of the ECF factories, etc has to be done in
> code rather than declaratively, but this is fine...we have runtime APIs
> for manipulating the ECF factory contents.
>
> We already have a compile-time dependency on IAdaptable, so no matter
> which environment is present at runtime we need a few classes from
> org.eclipse.core.runtime, but we don't have many of these dependencies
> currently, and they are mostly on core interfaces (like
> IAdaptable/IAdapterFactory), rather than on classes (like Platform) so
> things work just fine in 'd' by adding core runtime jar to classpath.
>
> So I suppose to address all use cases what's needed is either a) some
> other consistent interface/way to determine whether the OSGi platform is
> running; or b) an indication of the runtime requirements for all the
> org.eclipse.ecf.core.runtime classes (if they are going to serve that
> role WRT Equinox).
>
> Please let me know if this conclusion/analysis isn't right...or even if
> it is!
>
> Thanks,
>
> Scott
>
>
>>
>> Jeff
>>
>>
>> Scott Lewis wrote:
>>> Scott Lewis wrote:
>>>> I would like to have some code that would run within Equinox or as
>>>> java application. Is there a way this code can query whether
>>>> Equinox is running?
>>>
>>> Platform.isRunning() duh...sorry for the distraction
Re: Best way to determine whether Equinox is running [message #76139 is a reply to message #76123] Wed, 01 November 2006 14:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: slewis.composent.com

Hi Jeff,

Jeff McAffer wrote:
> I guess what I am asking is "what is the question you want to ask in the
> code and how would you react depending on the different answers?" some
> sample questions
>
> - Is Equionx running?
> - Is OSGi running?
> - Is an Eclipse application running?
> - etc.

For our purposes, the first one is the one we would really like to ask.
Depending upon the answer we would like populate a factory class
because we then know it won't be done via extension registry ('no' in
response to 'is Equinox running?')

I can imagine use cases for the others, but I'm not experiencing them
right now.

Scott
Re: Best way to determine whether Equinox is running [message #76510 is a reply to message #76139] Sun, 05 November 2006 20:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jeff_mcaffer.REMOVE.ca.ibm.com

Not to be pedantic about it but is the question you want to ask
"Is there a registry service?"
The Extension registry can run in any R4 compliant framework and Equinox
can run without the Extension registry. Knowing that the underlying
framework is Equinox doesn't seem like it would help you in this case.

If you want to see if the registry is around, look for the
org.eclipse.core.runtime.ExtensionRegistry service (or something like that)

Does that match what you are trying to do?

Jeff


Scott Lewis wrote:
> Hi Jeff,
>
> Jeff McAffer wrote:
>> I guess what I am asking is "what is the question you want to ask in
>> the code and how would you react depending on the different answers?"
>> some sample questions
>>
>> - Is Equionx running?
>> - Is OSGi running?
>> - Is an Eclipse application running?
>> - etc.
>
> For our purposes, the first one is the one we would really like to ask.
> Depending upon the answer we would like populate a factory class
> because we then know it won't be done via extension registry ('no' in
> response to 'is Equinox running?')
>
> I can imagine use cases for the others, but I'm not experiencing them
> right now.
>
> Scott
Re: Best way to determine whether Equinox is running [message #76687 is a reply to message #76510] Tue, 07 November 2006 17:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: slewis.composent.com

Hi Jeff,

Jeff McAffer wrote:
> Not to be pedantic about it but is the question you want to ask
> "Is there a registry service?"

Yes.

> The Extension registry can run in any R4 compliant framework and Equinox
> can run without the Extension registry. Knowing that the underlying
> framework is Equinox doesn't seem like it would help you in this case.

I wasn't aware that Equinox can/could run without the Extension
registry...thanks. For curiosity's sake...what's the minimal Equinox,
then, above and beyond OSGi spec?

>
> If you want to see if the registry is around, look for the
> org.eclipse.core.runtime.ExtensionRegistry service (or something like that)


Thanks.

Scott


>
> Does that match what you are trying to do?


>
> Jeff
>
>
> Scott Lewis wrote:
>> Hi Jeff,
>>
>> Jeff McAffer wrote:
>>> I guess what I am asking is "what is the question you want to ask in
>>> the code and how would you react depending on the different
>>> answers?" some sample questions
>>>
>>> - Is Equionx running?
>>> - Is OSGi running?
>>> - Is an Eclipse application running?
>>> - etc.
>>
>> For our purposes, the first one is the one we would really like to
>> ask. Depending upon the answer we would like populate a factory class
>> because we then know it won't be done via extension registry ('no' in
>> response to 'is Equinox running?')
>>
>> I can imagine use cases for the others, but I'm not experiencing them
>> right now.
>>
>> Scott
Re: Best way to determine whether Equinox is running [message #76719 is a reply to message #75977] Wed, 08 November 2006 04:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stepper.sympedia.de

Scott,

I've had the same problem and solved it this way:

public class Activator implements BundleActivator
{
private static boolean osgiRunning;

public static boolean isOsgiRunning()
{
return osgiRunning;
}

public void start(BundleContext context) throws Exception
{
osgiRunning = true;
}

public void stop(BundleContext context) throws Exception
{
}
}

Do you think this is appropriate?

Cheers
/Eike


Scott Lewis schrieb:
> I would like to have some code that would run within Equinox or as
> java application. Is there a way this code can query whether Equinox
> is running?
Re: Best way to determine whether Equinox is running [message #76735 is a reply to message #76687] Wed, 08 November 2006 06:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

Actually, Jeff, this isn't the first time that people haven't been aware that you could do this, and being fair, there's not much on the Equinox home page (http://www.eclipse.org/equinox/) that says you can either.

What about putting together some kind of diagram, like that used for advertising RCP (e.g. http://wiki.eclipse.org/index.php/RCP_FAQ#otherComponents) showing the relationships between the 'core' equinox implementation of the OSGi spec, and additional bundles which sit upon an OSGi spec that can be used outside of the Equinox-OSGi-core?

Alex.
Re: Best way to determine whether Equinox is running [message #76781 is a reply to message #76735] Wed, 08 November 2006 13:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jeff_mcaffer.REMOVE.ca.ibm.com

Yup. To a certain degree we are still refining the implementation. Our
challenge has been that the other open source OSGi implementations
either did/do not implement all the parts of the spec that we need
and/or have/had bugs preventing Eclipse things from running. The net
effect is that we have not had the opportunity to test various bits of
equinox on other frameworks.

As this story evolves we certainly will make the information you suggest
widely available.

Jeff

Alex Blewitt wrote:
> Actually, Jeff, this isn't the first time that people haven't been aware that you could do this, and being fair, there's not much on the Equinox home page (http://www.eclipse.org/equinox/) that says you can either.
>
> What about putting together some kind of diagram, like that used for advertising RCP (e.g. http://wiki.eclipse.org/index.php/RCP_FAQ#otherComponents) showing the relationships between the 'core' equinox implementation of the OSGi spec, and additional bundles which sit upon an OSGi spec that can be used outside of the Equinox-OSGi-core?
>
> Alex.
Re: Best way to determine whether Equinox is running [message #76797 is a reply to message #76687] Wed, 08 November 2006 13:25 Go to previous message
Eclipse UserFriend
Originally posted by: jeff_mcaffer.REMOVE.ca.ibm.com

Scott Lewis wrote:
> Jeff McAffer wrote:
>> Not to be pedantic about it but is the question you want to ask
>> "Is there a registry service?"
> Yes.

Given that, you should be able just to see if the registry service is
present by using standard OSGi service registry calls.

> I wasn't aware that Equinox can/could run without the Extension
> registry...thanks. For curiosity's sake...what's the minimal Equinox,
> then, above and beyond OSGi spec?

I'm not quite sure how to answer that. Equinox is, in essence, our OSGi
framework implementation. So the minimal Equinox is the
org.eclipse.osgi bundle. It runs fine just by itself. In fact, there
is a mess of stuff in there that really isn't needed by someone just
doing OSGi. As you step up from that you add bundles that get you the
function you want. If you want the registry (for example) you likely
just need org.eclipse.equinox.registry and org.eclipse.equinox.common.
Jobs would be optional.

In general then you start with the bundle(s) that implement the function
you need and pull the dependency strings. The work we have going on now
is to reduce the number of interconnections and at the very bottom cut
the string that connect people to the org.eclipse.osgi bundle. (see my
reply to Alex)

Jeff
Previous Topic:Classloading problems while migrating vom 3.1.0 to 3.2.1
Next Topic:Component descriptions, update, and Eclipse
Goto Forum:
  


Current Time: Sat May 10 02:07:53 EDT 2025

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

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

Back to the top