You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2009/04/20 06:27:19 UTC

svn commit: r766569 - in /geronimo/sandbox/blueprint: ./ blueprint-core/src/main/java/org/apache/geronimo/blueprint/ blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ blueprint-core/src/test/java/org/apache/geronimo/blueprint/

Author: gawor
Date: Mon Apr 20 04:27:18 2009
New Revision: 766569

URL: http://svn.apache.org/viewvc?rev=766569&view=rev
Log:
add support for bundle scope for services

Added:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java   (with props)
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ScopedRepository.java   (with props)
Modified:
    geronimo/sandbox/blueprint/README
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BlueprintConstants.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ModuleContextImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java
    geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java

Modified: geronimo/sandbox/blueprint/README
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/README?rev=766569&r1=766568&r2=766569&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/README (original)
+++ geronimo/sandbox/blueprint/README Mon Apr 20 04:27:18 2009
@@ -11,6 +11,7 @@
   d) install http://www.springsource.com/repository/app/bundle/version/download?name=com.springsource.org.objectweb.asm&version=3.1.0&type=binary
   e) install http://www.springsource.com/repository/app/bundle/version/download?name=com.springsource.org.objectweb.asm.tree&version=3.1.0&type=binary
   f) install http://www.springsource.com/repository/app/bundle/version/download?name=com.springsource.org.objectweb.asm.commons&version=3.1.0&type=binary
+  g) install http://www.springsource.com/repository/app/bundle/version/download?name=com.springsource.net.sf.cglib&version=2.1.3&type=binary
 
 3) Install EventAdmin service and dependencies
 
@@ -18,12 +19,12 @@
 
 4) Build the blueprint project and install the extender and sample bundles:
 
-  a) install file://<m2_repo>/org/apache/felix/blueprint-api/1.0.0-SNAPSHOT/blueprint-api-1.0.0-SNAPSHOT.jar
-  b) install file://<m2_repo>/org/apache/felix/org.apache.geronimo.blueprint/1.0.0-SNAPSHOT/org.apache.geronimo.blueprint-1.0.0-SNAPSHOT.jar
-  c) install file://<m2_repo>/org/apache/felix/sample/1.0.0-SNAPSHOT/sample-1.0.0-SNAPSHOT.jar
+  a) install file://<m2_repo>/org/apache/geronimo/blueprint-api/1.0.0-SNAPSHOT/blueprint-api-1.0.0-SNAPSHOT.jar
+  b) install file://<m2_repo>/org/apache/geronimo/blueprint-core/1.0.0-SNAPSHOT/blueprint-core-1.0.0-SNAPSHOT.jar
+  c) install file://<m2_repo>/org/apache/geronimo/blueprint-sample/1.0.0-SNAPSHOT/blueprint-sample-1.0.0-SNAPSHOT.jar
 
 5) Start the extender and sample bundles:
 
-  a) start <bundle id for extender bundle>
+  a) start <bundle id for core bundle>
   b) start <bundle id for sample bundle>
 

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BlueprintConstants.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BlueprintConstants.java?rev=766569&r1=766568&r2=766569&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BlueprintConstants.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BlueprintConstants.java Mon Apr 20 04:27:18 2009
@@ -32,4 +32,8 @@
     
     public static final String COMPONENT_NAME_PROPERTY = "osgi.service.blueprint.compname";
     
+    public static final String CONTEXT_SYMBOLIC_NAME_PROPERTY = "osgi.blueprint.context.symbolicname";
+    
+    public static final String CONTEXT_VERSION_PROPERTY = "osgi.blueprint.context.version";
+    
 }

