public String[] getProgramArguments() { return data.getProgramArgs(); }
public String[] getProgramArguments() { return data.getProgramArgs(); }
@Override public String[] getProgramArguments() { return data.getProgramArgs(); }
private boolean hasBaseChanged(File configIni, Manipulator manipulator, Properties configProps) { LauncherData launcherData = manipulator.getLauncherData(); File sharedConfigIni = findSharedConfigIniFile(ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), configProps, launcherData), configProps.getProperty(EquinoxConstants.PROP_SHARED_CONFIGURATION_AREA)); File timestampFile = new File(configIni.getParentFile(), BASE_TIMESTAMP_FILE_CONFIGINI); Properties timestamps; try { timestamps = loadProperties(timestampFile); } catch (FileNotFoundException e) { return false; } catch (IOException e) { return false; } return !String.valueOf(sharedConfigIni.lastModified()).equals(timestamps.getProperty(KEY_CONFIGINI_TIMESTAMP)); }
private boolean hasBaseChanged(File configIni, Manipulator manipulator, Properties configProps) { LauncherData launcherData = manipulator.getLauncherData(); File sharedConfigIni = findSharedConfigIniFile(ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), configProps, launcherData), configProps.getProperty(EquinoxConstants.PROP_SHARED_CONFIGURATION_AREA)); File timestampFile = new File(configIni.getParentFile(), BASE_TIMESTAMP_FILE_CONFIGINI); Properties timestamps; try { timestamps = loadProperties(timestampFile); } catch (FileNotFoundException e) { return false; } catch (IOException e) { return false; } return !String.valueOf(sharedConfigIni.lastModified()).equals(timestamps.getProperty(KEY_CONFIGINI_TIMESTAMP)); }
private void rememberSharedConfigurationTimestamp(Properties configProps, Manipulator manipulator, File folder) throws IOException { LauncherData launcherData = manipulator.getLauncherData(); //Remove from the config file that we are about to write the properties that are unchanged compared to what is in the base File sharedConfigIni = findSharedConfigIniFile(ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), configProps, launcherData), configProps.getProperty(EquinoxConstants.PROP_SHARED_CONFIGURATION_AREA)); if (sharedConfigIni == null) return; File timestampFile = new File(folder, BASE_TIMESTAMP_FILE_CONFIGINI); Properties timestamps; try { timestamps = loadProperties(timestampFile); } catch (IOException e) { timestamps = new Properties(); } timestamps.setProperty(KEY_CONFIGINI_TIMESTAMP, String.valueOf(sharedConfigIni.lastModified())); saveProperties(timestampFile, timestamps); }
public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG); if (programArg == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROGRAM_ARG, ID)); if (programArg.startsWith("-")) {//$NON-NLS-1$ List<String> programArgs = Arrays.asList(manipulator.getLauncherData().getProgramArgs()); int index = programArgs.indexOf(programArg); if (index == -1) return Status.OK_STATUS; index++; // move index to potential programArgValue if (programArgs.size() > index) { String programArgValue = programArgs.get(index); if (!programArgValue.startsWith("-")) //$NON-NLS-1$ getMemento().put(ActionConstants.PARM_PROGRAM_ARG_VALUE, programArgValue); } manipulator.getLauncherData().removeProgramArg(programArg); } return Status.OK_STATUS; }
private void rememberSharedConfigurationTimestamp(Properties configProps, Manipulator manipulator, File folder) throws IOException { LauncherData launcherData = manipulator.getLauncherData(); //Remove from the config file that we are about to write the properties that are unchanged compared to what is in the base File sharedConfigIni = findSharedConfigIniFile(ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), configProps, launcherData), configProps.getProperty(EquinoxConstants.PROP_SHARED_CONFIGURATION_AREA)); if (sharedConfigIni == null) return; File timestampFile = new File(folder, BASE_TIMESTAMP_FILE_CONFIGINI); Properties timestamps; try { timestamps = loadProperties(timestampFile); } catch (IOException e) { timestamps = new Properties(); } timestamps.setProperty(KEY_CONFIGINI_TIMESTAMP, String.valueOf(sharedConfigIni.lastModified())); saveProperties(timestampFile, timestamps); }
private void writeFwJarLocation(ConfigData configData, LauncherData launcherData, Properties props) { if (launcherData.getFwJar() == null) return; props.setProperty(EquinoxConstants.PROP_OSGI_FW, FileUtils.toFileURL(URIUtil.makeRelative(launcherData.getFwJar().toURI(), ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), configData.getProperties(), launcherData).toURI()))); }
public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG); if (programArg == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROGRAM_ARG, ID)); if (programArg.startsWith("-")) {//$NON-NLS-1$ List<String> programArgs = Arrays.asList(manipulator.getLauncherData().getProgramArgs()); int index = programArgs.indexOf(programArg); if (index == -1) return Status.OK_STATUS; index++; // move index to potential programArgValue if (programArgs.size() > index) { String programArgValue = programArgs.get(index); if (!programArgValue.startsWith("-")) //$NON-NLS-1$ getMemento().put(ActionConstants.PARM_PROGRAM_ARG_VALUE, programArgValue); } manipulator.getLauncherData().removeProgramArg(programArg); } return Status.OK_STATUS; }
private void writeFwJarLocation(ConfigData configData, LauncherData launcherData, Properties props) { if (launcherData.getFwJar() == null) return; props.setProperty(EquinoxConstants.PROP_OSGI_FW, FileUtils.toFileURL(URIUtil.makeRelative(launcherData.getFwJar().toURI(), ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), configData.getProperties(), launcherData).toURI()))); }
public static URI getEclipseRealLocation(Manipulator manipulator, String location) { //if this is some form of URL just return it try { new URL(location); return URIUtil.makeAbsolute(new URI(location), ParserUtils.getOSGiInstallArea(Arrays.asList(manipulator.getLauncherData().getProgramArgs()), manipulator.getConfigData().getProperties(), manipulator.getLauncherData()).toURI()); } catch (URISyntaxException e) { // expected } catch (MalformedURLException e) { // expected } File base = new File(location); if (!base.isAbsolute()) { String pluginsDir = getSysPath(manipulator); if (pluginsDir == null) return null; base = new File(pluginsDir, location); } return getEclipsePluginFullLocation(base.getName(), base.getParentFile()); }
public static URI getEclipseRealLocation(Manipulator manipulator, String location) { //if this is some form of URL just return it try { new URL(location); return URIUtil.makeAbsolute(new URI(location), ParserUtils.getOSGiInstallArea(Arrays.asList(manipulator.getLauncherData().getProgramArgs()), manipulator.getConfigData().getProperties(), manipulator.getLauncherData()).toURI()); } catch (URISyntaxException e) { // expected } catch (MalformedURLException e) { // expected } File base = new File(location); if (!base.isAbsolute()) { String pluginsDir = getSysPath(manipulator); if (pluginsDir == null) return null; base = new File(pluginsDir, location); } return getEclipsePluginFullLocation(base.getName(), base.getParentFile()); }
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 File readFwJarLocation(ConfigData configData, LauncherData launcherData, Properties props) throws URISyntaxException { File fwJar = null; if (props.getProperty(EquinoxConstants.PROP_OSGI_FW) != null) { URI absoluteFwJar = null; absoluteFwJar = URIUtil.makeAbsolute(FileUtils.fromFileURL(props.getProperty(EquinoxConstants.PROP_OSGI_FW)), ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), props, launcherData).toURI()); props.setProperty(EquinoxConstants.PROP_OSGI_FW, absoluteFwJar.toString()); String fwJarString = props.getProperty(EquinoxConstants.PROP_OSGI_FW); if (fwJarString != null) { fwJar = URIUtil.toFile(absoluteFwJar); if (fwJar == null) throw new IllegalStateException(Messages.exception_noFrameworkLocation); //Here we overwrite the value read from eclipse.ini, because the value of osgi.framework always takes precedence. launcherData.setFwJar(fwJar); } else { throw new IllegalStateException(Messages.exception_noFrameworkLocation); } } if (launcherData.getFwJar() != null) configData.addBundle(new BundleInfo(launcherData.getFwJar().toURI())); return launcherData.getFwJar(); }
public BundleInfo[] save(Manipulator manipulator, boolean backup) throws IOException { List setToInitialConfig = new LinkedList(); List setToSimpleConfig = new LinkedList(); 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((BundleInfo[]) setToSimpleConfig.toArray(new BundleInfo[setToSimpleConfig.size()]), outputFile, installArea, backup); configData.setProperty(SimpleConfiguratorManipulatorImpl.PROP_KEY_CONFIGURL, outputFile.toURL().toExternalForm()); return orderingInitialConfig(setToInitialConfig); }
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 File readFwJarLocation(ConfigData configData, LauncherData launcherData, Properties props) throws URISyntaxException { File fwJar = null; if (props.getProperty(EquinoxConstants.PROP_OSGI_FW) != null) { URI absoluteFwJar = null; absoluteFwJar = URIUtil.makeAbsolute(FileUtils.fromFileURL(props.getProperty(EquinoxConstants.PROP_OSGI_FW)), ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), props, launcherData).toURI()); props.setProperty(EquinoxConstants.PROP_OSGI_FW, absoluteFwJar.toString()); String fwJarString = props.getProperty(EquinoxConstants.PROP_OSGI_FW); if (fwJarString != null) { fwJar = URIUtil.toFile(absoluteFwJar); if (fwJar == null) throw new IllegalStateException(Messages.exception_noFrameworkLocation); //Here we overwrite the value read from eclipse.ini, because the value of osgi.framework always takes precedence. launcherData.setFwJar(fwJar); } else { throw new IllegalStateException(Messages.exception_noFrameworkLocation); } } if (launcherData.getFwJar() != null) configData.addBundle(new BundleInfo(launcherData.getFwJar().toURI())); return launcherData.getFwJar(); }
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); } }
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); } }