felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1781361 - in /felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject: ClassUtils.java ValueUtils.java methods/BindMethod.java
Date Thu, 02 Feb 2017 09:40:10 GMT
Author: cziegeler
Date: Thu Feb  2 09:40:10 2017
New Revision: 1781361

URL: http://svn.apache.org/viewvc?rev=1781361&view=rev
Log:
FELIX--5457 : Logger Support. Support bind/unbind methods

Modified:
    felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/ClassUtils.java
    felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/ValueUtils.java
    felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/methods/BindMethod.java

Modified: felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/ClassUtils.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/ClassUtils.java?rev=1781361&r1=1781360&r2=1781361&view=diff
==============================================================================
--- felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/ClassUtils.java
(original)
+++ felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/ClassUtils.java
Thu Feb  2 09:40:10 2017
@@ -58,6 +58,10 @@ public class ClassUtils
     public static final Class<?> BUNDLE_CONTEXT_CLASS = BundleContext.class;
     public static final Class<?> INTEGER_CLASS = Integer.class;
 
+    public static final String LOGGER_CLASS = "org.osgi.service.log.Logger";
+    public static final String FORMATTER_LOGGER_CLASS = "org.osgi.service.log.FormatterLogger";
+    public static final String LOGGER_FACTORY_CLASS = "org.osgi.service.log.LoggerFactory";
+
 
     // this bundle's context
     private static BundleContext m_context;

Modified: felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/ValueUtils.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/ValueUtils.java?rev=1781361&r1=1781360&r2=1781361&view=diff
==============================================================================
--- felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/ValueUtils.java
(original)
+++ felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/ValueUtils.java
Thu Feb  2 09:40:10 2017
@@ -37,10 +37,6 @@ import org.osgi.service.log.LogService;
  */
 public class ValueUtils {
 
-    private static final String LOGGER_CLASS = "org.osgi.service.log.Logger";
-    private static final String FORMATTER_LOGGER_CLASS = "org.osgi.service.log.FormatterLogger";
-    private static final String LOGGER_FACTORY_CLASS = "org.osgi.service.log.LoggerFactory";
-
     /**
      * The value type of the field, activation field or constructor parameter
      */
@@ -141,12 +137,12 @@ public class ValueUtils {
                 valueType = ValueType.ref_tuple;
             }
             // 1.4: Logger - reference needs to be of type LoggerFactory
-            else if ( typeClass.getName().equals(LOGGER_CLASS) && metadata.getInterface().equals(LOGGER_FACTORY_CLASS)
)
+            else if ( typeClass.getName().equals(ClassUtils.LOGGER_CLASS) && metadata.getInterface().equals(ClassUtils.LOGGER_FACTORY_CLASS)
)
             {
                 return ValueType.ref_logger;
             }
             // 1.4: FormatterLogger - reference needs to be of type LoggerFactory
-            else if ( typeClass.getName().equals(FORMATTER_LOGGER_CLASS) && metadata.getInterface().equals(LOGGER_FACTORY_CLASS)
)
+            else if ( typeClass.getName().equals(ClassUtils.FORMATTER_LOGGER_CLASS) &&
metadata.getInterface().equals(ClassUtils.LOGGER_FACTORY_CLASS) )
             {
                 return ValueType.ref_formatterLogger;
             }

Modified: felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/methods/BindMethod.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/methods/BindMethod.java?rev=1781361&r1=1781360&r2=1781361&view=diff
==============================================================================
--- felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/methods/BindMethod.java
(original)
+++ felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/inject/methods/BindMethod.java
Thu Feb  2 09:40:10 2017
@@ -24,7 +24,6 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.felix.scr.impl.helper.SimpleLogger;
 import org.apache.felix.scr.impl.inject.BindParameters;
@@ -302,9 +301,9 @@ implements org.apache.felix.scr.impl.inj
                                     paramTypes.add(ValueUtils.ValueType.ref_serviceObjects);
                                 }
                             }
-                            else if (paramType == Map.class)
+                            else if (paramType == ClassUtils.MAP_CLASS)
                             {
-                                if (specialMatch && parameterClass == Map.class)
+                                if (specialMatch && parameterClass == ClassUtils.MAP_CLASS)
                                 {
                                     specialMatch = false;
                                     paramTypes.add(ValueUtils.ValueType.ref_serviceType);
@@ -318,6 +317,23 @@ implements org.apache.felix.scr.impl.inj
                             {
                                 paramTypes.add(ValueUtils.ValueType.ref_serviceType);
                             }
+                            // DS 1.4 : Logger and FormattedLogger
+                            else if ( getDSVersion().isDS14() && ClassUtils.LOGGER_FACTORY_CLASS.equals(m_referenceClassName)
)
+                            {
+                                 if ( paramType.getName().equals(ClassUtils.LOGGER_CLASS)
)
+                                 {
+                                     paramTypes.add(ValueUtils.ValueType.ref_logger);
+                                 }
+                                 else if ( paramType.getName().equals(ClassUtils.FORMATTER_LOGGER_CLASS)
)
+                                 {
+                                     paramTypes.add(ValueUtils.ValueType.ref_formatterLogger);
+                                 }
+                                 else
+                                 {
+                                     matches = false;
+                                     break;
+                                 }
+                            }
                             else
                             {
                                 matches = false;



Mime
View raw message