[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
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