package aQute.lib.deployer.obr;

import java.util.*;

import aQute.bnd.service.*;
import aQute.lib.deployer.repository.*;

@SuppressWarnings("deprecation")
public class Conversions {

	public static final Map<String,String> convertConfig(Map<String,String> map) {
		if (!map.containsKey(AbstractIndexedRepo.PROP_REPO_TYPE))
			map.put(AbstractIndexedRepo.PROP_REPO_TYPE, AbstractIndexedRepo.REPO_TYPE_OBR);

		String location = map.get("location");
		if (location != null)
			map.put(FixedIndexedRepo.PROP_LOCATIONS, location);

		return map;
	}

	public static final Set<OBRResolutionMode> convertResolutionPhases(Collection<ResolutionPhase> phases) {
		Set<OBRResolutionMode> modes = new HashSet<OBRResolutionMode>();
		for (ResolutionPhase phase : phases) {
			OBRResolutionMode mode;
			switch (phase) {
				case build :
					mode = OBRResolutionMode.build;
					break;
				case runtime :
					mode = OBRResolutionMode.runtime;
					break;
				default :
					throw new IllegalArgumentException("");
			}
			modes.add(mode);
		}
		return modes;
	}
}

@@ -520,16 +520,133 @@
 cation);
+%0A%09%09%0A%09%09String mode = map.get(%22mode%22);%0A%09%09if (mode != null)%0A%09%09%09map.put(AbstractIndexedRepo.PROP_RESOLUTION_PHASE, mode);
 %0A%0A%09%09retu

Convert legacy property "mode" to "phase" in OBR & LocalOBR plugins