Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2010-01-13 16:17:21 +0000
committerPascal Rapicault2010-01-13 16:17:21 +0000
commit39397b81698920b0710f07562127af23b03ff471 (patch)
tree8c698b344dbc2d5c3713e8e5b6989902f6d5bab8 /bundles/org.eclipse.equinox.frameworkadmin.equinox
parent62eb06de9e9564748a3048f99f307c32a984b214 (diff)
downloadrt.equinox.p2-39397b81698920b0710f07562127af23b03ff471.tar.gz
rt.equinox.p2-39397b81698920b0710f07562127af23b03ff471.tar.xz
rt.equinox.p2-39397b81698920b0710f07562127af23b03ff471.zip
Merging api branch back to HEAD
Diffstat (limited to 'bundles/org.eclipse.equinox.frameworkadmin.equinox')
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/.project5
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/OSGI-INF/fwadmin.xml13
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/build.properties15
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Activator.java99
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java21
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxConstants.java1
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwAdminImpl.java117
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java23
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java24
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Messages.java2
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java2
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/messages.properties2
13 files changed, 127 insertions, 200 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/.project b/bundles/org.eclipse.equinox.frameworkadmin.equinox/.project
index e1ceadb55..256472c44 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/.project
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/.project
@@ -25,6 +25,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF
index acf9f5eb1..40cd58e4d 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.frameworkadmin.equinox;singleton:=true
Bundle-Version: 1.0.200.qualifier
-Bundle-Activator: org.eclipse.equinox.internal.frameworkadmin.equinox.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Import-Package: org.eclipse.core.runtime.internal.adaptor,
@@ -24,3 +23,5 @@ Export-Package: org.eclipse.equinox.internal.frameworkadmin.equinox;x-friends:="
Require-Bundle: org.eclipse.equinox.common
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
J2SE-1.4
+Service-Component: OSGI-INF/fwadmin.xml
+Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/OSGI-INF/fwadmin.xml b/bundles/org.eclipse.equinox.frameworkadmin.equinox/OSGI-INF/fwadmin.xml
new file mode 100644
index 000000000..e3f045a71
--- /dev/null
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/OSGI-INF/fwadmin.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.equinox.frameworkadmin.equinox">
+ <implementation class="org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwAdminImpl"/>
+ <service>
+ <provide interface="org.eclipse.equinox.internal.provisional.frameworkadmin.FrameworkAdmin"/>
+ </service>
+ <property name="org.eclipse.equinox.frameworkhandler.framework.name" type="String" value="Equinox"/>
+ <property name="org.eclipse.equinox.frameworkhandler.framework.version" type="String" value="3.3"/>
+ <property name="org.eclipse.equinox.frameworkhandler.launcher.name" type="String" value="Eclipse.exe"/>
+ <property name="org.eclipse.equinox.frameworkhandler.launcher.version" type="String" value="3.2"/>
+ <reference bind="setStartLevel" cardinality="1..1" interface="org.osgi.service.startlevel.StartLevel" name="StartLevel" policy="static"/>
+ <reference bind="setPlatformAdmin" cardinality="1..1" interface="org.eclipse.osgi.service.resolver.PlatformAdmin" name="PlatformAdmin" policy="static"/>
+</scr:component>
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/build.properties b/bundles/org.eclipse.equinox.frameworkadmin.equinox/build.properties
index b0b12db73..db8ea728e 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/build.properties
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/build.properties
@@ -1,17 +1,8 @@
-###############################################################################
-# Copyright (c) 2005, 2008 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
about.html,\
- plugin.properties
+ plugin.properties,\
+ OSGI-INF/
src.includes = about.html
+source.. = src/
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Activator.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Activator.java
deleted file mode 100644
index 4a3ec8674..000000000
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Activator.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.frameworkadmin.equinox;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import org.eclipse.equinox.internal.provisional.frameworkadmin.FrameworkAdmin;
-import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
-import org.osgi.framework.*;
-
-/**
- * This bundle provides the {@link FrameworkAdmin} implementation for Felix.
- *
- * This bundle registers {@link Manipulator} object with these service property values.
- *
- * FW_NAME = "Equinox";
- * FW_VERSION = "3.3";
- * LAUCNHER_NAME = "Eclipse.exe";
- * LAUNCHER_VERSION = "3.2";
- *
- * The launching by the eclipse launcher is supported.
- *
- * Handling plugins in non Jar format is not supported.
- *
- * FwBundleState supports retrieving fw persistent data
- * and resolving bundles if running on equinox.
- * FwBundleState Does NOT support retrieving start Levels from fw persistent data location/
- *
- */
-public class Activator implements BundleActivator {
- private static BundleContext context;
- private ServiceRegistration registrationFA;
- EquinoxFwAdminImpl fwAdmin = null;
-
- private void registerFwAdmin() {
- Dictionary props = new Hashtable();
- props.put(Constants.SERVICE_VENDOR, "Eclipse.org");
-
- props.put(FrameworkAdmin.SERVICE_PROP_KEY_FW_NAME, EquinoxConstants.FW_NAME);
- props.put(FrameworkAdmin.SERVICE_PROP_KEY_FW_VERSION, EquinoxConstants.FW_VERSION);
- props.put(FrameworkAdmin.SERVICE_PROP_KEY_LAUNCHER_NAME, EquinoxConstants.LAUNCHER_NAME);
- props.put(FrameworkAdmin.SERVICE_PROP_KEY_LAUNCHER_VERSION, EquinoxConstants.LAUNCHER_VERSION);
-
- if (EquinoxFwAdminImpl.isRunningFw(context)) {
- props.put(FrameworkAdmin.SERVICE_PROP_KEY_RUNNING_SYSTEM_FLAG, "true");
- fwAdmin = new EquinoxFwAdminImpl(context, true);
- } else
- fwAdmin = new EquinoxFwAdminImpl(context);
-
- registrationFA = context.registerService(FrameworkAdmin.class.getName(), fwAdmin, props);
- }
-
- /**
- * TODO: These services are never disposed.
- */
- public static Object acquireService(String serviceName) {
- //be tolerant of concurrent shutdown
- BundleContext theContext = context;
- if (theContext == null)
- return null;
- ServiceReference reference = theContext.getServiceReference(serviceName);
- if (reference == null)
- return null;
- return theContext.getService(reference);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- Log.init(bundleContext);
- registerFwAdmin();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- if (registrationFA != null)
- registrationFA.unregister();
- if (fwAdmin != null)
- fwAdmin.deactivate();
- Log.dispose();
- }
-}
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java
index 41e2c4fd9..9aed53860 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java
@@ -166,7 +166,7 @@ public class EquinoxBundlesState implements BundlesState {
String nl = Locale.getDefault().toString();
platformProperties.setProperty("osgi.nl", nl); //$NON-NLS-1$
- // TODO remove EclipseEnvironmentInof
+ // TODO remove EclipseEnvironmentInfo
String os = EclipseEnvironmentInfo.guessOS(System.getProperty("os.name"));//$NON-NLS-1$);
platformProperties.setProperty("osgi.os", os); //$NON-NLS-1$
@@ -194,16 +194,11 @@ public class EquinoxBundlesState implements BundlesState {
}
EquinoxFwAdminImpl fwAdmin = null;
-
BundleContext context;
-
Manipulator manipulator = null;
Properties platfromProperties = new Properties();
-
long maxId = DEFAULT_TIMESTAMP;
-
StateObjectFactory soFactory = null;
-
State state = null;
/**
@@ -216,6 +211,7 @@ public class EquinoxBundlesState implements BundlesState {
* and version as defined by the {@link #getKey(BundleDescription)} method.
*/
private HashMap nameVersionStateIndex = new HashMap();
+ private final PlatformAdmin platformAdmin;
/**
* If useFwPersistentData flag equals false, this constructor will not take
@@ -226,9 +222,10 @@ public class EquinoxBundlesState implements BundlesState {
* @param manipulator
* @param useFwPersistentData
*/
- EquinoxBundlesState(BundleContext context, EquinoxFwAdminImpl fwAdmin, Manipulator manipulator, boolean useFwPersistentData) {
+ EquinoxBundlesState(BundleContext context, EquinoxFwAdminImpl fwAdmin, Manipulator manipulator, PlatformAdmin admin, boolean useFwPersistentData) {
this.context = context;
this.fwAdmin = fwAdmin;
+ this.platformAdmin = admin;
// copy manipulator object for avoiding modifying the parameters of the
// manipulator.
this.manipulator = fwAdmin.getManipulator();
@@ -246,10 +243,11 @@ public class EquinoxBundlesState implements BundlesState {
* @param manipulator
* @param platformProperties
*/
- EquinoxBundlesState(BundleContext context, EquinoxFwAdminImpl fwAdmin, Manipulator manipulator, Properties platformProperties) {
+ EquinoxBundlesState(BundleContext context, EquinoxFwAdminImpl fwAdmin, Manipulator manipulator, PlatformAdmin admin, Properties platformProperties) {
super();
this.context = context;
this.fwAdmin = fwAdmin;
+ this.platformAdmin = admin;
// copy manipulator object for avoiding modifying the parameters of the
// manipulator.
this.manipulator = fwAdmin.getManipulator();
@@ -501,7 +499,6 @@ public class EquinoxBundlesState implements BundlesState {
public String[] getUnsatisfiedConstraints(BundleInfo bInfo) {
URI realLocation = bInfo.getLocation();
BundleDescription description = getBundleByLocation(realLocation);
- PlatformAdmin platformAdmin = (PlatformAdmin) Activator.acquireService(PlatformAdmin.class.getName());
StateHelper helper = platformAdmin.getStateHelper();
VersionConstraint[] constraints = helper.getUnsatisfiedConstraints(description);
String[] ret = new String[constraints.length];
@@ -634,10 +631,8 @@ public class EquinoxBundlesState implements BundlesState {
}
private void setStateObjectFactory() {
- if (soFactory != null)
- return;
- PlatformAdmin platformAdmin = (PlatformAdmin) Activator.acquireService(PlatformAdmin.class.getName());
- soFactory = platformAdmin.getFactory();
+ if (soFactory == null)
+ soFactory = platformAdmin.getFactory();
}
public String toString() {
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxConstants.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxConstants.java
index 99d104ea3..d9623ab4b 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxConstants.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxConstants.java
@@ -35,7 +35,6 @@ public class EquinoxConstants {
public static final String OPTION_VMARGS = "-vmargs"; //$NON-NLS-1$
public static final String OPTION_CLEAN = "-clean"; //$NON-NLS-1$
public static final String OPTION_STARTUP = "-startup"; //$NON-NLS-1$
- public static final String OPTION_SHOWSPLASH = "-showsplash"; //$NON-NLS-1$
public static final String OPTION_INSTALL = "-install"; //$NON-NLS-1$
public static final String OPTION_LAUNCHER_LIBRARY = "--launcher.library"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwAdminImpl.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwAdminImpl.java
index 12f8e30ca..39d29374c 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwAdminImpl.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwAdminImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,50 +16,39 @@ import java.util.Dictionary;
import org.eclipse.equinox.internal.provisional.configuratormanipulator.ConfiguratorManipulator;
import org.eclipse.equinox.internal.provisional.configuratormanipulator.ConfiguratorManipulatorFactory;
import org.eclipse.equinox.internal.provisional.frameworkadmin.*;
+import org.eclipse.osgi.service.resolver.PlatformAdmin;
import org.osgi.framework.*;
+import org.osgi.service.startlevel.StartLevel;
public class EquinoxFwAdminImpl implements FrameworkAdmin {
- /**
- * If both the vendor and the Bundle-Version in the manifest match,
- * return true. Otherwise false.
- *
- * @return flag true if the ManipulatorAdmin object can handle currently running fw launch.
- */
- static boolean isRunningFw(BundleContext context) {
- //TODO implementation for Eclipse.exe and for Equinox
- String fwVendor = context.getProperty(Constants.FRAMEWORK_VENDOR);
- if (!"Eclipse".equals(fwVendor)) //$NON-NLS-1$
- return false;
- //TODO decide if this version can be supported by this bundle.
- Dictionary header = context.getBundle(0).getHeaders();
- String versionSt = (String) header.get(Constants.BUNDLE_VERSION);
- Version version = new Version(versionSt);
- int value = version.compareTo(new Version(EquinoxConstants.FW_VERSION));
- if (value > 0) {
- return true;
- }
- // TODO need to identify the version of eclipse.exe used for this launch, if used.
- return false;
- }
+ boolean active = false;
- BundleContext context = null;
+ private ConfiguratorManipulator configuratorManipulator = null;
- boolean active = false;
+ BundleContext context = null;
private boolean runningFw = false;
- private ConfiguratorManipulator configuratorManipulator = null;
- // private String configuratorManipulatorFactoryName = null;
+ private PlatformAdmin platformAdmin;
+ private StartLevel startLevelService;
- EquinoxFwAdminImpl() {
+ public EquinoxFwAdminImpl() {
this(null, false);
}
+ // private String configuratorManipulatorFactoryName = null;
+
EquinoxFwAdminImpl(BundleContext context) {
this(context, false);
}
+ EquinoxFwAdminImpl(BundleContext context, boolean runningFw) {
+ this.context = context;
+ this.active = true;
+ this.runningFw = runningFw;
+ }
+
EquinoxFwAdminImpl(String configuratorManipulatorFactoryName) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
this.context = null;
this.active = true;
@@ -68,45 +57,81 @@ public class EquinoxFwAdminImpl implements FrameworkAdmin {
loadConfiguratorManipulator(configuratorManipulatorFactoryName);
}
- private void loadConfiguratorManipulator(String configuratorManipulatorFactoryName) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
- if (configuratorManipulatorFactoryName == null)
- this.configuratorManipulator = null;
- else
- this.configuratorManipulator = ConfiguratorManipulatorFactory.getInstance(configuratorManipulatorFactoryName);
- return;
- }
-
- EquinoxFwAdminImpl(BundleContext context, boolean runningFw) {
- this.context = context;
- this.active = true;
- this.runningFw = runningFw;
+ /**
+ * DS component activator
+ * @param aContext The bundle context
+ */
+ public void activate(BundleContext aContext) {
+ this.context = aContext;
+ this.runningFw = isRunningFw();
+ Log.init(aContext);
}
void deactivate() {
active = false;
+ Log.dispose();
+ }
+
+ public ConfiguratorManipulator getConfiguratorManipulator() {
+ return configuratorManipulator;
}
public Manipulator getManipulator() {
- return new EquinoxManipulatorImpl(context, this);
+ return new EquinoxManipulatorImpl(context, this, platformAdmin, startLevelService, false);
}
public Manipulator getRunningManipulator() {
- if (this.runningFw)
- return new EquinoxManipulatorImpl(context, this, true);
- return null;
+ if (!this.runningFw)
+ return null;
+ return new EquinoxManipulatorImpl(context, this, platformAdmin, startLevelService, true);
}
public boolean isActive() {
return active;
}
+ /**
+ * If both the vendor and the Bundle-Version in the manifest match,
+ * return true. Otherwise false.
+ *
+ * @return flag true if the ManipulatorAdmin object can handle currently running fw launch.
+ */
+ boolean isRunningFw() {
+ //TODO implementation for Eclipse.exe and for Equinox
+ String fwVendor = context.getProperty(Constants.FRAMEWORK_VENDOR);
+ if (!"Eclipse".equals(fwVendor)) //$NON-NLS-1$
+ return false;
+ //TODO decide if this version can be supported by this bundle.
+ Dictionary header = context.getBundle(0).getHeaders();
+ String versionSt = (String) header.get(Constants.BUNDLE_VERSION);
+ Version version = new Version(versionSt);
+ int value = version.compareTo(new Version(EquinoxConstants.FW_VERSION));
+ if (value > 0) {
+ return true;
+ }
+ // TODO need to identify the version of eclipse.exe used for this launch, if used.
+ return false;
+ }
+
public Process launch(Manipulator manipulator, File cwd) throws IllegalArgumentException, FrameworkAdminRuntimeException, IOException {
//return new EclipseLauncherImpl(context, this).launch(manipulator, cwd);
return new EclipseLauncherImpl(this).launch(manipulator, cwd);
}
- public ConfiguratorManipulator getConfiguratorManipulator() {
- return configuratorManipulator;
+ private void loadConfiguratorManipulator(String configuratorManipulatorFactoryName) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+ if (configuratorManipulatorFactoryName == null)
+ this.configuratorManipulator = null;
+ else
+ this.configuratorManipulator = ConfiguratorManipulatorFactory.getInstance(configuratorManipulatorFactoryName);
+ return;
+ }
+
+ public void setPlatformAdmin(PlatformAdmin admin) {
+ this.platformAdmin = admin;
+ }
+
+ public void setStartLevel(StartLevel sl) {
+ this.startLevelService = sl;
}
}
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java
index 5a778a8e0..aa14afea5 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java
@@ -23,6 +23,7 @@ import org.osgi.framework.Constants;
import org.osgi.service.log.LogService;
public class EquinoxFwConfigFileParser {
+ private static final Set KNOWN_PROPERTIES = new HashSet(Arrays.asList(new String[] {EquinoxConstants.PROP_BUNDLES, EquinoxConstants.PROP_FW_EXTENSIONS, EquinoxConstants.PROP_INITIAL_STARTLEVEL, EquinoxConstants.PROP_BUNDLES_STARTLEVEL}));
private static final String CONFIG_DIR = "@config.dir/"; //$NON-NLS-1$
private static final String KEY_ECLIPSE_PROV_DATA_AREA = "eclipse.p2.data.area"; //$NON-NLS-1$
private static final String KEY_ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR_CONFIGURL = "org.eclipse.equinox.simpleconfigurator.configUrl"; //$NON-NLS-1$
@@ -226,19 +227,11 @@ public class EquinoxFwConfigFileParser {
readBundlesList(manipulator, ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), props, launcherData).toURI(), props);
readInitialStartLeve(configData, props);
readDefaultStartLevel(configData, props);
- // if (key.equals(EquinoxConstants.PROP_LAUNCHER_NAME))
- // if (launcherData.getLauncher() == null)
- // launcherName = value;
- // if (key.equals(EquinoxConstants.PROP_LAUNCHER_PATH))
- // if (launcherData.getLauncher() == null)
- // launcherPath = value;
- String[] KNOWN_PROPERTIES = {EquinoxConstants.PROP_BUNDLES, EquinoxConstants.PROP_FW_EXTENSIONS, EquinoxConstants.PROP_INITIAL_STARTLEVEL, EquinoxConstants.PROP_BUNDLES_STARTLEVEL};
- top: for (Enumeration enumeration = props.keys(); enumeration.hasMoreElements();) {
+
+ for (Enumeration enumeration = props.keys(); enumeration.hasMoreElements();) {
String key = (String) enumeration.nextElement();
- for (int i = 0; i < KNOWN_PROPERTIES.length; i++) {
- if (KNOWN_PROPERTIES[i].equals(key))
- continue top;
- }
+ if (KNOWN_PROPERTIES.contains(key))
+ continue;
String value = props.getProperty(key);
configData.setProperty(key, value);
}
@@ -279,11 +272,11 @@ public class EquinoxFwConfigFileParser {
if (fwJarString != null) {
fwJar = URIUtil.toFile(absoluteFwJar);
if (fwJar == null)
- throw new IllegalStateException("Can't determinate the osgi.framework location");
+ 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("Can't determinate the osgi.framework location");
+ throw new IllegalStateException(Messages.exception_noFrameworkLocation);
}
}
if (launcherData.getFwJar() != null)
@@ -458,7 +451,7 @@ public class EquinoxFwConfigFileParser {
writeInitialStartLevel(configData, configProps);
writeDefaultStartLevel(configData, configProps);
} catch (URISyntaxException e) {
- throw new FrameworkAdminRuntimeException(e, "saving config.ini");
+ throw new FrameworkAdminRuntimeException(e, Messages.exception_errorSavingConfigIni);
}
Properties original = configData.getProperties();
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java
index 012203130..e82df428a 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java
@@ -20,6 +20,7 @@ import org.eclipse.equinox.internal.frameworkadmin.utils.Utils;
import org.eclipse.equinox.internal.provisional.configuratormanipulator.ConfiguratorManipulator;
import org.eclipse.equinox.internal.provisional.frameworkadmin.*;
import org.eclipse.osgi.service.datalocation.Location;
+import org.eclipse.osgi.service.resolver.PlatformAdmin;
import org.osgi.framework.*;
import org.osgi.service.log.LogService;
import org.osgi.service.startlevel.StartLevel;
@@ -100,12 +101,13 @@ public class EquinoxManipulatorImpl implements Manipulator {
ConfigData configData = new ConfigData(EquinoxConstants.FW_NAME, EquinoxConstants.FW_VERSION, EquinoxConstants.LAUNCHER_NAME, EquinoxConstants.LAUNCHER_VERSION);
EquinoxLauncherData launcherData = new EquinoxLauncherData(EquinoxConstants.FW_NAME, EquinoxConstants.FW_VERSION, EquinoxConstants.LAUNCHER_NAME, EquinoxConstants.LAUNCHER_VERSION);
-
BundleContext context = null;
private Properties platformProperties = new Properties();
ServiceTracker cmTracker;
int trackingCount = -1;
+ private final PlatformAdmin platformAdmin;
+ private final StartLevel startLevelService;
// private final boolean runtime;
@@ -113,13 +115,11 @@ public class EquinoxManipulatorImpl implements Manipulator {
EquinoxFwAdminImpl fwAdmin = null;
- EquinoxManipulatorImpl(BundleContext context, EquinoxFwAdminImpl fwAdmin) {
- this(context, fwAdmin, false);
- }
-
- EquinoxManipulatorImpl(BundleContext context, EquinoxFwAdminImpl fwAdmin, boolean runtime) {
+ EquinoxManipulatorImpl(BundleContext context, EquinoxFwAdminImpl fwAdmin, PlatformAdmin admin, StartLevel slService, boolean runtime) {
this.context = context;
this.fwAdmin = fwAdmin;
+ this.platformAdmin = admin;
+ this.startLevelService = slService;
if (context != null) {
cmTracker = new ServiceTracker(context, ConfiguratorManipulator.class.getName(), null);
cmTracker.open();
@@ -142,10 +142,11 @@ public class EquinoxManipulatorImpl implements Manipulator {
if (!EquinoxBundlesState.checkFullySupported())
return new SimpleBundlesState(fwAdmin, this, EquinoxConstants.FW_SYMBOLIC_NAME);
+ EquinoxBundlesState state;
if (platformProperties.isEmpty())
- return new EquinoxBundlesState(context, fwAdmin, this, false);
+ return new EquinoxBundlesState(context, fwAdmin, this, platformAdmin, false);
// XXX checking if fwDependent or fwIndependent platformProperties are updated after the platformProperties was created might be required for better implementation.
- return new EquinoxBundlesState(context, fwAdmin, this, platformProperties);
+ return new EquinoxBundlesState(context, fwAdmin, this, platformAdmin, platformProperties);
}
public ConfigData getConfigData() throws FrameworkAdminRuntimeException {
@@ -315,10 +316,9 @@ public class EquinoxManipulatorImpl implements Manipulator {
}
// update initialBundleStartLevel
- StartLevel slAdmin = (StartLevel) Activator.acquireService(StartLevel.class.getName());
int initialBSL = configData.getInitialBundleStartLevel();
- if (initialBSL != slAdmin.getInitialBundleStartLevel())
- configData.setInitialBundleStartLevel(slAdmin.getInitialBundleStartLevel());
+ if (initialBSL != startLevelService.getInitialBundleStartLevel())
+ configData.setInitialBundleStartLevel(startLevelService.getInitialBundleStartLevel());
// for (int j = 0; j < bInfos.length; j++)
// configData.addBundle(bInfos[j]);
@@ -333,7 +333,7 @@ public class EquinoxManipulatorImpl implements Manipulator {
BundlesState bundlesState = null;
if (EquinoxBundlesState.checkFullySupported()) {
- bundlesState = new EquinoxBundlesState(context, fwAdmin, this, !launcherData.isClean());
+ bundlesState = new EquinoxBundlesState(context, fwAdmin, this, platformAdmin, !launcherData.isClean());
platformProperties = ((EquinoxBundlesState) bundlesState).getPlatformProperties();
} else {
bundlesState = new SimpleBundlesState(fwAdmin, this, EquinoxConstants.FW_SYMBOLIC_NAME);
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Messages.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Messages.java
index 186d264f1..de7c16b0b 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Messages.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Messages.java
@@ -24,6 +24,8 @@ public class Messages extends NLS {
public static String exception_bundleManifest;
public static String exception_createAbsoluteURI;
public static String exception_nullConfigArea;
+ public static String exception_noFrameworkLocation;
+ public static String exception_errorSavingConfigIni;
public static String log_configFile;
public static String log_configProps;
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java
index 973795aba..89f30b177 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java
@@ -111,7 +111,7 @@ public class ParserUtils {
public static File fromOSGiJarToOSGiInstallArea(String path) {
IPath parentFolder = new Path(path).removeLastSegments(1);
- if (parentFolder.lastSegment().equalsIgnoreCase("plugins")) //$NON-NLS-1$
+ if ("plugins".equalsIgnoreCase(parentFolder.lastSegment())) //$NON-NLS-1$
return parentFolder.removeLastSegments(1).toFile();
return parentFolder.toFile();
}
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/messages.properties b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/messages.properties
index 9c450104c..661460702 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/messages.properties
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/messages.properties
@@ -19,6 +19,8 @@ exception_fileURLExpected= The property {0} = {1} is expected to be a \"file:\"
exception_bundleManifest= Unable to get bundle manifest for: {0}
exception_createAbsoluteURI=Failed to create absolute URI from \"{0}\" and \"{1}\".
exception_nullConfigArea=The configuration area is not set.
+exception_noFrameworkLocation = Unable to determinate the osgi.framework location.
+exception_errorSavingConfigIni = Error saving config.ini.
log_configFile= Configuration file ({0}) has been read successfully.
log_configProps= Configuration properties is empty.

Back to the top