geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r797095 - in /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container: AbstractServiceReferenceRecipe.java RecipeBuilder.java ServiceListener.java
Date Thu, 23 Jul 2009 15:06:40 GMT
Author: gawor
Date: Thu Jul 23 15:06:39 2009
New Revision: 797095

URL: http://svn.apache.org/viewvc?rev=797095&view=rev
Log:
more security related updates

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RecipeBuilder.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceListener.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java?rev=797095&r1=797094&r2=797095&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java
Thu Jul 23 15:06:39 2009
@@ -360,10 +360,9 @@
 
         private static final Logger LOGGER = LoggerFactory.getLogger(Listener.class);
 
-        /* Inject by ObjectRecipe */
         private Object listener;
-        /* Inject by ObjectRecipe */
         private ReferenceListener metadata;
+        private ExtendedBlueprintContainer blueprintContainer;
 
         private Set<Method> bindMethodsReference = new HashSet<Method>();
         private Set<Method> bindMethodsObjectProp = new HashSet<Method>();
@@ -380,6 +379,10 @@
             this.metadata = metadata;
         }
 
+        public void setBlueprintContainer(ExtendedBlueprintContainer blueprintContainer)
{
+            this.blueprintContainer = blueprintContainer;
+        }
+        
         public void init(Collection<Class> classes) {
             Set<Class> clazzes = new HashSet<Class>(classes);
             clazzes.add(Object.class);
@@ -419,14 +422,16 @@
         private void invokeMethods(Set<Method> referenceMethods, Set<Method>
objectMethods, Set<Method> objectPropMethods, ServiceReference reference, Object service)
{
             for (Method method : referenceMethods) {
                 try {
-                    method.invoke(listener, reference);
+                    ReflectionUtils.invoke(blueprintContainer.getAccessControlContext(),

+                                           method, listener, reference);
                 } catch (Exception e) {
                     LOGGER.info("Error calling listener method " + method, e);
                 }
             }
             for (Method method : objectMethods) {
                 try {
-                    method.invoke(listener, service);
+                    ReflectionUtils.invoke(blueprintContainer.getAccessControlContext(),

+                                           method, listener, service);
                 } catch (Exception e) {
                     LOGGER.info("Error calling listener method " + method, e);
                 }
@@ -442,7 +447,8 @@
                     }
                 }
                 try {
-                    method.invoke(listener, service, props);
+                    ReflectionUtils.invoke(blueprintContainer.getAccessControlContext(),

+                                           method, listener, service, props);
                 } catch (Exception e) {
                     LOGGER.info("Error calling listener method " + method, e);
                 }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RecipeBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RecipeBuilder.java?rev=797095&r1=797094&r2=797095&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RecipeBuilder.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RecipeBuilder.java
Thu Jul 23 15:06:39 2009
@@ -247,6 +247,7 @@
         if (listener.getUnregistrationMethod() != null) {
             recipe.setProperty("unregisterMethod", listener.getUnregistrationMethod());
         }
+        recipe.setProperty("blueprintContainer", blueprintContainer);
         return recipe;
     }
 
@@ -254,6 +255,7 @@
         BeanRecipe recipe = new BeanRecipe(getName(null), blueprintContainer, AbstractServiceReferenceRecipe.Listener.class);
         recipe.setProperty("listener", getValue(listener.getListenerComponent(), null));
         recipe.setProperty("metadata", listener);
+        recipe.setProperty("blueprintContainer", blueprintContainer);
         return recipe;
     }
 

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceListener.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceListener.java?rev=797095&r1=797094&r2=797095&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceListener.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceListener.java
Thu Jul 23 15:06:39 2009
@@ -20,6 +20,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.geronimo.blueprint.ExtendedBlueprintContainer;
 import org.apache.geronimo.blueprint.utils.ReflectionUtils;
 import org.osgi.service.blueprint.container.ComponentDefinitionException;
 import org.slf4j.Logger;
@@ -32,6 +33,7 @@
     private Object listener;
     private String registerMethod;
     private String unregisterMethod;
+    private ExtendedBlueprintContainer blueprintContainer;
 
     private List<Method> registerMethods;
     private List<Method> unregisterMethods;
@@ -49,6 +51,10 @@
         this.unregisterMethod = method;
     }
     
+    public void setBlueprintContainer(ExtendedBlueprintContainer blueprintContainer) {
+        this.blueprintContainer = blueprintContainer;
+    }
+    
     public void register(Object service, Map properties) {
         init(service);
         invokeMethod(registerMethods, service, properties);
@@ -87,10 +93,10 @@
         if (methods == null || methods.isEmpty()) {
             return;
         }
-        Object[] args = new Object[] { service, properties };
         for (Method method : methods) {
             try {
-                method.invoke(listener, args);
+                ReflectionUtils.invoke(blueprintContainer.getAccessControlContext(), 
+                                       method, listener, service, properties);
             } catch (Exception e) {
                 LOGGER.info("Error calling listener method " + method, e);
             }



Mime
View raw message