aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timothyjw...@apache.org
Subject svn commit: r1209428 - in /aries/trunk/blueprint: blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java
Date Fri, 02 Dec 2011 11:56:05 GMT
Author: timothyjward
Date: Fri Dec  2 11:56:05 2011
New Revision: 1209428

URL: http://svn.apache.org/viewvc?rev=1209428&view=rev
Log:
Remove unnecessary dependency on org.apache.aries.blueprint.reflect from blueprint cm, and
clarify the behaviour of MutableServiceReferenceMetadata#setBundleContext(BundleContext)

Modified:
    aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
    aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java

Modified: aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java?rev=1209428&r1=1209427&r2=1209428&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
(original)
+++ aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
Fri Dec  2 11:56:05 2011
@@ -45,7 +45,6 @@ import org.apache.aries.blueprint.mutabl
 import org.apache.aries.blueprint.mutable.MutableRefMetadata;
 import org.apache.aries.blueprint.mutable.MutableReferenceMetadata;
 import org.apache.aries.blueprint.mutable.MutableValueMetadata;
-import org.apache.aries.blueprint.reflect.PassThroughMetadataImpl;
 import org.apache.aries.blueprint.utils.ServiceListener;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.blueprint.container.ComponentDefinitionException;
@@ -483,7 +482,7 @@ public class CmNamespaceHandler implemen
     }
     
     private MutableReferenceMetadata createConfigurationAdminRef(ParserContext context) {
-        return createServiceRef(getBlueprintBundleContext(context), context, ConfigurationAdmin.class,
"(objectClass=" + ConfigurationAdmin.class.getName() + ")");
+        return createServiceRef(context, ConfigurationAdmin.class, "(objectClass=" + ConfigurationAdmin.class.getName()
+ ")");
     }
     
     private static ValueMetadata createValue(ParserContext context, String value) {
@@ -503,11 +502,10 @@ public class CmNamespaceHandler implemen
         return m;
     }
     
-    private MutableReferenceMetadata createServiceRef(BundleContext ctx, ParserContext context,
Class<?> cls, String filter) {
+    private MutableReferenceMetadata createServiceRef(ParserContext context, Class<?>
cls, String filter) {
         MutableReferenceMetadata m = context.createMetadata(MutableReferenceMetadata.class);
         m.setRuntimeInterface(cls);
         m.setInterface(cls.getName());
-        m.setBundleContext(ctx);
         m.setActivation(ReferenceMetadata.ACTIVATION_EAGER);
         m.setAvailability(ReferenceMetadata.AVAILABILITY_MANDATORY);
         
@@ -596,25 +594,4 @@ public class CmNamespaceHandler implemen
         }
         return interfaceNames;
     }
-
-    /**
-     * Returns the bundle context within the parser context
-     * 
-     * @param parserContext the parser context
-     * @return the bundle context within the parser context (if it exists)
-     */
-    private BundleContext getBlueprintBundleContext(ParserContext parserContext)
-    {
-        BundleContext blueprintContext = null;
-        
-        if (parserContext != null) {
-            ComponentMetadata metaData = parserContext.getComponentDefinitionRegistry().getComponentDefinition("blueprintBundleContext");
-            
-            if (metaData != null) {
-                blueprintContext = (BundleContext)((PassThroughMetadataImpl)metaData).getObject();
  
-            }   
-        }
-        
-        return blueprintContext;
-    }
 }

Modified: aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java?rev=1209428&r1=1209427&r2=1209428&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java
(original)
+++ aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java
Fri Dec  2 11:56:05 2011
@@ -50,5 +50,11 @@ public interface MutableServiceReference
 
     void setRuntimeInterface(Class clazz);
     
+    /**
+     * Used to set a {@link BundleContext} for this reference lookup. If this
+     * is set to null (or left unset) then the bundle context of the blueprint
+     * bundle will be used (normal behaviour)
+     * @param bc
+     */
     void setBundleContext(BundleContext bc);
 }



Mime
View raw message