You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by cs...@apache.org on 2016/11/04 10:55:16 UTC
cxf git commit: [CXF-7125] Expose Logging feature as DOSGi intent
named logging by default
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 <ch...@die-schneider.net>
Authored: Fri Nov 4 11:55:07 2016 +0100
Committer: Christian Schneider <ch...@die-schneider.net>
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<String, Object> 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<String, Object> properties = new Hashtable<>();
+ properties.put("name", "logging");
serviceReg = bundleContext.registerService(Feature.class.getName(), logging, properties);
}
} else {