[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] p2 migration guide


You have a few choices depending on what you are doing with your agent. The simplest approach is probably to use the "service.ranking" property on your service to make its rank higher than the default service factory. That should cause your factory to be selected over the default one. You can also manually register services with the agent using IProvisioningAgent#registerService, although you would need to do this before anyone accessed that service from the agent. This works if you are manually creating an agent yourself for manipulating a system stored in a different location. You can also craft your own custom IProvisioningAgent service that has a hand-crafted set of services registered.

John



Meng Xin Zhu <kane.zhu@xxxxxxxxxxxxx>
Sent by: p2-dev-bounces@xxxxxxxxxxx

01/29/2010 12:40 AM

Please respond to
P2 developer discussions <p2-dev@xxxxxxxxxxx>

To
P2 developer discussions <p2-dev@xxxxxxxxxxx>
cc
Subject
Re: [p2-dev] p2 migration guide





Thanks John for creating so useful guide.

The guide recommend clients to contribute services via providing an
IAgentServiceFactory. If I want to provide customized IProfileRegistry,
as well as override the default IProfileRegistry, I provide an
IAgentServiceFactory via a DS component like the recommending way. But
the implementation of IProvisioningAgent simply uses the first factory
instance in its querying result. How can it make sure using my service
factory to create IProfileRegistry when getting IProfileRegistry from
the agent?

                                 //attempt to get factory service from service registry
                                 ServiceReference[] refs;
                                 try {
                                                  refs =
context.getServiceReferences(IAgentServiceFactory.SERVICE_NAME, "(" +
IAgentServiceFactory.PROP_CREATED_SERVICE_NAME + '=' + serviceName +
')'); //$NON-NLS-1$
                                 } catch (InvalidSyntaxException e) {
                                                  e.printStackTrace();
                                                  return null;
                                 }
                                 if (refs == null || refs.length == 0)
                                                  return null;
                                 IAgentServiceFactory factory = (IAgentServiceFactory)
context.getService(refs[0]);

--
Best Regards,
Meng Xin(Kane)


On Mon, 2010-01-25 at 10:25 -0500, John Arthorne wrote:
>
> We have already begun to have lots of questions on this list and
> elsewhere from people trying to migrate from our old provisional API
> to the new API we are planning to declare in the Helios release. I'm
> sure for everyone asking here there are also many more battling
> through the changes in silence. So, I have created a skeleton of a
> migration guide to help out our provisional API clients in
> transitioning to our mature API:
>
> http://wiki.eclipse.org/Equinox/p2/Helios_Migration_Guide
>
> To p2 developers and all clients who are dealing with this, feel free
> to add, edit, or expand on entries here as you encounter non-trivial
> migration problems. Minimally, when you get asked questions, copy the
> answer into this wiki page so that others can benefit from it. I have
> already copied a few of the answers that I have seen go by on this
> list over the past week. Hopefully some of this material can also be
> used when we go to write the developer documentation for p2 closer to
> the Helios release. I'm not suggesting that we create an exhaustive
> catalog of every change we made, but just that we provide some hints
> for the non-trivial changes that migrating clients are likely to
> stumble over.
>
> John
> _______________________________________________
> 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