You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gn...@apache.org on 2006/06/07 20:26:25 UTC

svn commit: r412478 - in /geronimo/xbean/branches/spring2/trunk: xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/ xbean-spring-common/src/main/java/org/apache/xbean/sp...

Author: gnodet
Date: Wed Jun  7 11:26:24 2006
New Revision: 412478

URL: http://svn.apache.org/viewvc?rev=412478&view=rev
Log:
Merge from head

Modified:
    geronimo/xbean/branches/spring2/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardKernel.java
    geronimo/xbean/branches/spring2/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/ClassLoaderXmlPreprocessor.java
    geronimo/xbean/branches/spring2/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java

Modified: geronimo/xbean/branches/spring2/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardKernel.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/branches/spring2/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardKernel.java?rev=412478&r1=412477&r2=412478&view=diff
==============================================================================
--- geronimo/xbean/branches/spring2/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardKernel.java (original)
+++ geronimo/xbean/branches/spring2/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardKernel.java Wed Jun  7 11:26:24 2006
@@ -20,8 +20,8 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 
-import edu.emory.mathcs.backport.java.util.concurrent.Executor;
 import edu.emory.mathcs.backport.java.util.concurrent.Executors;
+import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
 import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
 import edu.emory.mathcs.backport.java.util.concurrent.locks.Lock;
 import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock;
@@ -92,6 +92,17 @@
      * Creates the service managers with handle service lifecycle.
      */
     private ServiceManagerFactory serviceManagerFactory;
+    
+    /**
+     * The service executor for this kernel
+     */         
+    private ExecutorService serviceExecutor;
+    
+    /**
+     * True if the executor is owned by this kernel and should be shutdown
+     * when the kernel is destroyed     
+     */         
+    private boolean ownsServiceExecutor;
 
     /**
      * Creates a kernel using the specified name.
@@ -100,6 +111,7 @@
      */
     public StandardKernel(String kernelName) {
         this(kernelName, Executors.newCachedThreadPool(), 30, TimeUnit.SECONDS);
+        ownsServiceExecutor = true;
     }
 
     /**
@@ -110,13 +122,14 @@
      * @param timeoutDuration the maximum duration to wait for a service event to complete
      * @param timeoutUnits the unit of measure for the timeoutDuration
      */
