From 2fa5b87e1f0764f9abb081904ecba5b340c25893 Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Thu, 12 Jul 2018 16:24:43 +0100 Subject: Fix for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=534087 Allow ECF to build against both R6 and R7 implementations of the org.osgi.service.log API. This is accomplished by providing stubs of the new interfaces on the build-time classpath so that we can implement the new R7 methods without having unresolved classes on R6. The stubs are not shipped with the binary distribution of ECF, so in the actual ECF code we can use them as long as we avoid any explicit import statements to avoid runtime linkage errors on R6. Change-Id: Ib29135c030e3dd8a3bf799552a2f3144c26edfe3 Signed-off-by: Mat Booth --- .../bundles/org.eclipse.ecf.identity/.classpath | 1 + .../bundles/org.eclipse.ecf.identity/.gitignore | 4 +++- .../org.eclipse.ecf.identity/build.properties | 3 +++ .../eclipse/ecf/core/util/SystemLogService.java | 22 +++++++++++++++++++++- .../src_r7stubs/org/osgi/service/log/Logger.java | 21 +++++++++++++++++++++ 5 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 framework/bundles/org.eclipse.ecf.identity/src_r7stubs/org/osgi/service/log/Logger.java (limited to 'framework/bundles') diff --git a/framework/bundles/org.eclipse.ecf.identity/.classpath b/framework/bundles/org.eclipse.ecf.identity/.classpath index 64c5e31b7..867c88624 100644 --- a/framework/bundles/org.eclipse.ecf.identity/.classpath +++ b/framework/bundles/org.eclipse.ecf.identity/.classpath @@ -3,5 +3,6 @@ + diff --git a/framework/bundles/org.eclipse.ecf.identity/.gitignore b/framework/bundles/org.eclipse.ecf.identity/.gitignore index e660fd93d..bd643ede8 100644 --- a/framework/bundles/org.eclipse.ecf.identity/.gitignore +++ b/framework/bundles/org.eclipse.ecf.identity/.gitignore @@ -1 +1,3 @@ -bin/ +/bin/ +/bin_r7stubs/ +/r7stubs.jar diff --git a/framework/bundles/org.eclipse.ecf.identity/build.properties b/framework/bundles/org.eclipse.ecf.identity/build.properties index 7debffea9..48b7df20c 100644 --- a/framework/bundles/org.eclipse.ecf.identity/build.properties +++ b/framework/bundles/org.eclipse.ecf.identity/build.properties @@ -9,7 +9,9 @@ # Composent Inc. - initial API and implementation ############################################################################### source.. = src/ +source.r7stubs.jar = src_r7stubs/ output.. = bin/ +jars.compile.order = r7stubs.jar,. bin.includes = META-INF/,\ .,\ plugin.xml,\ @@ -18,3 +20,4 @@ bin.includes = META-INF/,\ plugin.properties src.includes = about.html,\ schema/ +jars.extra.classpath=r7stubs.jar diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/SystemLogService.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/SystemLogService.java index 7826b0891..33eb9c568 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/SystemLogService.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/SystemLogService.java @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007, 2009 Composent, Inc. and others. + * Copyright (c) 2007, 2018 Composent, Inc. 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 @@ -13,6 +13,7 @@ package org.eclipse.ecf.core.util; import java.text.SimpleDateFormat; import java.util.Date; +import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; @@ -100,4 +101,23 @@ public class SystemLogService implements LogService { doLog(sr, level, message, exception); } + public org.osgi.service.log.Logger getLogger(String name) { + throw new UnsupportedOperationException(); + } + + public org.osgi.service.log.Logger getLogger(Class clazz) { + throw new UnsupportedOperationException(); + } + + public L getLogger(String name, Class loggerType) { + throw new UnsupportedOperationException(); + } + + public L getLogger(Class clazz, Class loggerType) { + throw new UnsupportedOperationException(); + } + + public L getLogger(Bundle bundle, String name, Class loggerType) { + throw new UnsupportedOperationException(); + } } diff --git a/framework/bundles/org.eclipse.ecf.identity/src_r7stubs/org/osgi/service/log/Logger.java b/framework/bundles/org.eclipse.ecf.identity/src_r7stubs/org/osgi/service/log/Logger.java new file mode 100644 index 000000000..e1829d881 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.identity/src_r7stubs/org/osgi/service/log/Logger.java @@ -0,0 +1,21 @@ +/**************************************************************************** + * Copyright (c) 2018 Red Hat, Inc. 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: + * Red Hat, Inc. - initial API and implementation + *****************************************************************************/ +package org.osgi.service.log; + +/** + * NOTE: This is a stub interface that exists only to allow ECF to build against + * both OSGi R6 and R7 implementations. It is not shipped as part of the binary + * distribution and can be removed once the minimum version of OSGi that ECF + * supports increases to R7. + */ +public interface Logger { + +} -- cgit v1.2.3