[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] touchpoint actions and feature artifacts

> Scott Lewis
>
> to:

>
> P2 developer discussions

>
> 05/21/2009 12:38 PM

>
> Sent by:

>
> p2-dev-bounces@xxxxxxxxxxx

>
> Please respond to P2 developer discussions

>
> Hi Simon,
>
> Simon Kaegi wrote:
> >
> > Are you looking at the feature.jar or feature.group IU?
> >
>
> I was looking to get a hold of the feature.jar.  That code was an
> attempt to get the feature.jar via featureIU.getArtifacts()[0].
>


A feature is broken into a feature group IU and feature jar IU. What I was getting at was that you were likely looking at the group iu instead of the feature jar IU.

> >
> > Also, if you're using a feature.jar to deliver content be aware that
> > there is a filter [ (org.eclipse.update.install.features=true) ] .
> >
> > IMO you're better off delivering the content in a native iu although
> > you'll have to author it yourself.
> >
>
> I am now using a bundle IU to deliver the content.  I'm working through
> getting a hold of the bundle.jar (to get some files out of it) and have
> the following code (the following is intended to result in a File that
> is the bundle.jar associated with the iu):
>
>             IArtifactKey artifactKey = iu.getArtifacts()[0];
>
>             IFileArtifactRepository downloadCache;
>             try {
>                 downloadCache = Util.getDownloadCacheRepo();
>             } catch (ProvisionException e) {
>                 return e.getStatus();
>             }
>             File fileLocation = downloadCache.getArtifactFile(artifactKey);
>
> (This is obviously modeled after code that exists in other actions).
>
> In my context I'm seeing (install phase) the above gets the artifactKey
> (for the bundle jar) and the downloadCache...but the
> downloadCache.getArtifactFile(artifactKey) returns null instead of a
> real File.  I can see that the downloadCache points to the
> p2/org.eclipse.equinox.p2.core/cache area, and I don't see the jar file
> in the cache on disk.
>
> Any ideas about why this doesn't work or pointers would be appreciated.
>

That code will find the artifact file for a Native artifact however you are using an artifact collected by the Eclipse Touchpoint.
Instead you should look at org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util.getArtifactFile(...) for inspiration.
(keep in mind that this is not and will likely never be api so a snapshot might be the best approach)

That ugliness is temporary as the artifact location can and should be provided in the parameter map -- see https://bugs.eclipse.org/bugs/show_bug.cgi?id=275404

-Simon

> Scott
>
> > -Simon
> >
> >
> > Inactive hide details for Scott Lewis ---05/20/2009 09:29:25
> > PM---Question:Scott Lewis ---05/20/2009 09:29:25 PM---Question:
> >
> >
> > From:    
> > Scott Lewis <slewis@xxxxxxxxxxxxxxxxx>
> >
> > To:    
> > P2 developer discussions <p2-dev@xxxxxxxxxxx>
> >
> > Date:    
> > 05/20/2009 09:29 PM
> >
> > Subject:    
> > [p2-dev] touchpoint actions and feature artifacts
> >
> > ------------------------------------------------------------------------
> >
> >
> >
> > Question:
> >
> > I'm creating a new touchpoint, and inside an action within this
> > touchpoint I have code that looks like this:
> >
> >        IInstallableUnit iu = (IInstallableUnit) parameters
> >                .get(ActionConstants.PARM_IU);
> >
> >        if (iu.getArtifacts() == null || iu.getArtifacts().length == 0)
> >            return Status.OK_STATUS;
> >
> >        IArtifactKey artifactKey = iu.getArtifacts()[0];
> >
> > the intention here is to get the artifact (jar) and then mess with it
> > (actually to get some stuff out of it but that's not material to this
> > question).
> >
> > The problem I'm experiencing is that when the iu is a *feature* the call
> > to iu.getArtifacts() returns null and so
> >
> >        if (iu.getArtifacts() == null || iu.getArtifacts().length == 0)
> >            return Status.OK_STATUS;
> >
> >   is executed and my action doesn't do what I want it to do.
> >
> > Obviously this isn't what is desired.  Is there some other pattern of
> > code to use to access the feature jar artifact from inside the action?  
> > Or is it necessary to always put these things in a bundle (rather than a
> > feature)?  I have verified that the feature jar exported to the repo
> > contains the artifacts that I'm looking for, so if I could get to the
> > feature.jar artifact then I would be there I believe.
> >
> > Thanksinadvance for any info.
> >
> > Scott
> >
> >
> >
> > _______________________________________________
> > p2-dev mailing list
> > p2-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/p2-dev
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > p2-dev mailing list
> > p2-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/p2-dev
> >  
>
> _______________________________________________
> p2-dev mailing list
> p2-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/p2-dev