Skip to content

Commit

Permalink
Bug 568414 - Finish off removing Activator from core
Browse files Browse the repository at this point in the history
Having removed the main content from the Activator/Plugin, we can now
refactor and remove the class completely from the plugin.

Change-Id: Iede1ee2e1ad62f256af8665b47a5a5fb4830590e
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
  • Loading branch information
alblue authored and l3-g5 committed Nov 5, 2020
1 parent 11719b7 commit 218a01a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 85 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.epp.mpc.core.debug.options">
<property name="listener.symbolic.name" value="org.eclipse.epp.mpc.core"/>
<service>
<provide interface="org.eclipse.osgi.service.debug.DebugOptionsListener"/>
</service>
<implementation class="org.eclipse.epp.internal.mpc.core.MarketplaceClientCorePlugin$DebugOptionsInitializer"/>
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.epp.mpc.core.debug.options">
<property name="listener.symbolic.name" value="org.eclipse.epp.mpc.core"/>
<service>
<provide interface="org.eclipse.osgi.service.debug.DebugOptionsListener"/>
</service>
<implementation class="org.eclipse.epp.internal.mpc.core.ServiceLocator$DebugOptionsInitializer"/>
</scr:component>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2018 The Eclipse Foundation and others.
* Copyright (c) 2010, 2020 The Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -38,6 +38,8 @@
import org.eclipse.epp.mpc.core.service.IMarketplaceStorageService;
import org.eclipse.epp.mpc.core.service.IUserFavoritesService;
import org.eclipse.epp.mpc.core.service.ServiceHelper;
import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.debug.DebugOptionsListener;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
Expand All @@ -59,8 +61,35 @@
@Component(name = "org.eclipse.epp.mpc.core.servicelocator", service = IMarketplaceServiceLocator.class)
public class ServiceLocator implements IMarketplaceServiceLocator {

private static final String DEBUG_CLIENT_REMOVE_OPTION = "xxx"; //$NON-NLS-1$

private static final String STORAGE_SERVICE_BINDING_ID = "bind.storageService"; //$NON-NLS-1$

private static final String DEBUG_CLIENT_OPTIONS_PATH = MarketplaceClientCore.BUNDLE_ID + "/client/"; //$NON-NLS-1$

private static boolean DEBUG_FAKE_CLIENT = false;

private static final String DEBUG_OPTION = "/debug"; //$NON-NLS-1$

private static final String DEBUG_FAKE_CLIENT_OPTION = "/client/fakeVersion"; //$NON-NLS-1$

@Component(name = "org.eclipse.epp.mpc.core.debug.options", property = {
"listener.symbolic.name=org.eclipse.epp.mpc.core" })
public static class DebugOptionsInitializer implements DebugOptionsListener {

@Override
public void optionsChanged(DebugOptions options) {
boolean debug = options.getBooleanOption(MarketplaceClientCore.BUNDLE_ID + DEBUG_OPTION, false);
boolean fakeClient = false;
if (debug) {
fakeClient = options.getBooleanOption(MarketplaceClientCore.BUNDLE_ID + DEBUG_FAKE_CLIENT_OPTION,
false);
}
DEBUG_FAKE_CLIENT = fakeClient;
}

}

private abstract class DynamicBindingOperation<T, B> implements ServiceReferenceOperation<T> {

private final String dynamicBindId;
Expand Down Expand Up @@ -675,9 +704,9 @@ public static Map<String, String> computeProductInfo() {

private static void addDefaultRequestMetaParameter(Map<String, String> requestMetaParameters, String key,
String value) {
if (MarketplaceClientCorePlugin.DEBUG_FAKE_CLIENT) {
String debugOption = Platform.getDebugOption(MarketplaceClientCorePlugin.DEBUG_CLIENT_OPTIONS_PATH + key);
if (MarketplaceClientCorePlugin.DEBUG_CLIENT_REMOVE_OPTION.equals(debugOption)) {
if (DEBUG_FAKE_CLIENT) {
String debugOption = Platform.getDebugOption(DEBUG_CLIENT_OPTIONS_PATH + key);
if (DEBUG_CLIENT_REMOVE_OPTION.equals(debugOption)) {
requestMetaParameters.remove(key);
return;
} else if (debugOption != null && !"".equals(debugOption)) { //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.epp.internal.mpc.core.MarketplaceClientCore;
import org.eclipse.epp.internal.mpc.core.MarketplaceClientCorePlugin;
import org.eclipse.epp.internal.mpc.core.ServiceHelperImpl;
import org.eclipse.epp.mpc.core.service.ITransportFactory;
import org.eclipse.epp.mpc.core.service.ServiceHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.epp.internal.mpc.core.MarketplaceClientCore;
import org.eclipse.epp.internal.mpc.core.MarketplaceClientCorePlugin;
import org.eclipse.epp.internal.mpc.core.ServiceHelperImpl;
import org.eclipse.epp.internal.mpc.core.ServiceLocator;
import org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService;
Expand Down

0 comments on commit 218a01a

Please sign in to comment.