private void setInstall(List<String> lines, LauncherData launcherData, File launcherFolder) { if (launcherData.getFwConfigLocation() == null || launcherData.getFwJar() == null) { ParserUtils.removeArgument(EquinoxConstants.OPTION_INSTALL, lines); return; } if (Constants.OS_MACOSX.equals(launcherData.getOS())) { if (!new File(ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()), "../MacOS").equals(launcherFolder)) { ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, launcherFolder.getAbsolutePath().replace('\\', '/'), lines); } } else if (!ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()).equals(launcherFolder)) { ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, launcherFolder.getAbsolutePath().replace('\\', '/'), lines); } }
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()))); }
private void setInstall(List lines, LauncherData launcherData, File launcherFolder) { if (launcherData.getFwConfigLocation() == null || launcherData.getFwJar() == null) { ParserUtils.removeArgument(EquinoxConstants.OPTION_INSTALL, lines); return; } String launcherString = launcherFolder.getAbsolutePath().replace('\\', '/'); if (launcherString.endsWith(MAC_OS_APP_FOLDER)) { //We can do 3 calls to getParentFile without checking because launcherFolder = launcherFolder.getParentFile().getParentFile(); if (!launcherData.getOS().endsWith(MACOSX_BUNDLED)) launcherFolder = launcherFolder.getParentFile(); } if (!ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()).equals(launcherFolder)) { ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, launcherFolder.getAbsolutePath().replace('\\', '/'), lines); } }
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()))); }
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 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 getFrameworkJar(List<String> lines, URI launcherFolder, LauncherData launcherData) { File fwJar = launcherData.getFwJar(); if (fwJar != null) return; URI location = ParserUtils.getFrameworkJar(lines, launcherFolder); if (location != null) launcherData.setFwJar(URIUtil.toFile(location)); }
private void getFrameworkJar(List lines, URI launcherFolder, LauncherData launcherData) { File fwJar = launcherData.getFwJar(); if (fwJar != null) return; URI location = ParserUtils.getFrameworkJar(lines, launcherFolder); if (location != null) launcherData.setFwJar(URIUtil.toFile(location)); }
void read(File launcherConfigFile, LauncherData launcherData) throws IOException { if (!launcherConfigFile.exists()) return; List lines = FileUtils.loadFile(launcherConfigFile); URI launcherFolder = launcherData.getLauncher().getParentFile().toURI(); getStartup(lines, launcherFolder); getFrameworkJar(lines, launcherFolder, launcherData); URI osgiInstallArea = getOSGiInstallArea(lines, launcherFolder, launcherData); if (osgiInstallArea == null) { osgiInstallArea = launcherData.getFwJar() != null ? ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()).toURI() : launcherFolder; } URI configArea = getConfigurationLocation(lines, osgiInstallArea, launcherData); if (configArea == null) throw new FrameworkAdminRuntimeException(Messages.exception_nullConfigArea, ""); //$NON-NLS-1$ getPersistentDataLocation(lines, osgiInstallArea, configArea, launcherData); getLauncherLibrary(lines, launcherFolder); getJVMArgs(lines, launcherData); getProgramArgs(lines, launcherData); getVM(lines, launcherFolder, launcherData); Log.log(LogService.LOG_INFO, NLS.bind(Messages.log_configFile, launcherConfigFile.getAbsolutePath())); }
void read(File launcherConfigFile, LauncherData launcherData) throws IOException { if (!launcherConfigFile.exists()) return; List<String> lines = FileUtils.loadFile(launcherConfigFile); URI launcherFolder = launcherData.getLauncher().getParentFile().toURI(); getStartup(lines, launcherFolder); getFrameworkJar(lines, launcherFolder, launcherData); URI osgiInstallArea = getOSGiInstallArea(lines, launcherFolder, launcherData); if (osgiInstallArea == null) { osgiInstallArea = launcherData.getFwJar() != null ? ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()).toURI() : launcherFolder; } URI configArea = getConfigurationLocation(lines, osgiInstallArea, launcherData); if (configArea == null) throw new FrameworkAdminRuntimeException(Messages.exception_nullConfigArea, ""); //$NON-NLS-1$ getPersistentDataLocation(lines, osgiInstallArea, configArea, launcherData); getLauncherLibrary(lines, launcherFolder); getJVMArgs(lines, launcherData); getProgramArgs(lines, launcherData); getVM(lines, launcherFolder, launcherData); Log.log(LogService.LOG_INFO, NLS.bind(Messages.log_configFile, launcherConfigFile.getAbsolutePath())); }
private BundleInfo convertSystemBundle(BundleDescription toConvert) { // Converting the System Bundle boolean markedAsStarted = false; int sl = BundleInfo.NO_LEVEL; URI location = null; String symbolicNameTarget = toConvert.getSymbolicName(); Version versionTarget = toConvert.getVersion(); try { File fwJar = manipulator.getLauncherData().getFwJar(); if (fwJar != null) { URI fwJarLocation = fwJar.toURI(); String[] clauses = Utils.getClausesManifestMainAttributes(fwJarLocation, Constants.BUNDLE_SYMBOLICNAME); String fwJarSymbolicName = Utils.getPathFromClause(clauses[0]); String fwJarVersionSt = Utils.getManifestMainAttributes(fwJarLocation, Constants.BUNDLE_VERSION); if (fwJarSymbolicName.equals(symbolicNameTarget) && fwJarVersionSt.equals(versionTarget.toString())) { location = fwJarLocation; markedAsStarted = true; } } } catch (FrameworkAdminRuntimeException e1) { Log.log(LogService.LOG_ERROR, "", e1); //$NON-NLS-1$ } return createBundleInfo(toConvert, markedAsStarted, sl, location, null); }
private BundleInfo convertSystemBundle(BundleDescription toConvert) { // Converting the System Bundle boolean markedAsStarted = false; int sl = BundleInfo.NO_LEVEL; URI location = null; String symbolicNameTarget = toConvert.getSymbolicName(); Version versionTarget = toConvert.getVersion(); try { File fwJar = manipulator.getLauncherData().getFwJar(); if (fwJar != null) { URI fwJarLocation = fwJar.toURI(); String[] clauses = Utils.getClausesManifestMainAttributes(fwJarLocation, Constants.BUNDLE_SYMBOLICNAME); String fwJarSymbolicName = Utils.getPathFromClause(clauses[0]); String fwJarVersionSt = Utils.getManifestMainAttributes(fwJarLocation, Constants.BUNDLE_VERSION); if (fwJarSymbolicName.equals(symbolicNameTarget) && fwJarVersionSt.equals(versionTarget.toString())) { location = fwJarLocation; markedAsStarted = true; } } } catch (FrameworkAdminRuntimeException e1) { Log.log(LogService.LOG_ERROR, "", e1); //$NON-NLS-1$ } return createBundleInfo(toConvert, markedAsStarted, sl, location, null); }
private void initialize() { this.bundleInfosList.clear(); LauncherData launcherData = manipulator.getLauncherData(); ConfigData configData = manipulator.getConfigData(); File fwJar = getFwJar(launcherData);; if (fwJar == null) throw new IllegalStateException("launcherData.getLauncherConfigFile() == null && fwJar is not set."); // No fw persistent data location is taken into consideration. BundleInfo[] bInfos = configData.getBundles(); for (int j = 0; j < bInfos.length; j++) this.installBundle(bInfos[j]); if (getSystemBundle() == null) { BundleInfo sysBInfo = new BundleInfo(launcherData.getFwJar().toURI(), 0, true); sysBInfo.setBundleId(0); this.installBundle(sysBInfo); } }
private void initialize() { this.bundleInfosList.clear(); LauncherData launcherData = manipulator.getLauncherData(); ConfigData configData = manipulator.getConfigData(); File fwJar = getFwJar(launcherData); if (fwJar == null) throw new IllegalStateException("launcherData.getLauncherConfigFile() == null && fwJar is not set."); //$NON-NLS-1$ // No fw persistent data location is taken into consideration. BundleInfo[] bInfos = configData.getBundles(); for (int j = 0; j < bInfos.length; j++) this.installBundle(bInfos[j]); if (getSystemBundle() == null) { BundleInfo sysBInfo = new BundleInfo(launcherData.getFwJar().toURI(), 0, true); sysBInfo.setBundleId(0); this.installBundle(sysBInfo); } }
private void initialize() { this.bundleInfosList.clear(); LauncherData launcherData = manipulator.getLauncherData(); ConfigData configData = manipulator.getConfigData(); File fwJar = getFwJar(launcherData); if (fwJar == null) throw new IllegalStateException("launcherData.getLauncherConfigFile() == null && fwJar is not set."); //$NON-NLS-1$ // No fw persistent data location is taken into consideration. BundleInfo[] bInfos = configData.getBundles(); for (int j = 0; j < bInfos.length; j++) this.installBundle(bInfos[j]); if (getSystemBundle() == null) { BundleInfo sysBInfo = new BundleInfo(launcherData.getFwJar().toURI(), 0, true); sysBInfo.setBundleId(0); this.installBundle(sysBInfo); } }
public void setLauncherData(LauncherData value) { launcherData.initialize(); launcherData.setFwConfigLocation(value.getFwConfigLocation()); launcherData.setFwPersistentDataLocation(value.getFwPersistentDataLocation(), value.isClean()); launcherData.setJvm(value.getJvm()); launcherData.setJvmArgs(value.getJvmArgs()); launcherData.setOS(value.getOS()); if (launcherData.getFwName().equals(value.getFwName())) if (launcherData.getFwVersion().equals(value.getFwVersion())) { // TODO launcherData.getFwName()/getFwVersion()/ // getLauncherName()/getLauncherVersion() might be taken into consideration // for copying . launcherData.setFwJar(value.getFwJar()); launcherData.setHome(value.getHome()); launcherData.setLauncher(value.getLauncher()); launcherData.setLauncherConfigLocation(value.getLauncherConfigLocation()); } }
@Override public void setLauncherData(LauncherData value) { launcherData.initialize(); launcherData.setFwConfigLocation(value.getFwConfigLocation()); launcherData.setFwPersistentDataLocation(value.getFwPersistentDataLocation(), value.isClean()); launcherData.setJvm(value.getJvm()); launcherData.setJvmArgs(value.getJvmArgs()); launcherData.setOS(value.getOS()); if (launcherData.getFwName().equals(value.getFwName())) if (launcherData.getFwVersion().equals(value.getFwVersion())) { // TODO launcherData.getFwName()/getFwVersion()/ // getLauncherName()/getLauncherVersion() might be taken into consideration // for copying . launcherData.setFwJar(value.getFwJar()); launcherData.setHome(value.getHome()); launcherData.setLauncher(value.getLauncher()); launcherData.setLauncherConfigLocation(value.getLauncherConfigLocation()); } }