Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » B3 » Using the ProvisioningAgent
Using the ProvisioningAgent [message #518178] Wed, 03 March 2010 06:14 Go to next message
Filip Hrbek is currently offline Filip Hrbek
Messages: 233
Registered: July 2009
Senior Member
Hi all,

I am trying to user the provisioning framework properly in the b3 aggregator (no more restarting p2 bundles to switch p2 data area etc.).

I created a dedicated provisioning agent (with its location in the aggregation target) for everything that is done during the aggregation.
It means that, in headless run, there are no repository managers registered as "global" services, but they are obtained on demand from the provisioning agent.

Everything seems to work perfectly but one thing - if loading of UpdateSiteArtifactRepository fails (which is expected if the target folder is empty),
there's a piece of code that tries to refresh the artifact manager in this way (SimpleArtifactRepository.java, method setProperty):

public String setProperty(String key, String newValue) {
...
save();
//force repository manager to reload this repository because it caches properties
ArtifactRepositoryManager manager = (ArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.SERVICE_NAME);
if (manager.removeRepository(getLocation()))
manager.addRepository(this);
return oldValue;
}

Obviously, there's no artifact repository manager global service available at the moment, so I get an NPE on "manager.removeRepository".
(This does not prevent the aggregator from finishing its work since this error is silently ignored - it just means "the repo does not exist")

Does it mean that there are some pieces of code in p2 that are not adapted to proper usage of the provisioning framework?
Or am I doing anything wrong?
Should I rather ask at p2-dev?

Thanks for hints.

Filip
Re: Using the ProvisioningAgent [message #518193 is a reply to message #518178] Wed, 03 March 2010 07:05 Go to previous message
Thomas Hallgren is currently offline Thomas Hallgren
Messages: 3229
Registered: July 2009
Senior Member
Hi Filip,
I think you need to update the p2 that you use to the latest I-build where I believe this has been fixed already. That's
a good idea for other reasons as well since some of the p2 API's have changed now. The bugzillas you entered about
inconsistent getters and naming are two of them.

- thomas



On 03/03/2010 12:14 PM, Filip Hrbek wrote:
> Hi all,
>
> I am trying to user the provisioning framework properly in the b3
> aggregator (no more restarting p2 bundles to switch p2 data area etc.).
>
> I created a dedicated provisioning agent (with its location in the
> aggregation target) for everything that is done during the aggregation.
> It means that, in headless run, there are no repository managers
> registered as "global" services, but they are obtained on demand from
> the provisioning agent.
>
> Everything seems to work perfectly but one thing - if loading of
> UpdateSiteArtifactRepository fails (which is expected if the target
> folder is empty),
> there's a piece of code that tries to refresh the artifact manager in
> this way (SimpleArtifactRepository.java, method setProperty):
>
> public String setProperty(String key, String newValue) {
> ...
> save();
> //force repository manager to reload this repository because it caches
> properties
> ArtifactRepositoryManager manager = (ArtifactRepositoryManager)
> ServiceHelper.getService(Activator.getContext(),
> IArtifactRepositoryManager.SERVICE_NAME);
> if (manager.removeRepository(getLocation()))
> manager.addRepository(this);
> return oldValue;
> }
>
> Obviously, there's no artifact repository manager global service
> available at the moment, so I get an NPE on "manager.removeRepository".
> (This does not prevent the aggregator from finishing its work since this
> error is silently ignored - it just means "the repo does not exist")
>
> Does it mean that there are some pieces of code in p2 that are not
> adapted to proper usage of the provisioning framework?
> Or am I doing anything wrong?
> Should I rather ask at p2-dev?
>
> Thanks for hints.
>
> Filip
Re: Using the ProvisioningAgent [message #602131 is a reply to message #518178] Wed, 03 March 2010 07:05 Go to previous message
Thomas Hallgren is currently offline Thomas Hallgren
Messages: 3229
Registered: July 2009
Senior Member
Hi Filip,
I think you need to update the p2 that you use to the latest I-build where I believe this has been fixed already. That's
a good idea for other reasons as well since some of the p2 API's have changed now. The bugzillas you entered about
inconsistent getters and naming are two of them.

- thomas



On 03/03/2010 12:14 PM, Filip Hrbek wrote:
> Hi all,
>
> I am trying to user the provisioning framework properly in the b3
> aggregator (no more restarting p2 bundles to switch p2 data area etc.).
>
> I created a dedicated provisioning agent (with its location in the
> aggregation target) for everything that is done during the aggregation.
> It means that, in headless run, there are no repository managers
> registered as "global" services, but they are obtained on demand from
> the provisioning agent.
>
> Everything seems to work perfectly but one thing - if loading of
> UpdateSiteArtifactRepository fails (which is expected if the target
> folder is empty),
> there's a piece of code that tries to refresh the artifact manager in
> this way (SimpleArtifactRepository.java, method setProperty):
>
> public String setProperty(String key, String newValue) {
> ...
> save();
> //force repository manager to reload this repository because it caches
> properties
> ArtifactRepositoryManager manager = (ArtifactRepositoryManager)
> ServiceHelper.getService(Activator.getContext(),
> IArtifactRepositoryManager.SERVICE_NAME);
> if (manager.removeRepository(getLocation()))
> manager.addRepository(this);
> return oldValue;
> }
>
> Obviously, there's no artifact repository manager global service
> available at the moment, so I get an NPE on "manager.removeRepository".
> (This does not prevent the aggregator from finishing its work since this
> error is silently ignored - it just means "the repo does not exist")
>
> Does it mean that there are some pieces of code in p2 that are not
> adapted to proper usage of the provisioning framework?
> Or am I doing anything wrong?
> Should I rather ask at p2-dev?
>
> Thanks for hints.
>
> Filip
Previous Topic:Using the ProvisioningAgent
Next Topic:In search of a good name...
Goto Forum:
  


Current Time: Sun Aug 31 02:26:33 EDT 2014

Powered by FUDForum. Page generated in 0.01622 seconds