Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIkuo Yamasaki2007-03-07 08:25:11 +0000
committerIkuo Yamasaki2007-03-07 08:25:11 +0000
commit77e25567868ac61655aaf0409e12c034c3f7bc64 (patch)
tree2db4465664e8b4a930123f34351edd54810070d1 /bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org
parentafc2b6ff6c2c25dc13ceb69da90554fb05c428ff (diff)
downloadrt.equinox.p2-77e25567868ac61655aaf0409e12c034c3f7bc64.tar.gz
rt.equinox.p2-77e25567868ac61655aaf0409e12c034c3f7bc64.tar.xz
rt.equinox.p2-77e25567868ac61655aaf0409e12c034c3f7bc64.zip
Bugfix about programArgs.
Support for bundlelocation starting with "reference:".
Diffstat (limited to 'bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org')
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EclipseLauncherParser.java4
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxBundlesState.java31
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxConstants.java2
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxFwConfigFileParser.java29
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxManipulatorImpl.java9
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/utils/FileUtils.java9
6 files changed, 55 insertions, 29 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EclipseLauncherParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EclipseLauncherParser.java
index 6cc1fff67..9ce31b02f 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EclipseLauncherParser.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EclipseLauncherParser.java
@@ -26,7 +26,7 @@ public class EclipseLauncherParser {
final String[] programArgs = launcherData.getProgramArgs();
if (programArgs != null && programArgs.length != 0)
for (int i = 0; i < programArgs.length; i++) {
- if (programArgs[i].equals(EquinoxConstants.OPTION_STARTUP) || programArgs[i + 1] != null || programArgs[i + 1].length() != 0) {
+ if (programArgs[i].equals(EquinoxConstants.OPTION_STARTUP) && (programArgs[i + 1] != null || programArgs[i + 1].length() != 0)) {
lines.add(programArgs[i]);
lines.add(programArgs[++i]);
startUpFlag = true;
@@ -187,8 +187,6 @@ public class EclipseLauncherParser {
if (launcherConfigFile == null || !launcherConfigFile.exists())
throw new IllegalStateException("launcherData.getLauncherConfigFile() should be set in advance");
-
-
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(launcherConfigFile));
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxBundlesState.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxBundlesState.java
index f4a06495f..5dcb2e2d2 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxBundlesState.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxBundlesState.java
@@ -111,13 +111,14 @@ public class EquinoxBundlesState implements BundlesState {
BundleInfo[] bundleInfos = configData.getBundles();
for (int i = 0; i < bundleInfos.length; i++) {
- if (bundleInfos[i].getLocation().startsWith("file:")) {
- String[] clauses = Utils.getClausesManifestMainAttributes(bundleInfos[i].getLocation(), Constants.BUNDLE_SYMBOLICNAME);
- if (bundleInfos[i].getLocation().indexOf(EquinoxConstants.FW_JAR_PLUGIN_NAME) > 0) {
- if ("org.eclipse.osgi".equals(Utils.getPathFromClause(clauses[0]))) {
- return new File(bundleInfos[i].getLocation().substring("file:".length()));
- }
- }
+ String bundleLocation = bundleInfos[i].getLocation();
+ if (bundleLocation.startsWith(EquinoxConstants.REFERENCE))
+ bundleLocation = bundleLocation.substring(EquinoxConstants.REFERENCE.length());
+ if (bundleLocation.startsWith("file:")) {
+ String[] clauses = Utils.getClausesManifestMainAttributes(bundleLocation, Constants.BUNDLE_SYMBOLICNAME);
+ if (bundleLocation.indexOf(EquinoxConstants.FW_JAR_PLUGIN_NAME) > 0)
+ if ("org.eclipse.osgi".equals(Utils.getPathFromClause(clauses[0])))
+ return new File(bundleLocation.substring("file:".length()));
}
}
@@ -423,7 +424,7 @@ public class EquinoxBundlesState implements BundlesState {
//bundleList.addAll(Arrays.asList(cachedInstalledBundles));
for (int i = 0; i < cachedInstalledBundles.length; i++) {
if (cachedInstalledBundles[i].getLocation().startsWith("initial@")) {
- String location = FileUtils.getRealLocation(manipulator, cachedInstalledBundles[i].getLocation());
+ String location = FileUtils.getRealLocation(manipulator, cachedInstalledBundles[i].getLocation(), true);
boolean found = false;
for (int j = 0; j < bInfos.length; j++) {
if (location.equals(bInfos[j].getLocation())) {
@@ -463,7 +464,7 @@ public class EquinoxBundlesState implements BundlesState {
public BundleInfo convert(BundleDescription toConvert) {
boolean markedAsStarted = false;
int sl = BundleInfo.NO_LEVEL;
-
+
String location = null;
// This algorithm is not sophicificated.
if (toConvert.getBundleId() == 0) {//System Bundle
@@ -474,9 +475,9 @@ public class EquinoxBundlesState implements BundlesState {
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())){
+ if (fwJarSymbolicName.equals(symbolicNameTarget) && fwJarVersionSt.equals(versionTarget.toString())) {
location = fwJarLocation;
- markedAsStarted=true;
+ markedAsStarted = true;
}
} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
@@ -718,15 +719,15 @@ public class EquinoxBundlesState implements BundlesState {
boolean found = false;
BundleDescription[] currentInstalledBundles = state.getBundles();
- String newLocation = FileUtils.getRealLocation(manipulator, bInfo.getLocation());
+ String newLocation = FileUtils.getRealLocation(manipulator, bInfo.getLocation(), true);
Dictionary manifest = Utils.getOSGiManifest(newLocation);
String newSymbolicName = (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME);
int position = newSymbolicName.indexOf(";");
- if(position >=0)
- newSymbolicName=newSymbolicName.substring(0,position).trim();
+ if (position >= 0)
+ newSymbolicName = newSymbolicName.substring(0, position).trim();
String newVersion = (String) manifest.get(Constants.BUNDLE_VERSION);
for (int i = 0; i < currentInstalledBundles.length; i++) {
- String location = FileUtils.getRealLocation(manipulator, currentInstalledBundles[i].getLocation());
+ String location = FileUtils.getRealLocation(manipulator, currentInstalledBundles[i].getLocation(), true);
if (newLocation.equals(location)) {
found = true;
break;
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxConstants.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxConstants.java
index f37fb13e0..8be49569f 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxConstants.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxConstants.java
@@ -9,6 +9,7 @@
package org.eclipse.equinox.frameworkadmin.equinox.internal;
public class EquinoxConstants {
+ public static final String PROP_KEY_USE_REFERENCE = "org.eclipse.equinox.frameworkadmin.equinox.useReference";
public static final String PLUGINS_DIR = "plugins";
public static final String FW_JAR_PLUGIN_NAME = "org.eclipse.osgi";
public static final String DEFAULT_CONFIGURATION = "configuration";
@@ -85,5 +86,6 @@ public class EquinoxConstants {
public static final String EXE_EXTENSION = ".exe";
public static final String PROP_EQUINOX_DEPENDENT_PREFIX = "osgi.";
+ static final String REFERENCE = "reference:";
}
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxFwConfigFileParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxFwConfigFileParser.java
index 62637d65f..1e1a7891b 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxFwConfigFileParser.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxFwConfigFileParser.java
@@ -17,19 +17,39 @@ import java.util.Properties;
import org.eclipse.equinox.frameworkadmin.*;
import org.eclipse.equinox.frameworkadmin.equinox.internal.utils.FileUtils;
import org.eclipse.equinox.internal.frameworkadmin.utils.Utils;
+import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogService;
class EquinoxFwConfigFileParser {
private static boolean DEBUG = false;
+ private final BundleContext context;
+ private static String USE_REFERENCE_STRING;
+
+ public EquinoxFwConfigFileParser(BundleContext context) {
+ this.context = context;
+ USE_REFERENCE_STRING = context.getProperty(EquinoxConstants.PROP_KEY_USE_REFERENCE);
+ }
private static String getCommandLine(BundleInfo bundleInfo, final URL baseUrl) {
- URL bundleUrl = null;
+ String location = bundleInfo.getLocation();
+ if (location == null)
+ return null;
+ boolean useReference = true;
+ if (location.startsWith("file:")) {
+ if (USE_REFERENCE_STRING != null && USE_REFERENCE_STRING.equals("false"))
+ useReference = false;
+ }
+
try {
- bundleUrl = new URL(bundleInfo.getLocation());
+ new URL(location);
} catch (MalformedURLException e) {
Log.log(LogService.LOG_ERROR, "EquinoxFwConfigFileParser.getCommandLine():bundleInfo=" + bundleInfo, e);
// Never happen. ignore.
}
+ if (useReference)
+ if (!location.startsWith("reference:"))
+ location = "reference:" + location;
+
int startLevel = bundleInfo.getStartLevel();
boolean toBeStarted = bundleInfo.isMarkedAsStarted();
@@ -39,7 +59,7 @@ class EquinoxFwConfigFileParser {
// bundlePath = Utils.getRelativePath(bundleUrl, baseUrl);
// sb.append(bundlePath);
// } else
- sb.append(bundleUrl.toString());
+ sb.append(location);
if (startLevel == BundleInfo.NO_LEVEL && !toBeStarted)
return sb.toString();
sb.append("@");
@@ -157,6 +177,7 @@ class EquinoxFwConfigFileParser {
configData.setBundles(null);
for (int i = 0; i < bInfoStrings.length; i++) {
String token = bInfoStrings[i].trim();
+ token = FileUtils.getRealLocation(manipulator, token, false);
int index = 0;
while (true) {
if (token.charAt(index) == ' ')
@@ -303,7 +324,7 @@ class EquinoxFwConfigFileParser {
}
String header = "This properties were written by " + this.getClass().getName();
- Properties configProps = this.getConfigProps(bInfos, configData, launcherData, relative, fwJar);
+ Properties configProps = getConfigProps(bInfos, configData, launcherData, relative, fwJar);
if (configProps == null || configProps.size() == 0) {
Log.log(LogService.LOG_WARNING, this, "saveFwConfig() ", "configProps is empty");
return;
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxManipulatorImpl.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxManipulatorImpl.java
index 2a76be01b..523a881c6 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxManipulatorImpl.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/EquinoxManipulatorImpl.java
@@ -255,7 +255,7 @@ public class EquinoxManipulatorImpl implements Manipulator {
if (bundles[i].getBundleId() == 0) // SystemBundle
bInfos[i] = new BundleInfo(fwJarLocation, startLevel.getBundleStartLevel(bundles[i]), startLevel.isBundlePersistentlyStarted(bundles[i]), bundles[i].getBundleId());
else
- bInfos[i] = new BundleInfo(FileUtils.getRealLocation(this, bundles[i].getLocation()), startLevel.getBundleStartLevel(bundles[i]), startLevel.isBundlePersistentlyStarted(bundles[i]), bundles[i].getBundleId());
+ bInfos[i] = new BundleInfo(FileUtils.getRealLocation(this, bundles[i].getLocation(), true), startLevel.getBundleStartLevel(bundles[i]), startLevel.isBundlePersistentlyStarted(bundles[i]), bundles[i].getBundleId());
configData.setBundles(bInfos);
platformProperties = this.getRunningPlatformProperties();
@@ -332,7 +332,7 @@ public class EquinoxManipulatorImpl implements Manipulator {
checkConsistencyOfFwConfigLocAndFwPersistentDataLoc(launcherData);
File fwConfigFile = new File(launcherData.getFwConfigLocation(), EquinoxConstants.CONFIG_INI);
- EquinoxFwConfigFileParser parser = new EquinoxFwConfigFileParser();
+ EquinoxFwConfigFileParser parser = new EquinoxFwConfigFileParser(context);
if (fwConfigFile.exists())
parser.readFwConfig(this, fwConfigFile);
@@ -371,7 +371,7 @@ public class EquinoxManipulatorImpl implements Manipulator {
} else
newBInfo = configData.getBundles();
// Save FwConfigFile
- EquinoxFwConfigFileParser parser = new EquinoxFwConfigFileParser();
+ EquinoxFwConfigFileParser parser = new EquinoxFwConfigFileParser(context);
parser.saveFwConfig(newBInfo, this, backup, false);
}
@@ -421,10 +421,11 @@ public class EquinoxManipulatorImpl implements Manipulator {
return;
for (int i = 0; i < bInfos.length; i++) {
String location = bInfos[i].getLocation();
+ location = FileUtils.getRealLocation(this, location, true);
if (!bInfos[i].isMarkedAsStarted())
continue;
for (int j = 0; j < references.length; j++)
- if (references[j].getProperty(ConfiguratorManipulator.SERVICE_PROP_KEY_CONFIGURATOR_BUNDLESYMBOLICNAME).equals(Utils.getManifestMainAttributes(bInfos[i].getLocation(), Constants.BUNDLE_SYMBOLICNAME))) {
+ if (references[j].getProperty(ConfiguratorManipulator.SERVICE_PROP_KEY_CONFIGURATOR_BUNDLESYMBOLICNAME).equals(Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME))) {
configuratorManipulator = (ConfiguratorManipulator) cmTracker.getService(references[j]);
break;
}
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/utils/FileUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/utils/FileUtils.java
index 19d0dc4a3..ab1a4a096 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/utils/FileUtils.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/frameworkadmin/equinox/internal/utils/FileUtils.java
@@ -53,7 +53,7 @@ public class FileUtils {
// return getRealLocation(ret);
}
- public static String getRealLocation(Manipulator manipulator, final String location) {
+ public static String getRealLocation(Manipulator manipulator, final String location, boolean useEclipse) {
String ret = location;
if (location.startsWith("reference:"))
ret = location.substring("reference:".length());
@@ -61,8 +61,11 @@ public class FileUtils {
ret = location.substring("initial@".length());
if (ret == location)
- return FileUtils.getEclipseRealLocation(manipulator, location);
- return getRealLocation(manipulator, ret);
+ if (useEclipse)
+ return FileUtils.getEclipseRealLocation(manipulator, location);
+ else
+ return location;
+ return getRealLocation(manipulator, ret, useEclipse);
}
public static boolean copy(File source, File target) throws IOException {

Back to the top