Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C1B3A200BB6 for ; Fri, 4 Nov 2016 11:55:18 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C04A4160AE9; Fri, 4 Nov 2016 10:55:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 13700160AE8 for ; Fri, 4 Nov 2016 11:55:17 +0100 (CET) Received: (qmail 98091 invoked by uid 500); 4 Nov 2016 10:55:17 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 98082 invoked by uid 99); 4 Nov 2016 10:55:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2016 10:55:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id EEF11DFE93; Fri, 4 Nov 2016 10:55:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: cschneider@apache.org To: commits@cxf.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: [CXF-7125] Expose Logging feature as DOSGi intent named logging by default Date: Fri, 4 Nov 2016 10:55:16 +0000 (UTC) archived-at: Fri, 04 Nov 2016 10:55:18 -0000 Repository: cxf Updated Branches: refs/heads/master 87f503fe2 -> 3d3e99d4e [CXF-7125] Expose Logging feature as DOSGi intent named logging by default Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3d3e99d4 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3d3e99d4 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3d3e99d4 Branch: refs/heads/master Commit: 3d3e99d4efe2185b8dc156bf65892c3aa8707133 Parents: 87f503f Author: Christian Schneider Authored: Fri Nov 4 11:55:07 2016 +0100 Committer: Christian Schneider Committed: Fri Nov 4 11:55:07 2016 +0100 ---------------------------------------------------------------------- .../apache/cxf/ext/logging/osgi/Activator.java | 37 ++++++++++++-------- 1 file changed, 23 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/3d3e99d4/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java ---------------------------------------------------------------------- diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java index 6d45a28..814de9a 100644 --- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java +++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java @@ -22,6 +22,7 @@ import java.util.Dictionary; import java.util.Hashtable; import org.apache.cxf.ext.logging.LoggingFeature; +import org.apache.cxf.feature.AbstractFeature; import org.apache.cxf.feature.Feature; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; @@ -51,6 +52,7 @@ public class Activator implements BundleActivator { private final class ConfigUpdater implements ManagedService { private BundleContext bundleContext; private ServiceRegistration serviceReg; + private ServiceRegistration intentReg; private LoggingFeature logging; ConfigUpdater(BundleContext bundleContext) { @@ -63,23 +65,30 @@ public class Activator implements BundleActivator { public void updated(Dictionary config) throws ConfigurationException { boolean enabled = Boolean.valueOf(getValue(config, "enabled", "false")); LOG.info("CXF message logging feature " + (enabled ? "enabled" : "disabled")); - if (enabled) { - Integer limit = Integer.valueOf(getValue(config, "limit", "65536")); - Boolean pretty = Boolean.valueOf(getValue(config, "pretty", "false")); - Long inMemThreshold = Long.valueOf(getValue(config, "inMemThresHold", "-1")); + Integer limit = Integer.valueOf(getValue(config, "limit", "65536")); + Boolean pretty = Boolean.valueOf(getValue(config, "pretty", "false")); + Long inMemThreshold = Long.valueOf(getValue(config, "inMemThresHold", "-1")); - if (limit != null) { - logging.setLimit(limit); - } - if (inMemThreshold != null) { - logging.setInMemThreshold(inMemThreshold); - } - if (pretty != null) { - logging.setPrettyLogging(pretty); - } + if (limit != null) { + logging.setLimit(limit); + } + if (inMemThreshold != null) { + logging.setInMemThreshold(inMemThreshold); + } + if (pretty != null) { + logging.setPrettyLogging(pretty); + } + + if (intentReg == null) { Dictionary properties = new Hashtable<>(); - properties.put("name", "logging"); + properties.put("org.apache.cxf.dosgi.IntentName", "logging"); + bundleContext.registerService(AbstractFeature.class.getName(), logging, properties); + } + + if (enabled) { if (serviceReg == null) { + Dictionary properties = new Hashtable<>(); + properties.put("name", "logging"); serviceReg = bundleContext.registerService(Feature.class.getName(), logging, properties); } } else {