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/src | |
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/src')
2 files changed, 35 insertions, 7 deletions
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 |