diff options
author | Thomas Watson | 2013-02-07 20:14:51 +0000 |
---|---|---|
committer | Thomas Watson | 2013-02-07 20:14:51 +0000 |
commit | b4fbb0318b017272125cc4d34c6fdb997d66f51e (patch) | |
tree | 4c75e43e0b90fc7cdc625259262ad98b071e4430 /bundles/org.eclipse.osgi.compatibility.state | |
parent | 4573407d7c93ab62805d368afcd9d9f023e2afdc (diff) | |
download | rt.equinox.framework-b4fbb0318b017272125cc4d34c6fdb997d66f51e.tar.gz rt.equinox.framework-b4fbb0318b017272125cc4d34c6fdb997d66f51e.tar.xz rt.equinox.framework-b4fbb0318b017272125cc4d34c6fdb997d66f51e.zip |
Do not require DS for compatibility state
Diffstat (limited to 'bundles/org.eclipse.osgi.compatibility.state')
5 files changed, 37 insertions, 13 deletions
diff --git a/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF index 990af6c69..02641aeed 100644 --- a/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF @@ -3,5 +3,6 @@ Bundle-ManifestVersion: 2 Bundle-Name: State Bundle-SymbolicName: org.eclipse.osgi.compatibility.state Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.osgi.compatibility.state.Activator Fragment-Host: org.eclipse.osgi;bundle-version="3.10.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/bundles/org.eclipse.osgi.compatibility.state/OSGI-INF/PlatformAdmin.xml b/bundles/org.eclipse.osgi.compatibility.state/OSGI-INF/PlatformAdmin.xml deleted file mode 100644 index d3bb63080..000000000 --- a/bundles/org.eclipse.osgi.compatibility.state/OSGI-INF/PlatformAdmin.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.osgi.compatibility.state"> - <implementation class="org.eclipse.osgi.compatibility.state.PlatformAdminImpl"/> -</scr:component> diff --git a/bundles/org.eclipse.osgi.compatibility.state/build.properties b/bundles/org.eclipse.osgi.compatibility.state/build.properties index dcc2d7c7a..f250f9906 100644 --- a/bundles/org.eclipse.osgi.compatibility.state/build.properties +++ b/bundles/org.eclipse.osgi.compatibility.state/build.properties @@ -1,5 +1,4 @@ output.. = bin/ bin.includes = META-INF/,\ - .,\ - OSGI-INF/PlatformAdmin.xml + . source.. = src/ diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/Activator.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/Activator.java new file mode 100644 index 000000000..1528b4842 --- /dev/null +++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/Activator.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2013 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 - Initial API and implementation + ******************************************************************************/ +package org.eclipse.osgi.compatibility.state; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + private final PlatformAdminImpl platformAdmin = new PlatformAdminImpl(); + + @Override + public void start(BundleContext context) throws Exception { + platformAdmin.start(context); + } + + @Override + public void stop(BundleContext context) throws Exception { + platformAdmin.start(context); + } + +} diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java index 71f035ffa..a792cf8a3 100644 --- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java +++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java @@ -17,23 +17,24 @@ import org.eclipse.osgi.internal.module.ResolverImpl; import org.eclipse.osgi.internal.resolver.StateHelperImpl; import org.eclipse.osgi.internal.resolver.StateObjectFactoryImpl; import org.eclipse.osgi.service.resolver.*; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; +import org.osgi.framework.*; public class PlatformAdminImpl implements PlatformAdmin { - private final StateHelper stateHelper = new StateHelperImpl(); private final StateObjectFactory factory = new StateObjectFactoryImpl(); private final Object monitor = new Object(); private EquinoxContainer equinoxContainer; private State systemState; + private ServiceRegistration<PlatformAdmin> reg; - @SuppressWarnings("unused") - // this is used by DS to activate us - private void activate(BundleContext context) { + void start(BundleContext context) { synchronized (this.monitor) { equinoxContainer = ((BundleContextImpl) context).getContainer(); } - context.registerService(PlatformAdmin.class, this, null); + this.reg = context.registerService(PlatformAdmin.class, this, null); + } + + void stop(BundleContext context) { + this.reg.unregister(); } @Override |