[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[p2-dev] P2 provisioning without existing profile

Hi guys, 

We are trying to install OSGi product using external p2 agent. The product initially doesn't have a profile. This causes a lot of issues during installation since the p2 infrastructure relies on profile existence. 
Maybe in this case it's reasonable to start from empty profile and sequentially add each of the features which we would like the system to have. Thus after initial p2 installation we will end up with consistent profile describing the system. 
It is very easy to integrate such change into currently existing code (it would affect just several lines in SimpleProfileRegistry):

public synchronized IProfile getProfile(String id) {
	Profile profile = internalGetProfile(id);
	//new code
	if (profile == null){
		try {
			return  addProfile(id);
		} catch (ProvisionException e) {
			return null;
	//end of new code
	return profile.snapshot();

Of course, there may be other use cases in which the user would expect null when requested profile doesn't exist.
So to handle both cases it is worth considering a new property or an additional parameter which is reponsible for that decision.

What do you think? 

Thanks in advance,