geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1393346 [3/8] - in /geronimo/xbean/trunk: ./ maven-xbean-plugin/ maven-xbean-plugin/src/main/java/org/apache/xbean/maven/ xbean-asm-shaded/src/main/appended-resources/META-INF/ xbean-blueprint/ xbean-blueprint/src/main/java/org/apache/xbea...
Date Wed, 03 Oct 2012 08:38:37 GMT
Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/MissingFactoryMethodException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/NoSuchObjectException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ObjectGraph.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ObjectRecipe.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/Option.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ParameterNameLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ParameterNames.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/Recipe.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/RecipeHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/RecipeVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/Reference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ReferenceRecipe.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ReflectionUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/Repository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/StaticRecipe.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/UnresolvedReferencesException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/UnsetPropertiesRecipe.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/AbstractObjectGraphTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/AllPropertiesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/Box.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/Car.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/CaseInsensitivePropertiesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/Child.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/CollectionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/EnumTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/ExplicitInjectionStyleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/GenericCollectionsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/HiddenPropertiesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/MapRecipeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/MatchBytypeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/MissingPropertiesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/MixedRecipeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/ObjectGraphNestedTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/ObjectGraphReferenceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/ObjectRecipeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/ParameterNameLoaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/Parent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/Person.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/PersonFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/ReferenceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/ScratchPadTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/UnsetPropertiesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/Widget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/ClassPathXmlApplicationContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/FileSystemXmlApplicationContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/ResourceXmlApplicationContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/XmlWebApplicationContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/MappingMetaData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/NamespaceHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/ObjectNameEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/QNameHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/QNameReflectionHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/QNameReflectionParams.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/URIEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanHelper.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanHelper.java?rev=1393346&r1=1393345&r2=1393346&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanHelper.java (original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanHelper.java Wed Oct  3 08:38:26 2012
@@ -1,51 +1,51 @@
-/**
- * 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.xbean.spring.context.impl;
-
-import java.lang.reflect.Constructor;
-import java.util.List;
-
-import org.apache.xbean.spring.context.SpringApplicationContext;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-
-public class XBeanHelper {
-
-    public static XmlBeanDefinitionReader createBeanDefinitionReader(
-                    SpringApplicationContext applicationContext,
-                    BeanDefinitionRegistry registry,
-                    List xmlPreprocessors) {
-        
-        String version = "2.0";
-        
-        try {
-            Class spring20Clazz = Class.forName("org.springframework.core.AttributeAccessorSupport");
-            version = "2.0";
-        } catch(ClassNotFoundException e) {
-            version = "1.2.8";
-        }
-        
-        String className = "org.apache.xbean.spring.context.v" + version.charAt(0) + ".XBeanXmlBeanDefinitionReader";
-        try {
-            Class cl = Class.forName(className);
-            Constructor cstr = cl.getConstructor(new Class[] { SpringApplicationContext.class, BeanDefinitionRegistry.class, List.class });
-            return (XmlBeanDefinitionReader) cstr.newInstance(new Object[] { applicationContext, registry, xmlPreprocessors });
-        } catch (Exception e) {
-            throw (IllegalStateException) new IllegalStateException("Could not find valid implementation for: " + version).initCause(e);
-        }
-    }
-}
+/**
+ * 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.xbean.spring.context.impl;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.apache.xbean.spring.context.SpringApplicationContext;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+
+public class XBeanHelper {
+
+    public static XmlBeanDefinitionReader createBeanDefinitionReader(
+                    SpringApplicationContext applicationContext,
+                    BeanDefinitionRegistry registry,
+                    List xmlPreprocessors) {
+        
+        String version = "2.0";
+        
+        try {
+            Class spring20Clazz = Class.forName("org.springframework.core.AttributeAccessorSupport");
+            version = "2.0";
+        } catch(ClassNotFoundException e) {
+            version = "1.2.8";
+        }
+        
+        String className = "org.apache.xbean.spring.context.v" + version.charAt(0) + ".XBeanXmlBeanDefinitionReader";
+        try {
+            Class cl = Class.forName(className);
+            Constructor cstr = cl.getConstructor(new Class[] { SpringApplicationContext.class, BeanDefinitionRegistry.class, List.class });
+            return (XmlBeanDefinitionReader) cstr.newInstance(new Object[] { applicationContext, registry, xmlPreprocessors });
+        } catch (Exception e) {
+            throw (IllegalStateException) new IllegalStateException("Could not find valid implementation for: " + version).initCause(e);
+        }
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanFactory.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanFactory.java?rev=1393346&r1=1393345&r2=1393346&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanFactory.java (original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanFactory.java Wed Oct  3 08:38:26 2012
@@ -1,76 +1,76 @@
-/**
- * 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.xbean.spring.context.impl;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.core.io.Resource;
-
-public class XBeanXmlBeanFactory extends DefaultListableBeanFactory {
-
-    /**
-     * Create a new XBeanXmlBeanFactory with the given resource,
-     * which must be parsable using DOM.
-     * @param resource XML resource to load bean definitions from
-     * @throws BeansException in case of loading or parsing errors
-     */
-    public XBeanXmlBeanFactory(Resource resource) throws BeansException {
-        this(resource, null, Collections.EMPTY_LIST);
-    }
-
-    /**
-     * Create a new XBeanXmlBeanFactory with the given input stream,
-     * which must be parsable using DOM.
-     * @param resource XML resource to load bean definitions from
-     * @param parentBeanFactory parent bean factory
-     * @throws BeansException in case of loading or parsing errors
-     */
-    public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory) throws BeansException {
-        this(resource, parentBeanFactory, Collections.EMPTY_LIST);
-    }
-
-    /**
-     * Create a new XBeanXmlBeanFactory with the given input stream,
-     * which must be parsable using DOM.
-     * @param resource XML resource to load bean definitions from
-     * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
-     * @throws BeansException in case of loading or parsing errors
-     */
-    public XBeanXmlBeanFactory(Resource resource, List xmlPreprocessors) throws BeansException {
-        this(resource, null, xmlPreprocessors);
-    }
-
-    /**
-     * Create a new XBeanXmlBeanFactory with the given input stream,
-     * which must be parsable using DOM.
-     * @param resource XML resource to load bean definitions from
-     * @param parentBeanFactory parent bean factory
-     * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
-     * @throws BeansException in case of loading or parsing errors
-     */
-    public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory, List xmlPreprocessors) throws BeansException {
-        super(parentBeanFactory);
-        XmlBeanDefinitionReader reader = XBeanHelper.createBeanDefinitionReader(null, this, xmlPreprocessors);
-        reader.loadBeanDefinitions(resource);
-    }
-
-}
+/**
+ * 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.xbean.spring.context.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.core.io.Resource;
+
+public class XBeanXmlBeanFactory extends DefaultListableBeanFactory {
+
+    /**
+     * Create a new XBeanXmlBeanFactory with the given resource,
+     * which must be parsable using DOM.
+     * @param resource XML resource to load bean definitions from
+     * @throws BeansException in case of loading or parsing errors
+     */
+    public XBeanXmlBeanFactory(Resource resource) throws BeansException {
+        this(resource, null, Collections.EMPTY_LIST);
+    }
+
+    /**
+     * Create a new XBeanXmlBeanFactory with the given input stream,
+     * which must be parsable using DOM.
+     * @param resource XML resource to load bean definitions from
+     * @param parentBeanFactory parent bean factory
+     * @throws BeansException in case of loading or parsing errors
+     */
+    public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory) throws BeansException {
+        this(resource, parentBeanFactory, Collections.EMPTY_LIST);
+    }
+
+    /**
+     * Create a new XBeanXmlBeanFactory with the given input stream,
+     * which must be parsable using DOM.
+     * @param resource XML resource to load bean definitions from
+     * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
+     * @throws BeansException in case of loading or parsing errors
+     */
+    public XBeanXmlBeanFactory(Resource resource, List xmlPreprocessors) throws BeansException {
+        this(resource, null, xmlPreprocessors);
+    }
+
+    /**
+     * Create a new XBeanXmlBeanFactory with the given input stream,
+     * which must be parsable using DOM.
+     * @param resource XML resource to load bean definitions from
+     * @param parentBeanFactory parent bean factory
+     * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
+     * @throws BeansException in case of loading or parsing errors
+     */
+    public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory, List xmlPreprocessors) throws BeansException {
+        super(parentBeanFactory);
+        XmlBeanDefinitionReader reader = XBeanHelper.createBeanDefinitionReader(null, this, xmlPreprocessors);
+        reader.loadBeanDefinitions(resource);
+    }
+
+}

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java?rev=1393346&r1=1393345&r2=1393346&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java (original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java Wed Oct  3 08:38:26 2012
@@ -1,185 +1,185 @@
-/**
- * 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.xbean.spring.context.v2;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.parsing.BeanComponentDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
-import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
-import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
-import org.springframework.beans.factory.xml.XmlReaderContext;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.ResourcePatternUtils;
-import org.springframework.util.StringUtils;
-import org.springframework.util.SystemPropertyUtils;
-import org.springframework.util.xml.DomUtils;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class XBeanBeanDefinitionDocumentReader extends DefaultBeanDefinitionDocumentReader {
-
-    protected BeanDefinitionParserDelegate createHelper(XmlReaderContext readerContext, Element root) {
-        BeanDefinitionParserDelegate delegate = XBeanV2Helper.createParser(readerContext);
-        delegate.initDefaults(root);
-        return delegate;
-    }
-
-    protected void parseBeanDefinitions(Element root, BeanDefinitionParserDelegate delegate) {
-        String namespaceUri = root.getNamespaceURI();
-        if (!DomUtils.nodeNameEquals(root, "beans") && 
-            !delegate.isDefaultNamespace(namespaceUri)) {
-            try {
-                try {
-                    Method m = BeanDefinitionParserDelegate.class.getMethod("parseCustomElement", new Class[] { Element.class });
-                    m.invoke(delegate, new Object[] { root });
-                } catch (NoSuchMethodException e) {
-                    try {
-                        Method m = BeanDefinitionParserDelegate.class.getMethod("parseCustomElement", new Class[] { Element.class, boolean.class });
-                        m.invoke(delegate, new Object[] { root, Boolean.FALSE });
-                    } catch (NoSuchMethodException e2) {
-                        throw new IllegalStateException(e);
-                    }
-                }
-            } catch (IllegalAccessException e) {
-                throw new RuntimeException(e);
-            } catch (IllegalArgumentException e) {
-                throw new RuntimeException(e);
-            } catch (InvocationTargetException e) {
-                if (e.getCause() instanceof RuntimeException) {
-                    throw (RuntimeException) e.getCause();
-                }
-                throw new RuntimeException(e);
-            }
-        } else if (DomUtils.nodeNameEquals(root, "beans")) {
-            NodeList nl = root.getChildNodes();
-            for (int i = 0; i < nl.getLength(); i++) {
-                Node node = nl.item(i);
-                if (node instanceof Element) {
-                    Element ele = (Element) node;
-                    String childNamespaceUri = ele.getNamespaceURI();
-                    if (delegate.isDefaultNamespace(childNamespaceUri)) {
-                        parseDefaultElement(ele, delegate);
-                    }
-                    else {
-                        delegate.parseCustomElement(ele);
-                    }
-                }
-            }
-        } else {
-            super.parseBeanDefinitions(root, delegate);
-        }
-    }
-    
-    private void parseDefaultElement(Element ele, BeanDefinitionParserDelegate delegate) {
-        if (DomUtils.nodeNameEquals(ele, IMPORT_ELEMENT)) {
-            importBeanDefinitionResource(ele);
-        }
-        else if (DomUtils.nodeNameEquals(ele, ALIAS_ELEMENT)) {
-            processAliasRegistration(ele);
-        }
-        else if (DomUtils.nodeNameEquals(ele, BEAN_ELEMENT)) {
-            processBeanDefinition(ele, delegate);
-        }
-    }
-
-    /**
-     * Parse an "import" element and load the bean definitions
-     * from the given resource into the bean factory.
-     */
-    protected void importBeanDefinitionResource(Element ele) {
-        String location = ele.getAttribute(RESOURCE_ATTRIBUTE);
-        if (!StringUtils.hasText(location)) {
-            getReaderContext().error("Resource location must not be empty", ele);
-            return;
-        }
-
-        // Resolve system properties: e.g. "${user.dir}"
-        location = SystemPropertyUtils.resolvePlaceholders(location);
-
-        if (ResourcePatternUtils.isUrl(location)) {
-            int importCount = getReaderContext().getReader().loadBeanDefinitions(location);
-            if (logger.isDebugEnabled()) {
-                logger.debug("Imported " + importCount + " bean definitions from URL location [" + location + "]");
-            }
-        }
-        else {
-            // No URL -> considering resource location as relative to the current file.
-            try {
-                Resource relativeResource = getReaderContext().getResource().createRelative(location);
-                int importCount = getReaderContext().getReader().loadBeanDefinitions(relativeResource);
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Imported " + importCount + " bean definitions from relative location [" + location + "]");
-                }
-            }
-            catch (IOException ex) {
-                getReaderContext().error(
-                        "Invalid relative resource location [" + location + "] to import bean definitions from", ele, null, ex);
-            }
-        }
-
-        getReaderContext().fireImportProcessed(location, extractSource(ele));
-    }
-
-    /**
-     * Process the given alias element, registering the alias with the registry.
-     */
-    protected void processAliasRegistration(Element ele) {
-        String name = ele.getAttribute(NAME_ATTRIBUTE);
-        String alias = ele.getAttribute(ALIAS_ATTRIBUTE);
-        boolean valid = true;
-        if (!StringUtils.hasText(name)) {
-            getReaderContext().error("Name must not be empty", ele);
-            valid = false;
-        }
-        if (!StringUtils.hasText(alias)) {
-            getReaderContext().error("Alias must not be empty", ele);
-            valid = false;
-        }
-        if (valid) {
-            try {
-                getReaderContext().getRegistry().registerAlias(name, alias);
-            }
-            catch (BeanDefinitionStoreException ex) {
-                getReaderContext().error(ex.getMessage(), ele);
-            }
-            getReaderContext().fireAliasRegistered(name, alias, extractSource(ele));
-        }
-    }
-
-    /**
-     * Process the given bean element, parsing the bean definition
-     * and registering it with the registry.
-     */
-    protected void processBeanDefinition(Element ele, BeanDefinitionParserDelegate delegate) {
-        BeanDefinitionHolder bdHolder = delegate.parseBeanDefinitionElement(ele);
-        if (bdHolder != null) {
-            bdHolder = delegate.decorateBeanDefinitionIfRequired(ele, bdHolder);
-            // Register the final decorated instance.
-            BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getReaderContext().getRegistry());
-            // Send registration event.
-            getReaderContext().fireComponentRegistered(new BeanComponentDefinition(bdHolder));
-        }
-    }
-
-
-}
+/**
+ * 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.xbean.spring.context.v2;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.springframework.beans.factory.BeanDefinitionStoreException;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.parsing.BeanComponentDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
+import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
+import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
+import org.springframework.beans.factory.xml.XmlReaderContext;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.ResourcePatternUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.util.SystemPropertyUtils;
+import org.springframework.util.xml.DomUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class XBeanBeanDefinitionDocumentReader extends DefaultBeanDefinitionDocumentReader {
+
+    protected BeanDefinitionParserDelegate createHelper(XmlReaderContext readerContext, Element root) {
+        BeanDefinitionParserDelegate delegate = XBeanV2Helper.createParser(readerContext);
+        delegate.initDefaults(root);
+        return delegate;
+    }
+
+    protected void parseBeanDefinitions(Element root, BeanDefinitionParserDelegate delegate) {
+        String namespaceUri = root.getNamespaceURI();
+        if (!DomUtils.nodeNameEquals(root, "beans") && 
+            !delegate.isDefaultNamespace(namespaceUri)) {
+            try {
+                try {
+                    Method m = BeanDefinitionParserDelegate.class.getMethod("parseCustomElement", new Class[] { Element.class });
+                    m.invoke(delegate, new Object[] { root });
+                } catch (NoSuchMethodException e) {
+                    try {
+                        Method m = BeanDefinitionParserDelegate.class.getMethod("parseCustomElement", new Class[] { Element.class, boolean.class });
+                        m.invoke(delegate, new Object[] { root, Boolean.FALSE });
+                    } catch (NoSuchMethodException e2) {
+                        throw new IllegalStateException(e);
+                    }
+                }
+            } catch (IllegalAccessException e) {
+                throw new RuntimeException(e);
+            } catch (IllegalArgumentException e) {
+                throw new RuntimeException(e);
+            } catch (InvocationTargetException e) {
+                if (e.getCause() instanceof RuntimeException) {
+                    throw (RuntimeException) e.getCause();
+                }
+                throw new RuntimeException(e);
+            }
+        } else if (DomUtils.nodeNameEquals(root, "beans")) {
+            NodeList nl = root.getChildNodes();
+            for (int i = 0; i < nl.getLength(); i++) {
+                Node node = nl.item(i);
+                if (node instanceof Element) {
+                    Element ele = (Element) node;
+                    String childNamespaceUri = ele.getNamespaceURI();
+                    if (delegate.isDefaultNamespace(childNamespaceUri)) {
+                        parseDefaultElement(ele, delegate);
+                    }
+                    else {
+                        delegate.parseCustomElement(ele);
+                    }
+                }
+            }
+        } else {
+            super.parseBeanDefinitions(root, delegate);
+        }
+    }
+    
+    private void parseDefaultElement(Element ele, BeanDefinitionParserDelegate delegate) {
+        if (DomUtils.nodeNameEquals(ele, IMPORT_ELEMENT)) {
+            importBeanDefinitionResource(ele);
+        }
+        else if (DomUtils.nodeNameEquals(ele, ALIAS_ELEMENT)) {
+            processAliasRegistration(ele);
+        }
+        else if (DomUtils.nodeNameEquals(ele, BEAN_ELEMENT)) {
+            processBeanDefinition(ele, delegate);
+        }
+    }
+
+    /**
+     * Parse an "import" element and load the bean definitions
+     * from the given resource into the bean factory.
+     */
+    protected void importBeanDefinitionResource(Element ele) {
+        String location = ele.getAttribute(RESOURCE_ATTRIBUTE);
+        if (!StringUtils.hasText(location)) {
+            getReaderContext().error("Resource location must not be empty", ele);
+            return;
+        }
+
+        // Resolve system properties: e.g. "${user.dir}"
+        location = SystemPropertyUtils.resolvePlaceholders(location);
+
+        if (ResourcePatternUtils.isUrl(location)) {
+            int importCount = getReaderContext().getReader().loadBeanDefinitions(location);
+            if (logger.isDebugEnabled()) {
+                logger.debug("Imported " + importCount + " bean definitions from URL location [" + location + "]");
+            }
+        }
+        else {
+            // No URL -> considering resource location as relative to the current file.
+            try {
+                Resource relativeResource = getReaderContext().getResource().createRelative(location);
+                int importCount = getReaderContext().getReader().loadBeanDefinitions(relativeResource);
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Imported " + importCount + " bean definitions from relative location [" + location + "]");
+                }
+            }
+            catch (IOException ex) {
+                getReaderContext().error(
+                        "Invalid relative resource location [" + location + "] to import bean definitions from", ele, null, ex);
+            }
+        }
+
+        getReaderContext().fireImportProcessed(location, extractSource(ele));
+    }
+
+    /**
+     * Process the given alias element, registering the alias with the registry.
+     */
+    protected void processAliasRegistration(Element ele) {
+        String name = ele.getAttribute(NAME_ATTRIBUTE);
+        String alias = ele.getAttribute(ALIAS_ATTRIBUTE);
+        boolean valid = true;
+        if (!StringUtils.hasText(name)) {
+            getReaderContext().error("Name must not be empty", ele);
+            valid = false;
+        }
+        if (!StringUtils.hasText(alias)) {
+            getReaderContext().error("Alias must not be empty", ele);
+            valid = false;
+        }
+        if (valid) {
+            try {
+                getReaderContext().getRegistry().registerAlias(name, alias);
+            }
+            catch (BeanDefinitionStoreException ex) {
+                getReaderContext().error(ex.getMessage(), ele);
+            }
+            getReaderContext().fireAliasRegistered(name, alias, extractSource(ele));
+        }
+    }
+
+    /**
+     * Process the given bean element, parsing the bean definition
+     * and registering it with the registry.
+     */
+    protected void processBeanDefinition(Element ele, BeanDefinitionParserDelegate delegate) {
+        BeanDefinitionHolder bdHolder = delegate.parseBeanDefinitionElement(ele);
+        if (bdHolder != null) {
+            bdHolder = delegate.decorateBeanDefinitionIfRequired(ele, bdHolder);
+            // Register the final decorated instance.
+            BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getReaderContext().getRegistry());
+            // Send registration event.
+            getReaderContext().fireComponentRegistered(new BeanComponentDefinition(bdHolder));
+        }
+    }
+
+
+}

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java?rev=1393346&r1=1393345&r2=1393346&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java (original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java Wed Oct  3 08:38:26 2012
@@ -1,41 +1,41 @@
-/**
- * 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.xbean.spring.context.v2;
-
-import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;
-import org.springframework.beans.factory.xml.NamespaceHandler;
-
-
-public class XBeanNamespaceHandlerResolver extends DefaultNamespaceHandlerResolver {
-
-    public XBeanNamespaceHandlerResolver(ClassLoader classLoader) {
-        super(classLoader);
-    }
-
-    public NamespaceHandler resolve(String namespaceUri) {
-        NamespaceHandler handler = null;
-        try {
-            handler = super.resolve(namespaceUri);
-        } catch (IllegalArgumentException e) {
-            // ignore
-        }
-        if (handler == null) {
-            handler = new XBeanNamespaceHandler();
-        }
-        return handler;
-    }
-}
+/**
+ * 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.xbean.spring.context.v2;
+
+import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;
+import org.springframework.beans.factory.xml.NamespaceHandler;
+
+
+public class XBeanNamespaceHandlerResolver extends DefaultNamespaceHandlerResolver {
+
+    public XBeanNamespaceHandlerResolver(ClassLoader classLoader) {
+        super(classLoader);
+    }
+
+    public NamespaceHandler resolve(String namespaceUri) {
+        NamespaceHandler handler = null;
+        try {
+            handler = super.resolve(namespaceUri);
+        } catch (IllegalArgumentException e) {
+            // ignore
+        }
+        if (handler == null) {
+            handler = new XBeanNamespaceHandler();
+        }
+        return handler;
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanV2Helper.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanV2Helper.java?rev=1393346&r1=1393345&r2=1393346&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanV2Helper.java (original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanV2Helper.java Wed Oct  3 08:38:26 2012
@@ -1,73 +1,73 @@
-/**
- * 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.xbean.spring.context.v2;
-
-import java.lang.reflect.Constructor;
-
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
-import org.springframework.beans.factory.xml.NamespaceHandler;
-import org.springframework.beans.factory.xml.XmlReaderContext;
-import org.w3c.dom.Element;
-
-public class XBeanV2Helper {
-    
-    public static String version = null;
-
-    public static BeanDefinitionParserDelegate createParser(XmlReaderContext readerContext) {
-        try {
-            String className = "org.apache.xbean.spring.context." + getVersion() + ".XBeanBeanDefinitionParserDelegate";
-            Class clParser = Class.forName(className);
-            Constructor cns = clParser.getConstructor(new Class[] { XmlReaderContext.class });
-            return (BeanDefinitionParserDelegate) cns.newInstance(new Object[] { readerContext });
-        } catch (Throwable e) {
-            throw (IllegalStateException) new IllegalStateException("Unable to create namespace handler for: " + version).initCause(e);
-        }
-    }
-    
-    public static NamespaceHandler createNamespaceHandler() {
-        try {
-            String className = "org.apache.xbean.spring.context." + getVersion() + ".XBeanNamespaceHandler";
-            Class clHandler = Class.forName(className);
-            return (NamespaceHandler) clHandler.newInstance();
-        } catch (Throwable e) {
-            throw (IllegalStateException) new IllegalStateException("Unable to create namespace handler for: " + version).initCause(e);
-        }
-    }
-    
-    private static String getVersion() {
-        if (version == null) {
-            try {
-                try {
-                    Class.forName("org.springframework.beans.factory.parsing.BeanComponentDefinition");
-                    version = "v2c";
-                } catch (ClassNotFoundException e) {
-                    Class cl = Class.forName("org.springframework.beans.factory.xml.BeanDefinitionParserDelegate");
-                    try {
-                        cl.getMethod("parsePropertyElements", new Class[] { Element.class, BeanDefinition.class });
-                        version = "v2b";
-                    } catch (NoSuchMethodException e2) {
-                        version = "v2a";
-                    }
-                }
-            } catch (Throwable e) {
-                throw (IllegalStateException) new IllegalStateException("Could not create namespace handler for: " + version).initCause(e);
-            }
-        }
-        return version;
-    }
-}
+/**
+ * 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.xbean.spring.context.v2;
+
+import java.lang.reflect.Constructor;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
+import org.springframework.beans.factory.xml.NamespaceHandler;
+import org.springframework.beans.factory.xml.XmlReaderContext;
+import org.w3c.dom.Element;
+
+public class XBeanV2Helper {
+    
+    public static String version = null;
+
+    public static BeanDefinitionParserDelegate createParser(XmlReaderContext readerContext) {
+        try {
+            String className = "org.apache.xbean.spring.context." + getVersion() + ".XBeanBeanDefinitionParserDelegate";
+            Class clParser = Class.forName(className);
+            Constructor cns = clParser.getConstructor(new Class[] { XmlReaderContext.class });
+            return (BeanDefinitionParserDelegate) cns.newInstance(new Object[] { readerContext });
+        } catch (Throwable e) {
+            throw (IllegalStateException) new IllegalStateException("Unable to create namespace handler for: " + version).initCause(e);
+        }
+    }
+    
+    public static NamespaceHandler createNamespaceHandler() {
+        try {
+            String className = "org.apache.xbean.spring.context." + getVersion() + ".XBeanNamespaceHandler";
+            Class clHandler = Class.forName(className);
+            return (NamespaceHandler) clHandler.newInstance();
+        } catch (Throwable e) {
+            throw (IllegalStateException) new IllegalStateException("Unable to create namespace handler for: " + version).initCause(e);
+        }
+    }
+    
+    private static String getVersion() {
+        if (version == null) {
+            try {
+                try {
+                    Class.forName("org.springframework.beans.factory.parsing.BeanComponentDefinition");
+                    version = "v2c";
+                } catch (ClassNotFoundException e) {
+                    Class cl = Class.forName("org.springframework.beans.factory.xml.BeanDefinitionParserDelegate");
+                    try {
+                        cl.getMethod("parsePropertyElements", new Class[] { Element.class, BeanDefinition.class });
+                        version = "v2b";
+                    } catch (NoSuchMethodException e2) {
+                        version = "v2a";
+                    }
+                }
+            } catch (Throwable e) {
+                throw (IllegalStateException) new IllegalStateException("Could not create namespace handler for: " + version).initCause(e);
+            }
+        }
+        return version;
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanV2Helper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanXmlBeanFactory.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanXmlBeanFactory.java?rev=1393346&r1=1393345&r2=1393346&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanXmlBeanFactory.java (original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanXmlBeanFactory.java Wed Oct  3 08:38:26 2012
@@ -1,75 +1,75 @@
-/**
- * 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.xbean.spring.context.v2;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.core.io.Resource;
-
-import java.util.Collections;
-import java.util.List;
-
-public class XBeanXmlBeanFactory extends DefaultListableBeanFactory {
-
-    /**
-     * Create a new XBeanXmlBeanFactory with the given resource,
-     * which must be parsable using DOM.
-     * @param resource XML resource to load bean definitions from
-     * @throws BeansException in case of loading or parsing errors
-     */
-    public XBeanXmlBeanFactory(Resource resource) throws BeansException {
-        this(resource, null, Collections.EMPTY_LIST);
-    }
-
-    /**
-     * Create a new XBeanXmlBeanFactory with the given input stream,
-     * which must be parsable using DOM.
-     * @param resource XML resource to load bean definitions from
-     * @param parentBeanFactory parent bean factory
-     * @throws BeansException in case of loading or parsing errors
-     */
-    public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory) throws BeansException {
-        this(resource, parentBeanFactory, Collections.EMPTY_LIST);
-    }
-
-    /**
-     * Create a new XBeanXmlBeanFactory with the given input stream,
-     * which must be parsable using DOM.
-     * @param resource XML resource to load bean definitions from
-     * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
-     * @throws BeansException in case of loading or parsing errors
-     */
-    public XBeanXmlBeanFactory(Resource resource, List xmlPreprocessors) throws BeansException {
-        this(resource, null, xmlPreprocessors);
-    }
-
-    /**
-     * Create a new XBeanXmlBeanFactory with the given input stream,
-     * which must be parsable using DOM.
-     * @param resource XML resource to load bean definitions from
-     * @param parentBeanFactory parent bean factory
-     * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
-     * @throws BeansException in case of loading or parsing errors
-     */
-    public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory, List xmlPreprocessors) throws BeansException {
-        super(parentBeanFactory);
-        XBeanXmlBeanDefinitionReader reader = new XBeanXmlBeanDefinitionReader(null, this, xmlPreprocessors);
-        reader.loadBeanDefinitions(resource);
-    }
-
-}
+/**
+ * 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.xbean.spring.context.v2;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.core.io.Resource;
+
+import java.util.Collections;
+import java.util.List;
+
+public class XBeanXmlBeanFactory extends DefaultListableBeanFactory {
+
+    /**
+     * Create a new XBeanXmlBeanFactory with the given resource,
+     * which must be parsable using DOM.
+     * @param resource XML resource to load bean definitions from
+     * @throws BeansException in case of loading or parsing errors
+     */
+    public XBeanXmlBeanFactory(Resource resource) throws BeansException {
+        this(resource, null, Collections.EMPTY_LIST);
+    }
+
+    /**
+     * Create a new XBeanXmlBeanFactory with the given input stream,
+     * which must be parsable using DOM.
+     * @param resource XML resource to load bean definitions from
+     * @param parentBeanFactory parent bean factory
+     * @throws BeansException in case of loading or parsing errors
+     */
+    public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory) throws BeansException {
+        this(resource, parentBeanFactory, Collections.EMPTY_LIST);
+    }
+
+    /**
+     * Create a new XBeanXmlBeanFactory with the given input stream,
+     * which must be parsable using DOM.
+     * @param resource XML resource to load bean definitions from
+     * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
+     * @throws BeansException in case of loading or parsing errors
+     */
+    public XBeanXmlBeanFactory(Resource resource, List xmlPreprocessors) throws BeansException {
+        this(resource, null, xmlPreprocessors);
+    }
+
+    /**
+     * Create a new XBeanXmlBeanFactory with the given input stream,
+     * which must be parsable using DOM.
+     * @param resource XML resource to load bean definitions from
+     * @param parentBeanFactory parent bean factory
+     * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
+     * @throws BeansException in case of loading or parsing errors
+     */
+    public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory, List xmlPreprocessors) throws BeansException {
+        super(parentBeanFactory);
+        XBeanXmlBeanDefinitionReader reader = new XBeanXmlBeanDefinitionReader(null, this, xmlPreprocessors);
+        reader.loadBeanDefinitions(resource);
+    }
+
+}

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanXmlBeanFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanBeanDefinitionParserDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanBeanDefinitionParserDelegate.java?rev=1393346&r1=1393345&r2=1393346&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanBeanDefinitionParserDelegate.java (original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanBeanDefinitionParserDelegate.java Wed Oct  3 08:38:26 2012
@@ -1,99 +1,99 @@
-/**
- * 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.xbean.spring.context.v2c;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.xbean.spring.context.impl.PropertyEditorHelper;
-import org.apache.xbean.spring.context.impl.QNameReflectionHelper;
-import org.apache.xbean.spring.context.v2.XBeanNamespaceHandler;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
-import org.springframework.beans.factory.xml.XmlReaderContext;
-import org.springframework.util.StringUtils;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class XBeanBeanDefinitionParserDelegate extends BeanDefinitionParserDelegate {
-
-    public static final String QNAME_ELEMENT = "qname";
-    
-    private XBeanQNameHelper qnameHelper;
-    
-    public XBeanBeanDefinitionParserDelegate(XmlReaderContext readerContext) {
-        super(readerContext);
-        qnameHelper = new XBeanQNameHelper(readerContext);
-    }
-
-    public Object parsePropertySubElement(Element ele, BeanDefinition bd, String defaultTypeClassName) {
-        if (!isDefaultNamespace(ele.getNamespaceURI())) {
-            return internalParseNestedCustomElement(ele, bd);
-        } 
-        else if (ele.getTagName().equals(QNAME_ELEMENT)) {
-            return parseQNameElement(ele);
-        } 
-        else {
-            return super.parsePropertySubElement(ele, bd, defaultTypeClassName);
-        }
-    }
-
-    public AbstractBeanDefinition parseBeanDefinitionElement(Element ele, String beanName, BeanDefinition containingBean) {
-        AbstractBeanDefinition bd = super.parseBeanDefinitionElement(ele, beanName, containingBean);
-        qnameHelper.coerceNamespaceAwarePropertyValues(bd, ele);
-        return bd;
-    }
-    
-    public boolean isDefaultNamespace(String namespaceUri) {
-        return (!StringUtils.hasLength(namespaceUri) || 
-               BEANS_NAMESPACE_URI.equals(namespaceUri)) ||
-               XBeanNamespaceHandler.SPRING_SCHEMA.equals(namespaceUri) ||
-               XBeanNamespaceHandler.SPRING_SCHEMA_COMPAT.equals(namespaceUri);
-    }
-    
-    protected Object parseQNameElement(Element element) {
-        return QNameReflectionHelper.createQName(element, getElementText(element));
-    }
-
-    protected String getElementText(Element element) {
-        StringBuffer buffer = new StringBuffer();
-        NodeList nodeList = element.getChildNodes();
-        for (int i = 0, size = nodeList.getLength(); i < size; i++) {
-            Node node = nodeList.item(i);
-            if (node.getNodeType() == Node.TEXT_NODE) {
-                buffer.append(node.getNodeValue());
-            }
-        }
-        return buffer.toString();
-    }
-    
-    private Object internalParseNestedCustomElement(Element candidateEle, BeanDefinition containingBeanDefinition) {
-        try {
-            Method mth = getClass().getSuperclass().getDeclaredMethod("parseNestedCustomElement", new Class[] { Element.class, BeanDefinition.class });
-            mth.setAccessible(true);
-            return mth.invoke(this, new Object[] { candidateEle, containingBeanDefinition });
-        } catch (Exception e) {
-            if (e instanceof InvocationTargetException && e.getCause() instanceof RuntimeException) {
-                throw (RuntimeException) e.getCause();
-            }
-            throw (IllegalStateException) new IllegalStateException("Unable to invoke parseNestedCustomElement method").initCause(e);
-        }
-    }
-
-}
+/**
+ * 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.xbean.spring.context.v2c;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.xbean.spring.context.impl.PropertyEditorHelper;
+import org.apache.xbean.spring.context.impl.QNameReflectionHelper;
+import org.apache.xbean.spring.context.v2.XBeanNamespaceHandler;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
+import org.springframework.beans.factory.xml.XmlReaderContext;
+import org.springframework.util.StringUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class XBeanBeanDefinitionParserDelegate extends BeanDefinitionParserDelegate {
+
+    public static final String QNAME_ELEMENT = "qname";
+    
+    private XBeanQNameHelper qnameHelper;
+    
+    public XBeanBeanDefinitionParserDelegate(XmlReaderContext readerContext) {
+        super(readerContext);
+        qnameHelper = new XBeanQNameHelper(readerContext);
+    }
+
+    public Object parsePropertySubElement(Element ele, BeanDefinition bd, String defaultTypeClassName) {
+        if (!isDefaultNamespace(ele.getNamespaceURI())) {
+            return internalParseNestedCustomElement(ele, bd);
+        } 
+        else if (ele.getTagName().equals(QNAME_ELEMENT)) {
+            return parseQNameElement(ele);
+        } 
+        else {
+            return super.parsePropertySubElement(ele, bd, defaultTypeClassName);
+        }
+    }
+
+    public AbstractBeanDefinition parseBeanDefinitionElement(Element ele, String beanName, BeanDefinition containingBean) {
+        AbstractBeanDefinition bd = super.parseBeanDefinitionElement(ele, beanName, containingBean);
+        qnameHelper.coerceNamespaceAwarePropertyValues(bd, ele);
+        return bd;
+    }
+    
+    public boolean isDefaultNamespace(String namespaceUri) {
+        return (!StringUtils.hasLength(namespaceUri) || 
+               BEANS_NAMESPACE_URI.equals(namespaceUri)) ||
+               XBeanNamespaceHandler.SPRING_SCHEMA.equals(namespaceUri) ||
+               XBeanNamespaceHandler.SPRING_SCHEMA_COMPAT.equals(namespaceUri);
+    }
+    
+    protected Object parseQNameElement(Element element) {
+        return QNameReflectionHelper.createQName(element, getElementText(element));
+    }
+
+    protected String getElementText(Element element) {
+        StringBuffer buffer = new StringBuffer();
+        NodeList nodeList = element.getChildNodes();
+        for (int i = 0, size = nodeList.getLength(); i < size; i++) {
+            Node node = nodeList.item(i);
+            if (node.getNodeType() == Node.TEXT_NODE) {
+                buffer.append(node.getNodeValue());
+            }
+        }
+        return buffer.toString();
+    }
+    
+    private Object internalParseNestedCustomElement(Element candidateEle, BeanDefinition containingBeanDefinition) {
+        try {
+            Method mth = getClass().getSuperclass().getDeclaredMethod("parseNestedCustomElement", new Class[] { Element.class, BeanDefinition.class });
+            mth.setAccessible(true);
+            return mth.invoke(this, new Object[] { candidateEle, containingBeanDefinition });
+        } catch (Exception e) {
+            if (e instanceof InvocationTargetException && e.getCause() instanceof RuntimeException) {
+                throw (RuntimeException) e.getCause();
+            }
+            throw (IllegalStateException) new IllegalStateException("Unable to invoke parseNestedCustomElement method").initCause(e);
+        }
+    }
+
+}

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanBeanDefinitionParserDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanNamespaceHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanQNameHelper.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanQNameHelper.java?rev=1393346&r1=1393345&r2=1393346&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanQNameHelper.java (original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanQNameHelper.java Wed Oct  3 08:38:26 2012
@@ -1,118 +1,118 @@
-/**
- * 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.xbean.spring.context.v2c;
-
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-
-import org.apache.xbean.spring.context.impl.PropertyEditorHelper;
-import org.apache.xbean.spring.context.impl.QNameReflectionHelper;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.xml.XmlReaderContext;
-import org.w3c.dom.Element;
-
-public class XBeanQNameHelper {
-
-    private XmlReaderContext readerContext;
-    
-    private boolean qnameIsOnClassPath;
-
-    private boolean initQNameOnClassPath;
-    
-    public XBeanQNameHelper(XmlReaderContext readerContext) {
-        this.readerContext = readerContext;
-    }
-    
-    /**
-     * Any namespace aware property values (such as QNames) need to be coerced
-     * while we still have access to the XML Element from which its value comes -
-     * so lets do that now before we trash the DOM and just have the bean
-     * definition.
-     */
-    public void coerceNamespaceAwarePropertyValues(BeanDefinition definition, Element element) {
-        if (definition instanceof AbstractBeanDefinition && isQnameIsOnClassPath()) {
-            AbstractBeanDefinition bd = (AbstractBeanDefinition) definition;
-            // lets check for any QName types
-            BeanInfo beanInfo = getBeanInfo(bd.getBeanClassName());
-            if (beanInfo != null) {
-                PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
-                for (int i = 0; i < descriptors.length; i++) {
-                    QNameReflectionHelper.coerceNamespaceAwarePropertyValues(bd, element, descriptors, i);
-                }
-            }
-        }
-    }
-
-    public BeanInfo getBeanInfo(String className) throws BeanDefinitionStoreException {
-        if (className == null) {
-            return null;
-        }
-
-        BeanInfo info = null;
-        Class type = null;
-        try {
-            type = loadClass(className);
-        }
-        catch (ClassNotFoundException e) {
-            throw new BeanDefinitionStoreException("Failed to load type: " + className + ". Reason: " + e, e);
-        }
-        try {
-            info = Introspector.getBeanInfo(type);
-        }
-        catch (IntrospectionException e) {
-            throw new BeanDefinitionStoreException("Failed to introspect type: " + className + ". Reason: " + e, e);
-        }
-        return info;
-    }
-
-    /**
-     * Attempts to load the class on the current thread context class loader or
-     * the class loader which loaded us
-     */
-    protected Class loadClass(String name) throws ClassNotFoundException {
-        ClassLoader beanClassLoader = readerContext.getReader().getBeanClassLoader();
-        if (beanClassLoader != null) {
-            try {
-                return beanClassLoader.loadClass(name);
-            }
-            catch (ClassNotFoundException e) {
-            }
-        }
-        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
-        if (contextClassLoader != null) {
-            try {
-                return contextClassLoader.loadClass(name);
-            }
-            catch (ClassNotFoundException e) {
-            }
-        }
-        return getClass().getClassLoader().loadClass(name);
-    }
-
-    protected boolean isQnameIsOnClassPath() {
-        if (initQNameOnClassPath == false) {
-            qnameIsOnClassPath = PropertyEditorHelper.loadClass("javax.xml.namespace.QName") != null;
-            initQNameOnClassPath = true;
-        }
-        return qnameIsOnClassPath;
-    }
-    
-}
+/**
+ * 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.xbean.spring.context.v2c;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+
+import org.apache.xbean.spring.context.impl.PropertyEditorHelper;
+import org.apache.xbean.spring.context.impl.QNameReflectionHelper;
+import org.springframework.beans.factory.BeanDefinitionStoreException;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.xml.XmlReaderContext;
+import org.w3c.dom.Element;
+
+public class XBeanQNameHelper {
+
+    private XmlReaderContext readerContext;
+    
+    private boolean qnameIsOnClassPath;
+
+    private boolean initQNameOnClassPath;
+    
+    public XBeanQNameHelper(XmlReaderContext readerContext) {
+        this.readerContext = readerContext;
+    }
+    
+    /**
+     * Any namespace aware property values (such as QNames) need to be coerced
+     * while we still have access to the XML Element from which its value comes -
+     * so lets do that now before we trash the DOM and just have the bean
+     * definition.
+     */
+    public void coerceNamespaceAwarePropertyValues(BeanDefinition definition, Element element) {
+        if (definition instanceof AbstractBeanDefinition && isQnameIsOnClassPath()) {
+            AbstractBeanDefinition bd = (AbstractBeanDefinition) definition;
+            // lets check for any QName types
+            BeanInfo beanInfo = getBeanInfo(bd.getBeanClassName());
+            if (beanInfo != null) {
+                PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
+                for (int i = 0; i < descriptors.length; i++) {
+                    QNameReflectionHelper.coerceNamespaceAwarePropertyValues(bd, element, descriptors, i);
+                }
+            }
+        }
+    }
+
+    public BeanInfo getBeanInfo(String className) throws BeanDefinitionStoreException {
+        if (className == null) {
+            return null;
+        }
+
+        BeanInfo info = null;
+        Class type = null;
+        try {
+            type = loadClass(className);
+        }
+        catch (ClassNotFoundException e) {
+            throw new BeanDefinitionStoreException("Failed to load type: " + className + ". Reason: " + e, e);
+        }
+        try {
+            info = Introspector.getBeanInfo(type);
+        }
+        catch (IntrospectionException e) {
+            throw new BeanDefinitionStoreException("Failed to introspect type: " + className + ". Reason: " + e, e);
+        }
+        return info;
+    }
+
+    /**
+     * Attempts to load the class on the current thread context class loader or
+     * the class loader which loaded us
+     */
+    protected Class loadClass(String name) throws ClassNotFoundException {
+        ClassLoader beanClassLoader = readerContext.getReader().getBeanClassLoader();
+        if (beanClassLoader != null) {
+            try {
+                return beanClassLoader.loadClass(name);
+            }
+            catch (ClassNotFoundException e) {
+            }
+        }
+        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+        if (contextClassLoader != null) {
+            try {
+                return contextClassLoader.loadClass(name);
+            }
+            catch (ClassNotFoundException e) {
+            }
+        }
+        return getClass().getClassLoader().loadClass(name);
+    }
+
+    protected boolean isQnameIsOnClassPath() {
+        if (initQNameOnClassPath == false) {
+            qnameIsOnClassPath = PropertyEditorHelper.loadClass("javax.xml.namespace.QName") != null;
+            initQNameOnClassPath = true;
+        }
+        return qnameIsOnClassPath;
+    }
+    
+}

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanQNameHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/LogFacade.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/LogFacade.java?rev=1393346&r1=1393345&r2=1393346&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/LogFacade.java (original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/LogFacade.java Wed Oct  3 08:38:26 2012
@@ -1,24 +1,24 @@
-/**
- * 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.xbean.spring.generator;
-
-public interface LogFacade {
-
-    void log(String message);
-    
-    void log(String message, int level);
-}
+/**
+ * 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.xbean.spring.generator;
+
+public interface LogFacade {
+
+    void log(String message);
+    
+    void log(String message, int level);
+}

Propchange: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/LogFacade.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message