-    public StandardKernel(String kernelName, Executor serviceExecutor, long timeoutDuration, TimeUnit timeoutUnits) {
+    public StandardKernel(String kernelName, ExecutorService serviceExecutor, long timeoutDuration, TimeUnit timeoutUnits) {
         if (kernelName == null) throw new NullPointerException("kernelName is null");
         if (kernelName.length() ==0) throw new IllegalArgumentException("kernelName must be atleast one character long");
         if (serviceExecutor == null) throw new NullPointerException("serviceExecutor is null");
         if (timeoutUnits == null) throw new NullPointerException("timeoutUnits is null");
 
         this.kernelName = kernelName;
+        this.serviceExecutor = serviceExecutor;
         serviceManagerFactory = new ServiceManagerFactory(this, serviceMonitor, serviceExecutor, timeoutDuration, timeoutUnits);
         serviceManagerRegistry = new ServiceManagerRegistry(serviceManagerFactory);
     }
@@ -138,6 +151,11 @@
 
         // destroy all services
         serviceManagerRegistry.destroy();
+        
+        // shutdown service executor
+        if (ownsServiceExecutor) {
+            serviceExecutor.shutdown();
+        }
 
         // remove this kernel from the kernel factory registry
         KernelFactory.destroyInstance(this);

Modified: geronimo/xbean/branches/spring2/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/ClassLoaderXmlPreprocessor.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/branches/spring2/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/ClassLoaderXmlPreprocessor.java?rev=412478&r1=412477&r2=412478&view=diff
==============================================================================
--- geronimo/xbean/branches/spring2/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/ClassLoaderXmlPreprocessor.java (original)
+++ geronimo/xbean/branches/spring2/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/ClassLoaderXmlPreprocessor.java Wed Jun  7 11:26:24 2006
@@ -88,7 +88,11 @@
             URL[] urls = new URL[classpath.size()];
             for (ListIterator iterator = classpath.listIterator(); iterator.hasNext();) {
                 String location = (String) iterator.next();
-                urls[iterator.previousIndex()] = repository.getResource(location);
+                URL url = repository.getResource(location);
+                if (url == null) {
+                    throw new FatalBeanException("Unable to resolve classpath location " + location);
+                }
+                urls[iterator.previousIndex()] = url;
             }
 
             // create the classloader

Modified: geronimo/xbean/branches/spring2/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/branches/spring2/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java?rev=412478&r1=412477&r2=412478&view=diff
==============================================================================
--- geronimo/xbean/branches/spring2/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java (original)
+++ geronimo/xbean/branches/spring2/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java Wed Jun  7 11:26:24 2006
@@ -170,37 +170,40 @@
         Map flatCollections = new HashMap();
         Set attributes = new HashSet();
         Map attributesByPropertyName = new HashMap();
-        BeanProperty[] beanProperties = javaClass.getBeanProperties();
-        for (int i = 0; i < beanProperties.length; i++) {
-            BeanProperty beanProperty = beanProperties[i];
-
-            // we only care about properties with a setter
-            if (beanProperty.getMutator() != null) {
-                AttributeMapping attributeMapping = loadAttribute(beanProperty, "");
-                if (attributeMapping != null) {
-                    attributes.add(attributeMapping);
-                    attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
-                }
-                JavaMethod acc = beanProperty.getAccessor();
-                if (acc != null) {
-                    DocletTag mapTag = acc.getTagByName(MAP_ANNOTATION);
-                    if (mapTag != null) {
-                        MapMapping mm = new MapMapping(mapTag.getNamedParameter("entryName"), 
-                                mapTag.getNamedParameter("keyName"));
-                        mapsByPropertyName.put(beanProperty.getName(), mm);
+        
+        for (JavaClass jClass = javaClass; jClass != null; jClass = jClass.getSuperJavaClass()) {
+            BeanProperty[] beanProperties = jClass.getBeanProperties();
+            for (int i = 0; i < beanProperties.length; i++) {
+                BeanProperty beanProperty = beanProperties[i];
+    
+                // we only care about properties with a setter
+                if (beanProperty.getMutator() != null) {
+                    AttributeMapping attributeMapping = loadAttribute(beanProperty, "");
+                    if (attributeMapping != null) {
+                        attributes.add(attributeMapping);
+                        attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
                     }
-                    
-                    DocletTag flatColTag = acc.getTagByName(FLAT_COLLECTION_ANNOTATION);
-                    if (flatColTag != null) {
-                        String childName = flatColTag.getNamedParameter("childElement");
-                        if (childName == null)
-                            throw new InvalidModelException("Flat collections must specify the childElement attribute.");
-                        flatCollections.put(beanProperty.getName(), childName);
-                    }
-                    
-                    DocletTag flatPropTag = acc.getTagByName(FLAT_PROPERTY_ANNOTATION);
-                    if (flatPropTag != null) {
-                        flatProperties.add(beanProperty.getName());
+                    JavaMethod acc = beanProperty.getAccessor();
+                    if (acc != null) {
+                        DocletTag mapTag = acc.getTagByName(MAP_ANNOTATION);
+                        if (mapTag != null) {
+                            MapMapping mm = new MapMapping(mapTag.getNamedParameter("entryName"), 
+                                    mapTag.getNamedParameter("keyName"));
+                            mapsByPropertyName.put(beanProperty.getName(), mm);
+                        }
+                        
+                        DocletTag flatColTag = acc.getTagByName(FLAT_COLLECTION_ANNOTATION);
+                        if (flatColTag != null) {
+                            String childName = flatColTag.getNamedParameter("childElement");
+                            if (childName == null)
+                                throw new InvalidModelException("Flat collections must specify the childElement attribute.");
+                            flatCollections.put(beanProperty.getName(), childName);
+                        }
+                        
+                        DocletTag flatPropTag = acc.getTagByName(FLAT_PROPERTY_ANNOTATION);
+                        if (flatPropTag != null) {
+                            flatProperties.add(beanProperty.getName());
+                        }
                     }
                 }
             }