Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » using a plugin as a service, Microkernel-like design pattern.
using a plugin as a service, Microkernel-like design pattern. [message #462865] Thu, 01 February 2007 15:44 Go to next message
Eclipse UserFriend
Originally posted by: kristof.taveirne.intec.ugent.be

Hi,

I'm trying to create a eclipse rcp application based on a
microkernel-like design pattern. I'm doing this just to do some research
of the capabilities of OSGi and the RCP platform.

I have a core with a couple of managers that know how to communicate and
handle events from a specific service provider.

What I'm trying to do is to create a core application which can turn
into different branches just by installing a different feature.
The branches differ in the way they provide a specific service.
For example branch1 has an IdentityProvider service which provides the
application of identity information read from an electronic identity
card. An other branch may get the info from a wizard or some other
online userbase.

What I'm trying to do now is to add the feature at runtime, and I use
the earlyStart extension point and the IStartup interface to startup the
bundle. Then when the identityService is needed my ideas was to simply
check the extensionRegistry if there is a bundle which declares in it's
plugin.xml file using an extension in which it specifies that that
plugin is indeed an IdentityProvider. At this point in my core I know
the identifier of the IdentityProvider using the ExtensionRegistry.

The next step is ofcourse that I want to be notified of events thrown by
this provider. This is because the identity provider should fire an
event when an identity is provided. For example when an E-ID is inserted
in the cardreader. Now HERE is where my problem is.
I can get the plugin identifier, but I can't get a reference to that
plugin to do a typical Observer/Observable design pattern.

My first idea was to use
((IdentityProvider)Platform.getPlugin(id)).register(new
IdentityListener(){...});

But now I see that Platform.getPlugin() is deprecated and I'm stuck with
my design.

Can somebody help me with this? Where is my design incompatible with the
RCP way of doing things, and how could I solve it?

Thanks,

Kristof Taveirne
Re: using a plugin as a service, Microkernel-like design pattern. [message #462868 is a reply to message #462865] Thu, 01 February 2007 16:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kristof.taveirne.intec.ugent.be

I guess I'm making things to complicated.
Maybe I shouldn't use the extension points but simply register the class
that implements the service to the core, instead trying to force the
core to register itself to events to my service.

It's easier to get a reference the other way around because I can easily
implement a Activator.getInstance() method in the application's core.

Getting a reference to the Activator using only IConfigurationElement is
not possible anymore because Platform.getPlugin() is deprecated. Is this
correct?

Greetings,
Kristof.

Kristof Taveirne schreef:
> Hi,
>
> I'm trying to create a eclipse rcp application based on a
> microkernel-like design pattern. I'm doing this just to do some research
> of the capabilities of OSGi and the RCP platform.
>
> I have a core with a couple of managers that know how to communicate and
> handle events from a specific service provider.
>
> What I'm trying to do is to create a core application which can turn
> into different branches just by installing a different feature.
> The branches differ in the way they provide a specific service.
> For example branch1 has an IdentityProvider service which provides the
> application of identity information read from an electronic identity
> card. An other branch may get the info from a wizard or some other
> online userbase.
>
> What I'm trying to do now is to add the feature at runtime, and I use
> the earlyStart extension point and the IStartup interface to startup the
> bundle. Then when the identityService is needed my ideas was to simply
> check the extensionRegistry if there is a bundle which declares in it's
> plugin.xml file using an extension in which it specifies that that
> plugin is indeed an IdentityProvider. At this point in my core I know
> the identifier of the IdentityProvider using the ExtensionRegistry.
>
> The next step is ofcourse that I want to be notified of events thrown by
> this provider. This is because the identity provider should fire an
> event when an identity is provided. For example when an E-ID is inserted
> in the cardreader. Now HERE is where my problem is.
> I can get the plugin identifier, but I can't get a reference to that
> plugin to do a typical Observer/Observable design pattern.
>
> My first idea was to use
> ((IdentityProvider)Platform.getPlugin(id)).register(new
> IdentityListener(){...});
>
> But now I see that Platform.getPlugin() is deprecated and I'm stuck with
> my design.
>
> Can somebody help me with this? Where is my design incompatible with the
> RCP way of doing things, and how could I solve it?
>
> Thanks,
>
> Kristof Taveirne
Re: using a plugin as a service, Microkernel-like design pattern. [message #462879 is a reply to message #462868] Thu, 01 February 2007 20:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: canterburry.gmail.com

This is a multi-part message in MIME format.

------=_NextPart_000_003B_01C7460D.FAAF9A80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Kristof,

I have/had the very same problem (I think...?) in that I am trying to =
use the rcp plugins in an SOA context as services. What I found is that =
plugins are really not means to be looked up and called, as you would a =
service, but rather extended. Basically, a callback pattern is your only =
option...or at least that is the only thing I could think of. Check out =
my post on the equinox group titled: "plug-ins, extension points and =
services?"

I ended up implementing an injector type mechanism by which plugin B =
registers itself with plugin A, and then A passes a handle to B so that =
B can talk to A on it's own. As OSGi works, B would always have to wait =
for A to initiate contact.

Ok, so...not sure of this is what you were trying to do or not.

-HC

"Kristof Taveirne" <kristof.taveirne@intec.ugent.be> wrote in message =
news:ept65u$cud$1@utils.eclipse.org...
>I guess I'm making things to complicated.
> Maybe I shouldn't use the extension points but simply register the =
class=20
> that implements the service to the core, instead trying to force the=20
> core to register itself to events to my service.
>=20
> It's easier to get a reference the other way around because I can =
easily=20
> implement a Activator.getInstance() method in the application's core.
>=20
> Getting a reference to the Activator using only IConfigurationElement =
is=20
> not possible anymore because Platform.getPlugin() is deprecated. Is =
this=20
> correct?
>=20
> Greetings,
> Kristof.
>=20
> Kristof Taveirne schreef:
>> Hi,
>>=20
>> I'm trying to create a eclipse rcp application based on a=20
>> microkernel-like design pattern. I'm doing this just to do some =
research=20
>> of the capabilities of OSGi and the RCP platform.
>>=20
>> I have a core with a couple of managers that know how to communicate =
and=20
>> handle events from a specific service provider.
>>=20
>> What I'm trying to do is to create a core application which can turn=20
>> into different branches just by installing a different feature.
>> The branches differ in the way they provide a specific service.
>> For example branch1 has an IdentityProvider service which provides =
the=20
>> application of identity information read from an electronic identity=20
>> card. An other branch may get the info from a wizard or some other=20
>> online userbase.
>>=20
>> What I'm trying to do now is to add the feature at runtime, and I use =

>> the earlyStart extension point and the IStartup interface to startup =
the=20
>> bundle. Then when the identityService is needed my ideas was to =
simply=20
>> check the extensionRegistry if there is a bundle which declares in =
it's=20
>> plugin.xml file using an extension in which it specifies that that=20
>> plugin is indeed an IdentityProvider. At this point in my core I know =

>> the identifier of the IdentityProvider using the ExtensionRegistry.
>>=20
>> The next step is ofcourse that I want to be notified of events thrown =
by=20
>> this provider. This is because the identity provider should fire an =

>> event when an identity is provided. For example when an E-ID is =
inserted=20
>> in the cardreader. Now HERE is where my problem is.
>> I can get the plugin identifier, but I can't get a reference to that=20
>> plugin to do a typical Observer/Observable design pattern.
>>=20
>> My first idea was to use=20
>> ((IdentityProvider)Platform.getPlugin(id)).register(new=20
>> IdentityListener(){...});
>>=20
>> But now I see that Platform.getPlugin() is deprecated and I'm stuck =
with=20
>> my design.
>>=20
>> Can somebody help me with this? Where is my design incompatible with =
the=20
>> RCP way of doing things, and how could I solve it?
>>=20
>> Thanks,
>>=20
>> Kristof Taveirne
------=_NextPart_000_003B_01C7460D.FAAF9A80
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.5730.11" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Kristof,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have/had the very same problem (I =
think...?) in=20
that I&nbsp; am trying to use the rcp plugins in an SOA context as =
services.=20
What I found is that plugins are really not means to be looked up and =
called, as=20
you would a service, but rather extended. Basically, a callback pattern =
is your=20
only option...or at least that is the only thing I could think of. Check =
out my=20
post on the equinox group titled: "plug-ins, extension points and=20
services?"</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I ended up implementing an injector =
type mechanism=20
by which plugin B registers itself with plugin A, and then A passes a =
handle to=20
B so that B can talk to A on it's own. As OSGi works, B would always =
have to=20
wait for A to initiate contact.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Ok, so...not sure of this is what you =
were trying=20
to do or not.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-HC</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Kristof Taveirne" &lt;</FONT><A=20
href=3D"mailto:kristof.taveirne@intec.ugent.be"><FONT face=3DArial=20
size=3D2>kristof.taveirne@intec.ugent.be</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
wrote in message </FONT><A =
href=3D"news:ept65u$cud$1@utils.eclipse.org"><FONT=20
face=3DArial =
size=3D2>news:ept65u$cud$1@utils.eclipse.org</FONT></A><FONT =
face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt;I guess I'm =
making things to=20
complicated.<BR>&gt; Maybe I shouldn't use the extension points but =
simply=20
register the class <BR>&gt; that implements the service to the core, =
instead=20
trying to force the <BR>&gt; core to register itself to events to my=20
service.<BR>&gt; <BR>&gt; It's easier to get a reference the other way =
around=20
because I can easily <BR>&gt; implement a Activator.getInstance() method =
in the=20
application's core.<BR>&gt; <BR>&gt; Getting a reference to the =
Activator using=20
only IConfigurationElement is <BR>&gt; not possible anymore because=20
Platform.getPlugin() is deprecated. Is this <BR>&gt; correct?<BR>&gt; =
<BR>&gt;=20
Greetings,<BR>&gt; Kristof.<BR>&gt; <BR>&gt; Kristof Taveirne=20
schreef:<BR>&gt;&gt; Hi,<BR>&gt;&gt; <BR>&gt;&gt; I'm trying to create a =
eclipse=20
rcp application based on a <BR>&gt;&gt; microkernel-like design pattern. =
I'm=20
doing this just to do some research <BR>&gt;&gt; of the capabilities of =
OSGi and=20
the RCP platform.<BR>&gt;&gt; <BR>&gt;&gt; I have a core with a couple =
of=20
managers that know how to communicate and <BR>&gt;&gt; handle events =
from a=20
specific service provider.<BR>&gt;&gt; <BR>&gt;&gt; What I'm trying to =
do is to=20
create a core application which can turn <BR>&gt;&gt; into different =
branches=20
just by installing a different feature.<BR>&gt;&gt; The branches differ =
in the=20
way they provide a specific service.<BR>&gt;&gt; For example branch1 has =
an=20
IdentityProvider service which provides the <BR>&gt;&gt; application of =
identity=20
information read from an electronic identity <BR>&gt;&gt; card. An other =
branch=20
may get the info from a wizard or some other <BR>&gt;&gt; online=20
userbase.<BR>&gt;&gt; <BR>&gt;&gt; What I'm trying to do now is to add =
the=20
feature at runtime, and I use <BR>&gt;&gt; the earlyStart extension =
point and=20
the IStartup interface to startup the <BR>&gt;&gt; bundle. Then when the =

identityService is needed my ideas was to simply <BR>&gt;&gt; check the=20
extensionRegistry if there is a bundle which declares in it's =
<BR>&gt;&gt;=20
plugin.xml file using an extension in which it specifies that that =
<BR>&gt;&gt;=20
plugin is indeed an IdentityProvider. At this point in my core I know=20
<BR>&gt;&gt; the identifier of the IdentityProvider using the=20
ExtensionRegistry.<BR>&gt;&gt; <BR>&gt;&gt; The next step is ofcourse =
that I=20
want to be notified of events thrown by <BR>&gt;&gt;&nbsp;&nbsp; this =
provider.=20
This is because the identity provider should fire an <BR>&gt;&gt; event =
when an=20
identity is provided. For example when an E-ID is inserted <BR>&gt;&gt; =
in the=20
cardreader. Now HERE is where my problem is.<BR>&gt;&gt; I can get the =
plugin=20
identifier, but I can't get a reference to that <BR>&gt;&gt; plugin to =
do a=20
typical Observer/Observable design pattern.<BR>&gt;&gt; <BR>&gt;&gt; My =
first=20
idea was to use <BR>&gt;&gt;=20
((IdentityProvider)Platform.getPlugin(id)).register(new <BR>&gt;&gt;=20
IdentityListener(){...});<BR>&gt;&gt; <BR>&gt;&gt; But now I see that=20
Platform.getPlugin() is deprecated and I'm stuck with <BR>&gt;&gt; my=20
design.<BR>&gt;&gt; <BR>&gt;&gt; Can somebody help me with this? Where =
is my=20
design incompatible with the <BR>&gt;&gt; RCP way of doing things, and =
how could=20
I solve it?<BR>&gt;&gt; <BR>&gt;&gt; Thanks,<BR>&gt;&gt; <BR>&gt;&gt; =
Kristof=20
Taveirne</FONT> </BODY></HTML>

------=_NextPart_000_003B_01C7460D.FAAF9A80--
Re: using a plugin as a service, Microkernel-like design pattern. [message #462953 is a reply to message #462879] Fri, 02 February 2007 14:58 Go to previous message
Eclipse UserFriend
Originally posted by: kristof.taveirne.intec.ugent.be

Hi Henry,

That's exactly was I was trying to do.
I implemented the callback pattern and it works nice.

It would be nice though if there was somekind of lookup mechanism to
plugins. I thought Platform.getPlugin() would do the trick using
metadata provided by an extension point.

I implementated the callback pattern using 2 interfaces in my core
application.
In Plugin A (core) I have
- MyServiceListener: - onMyServiceEvent();
- MyServiceProvider: - register(MyServiceListener l);

In A I have a method
registerMyServiceProvider(MyServiceProvider p)
{
p.register(new MyServiceListener(){...});
}

That way in plugin B I have an implementation of MyServiceProvider that
calls the methods the new MyServiceListener-implementation.

The only downside is that for B to call registerMyServiceProvider(this)
I need a reference in B to a class that has that method. Which makes it
harder to reuse without change in another application.

It would be nice if B could announce its presence to a repository so A
would be able to query that repository to get a reference to B.

This all kinda reminds me of JNDI or UDDI. To bad Platform.getPlugin()
doesnt work anymore. It would be excellent for what I want to do.

I've read something about a compatibility layer in the javadocs of
Platform.java. Maybe that's an option to try out? Could somebody tell me
why the pluginRegistry was deprecated in the first place?

Greetings,
Kristof Taveirne

Henry Canterburry schreef:
> Kristof,
>
> I have/had the very same problem (I think...?) in that I am trying to
> use the rcp plugins in an SOA context as services. What I found is that
> plugins are really not means to be looked up and called, as you would a
> service, but rather extended. Basically, a callback pattern is your only
> option...or at least that is the only thing I could think of. Check out
> my post on the equinox group titled: "plug-ins, extension points and
> services?"
>
> I ended up implementing an injector type mechanism by which plugin B
> registers itself with plugin A, and then A passes a handle to B so that
> B can talk to A on it's own. As OSGi works, B would always have to wait
> for A to initiate contact.
>
> Ok, so...not sure of this is what you were trying to do or not.
>
> -HC
>
> "Kristof Taveirne" <kristof.taveirne@intec.ugent.be
> <mailto:kristof.taveirne@intec.ugent.be>> wrote in message
> news:ept65u$cud$1@utils.eclipse.org...
> >I guess I'm making things to complicated.
> > Maybe I shouldn't use the extension points but simply register the class
> > that implements the service to the core, instead trying to force the
> > core to register itself to events to my service.
> >
> > It's easier to get a reference the other way around because I can easily
> > implement a Activator.getInstance() method in the application's core.
> >
> > Getting a reference to the Activator using only IConfigurationElement is
> > not possible anymore because Platform.getPlugin() is deprecated. Is this
> > correct?
> >
> > Greetings,
> > Kristof.
> >
> > Kristof Taveirne schreef:
> >> Hi,
> >>
> >> I'm trying to create a eclipse rcp application based on a
> >> microkernel-like design pattern. I'm doing this just to do some
> research
> >> of the capabilities of OSGi and the RCP platform.
> >>
> >> I have a core with a couple of managers that know how to communicate
> and
> >> handle events from a specific service provider.
> >>
> >> What I'm trying to do is to create a core application which can turn
> >> into different branches just by installing a different feature.
> >> The branches differ in the way they provide a specific service.
> >> For example branch1 has an IdentityProvider service which provides the
> >> application of identity information read from an electronic identity
> >> card. An other branch may get the info from a wizard or some other
> >> online userbase.
> >>
> >> What I'm trying to do now is to add the feature at runtime, and I use
> >> the earlyStart extension point and the IStartup interface to startup
> the
> >> bundle. Then when the identityService is needed my ideas was to simply
> >> check the extensionRegistry if there is a bundle which declares in it's
> >> plugin.xml file using an extension in which it specifies that that
> >> plugin is indeed an IdentityProvider. At this point in my core I know
> >> the identifier of the IdentityProvider using the ExtensionRegistry.
> >>
> >> The next step is ofcourse that I want to be notified of events
> thrown by
> >> this provider. This is because the identity provider should fire an
> >> event when an identity is provided. For example when an E-ID is
> inserted
> >> in the cardreader. Now HERE is where my problem is.
> >> I can get the plugin identifier, but I can't get a reference to that
> >> plugin to do a typical Observer/Observable design pattern.
> >>
> >> My first idea was to use
> >> ((IdentityProvider)Platform.getPlugin(id)).register(new
> >> IdentityListener(){...});
> >>
> >> But now I see that Platform.getPlugin() is deprecated and I'm stuck
> with
> >> my design.
> >>
> >> Can somebody help me with this? Where is my design incompatible with
> the
> >> RCP way of doing things, and how could I solve it?
> >>
> >> Thanks,
> >>
> >> Kristof Taveirne
Previous Topic:RCP App terminates after adding Action to ApplicationActionBarAdviso
Next Topic:Split plugin over multiple projects
Goto Forum:
  


Current Time: Sat Sep 14 11:08:07 GMT 2024

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

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

Back to the top