public void setConfigData(ConfigData configData) { this.configData.initialize(); this.configData.setInitialBundleStartLevel(configData.getInitialBundleStartLevel()); this.configData.setBeginningFwStartLevel(configData.getBeginingFwStartLevel()); BundleInfo[] bInfos = configData.getBundles(); for (int i = 0; i < bInfos.length; i++) this.configData.addBundle(bInfos[i]); this.configData.setProperties(configData.getProperties()); if (this.configData.getFwName().equals(configData.getFwName())) if (this.configData.getFwVersion().equals(configData.getFwVersion())) { // TODO refine the algorithm to copying fw dependent props. // configData.getFwName()/getFwVersion()/ // getLauncherName()/getLauncherVersion() might be taken into consideration. this.configData.setProperties(configData.getProperties()); } }
public BundleInfo[] save(Manipulator manipulator, boolean backup) throws IOException { List<BundleInfo> setToInitialConfig = new LinkedList<BundleInfo>(); List<BundleInfo> setToSimpleConfig = new LinkedList<BundleInfo>(); ConfigData configData = manipulator.getConfigData(); if (!divideBundleInfos(manipulator, setToInitialConfig, setToSimpleConfig, configData.getInitialBundleStartLevel())) return configData.getBundles(); File outputFile = getConfigFile(manipulator); URI installArea = ParserUtils.getOSGiInstallArea(Arrays.asList(manipulator.getLauncherData().getProgramArgs()), manipulator.getConfigData().getProperties(), manipulator.getLauncherData()).toURI(); saveConfiguration(setToSimpleConfig.toArray(new BundleInfo[setToSimpleConfig.size()]), outputFile, installArea, backup); configData.setProperty(SimpleConfiguratorManipulatorImpl.PROP_KEY_CONFIGURL, outputFile.toURL().toExternalForm()); return orderingInitialConfig(setToInitialConfig); }
private void updateAccordingToExpectedState(BundlesState bundlesState) { // File newFwJar = EquinoxBundlesState.getFwJar(launcherData, configData); // if (bundlesState instanceof EquinoxBundlesState) // ((EquinoxBundlesState) bundlesState).setFwJar(newFwJar); // // if (launcherData.getFwJar() == null && newFwJar != null) // launcherData.setFwJar(newFwJar); BundleInfo[] newBundleInfos = bundlesState.getExpectedState(); configData.setBundles(newBundleInfos); }
/** * Returns the Bundles that constitute this product. These * bundles may be specified in the .product file, .product file configuration * area, config.ini file, or a combination of these three places. */ public BundleInfo[] getBundles() { return configData.getBundles(); }
Map<String, List<BundleInfo>> unboundedBundles = new HashMap<>(); BundleInfo[] bundles = data.getBundles(); for (int i = 0; i < bundles.length; i++) { data.removeBundle(bundleInfo); data.addBundle(bundleInfo); } else if (bundleInfo.getVersion().equals(BundleInfo.EMPTY_VERSION)) { data.addBundle(bundleInfo); else for (BundleInfo target : list) { data.addBundle(bundleInfo);
String value = data.getProperty(ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR_CONFIGURL); if (value != null) { try { data.setBundles(bundleInfos); } catch (MalformedURLException e1) { data.setProperty(ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR_CONFIGURL, EquinoxManipulatorImpl.makeRelative(value, configurationLocation.toURL())); } catch (MalformedURLException e) {
public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String propValue = (String) parameters.get(ActionConstants.PARM_PROP_VALUE); if (propValue != null && propValue.equals(ActionConstants.PARM_AT_ARTIFACT)) { try { propValue = Util.resolveArtifactParam(parameters); } catch (CoreException e) { return e.getStatus(); } } getMemento().put(ActionConstants.PARM_PREVIOUS_VALUE, manipulator.getConfigData().getProperty(propName)); manipulator.getConfigData().setProperty(propName, propValue); return Status.OK_STATUS; }
configData.setBundles(bInfos); platformProperties = this.getRunningPlatformProperties(); if (toBeEliminated(key)) continue; configData.setProperty(key, value); int initialBSL = configData.getInitialBundleStartLevel(); if (initialBSL != startLevelService.getInitialBundleStartLevel()) configData.setInitialBundleStartLevel(startLevelService.getInitialBundleStartLevel());
private void addProductFileBundles(ConfigData data) { List<IVersionedId> bundles = product.getBundles(true); Set<BundleInfo> set = new HashSet<BundleInfo>(); set.addAll(Arrays.asList(data.getBundles())); for (IVersionedId vid : bundles) { BundleInfo bundleInfo = new BundleInfo(); bundleInfo.setSymbolicName(vid.getId()); bundleInfo.setVersion(vid.getVersion().toString()); if (!set.contains(bundleInfo)) data.addBundle(bundleInfo); } }
configData.initialize(); configData.setBundles(null); continue; String value = props.getProperty(key); configData.setProperty(key, value);
public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String previous = (String) getMemento().get(ActionConstants.PARM_PREVIOUS_VALUE); manipulator.getConfigData().setProperty(propName, previous); return Status.OK_STATUS; }
/** * compose new state without reading framework persistent data. The * configData.getFwDependentProps() is used for the composition. * * @param launcherData * @param configData * @param bInfos */ private void composeNewState(LauncherData launcherData, ConfigData configData, BundleInfo[] bInfos) { this.composeNewState(launcherData, configData, configData.getProperties(), bInfos); }
private void initialize(boolean useFwPersistentData) { LauncherData launcherData = manipulator.getLauncherData(); ConfigData configData = manipulator.getConfigData(); BundleInfo[] bInfos = configData.getBundles(); if (!useFwPersistentData) { composeNewState(launcherData, configData, bInfos); return; } EquinoxManipulatorImpl.checkConsistencyOfFwConfigLocAndFwPersistentDataLoc(launcherData); if (launcherData.isClean()) { composeNewState(launcherData, configData, bInfos); } else { if (manipulator.getLauncherData().getFwPersistentDataLocation() == null) { File installArea = ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), configData.getProperties(), launcherData); if (DEBUG) Log.log(LogService.LOG_DEBUG, this, "initialize(useFwPersistentDat)", "installArea=" + installArea); //$NON-NLS-1$ //$NON-NLS-2$ if (installArea == null) throw new IllegalStateException(Messages.exception_noInstallArea); File fwPersistentDataLocation = new File(installArea, "configuration"); //$NON-NLS-1$ manipulator.getLauncherData().setFwPersistentDataLocation(fwPersistentDataLocation, false); } if (!composeState(bInfos, null, manipulator.getLauncherData().getFwPersistentDataLocation())) composeNewState(launcherData, configData, bInfos); resolve(true); } }
BundleInfo[] infos = manipulator.getConfigData().getBundles(); this.manipulator.getConfigData().setBundles(null); SimpleBundlesState.checkAvailability(fwAdmin); this.setStateObjectFactory(); this.manipulator.getConfigData().setBundles(infos); return false; flagNewState = true; if (props == null) { this.manipulator.getConfigData().setBundles(infos); return false;
Utils.appendProperties(properties, manipulator.getConfigData().getProperties()); boolean exclusiveInstallation = Boolean.valueOf(properties.getProperty(SimpleConfiguratorManipulatorImpl.PROP_KEY_EXCLUSIVE_INSTALLATION)).booleanValue(); File configFile = getConfigFile(manipulator); File installArea = ParserUtils.getOSGiInstallArea(Arrays.asList(manipulator.getLauncherData().getProgramArgs()), manipulator.getConfigData().getProperties(), manipulator.getLauncherData()); BundleInfo[] toInstall = new BundleInfo[0]; manipulator.getConfigData().setBundles(bundleState.getExpectedState());
BundleInfo[] bInfos = configData.getBundles(); int initialBSL = configData.getInitialBundleStartLevel(); bInfos = Utils.sortBundleInfos(bInfos, initialBSL);
private void readBundlesList(Manipulator manipulator, URI osgiInstallArea, Properties props) throws NumberFormatException { ConfigData configData = manipulator.getConfigData(); BundleInfo[] fwExtensions = parseBundleList(manipulator, props.getProperty(EquinoxConstants.PROP_FW_EXTENSIONS)); if (fwExtensions != null) { for (int i = 0; i < fwExtensions.length; i++) { fwExtensions[i].setFragmentHost(Constants.SYSTEM_BUNDLE_SYMBOLICNAME); configData.addBundle(fwExtensions[i]); } } BundleInfo[] bundles = parseBundleList(manipulator, props.getProperty(EquinoxConstants.PROP_BUNDLES)); if (bundles != null) { for (int i = 0; i < bundles.length; i++) { configData.addBundle(bundles[i]); } } }
private ConfigData generateConfigData() { ConfigData result = new ConfigData(null, null, null, null); if (product.useFeatures()) return result; // Add all the bundles here. We replace / update them later // if we find configuration information List<IVersionedId> bundles = product.getBundles(true); for (IVersionedId vid : bundles) { BundleInfo bundleInfo = new BundleInfo(); bundleInfo.setSymbolicName(vid.getId()); bundleInfo.setVersion(vid.getVersion().toString()); result.addBundle(bundleInfo); } return result; }
private String getFwProperty(ConfigData data, String key) { return data.getProperty(key); }
if (bundleInfo == null) return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu)); manipulator.getConfigData().removeBundle(bundleInfo);