Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2020-11-02 21:25:11 +0000
committerLeif Geiger2020-11-05 14:49:01 +0000
commit218a01ab0bfac3027df1e212412a0f3445c363a1 (patch)
treea5e9c93014f081e54b3c052154ce5b575d153262
parent11719b74b46c03deff945ed17cdf1f4b339233dc (diff)
downloadorg.eclipse.epp.mpc-218a01ab0bfac3027df1e212412a0f3445c363a1.tar.gz
org.eclipse.epp.mpc-218a01ab0bfac3027df1e212412a0f3445c363a1.tar.xz
org.eclipse.epp.mpc-218a01ab0bfac3027df1e212412a0f3445c363a1.zip
Bug 568414 - Finish off removing Activator from core
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>
-rw-r--r--org.eclipse.epp.mpc.core/OSGI-INF/services/org.eclipse.epp.mpc.core.debug.options.xml14
-rw-r--r--org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/MarketplaceClientCorePlugin.java72
-rw-r--r--org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/ServiceLocator.java37
-rw-r--r--org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/util/TransportFactory.java1
-rw-r--r--org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/service/SolutionCompatibilityFilterTest.java1
5 files changed, 40 insertions, 85 deletions
diff --git a/org.eclipse.epp.mpc.core/OSGI-INF/services/org.eclipse.epp.mpc.core.debug.options.xml b/org.eclipse.epp.mpc.core/OSGI-INF/services/org.eclipse.epp.mpc.core.debug.options.xml
index f4fc55d5..f9e69934 100644
--- a/org.eclipse.epp.mpc.core/OSGI-INF/services/org.eclipse.epp.mpc.core.debug.options.xml
+++ b/org.eclipse.epp.mpc.core/OSGI-INF/services/org.eclipse.epp.mpc.core.debug.options.xml
@@ -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> \ No newline at end of file
diff --git a/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/MarketplaceClientCorePlugin.java b/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/MarketplaceClientCorePlugin.java
deleted file mode 100644
index 6f19c5b4..00000000
--- a/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/MarketplaceClientCorePlugin.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2018 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
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Yatta Solutions - initial API and implementation
- * Yatta Solutions - bug 432803: public API
- *******************************************************************************/
-package org.eclipse.epp.internal.mpc.core;
-
-import org.eclipse.epp.internal.mpc.core.util.DebugTraceUtil;
-import org.eclipse.osgi.service.debug.DebugOptions;
-import org.eclipse.osgi.service.debug.DebugOptionsListener;
-import org.eclipse.osgi.service.debug.DebugTrace;
-import org.osgi.service.component.annotations.Component;
-
-public class MarketplaceClientCorePlugin {
-
- public static final String DEBUG_OPTION = "/debug"; //$NON-NLS-1$
-
- public static final String DEBUG_FAKE_CLIENT_OPTION = "/client/fakeVersion"; //$NON-NLS-1$
-
- public static final String DEBUG_CLIENT_OPTIONS_PATH = MarketplaceClientCore.BUNDLE_ID + "/client/"; //$NON-NLS-1$
-
- public static final String DEBUG_CLIENT_REMOVE_OPTION = "xxx"; //$NON-NLS-1$
-
- public static boolean DEBUG = false;
-
- public static boolean DEBUG_FAKE_CLIENT = false;
-
- private static DebugTrace debugTrace;
-
- public static void trace(String option, String message) {
- final DebugTrace trace = debugTrace;
- if (DEBUG && trace != null) {
- trace.trace(option, message);
- }
- }
-
- public static void trace(String option, String message, Object... parameters) {
- final DebugTrace trace = debugTrace;
- if (DEBUG && trace != null) {
- DebugTraceUtil.trace(trace, option, message, parameters);
- }
- }
-
- @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) {
- DebugTrace debugTrace = null;
- boolean debug = options.getBooleanOption(MarketplaceClientCore.BUNDLE_ID + DEBUG_OPTION, false);
- boolean fakeClient = false;
- if (debug) {
- debugTrace = options.newDebugTrace(MarketplaceClientCore.BUNDLE_ID);
- fakeClient = options.getBooleanOption(MarketplaceClientCore.BUNDLE_ID + DEBUG_FAKE_CLIENT_OPTION,
- false);
- }
- DEBUG = debug;
- DEBUG_FAKE_CLIENT = fakeClient;
- MarketplaceClientCorePlugin.debugTrace = debugTrace;
- }
-
- }
-}
diff --git a/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/ServiceLocator.java b/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/ServiceLocator.java
index 5347fe38..aec332b4 100644
--- a/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/ServiceLocator.java
+++ b/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/ServiceLocator.java
@@ -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
@@ -38,6 +38,8 @@ import org.eclipse.epp.mpc.core.service.IMarketplaceServiceLocator;
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;
@@ -59,8 +61,35 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
@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;
@@ -675,9 +704,9 @@ public class ServiceLocator implements IMarketplaceServiceLocator {
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$
diff --git a/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/util/TransportFactory.java b/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/util/TransportFactory.java
index 3806dd1e..5314c552 100644
--- a/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/util/TransportFactory.java
+++ b/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/util/TransportFactory.java
@@ -33,7 +33,6 @@ import org.eclipse.core.runtime.IStatus;
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;
diff --git a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/service/SolutionCompatibilityFilterTest.java b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/service/SolutionCompatibilityFilterTest.java
index 65377594..1a72a683 100644
--- a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/service/SolutionCompatibilityFilterTest.java
+++ b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/service/SolutionCompatibilityFilterTest.java
@@ -44,7 +44,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
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;

Back to the top