karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [17/50] [abbrv] karaf git commit: [KARAF-4547] Use a correct logger for the resolver so that it delegates to pax-logging instead of writing to stdout
Date Mon, 22 Aug 2016 09:30:15 GMT
[KARAF-4547] Use a correct logger for the resolver so that it delegates to pax-logging instead
of writing to stdout

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/92b2f066
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/92b2f066
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/92b2f066

Branch: refs/heads/master
Commit: 92b2f06650628073e171a8e3b5796f4515159344
Parents: 89d1abd
Author: Guillaume Nodet <gnodet@apache.org>
Authored: Mon Jul 25 18:35:15 2016 +0200
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Mon Aug 22 11:29:19 2016 +0200

----------------------------------------------------------------------
 .../karaf/features/internal/osgi/Activator.java |  8 ++--
 .../internal/resolver/Slf4jResolverLog.java     | 49 ++++++++++++++++++++
 .../karaf/features/FeaturesServiceTest.java     |  1 +
 .../apache/karaf/features/Slf4jResolverLog.java | 49 --------------------
 .../region/FeaturesDependenciesTest.java        |  2 +-
 .../features/internal/region/SubsystemTest.java |  2 +-
 .../features/internal/service/DeployerTest.java |  2 +-
 .../service/FeaturesServiceImplTest.java        |  2 +-
 8 files changed, 57 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/92b2f066/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
b/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
index d80a90b..d18e881 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
@@ -29,7 +29,6 @@ import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.felix.resolver.Logger;
 import org.apache.felix.resolver.ResolverImpl;
 import org.apache.felix.utils.properties.Properties;
 import org.apache.karaf.features.FeaturesListener;
@@ -39,6 +38,7 @@ import org.apache.karaf.features.internal.region.DigraphHelper;
 import org.apache.karaf.features.internal.repository.AggregateRepository;
 import org.apache.karaf.features.internal.repository.JsonRepository;
 import org.apache.karaf.features.internal.repository.XmlRepository;
+import org.apache.karaf.features.internal.resolver.Slf4jResolverLog;
 import org.apache.karaf.features.internal.service.BootFeaturesInstaller;
 import org.apache.karaf.features.internal.service.EventAdminListener;
 import org.apache.karaf.features.internal.service.FeatureFinder;
