Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » Referencing a fragment instance in a touchpoint action
Referencing a fragment instance in a touchpoint action [message #551453] Fri, 06 August 2010 13:47 Go to next message
Filip Hrbek is currently offline Filip HrbekFriend
Messages: 233
Registered: July 2009
Senior Member
Hi,

I am trying to extend p2 by addition touchpoint actions. The problem is that I am unable to reference a fragment in a fragment's touchpoint action (I am getting the host IU instead).

In the example below, when "actionOnFragment" is executed, the "iu" parameter is set to the instance of the "something/1.0.0" installable unit (as fragments's host). However, I need to get information about the fragment.

Is there a way to find which fragment contributed the action being executed?

Regards
Filip

Example:

<units size='2'>
<unit id='something' version='1.0.0' singleton='false'>
<provides size='1'>
<provided namespace='org.eclipse.equinox.p2.iu' name='something' version='1.0.0'/>
</provides>
<touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
<touchpointData size='1'>
<instructions size='1'>
<instruction key='install'>
someAction()
</instruction>
</instructions>
</touchpointData>
</unit>
<unit id='fragment' version='1.0.0' singleton='false'>
<hostRequirements size='1'>
<required namespace='org.eclipse.equinox.p2.iu' name='something' range='1.0.0'/>
</hostRequirements>
<requires size='1'>
<required namespace='org.eclipse.equinox.p2.iu' name='something' range='1.0.0'/>
</requires>
<provides size='1'>
<provided namespace='org.eclipse.equinox.p2.iu' name='fragment' version='1.0.0'/>
</provides>
<touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
<touchpointData size='1'>
<instructions size='1'>
<instruction key='install'>
actionOnFragment()
</instruction>
</instructions>
</touchpointData>
</unit>
</units>
Re: Referencing a fragment instance in a touchpoint action [message #552550 is a reply to message #551453] Thu, 12 August 2010 15:18 Go to previous message
Andrew Niefer is currently offline Andrew NieferFriend
Messages: 990
Registered: July 2009
Senior Member
I think that the fragments get merged with the IUs and you will only
actually see the host.

It is not API, but I would guess that the the IU you have is actually an
instance of ResolvedInstallableUnit, which does have a getFragments()
method.

Sticking to the API, the #getProvidedCapabilities() returns the combination
of host + fragment capabilities (Similar for provided capabilities).
Generally, fragments have a requirement on the host, and also provide
themselves:

<unit id='fragment.runtime' version='3.6.0.I20100603-1500' >
<hostRequirements size='2'>
<required namespace='osgi.bundle' name='org.eclipse.core.runtime'
range='3.6.0.v20100505'/>
<required namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle'
range='[1.0.0,2.0.0)' greedy='false'/>
</hostRequirements>
<provides size='2'>
<provided namespace='org.eclipse.equinox.p2.iu'
name='toolinggtk.linux.x86_64org.eclipse.core.runtime'
version='3.6.0.I20100603-1500'/>
<provided namespace='org.eclipse.equinox.p2.flavor'
name='toolinggtk.linux.x86_64' version='1.0.0'/>
</provides>
<requires size='2'>
<required namespace='osgi.bundle' name='org.eclipse.core.runtime'
range='3.6.0.v20100505'/>
<required namespace='org.eclipse.equinox.p2.eclipse.type'
name='bundle' range='[1.0.0,2.0.0)' greedy='false'/>
</requires>

It is likely possible to deduce the presence of the fragment by inspecting
these.

-Andrew

Filip Hrbek wrote:

> Hi,
>
> I am trying to extend p2 by addition touchpoint actions. The problem is
> that I am unable to reference a fragment in a fragment's touchpoint action
> (I am getting the host IU instead).
>
> In the example below, when "actionOnFragment" is executed, the "iu"
> parameter is set to the instance of the "something/1.0.0" installable unit
> (as fragments's host). However, I need to get information about the
> fragment.
>
> Is there a way to find which fragment contributed the action being
> executed?
>
> Regards
> Filip
>
> Example:
>
> <units size='2'>
> <unit id='something' version='1.0.0' singleton='false'>
> <provides size='1'>
> <provided namespace='org.eclipse.equinox.p2.iu' name='something'
> version='1.0.0'/>
> </provides>
> <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
> <touchpointData size='1'>
> <instructions size='1'>
> <instruction key='install'>
> someAction()
> </instruction>
> </instructions>
> </touchpointData>
> </unit>
> <unit id='fragment' version='1.0.0' singleton='false'>
> <hostRequirements size='1'>
> <required namespace='org.eclipse.equinox.p2.iu' name='something'
> range='1.0.0'/>
> </hostRequirements>
> <requires size='1'>
> <required namespace='org.eclipse.equinox.p2.iu' name='something'
> range='1.0.0'/>
> </requires>
> <provides size='1'>
> <provided namespace='org.eclipse.equinox.p2.iu' name='fragment'
> version='1.0.0'/>
> </provides>
> <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
> <touchpointData size='1'>
> <instructions size='1'>
> <instruction key='install'>
> actionOnFragment()
> </instruction>
> </instructions>
> </touchpointData>
> </unit>
> </units>
Re: Referencing a fragment instance in a touchpoint action [message #571158 is a reply to message #551453] Thu, 12 August 2010 15:18 Go to previous message
Andrew Niefer is currently offline Andrew NieferFriend
Messages: 990
Registered: July 2009
Senior Member
I think that the fragments get merged with the IUs and you will only
actually see the host.

It is not API, but I would guess that the the IU you have is actually an
instance of ResolvedInstallableUnit, which does have a getFragments()
method.

Sticking to the API, the #getProvidedCapabilities() returns the combination
of host + fragment capabilities (Similar for provided capabilities).
Generally, fragments have a requirement on the host, and also provide
themselves:

<unit id='fragment.runtime' version='3.6.0.I20100603-1500' >
<hostRequirements size='2'>
<required namespace='osgi.bundle' name='org.eclipse.core.runtime'
range='3.6.0.v20100505'/>
<required namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle'
range='[1.0.0,2.0.0)' greedy='false'/>
</hostRequirements>
<provides size='2'>
<provided namespace='org.eclipse.equinox.p2.iu'
name='toolinggtk.linux.x86_64org.eclipse.core.runtime'
version='3.6.0.I20100603-1500'/>
<provided namespace='org.eclipse.equinox.p2.flavor'
name='toolinggtk.linux.x86_64' version='1.0.0'/>
</provides>
<requires size='2'>
<required namespace='osgi.bundle' name='org.eclipse.core.runtime'
range='3.6.0.v20100505'/>
<required namespace='org.eclipse.equinox.p2.eclipse.type'
name='bundle' range='[1.0.0,2.0.0)' greedy='false'/>
</requires>

It is likely possible to deduce the presence of the fragment by inspecting
these.

-Andrew

Filip Hrbek wrote:

> Hi,
>
> I am trying to extend p2 by addition touchpoint actions. The problem is
> that I am unable to reference a fragment in a fragment's touchpoint action
> (I am getting the host IU instead).
>
> In the example below, when "actionOnFragment" is executed, the "iu"
> parameter is set to the instance of the "something/1.0.0" installable unit
> (as fragments's host). However, I need to get information about the
> fragment.
>
> Is there a way to find which fragment contributed the action being
> executed?
>
> Regards
> Filip
>
> Example:
>
> <units size='2'>
> <unit id='something' version='1.0.0' singleton='false'>
> <provides size='1'>
> <provided namespace='org.eclipse.equinox.p2.iu' name='something'
> version='1.0.0'/>
> </provides>
> <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
> <touchpointData size='1'>
> <instructions size='1'>
> <instruction key='install'>
> someAction()
> </instruction>
> </instructions>
> </touchpointData>
> </unit>
> <unit id='fragment' version='1.0.0' singleton='false'>
> <hostRequirements size='1'>
> <required namespace='org.eclipse.equinox.p2.iu' name='something'
> range='1.0.0'/>
> </hostRequirements>
> <requires size='1'>
> <required namespace='org.eclipse.equinox.p2.iu' name='something'
> range='1.0.0'/>
> </requires>
> <provides size='1'>
> <provided namespace='org.eclipse.equinox.p2.iu' name='fragment'
> version='1.0.0'/>
> </provides>
> <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
> <touchpointData size='1'>
> <instructions size='1'>
> <instruction key='install'>
> actionOnFragment()
> </instruction>
> </instructions>
> </touchpointData>
> </unit>
> </units>
Previous Topic:Headless Update KO with update site, KO with feature export, OK with product export
Next Topic:How to add <references> to metadata repository
Goto Forum:
  


Current Time: Thu Apr 25 21:51:25 GMT 2024

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

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

Back to the top