Added: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java?rev=766569&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java (added)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java Mon Apr 20 04:27:18 2009
@@ -0,0 +1,119 @@
+/**
+ * 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.geronimo.blueprint.context;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.xbean.recipe.ObjectGraph;
+import org.apache.xbean.recipe.ObjectRecipe;
+import org.apache.xbean.recipe.Recipe;
+import org.apache.xbean.recipe.Repository;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/** 
+ * TODO: javadoc
+ */
+public class BundleScopeServiceFactory implements ServiceFactory {
+
+    private ModuleContextImpl moduleContext;
+    private Recipe serviceRecipe;
+    private Map<Bundle, Entry> instanceMap = Collections.synchronizedMap(new HashMap<Bundle, Entry>()); 
+    
+    public BundleScopeServiceFactory(ModuleContextImpl moduleContext, Recipe serviceRecipe) {
+        this.moduleContext = moduleContext;
+        this.serviceRecipe = serviceRecipe;
+    }
+    
+    public Object getService(Bundle bundle, ServiceRegistration registration) {
+        Entry entry;
+        synchronized(bundle) {        
+            entry = instanceMap.get(bundle);
+            if (entry == null) {
+                entry = new Entry(createInstance());
+                System.out.println("Created service instance for bundle: " + bundle + " " + entry.getServiceInstance().hashCode());
+                instanceMap.put(bundle, entry);                
+            }       
+            entry.addServiceRegistration(registration);
+        }
+        return entry.getServiceInstance();
+    }
+
+    public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+        synchronized(bundle) {        
+            Entry entry = instanceMap.get(bundle);
+            if (entry != null) {
+                entry.removeServiceRegistration(registration);
+                if (!entry.hasServiceRegistrations()) {
+                    destroyInstance(entry.getServiceInstance());
+                    System.out.println("Destroyed service instance for bundle: " + bundle);
+                    instanceMap.remove(bundle);
+                }
+            }
+        }
+    }
+  
+    private Object createInstance() {
+        Repository objectRepository = moduleContext.getObjectGraph().getRepository();
+        ScopedRepository repository = new ScopedRepository((ScopedRepository)objectRepository);
+        repository.set(serviceRecipe.getName(), serviceRecipe);
+        ObjectGraph graph = new ObjectGraph(repository);
+        return graph.create(serviceRecipe.getName());
+    }
+    
+    private void destroyInstance(Object instance) {
+        // TODO: call destroy method if any
+    }
+    
+    protected Class getServiceClass() {
+        return ((ObjectRecipe) serviceRecipe).getType();
+    }
+    
+    private static class Entry {
+        Object serviceInstance;
+        Set<ServiceRegistration> registrations = new HashSet<ServiceRegistration>();
+        
+        public Entry(Object serviceInstance) {
+            this.serviceInstance = serviceInstance;
+        }
+        
+        public Object getServiceInstance() {
+            return this.serviceInstance;
+        }
+        
+        public boolean hasServiceRegistrations() {
+            return !registrations.isEmpty();
+        }
+        
+        public void addServiceRegistration(ServiceRegistration registration) {
+            registrations.add(registration);
+        }
+        
+        public void removeServiceRegistration(ServiceRegistration registration) {
+            registrations.remove(registration);
+        }
+        
+    }
+    
+}

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java?rev=766569&r1=766568&r2=766569&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java Mon Apr 20 04:27:18 2009
@@ -39,6 +39,7 @@
 import org.apache.xbean.recipe.ReferenceRecipe;
 import org.apache.xbean.recipe.Repository;
 import org.osgi.service.blueprint.convert.ConversionService;
+import org.osgi.service.blueprint.namespace.ComponentDefinitionRegistry;
 import org.osgi.service.blueprint.reflect.ArrayValue;
 import org.osgi.service.blueprint.reflect.ComponentMetadata;
 import org.osgi.service.blueprint.reflect.ComponentValue;
@@ -96,8 +97,9 @@
         }
     }
     