@@ -63,6 +63,7 @@ import org.osgi.service.resolver.Resolver;
 import org.osgi.service.url.URLStreamHandlerService;
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.slf4j.LoggerFactory;
 
 @Services(
     requires = {
@@ -114,16 +115,13 @@ public class Activator extends BaseActivator {
 
     protected void doStart() throws Exception {
         ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
-        Resolver resolver = new ResolverImpl(new Logger(Logger.LOG_INFO));
+        Resolver resolver = new ResolverImpl(new Slf4jResolverLog(LoggerFactory.getLogger(ResolverImpl.class)));
         URLStreamHandlerService mvnUrlHandler = getTrackedService(URLStreamHandlerService.class);
 
         if (configurationAdmin == null || mvnUrlHandler == null) {
             return;
         }
 
-        // Resolver
-//        register(Resolver.class, new ResolverImpl(new Slf4jResolverLog(LoggerFactory.getLogger(ResolverImpl.class))));
-
         // RegionDigraph
         digraph = DigraphHelper.loadDigraph(bundleContext);
         register(ResolverHookFactory.class, digraph.getResolverHookFactory());

http://git-wip-us.apache.org/repos/asf/karaf/blob/92b2f066/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
new file mode 100644
index 0000000..f11d144
--- /dev/null
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.features.internal.resolver;
+
+import org.slf4j.Logger;
+
+/**
+ */
+public class Slf4jResolverLog extends org.apache.felix.resolver.Logger {
+
+    private final Logger logger;
+
+    public Slf4jResolverLog(Logger logger) {
+        super(LOG_DEBUG);
+        this.logger = logger;
+    }
+
+    @Override
+    protected void doLog(int level, String msg, Throwable throwable) {
+        switch (level) {
+            case LOG_ERROR:
+                logger.error(msg, throwable);
+                break;
+            case LOG_WARNING:
+                logger.warn(msg, throwable);
+                break;
+            case LOG_INFO:
+                logger.info(msg, throwable);
+                break;
+            default:
+                logger.debug(msg, throwable);
+                break;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf/blob/92b2f066/features/core/src/test/java/org/apache/karaf/features/FeaturesServiceTest.java
----------------------------------------------------------------------
diff --git a/features/core/src/test/java/org/apache/karaf/features/FeaturesServiceTest.java
b/features/core/src/test/java/org/apache/karaf/features/FeaturesServiceTest.java
index 0571bae..2b3d846 100644
--- a/features/core/src/test/java/org/apache/karaf/features/FeaturesServiceTest.java
+++ b/features/core/src/test/java/org/apache/karaf/features/FeaturesServiceTest.java
@@ -30,6 +30,7 @@ import java.util.List;
 import java.util.concurrent.CopyOnWriteArraySet;
 
 import org.apache.felix.resolver.ResolverImpl;
+import org.apache.karaf.features.internal.resolver.Slf4jResolverLog;
 import org.apache.karaf.features.internal.service.FeaturesServiceImpl;
 import org.apache.karaf.features.internal.service.StateStorage;
 import org.easymock.EasyMock;

http://git-wip-us.apache.org/repos/asf/karaf/blob/92b2f066/features/core/src/test/java/org/apache/karaf/features/Slf4jResolverLog.java
----------------------------------------------------------------------
diff --git a/features/core/src/test/java/org/apache/karaf/features/Slf4jResolverLog.java b/features/core/src/test/java/org/apache/karaf/features/Slf4jResolverLog.java
deleted file mode 100644
index 1b6d4bd..0000000
--- a/features/core/src/test/java/org/apache/karaf/features/Slf4jResolverLog.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features;
-
-import org.slf4j.Logger;
-
-/**
- */
-public class Slf4jResolverLog extends org.apache.felix.resolver.Logger {
-
-    private final Logger logger;
-
-    public Slf4jResolverLog(Logger logger) {
-        super(LOG_DEBUG);
-        this.logger = logger;
-    }
-
-    @Override
-    protected void doLog(int level, String msg, Throwable throwable) {
-        switch (level) {
-        case LOG_ERROR:
-            logger.error(msg, throwable);
-            break;
-        case LOG_WARNING:
-            logger.warn(msg, throwable);
-            break;
-        case LOG_INFO:
-            logger.info(msg, throwable);
-            break;
-        default:
-            logger.debug(msg, throwable);
-            break;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/92b2f066/features/core/src/test/java/org/apache/karaf/features/internal/region/FeaturesDependenciesTest.java
----------------------------------------------------------------------
diff --git a/features/core/src/test/java/org/apache/karaf/features/internal/region/FeaturesDependenciesTest.java
b/features/core/src/test/java/org/apache/karaf/features/internal/region/FeaturesDependenciesTest.java
index db990bd..c5bdfe0 100644
--- a/features/core/src/test/java/org/apache/karaf/features/internal/region/FeaturesDependenciesTest.java
+++ b/features/core/src/test/java/org/apache/karaf/features/internal/region/FeaturesDependenciesTest.java
@@ -27,7 +27,7 @@ import java.util.Set;
 
 import org.apache.felix.resolver.ResolverImpl;
 import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Slf4jResolverLog;
+import org.apache.karaf.features.internal.resolver.Slf4jResolverLog;
 import org.apache.karaf.features.internal.service.RepositoryImpl;
 import org.apache.karaf.features.internal.support.TestDownloadManager;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/karaf/blob/92b2f066/features/core/src/test/java/org/apache/karaf/features/internal/region/SubsystemTest.java
----------------------------------------------------------------------
diff --git a/features/core/src/test/java/org/apache/karaf/features/internal/region/SubsystemTest.java
b/features/core/src/test/java/org/apache/karaf/features/internal/region/SubsystemTest.java
index ec35104..cc113eb 100644
--- a/features/core/src/test/java/org/apache/karaf/features/internal/region/SubsystemTest.java
+++ b/features/core/src/test/java/org/apache/karaf/features/internal/region/SubsystemTest.java
@@ -27,7 +27,7 @@ import java.util.Set;
 
 import org.apache.felix.resolver.ResolverImpl;
 import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Slf4jResolverLog;
+import org.apache.karaf.features.internal.resolver.Slf4jResolverLog;
 import org.apache.karaf.features.internal.service.RepositoryImpl;
 import org.apache.karaf.features.internal.support.TestDownloadManager;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/karaf/blob/92b2f066/features/core/src/test/java/org/apache/karaf/features/internal/service/DeployerTest.java
----------------------------------------------------------------------
diff --git a/features/core/src/test/java/org/apache/karaf/features/internal/service/DeployerTest.java
b/features/core/src/test/java/org/apache/karaf/features/internal/service/DeployerTest.java
index 3bbed89..88913c4 100644
--- a/features/core/src/test/java/org/apache/karaf/features/internal/service/DeployerTest.java
+++ b/features/core/src/test/java/org/apache/karaf/features/internal/service/DeployerTest.java
@@ -33,7 +33,7 @@ import org.apache.felix.utils.version.VersionRange;
 import org.apache.karaf.features.Feature;
 import org.apache.karaf.features.FeatureEvent;
 import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Slf4jResolverLog;
+import org.apache.karaf.features.internal.resolver.Slf4jResolverLog;
 import org.apache.karaf.features.internal.support.TestBundle;
 import org.apache.karaf.features.internal.support.TestDownloadManager;
 import org.easymock.EasyMock;

http://git-wip-us.apache.org/repos/asf/karaf/blob/92b2f066/features/core/src/test/java/org/apache/karaf/features/internal/service/FeaturesServiceImplTest.java
----------------------------------------------------------------------
diff --git a/features/core/src/test/java/org/apache/karaf/features/internal/service/FeaturesServiceImplTest.java
b/features/core/src/test/java/org/apache/karaf/features/internal/service/FeaturesServiceImplTest.java
index cc51375..a549046 100644
--- a/features/core/src/test/java/org/apache/karaf/features/internal/service/FeaturesServiceImplTest.java
+++ b/features/core/src/test/java/org/apache/karaf/features/internal/service/FeaturesServiceImplTest.java
@@ -25,7 +25,7 @@ import java.util.Map;
 import org.apache.felix.resolver.ResolverImpl;
 import org.apache.karaf.features.Feature;
 import org.apache.karaf.features.TestBase;
-import org.apache.karaf.features.Slf4jResolverLog;
+import org.apache.karaf.features.internal.resolver.Slf4jResolverLog;
 import org.junit.Before;
 import org.junit.Test;
 import org.osgi.service.resolver.Resolver;


Mime
View raw message