geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r770211 - in /geronimo/sandbox/blueprint: blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ blueprint-core/src/main/java/org/apache/geronimo/blueprint/ blueprint-core/src/main/java/org/apache/geronimo/blueprint/context...
Date Thu, 30 Apr 2009 12:52:28 GMT
Author: gnodet
Date: Thu Apr 30 12:52:27 2009
New Revision: 770211

URL: http://svn.apache.org/viewvc?rev=770211&view=rev
Log:
Make use of the runtimeClass defined on BeanMetadata and avoid some of the classloader tricks

Modified:
    geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContext.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.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/convert/ConversionServiceImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableBeanMetadata.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd
    geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/TestBlueprintContext.java

Modified: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java?rev=770211&r1=770210&r2=770211&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java
Thu Apr 30 12:52:27 2009
@@ -91,7 +91,7 @@
     private ComponentMetadata parsePropertyPlaceholder(ExtendedParserContext context, Element
element) {
         MutableBeanMetadata metadata = context.createMetadata(MutableBeanMetadata.class);
         metadata.setId(getName(element));
-        metadata.setClassName(CmPropertyPlaceholder.class.getName());
+        metadata.setRuntimeClass(CmPropertyPlaceholder.class);
         metadata.addProperty("blueprintContext", createRef(context, "blueprintContext"));
         metadata.addProperty("configAdmin", createRef(context, CONFIG_ADMIN_REFERENCE_NAME));
         metadata.addProperty("persistentId", createValue(context, element.getAttribute(PERSISTENT_ID_ATTRIBUTE)));

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContext.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContext.java?rev=770211&r1=770210&r2=770211&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContext.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContext.java
Thu Apr 30 12:52:27 2009
@@ -29,7 +29,7 @@
  */
 public interface ExtendedBlueprintContext extends BlueprintContext {
 
-    ClassLoader getClassLoader();
+    Class loadClass(String name) throws ClassNotFoundException;
 
     <T  extends ComponentMetadata> List<T> getComponentsMetadata(Class<T>
type);
 

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java?rev=770211&r1=770210&r2=770211&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
Thu Apr 30 12:52:27 2009
@@ -101,7 +101,6 @@
     private boolean waitForNamespaceHandlersEventSent;
     private Map<String, Destroyable> destroyables = new HashMap<String, Destroyable>();
     private Map<String, List<SatisfiableRecipe>> satisfiables;
-    private ClassLoader classLoader;
 
     public BlueprintContextImpl(BundleContext bundleContext, BlueprintContextEventSender
sender, NamespaceHandlerRegistry handlers, ExecutorService executors, List<URL> urls)
{
         this.bundleContext = bundleContext;
@@ -112,11 +111,10 @@
         this.helperComponentDefinitionRegistry = new ComponentDefinitionRegistryImpl();
         this.componentDefinitionRegistry = new ComponentDefinitionRegistryImpl();
         this.executors = executors;
-        this.classLoader = new BundleDelegatingClassLoader(bundleContext.getBundle(), getClass().getClassLoader());
     }
 
-    public ClassLoader getClassLoader() {
-        return classLoader;
+    public Class loadClass(String name) throws ClassNotFoundException {
+        return bundleContext.getBundle().loadClass(name);
     }
 
     public void addDestroyable(String name, Destroyable destroyable) {

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=770211&r1=770210&r2=770211&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
Thu Apr 30 12:52:27 2009
@@ -196,7 +196,8 @@
     }
 
     private BlueprintObjectRecipe createBeanRecipe(BeanMetadata local) throws Exception {
-        BlueprintObjectRecipe recipe = new BlueprintObjectRecipe(blueprintContext, loadClass(local.getClassName()));
+        Class clazz = local.getRuntimeClass() != null ? local.getRuntimeClass() : loadClass(local.getClassName());
+        BlueprintObjectRecipe recipe = new BlueprintObjectRecipe(blueprintContext, clazz);
         if (local.getId() != null) {
             recipe.setName(local.getId());
         }
@@ -341,8 +342,7 @@
                 ClassLoader loader = Thread.currentThread().getContextClassLoader();
                 clazz = loader.loadClass(typeName);
             } else {
-                // TODO: use a mixed classloader while the classloading + namespace handler
problem is solved
-                clazz = context.getClassLoader().loadClass(typeName);
+                clazz = context.loadClass(typeName);
             }
         }
         return clazz;

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java?rev=770211&r1=770210&r2=770211&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
Thu Apr 30 12:52:27 2009
@@ -134,7 +134,7 @@
     private Object convertString(String value, Class toType) throws Exception {
         if (Class.class == toType) {
             try {
-                return blueprintContext.getClassLoader().loadClass(value);
+                return blueprintContext.loadClass(value);
             } catch (ClassNotFoundException e) {
                 throw new Exception("Unable to convert", e);
             }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableBeanMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableBeanMetadata.java?rev=770211&r1=770210&r2=770211&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableBeanMetadata.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableBeanMetadata.java
Thu Apr 30 12:52:27 2009
@@ -64,4 +64,6 @@
 
     void removeExplicitDependency(String dependency);
 
+    void setRuntimeClass(Class runtimeClass);
+
 }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd?rev=770211&r1=770210&r2=770211&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd
Thu Apr 30 12:52:27 2009
@@ -358,7 +358,7 @@
                 <xsd:sequence>
                 	<xsd:element name="entry" type="Tentry" minOccurs="0" maxOccurs="unbounded"/>
                 </xsd:sequence>
-                <xsd:attribute name="key-type" type="xsd:string"/>
+                <xsd:attribute name="key-type" type="Tclass"/>
             </xsd:extension>
         </xsd:complexContent>
     </xsd:complexType>

Modified: geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/TestBlueprintContext.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/TestBlueprintContext.java?rev=770211&r1=770210&r2=770211&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/TestBlueprintContext.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/TestBlueprintContext.java
Thu Apr 30 12:52:27 2009
@@ -29,12 +29,12 @@
         super(new TestBundleContext(), null, null, null, null);
         this.registry = registry;
     }
-    
+
     @Override
-    public ClassLoader getClassLoader() {
-        return Thread.currentThread().getContextClassLoader();
+    public Class loadClass(String name) throws ClassNotFoundException {
+        return Thread.currentThread().getContextClassLoader().loadClass(name);
     }
-    
+
     @Override
     public ComponentDefinitionRegistryImpl getComponentDefinitionRegistry() {
         return registry;



Mime
View raw message