-    public Repository createRepository(ComponentDefinitionRegistryImpl registry) throws Exception {
-        Repository repository = new DefaultRepository();
+    public Repository createRepository() throws Exception {
+        ComponentDefinitionRegistryImpl registry = (ComponentDefinitionRegistryImpl)getComponentDefinitionRegistry();
+        Repository repository = new ScopedRepository();
         addBuiltinComponents(repository);
         
         // Create type-converter recipes
@@ -146,7 +148,13 @@
             recipe.allow(Option.PRIVATE_PROPERTIES);
             recipe.setName(component.getName());
             recipe.setProperty("moduleContext", moduleContext);
-            recipe.setProperty("service", getValue(serviceExport.getExportedComponent(), null));   
+            LocalComponentMetadata exportedComponent = getServiceComponent(serviceExport.getExportedComponent());
+            if (LocalComponentMetadata.SCOPE_BUNDLE.equals(exportedComponent.getScope())) {
+                Recipe exportedComponentRecipe = createRecipe(exportedComponent);
+                recipe.setProperty("service", new BundleScopeServiceFactory(moduleContext, exportedComponentRecipe));
+            } else {
+                recipe.setProperty("service", getValue(serviceExport.getExportedComponent(), null));
+            }
             recipe.setProperty("metadata", component);
             if (component instanceof ServiceExportComponentMetadataImpl) {
                 ServiceExportComponentMetadataImpl impl = (ServiceExportComponentMetadataImpl) component;
@@ -181,6 +189,19 @@
         return recipe;
     }
     
+    private LocalComponentMetadata getServiceComponent(Value value) throws Exception {
+        if (value instanceof ReferenceValue) {
+            ReferenceValue ref = (ReferenceValue) value;
+            ComponentDefinitionRegistry registry = getComponentDefinitionRegistry();
+            return (LocalComponentMetadata) registry.getComponentDefinition(ref.getComponentName());
+        } else if (value instanceof ComponentValue) {
+            ComponentValue comp = (ComponentValue) value;
+            return (LocalComponentMetadata) comp.getComponentMetadata();
+        } else {
+            throw new RuntimeException("Unexpected component value: " + value);
+        }
+    }
+    
     private Object getValue(Value v, Class groupingType) throws Exception {
         if (v instanceof NullValue) {
             return null;
@@ -238,6 +259,10 @@
         }
     }
     
+    protected ComponentDefinitionRegistry getComponentDefinitionRegistry() {
+        return moduleContext.getComponentDefinitionRegistry();
+    }
+    
     protected ConversionService getConversionService() {
         return moduleContext.getConversionService();
     }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ModuleContextImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ModuleContextImpl.java?rev=766569&r1=766568&r2=766569&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ModuleContextImpl.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ModuleContextImpl.java Mon Apr 20 04:27:18 2009
@@ -23,7 +23,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Dictionary;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -46,13 +45,11 @@
 import org.osgi.service.blueprint.context.NoSuchComponentException;
 import org.osgi.service.blueprint.convert.ConversionService;
 import org.osgi.service.blueprint.convert.Converter;
+import org.osgi.service.blueprint.namespace.ComponentDefinitionRegistry;
 import org.osgi.service.blueprint.reflect.ComponentMetadata;
-import org.osgi.service.blueprint.reflect.ComponentValue;
 import org.osgi.service.blueprint.reflect.LocalComponentMetadata;
-import org.osgi.service.blueprint.reflect.ReferenceValue;
 import org.osgi.service.blueprint.reflect.ServiceExportComponentMetadata;
 import org.osgi.service.blueprint.reflect.ServiceReferenceComponentMetadata;
-import org.osgi.service.blueprint.reflect.Value;
 
 /**
  * TODO: javadoc
@@ -68,7 +65,7 @@
     private final List<URL> urls;
     private final ComponentDefinitionRegistryImpl componentDefinitionRegistry;
     private final ConversionServiceImpl conversionService;
-    private Map<String, Object> instances;
+    private ObjectGraph objectGraph;
     private ServiceRegistration registration;
 
     public ModuleContextImpl(BundleContext bundleContext, ModuleContextEventSender sender, NamespaceHandlerRegistry handlers, List<URL> urls) {
@@ -105,21 +102,23 @@
             Parser parser = new Parser(handlers, componentDefinitionRegistry, urls);
             parser.parse();
             Instanciator i = new Instanciator(this);
-            Repository repository = i.createRepository(componentDefinitionRegistry);
-            ObjectGraph graph = new ObjectGraph(repository);
+            Repository repository = i.createRepository();
+            objectGraph = new ObjectGraph(repository);
 
-            registerTypeConverters(graph);
+            registerTypeConverters();
 
             // TODO: handle scopes and such
-            instances = graph.createAll(new ArrayList<String>(componentDefinitionRegistry.getComponentDefinitionNames()));
+            Map instances = objectGraph.createAll(new ArrayList<String>(componentDefinitionRegistry.getComponentDefinitionNames()));
             System.out.println(instances);
 
             registerAllServices();
             
             // Register the ModuleContext in the OSGi registry
             Properties props = new Properties();
-            props.put("osgi.blueprint.context.symbolicname", bundleContext.getBundle().getSymbolicName());
-            props.put("osgi.blueprint.context.version", bundleContext.getBundle().getHeaders().get(Constants.BUNDLE_VERSION));
+            props.put(BlueprintConstants.CONTEXT_SYMBOLIC_NAME_PROPERTY, 
+                      bundleContext.getBundle().getSymbolicName());
+            props.put(BlueprintConstants.CONTEXT_VERSION_PROPERTY, 
+                      bundleContext.getBundle().getHeaders().get(Constants.BUNDLE_VERSION));
             registration = bundleContext.registerService(ModuleContext.class.getName(), this, props);
 
             sender.sendCreated(this);
@@ -133,9 +132,9 @@
         }
     }
 
-    private void registerTypeConverters(ObjectGraph graph) {
+    private void registerTypeConverters() {
         List<String> typeConvertersNames = componentDefinitionRegistry.getTypeConverterNames();
-        Map<String, Object> typeConverters = graph.createAll(typeConvertersNames);
+        Map<String, Object> typeConverters = objectGraph.createAll(typeConvertersNames);
         System.out.println(typeConverters);
         for (String name : typeConvertersNames) {
             Object typeConverterInstance = typeConverters.get(name);
@@ -171,8 +170,7 @@
         if (metadata == null) {
             throw new NoSuchComponentException(name);
         }
-        // TODO: handle scopes and such
-        return instances.get(name);
+        return objectGraph.create(name);
     }
 
     public ComponentMetadata getComponentMetadata(String name) {
@@ -208,7 +206,15 @@
 
     }
 
-    public ConversionService getConversionService() {
+    protected ObjectGraph getObjectGraph() {
+        return objectGraph;
+    }
+    
+    protected ComponentDefinitionRegistry getComponentDefinitionRegistry() {
+        return componentDefinitionRegistry;
+    }
+    
+    protected ConversionService getConversionService() {
         return conversionService;
     }
     

Added: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ScopedRepository.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ScopedRepository.java?rev=766569&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ScopedRepository.java (added)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ScopedRepository.java Mon Apr 20 04:27:18 2009
@@ -0,0 +1,57 @@
+/**
+ *
+ * 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.geronimo.blueprint.context;
+
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.apache.xbean.recipe.ConstructionException;
+import org.apache.xbean.recipe.Recipe;
+import org.apache.xbean.recipe.Repository;
+
+public class ScopedRepository implements Repository {
+
+    private SortedMap<String, Object> instances;
+
+    public ScopedRepository() {
+        instances = new TreeMap<String, Object>();
+    }
+    
+    public ScopedRepository(ScopedRepository source) {
+        instances = new TreeMap<String, Object>(source.instances);
+    }
+    
+    public void set(String name, Object instance) {
+        instances.put(name, instance);
+    }
+    
+    public boolean contains(String name) {
+        return instances.containsKey(name);
+    }
+
+    public Object get(String name) {
+        return instances.get(name);
+    }
+
+    public void add(String name, Object instance) {
+        if (instances.containsKey(name) && !(instances.get(name) instanceof Recipe)) {
+            throw new ConstructionException("Name " + name + " is already registered to instance " + instance);
+        }
+        instances.put(name, instance);
+    }
+}

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ScopedRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ScopedRepository.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ScopedRepository.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java?rev=766569&r1=766568&r2=766569&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java Mon Apr 20 04:27:18 2009
@@ -36,8 +36,6 @@
 import org.osgi.service.blueprint.reflect.ServiceExportComponentMetadata;
 
 /** 
- * TODO: if the exported component as a scope='bundle' we should create a ServiceFactory to honor that
- * 
  * TODO: javadoc
  */
 public class ServiceRegistrationProxy implements ServiceRegistration {
@@ -63,24 +61,28 @@
         if (registration != null) {
             return;
         }
-        
+                
+        Class serviceClass = service.getClass();
+        if (service instanceof BundleScopeServiceFactory) {
+            serviceClass = ((BundleScopeServiceFactory) service).getServiceClass();
+        }
         Set<String> classes;
         switch (metadata.getAutoExportMode()) {
             case ServiceExportComponentMetadata.EXPORT_MODE_INTERFACES:
-                classes = ReflectionUtils.getImplementedInterfaces(new HashSet<String>(), service.getClass());
+                classes = ReflectionUtils.getImplementedInterfaces(new HashSet<String>(), serviceClass);
                 break;
             case ServiceExportComponentMetadata.EXPORT_MODE_CLASS_HIERARCHY:
-                classes = ReflectionUtils.getSuperClasses(new HashSet<String>(), service.getClass());
+                classes = ReflectionUtils.getSuperClasses(new HashSet<String>(), serviceClass);
                 break;
             case ServiceExportComponentMetadata.EXPORT_MODE_ALL:
-                classes = ReflectionUtils.getSuperClasses(new HashSet<String>(), service.getClass());
-                classes = ReflectionUtils.getImplementedInterfaces(classes, service.getClass());
+                classes = ReflectionUtils.getSuperClasses(new HashSet<String>(), serviceClass);
+                classes = ReflectionUtils.getImplementedInterfaces(classes, serviceClass);
                 break;
             default:
                 classes = metadata.getInterfaceNames();
                 break;
         }
-        
+                
         Hashtable props = new Hashtable();
         if (serviceProperties != null) {
             props.putAll(serviceProperties);
@@ -94,7 +96,7 @@
         registration = moduleContext.getBundleContext().registerService(classesArray, service, props);
         registrationProperties = props;
         
-        System.out.println("service registered: " + service);
+        System.out.println("service registered: " + service + " " + classes);
         
         if (listeners != null) {
             for (Listener listener : listeners) {

Modified: geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java?rev=766569&r1=766568&r2=766569&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java Mon Apr 20 04:27:18 2009
@@ -30,13 +30,14 @@
 import org.apache.xbean.recipe.Repository;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.blueprint.convert.ConversionService;
+import org.osgi.service.blueprint.namespace.ComponentDefinitionRegistry;
 
 public class WiringTest extends AbstractBlueprintTest {
 
     public void testWiring() throws Exception {
         ComponentDefinitionRegistryImpl registry = parse("/test-wiring.xml");
-        Instanciator i = new TestInstanciator();
-        Repository repository = i.createRepository(registry);
+        Instanciator i = new TestInstanciator(registry);
+        Repository repository = i.createRepository();
         ObjectGraph graph = new ObjectGraph(repository);
         
         Object obj1 = graph.create("pojoA");
@@ -94,9 +95,11 @@
 
     private static class TestInstanciator extends Instanciator {
         ConversionServiceImpl conversionService = new ConversionServiceImpl();
+        ComponentDefinitionRegistryImpl registry;
         
-        public TestInstanciator() {
+        public TestInstanciator(ComponentDefinitionRegistryImpl registry) {
             super(null);
+            this.registry = registry;
         }
         
         @Override
@@ -104,5 +107,10 @@
             return conversionService;
         }
         
+        @Override
+        public ComponentDefinitionRegistry getComponentDefinitionRegistry() {
+            return registry;
+        }
+        
     }
 }