private void createProfile(ITargetDefinition target) throws CoreException, ProvisionException { // create a new profile IProfileRegistry registry = getProfileRegistry(); if (registry == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, Messages.AbstractTargetHandle_0)); } Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, INSTALL_FOLDERS.append(Long.toString(LocalTargetHandle.nextTimeStamp())).toOSString()); properties.put(IProfile.PROP_CACHE, BUNDLE_POOL.toOSString()); properties.put(IProfile.PROP_INSTALL_FEATURES, Boolean.TRUE.toString()); properties.put(IProfile.PROP_ENVIRONMENTS, generateEnvironmentProperties(target)); properties.put(IProfile.PROP_NL, generateNLProperty(target)); properties.put(PROP_SEQUENCE_NUMBER, Integer.toString(((TargetDefinition) target).getSequenceNumber())); properties.put(PROP_PROVISION_MODE, getProvisionMode(target)); properties.put(PROP_ALL_ENVIRONMENTS, Boolean.toString(getIncludeAllEnvironments())); properties.put(PROP_AUTO_INCLUDE_SOURCE, Boolean.toString(getIncludeSource())); properties.put(PROP_INCLUDE_CONFIGURE_PHASE, Boolean.toString(getIncludeConfigurePhase())); fProfile = registry.addProfile(getProfileId(target), properties); }
static IProfile addProfile(IProvisioningAgent agent, String profileId, Map<String, String> properties) throws ProvisionException { IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); if (profileRegistry == null) return null; IProfile profile = profileRegistry.getProfile(profileId); if (profile != null) return profile; Map<String, String> profileProperties = new HashMap<String, String>(properties); if (profileProperties.get(IProfile.PROP_ENVIRONMENTS) == null) { EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName()); if (info != null) profileProperties.put(IProfile.PROP_ENVIRONMENTS, "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ else profileProperties.put(IProfile.PROP_ENVIRONMENTS, ""); //$NON-NLS-1$ } return profileRegistry.addProfile(profileId, profileProperties); }
props.put(IProfile.PROP_NL, TargetPlatform.getNL()); profile = registry.addProfile(profileID, props);
IProfile profile; try { profile = registry.addProfile(profileId, filter); } catch (ProvisionException e) { throw new StatusException("Adding a profile failed (" + profileId + " " + filter + ")", e.getStatus());