cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1711427 - in /cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347: ./ src/main/java/org/apache/cocoon/spring/configurator/ src/main/java/org/apache/cocoon/spring/configurator/impl/
Date Fri, 30 Oct 2015 08:38:39 GMT
Author: ilgrosso
Date: Fri Oct 30 08:38:38 2015
New Revision: 1711427

URL: http://svn.apache.org/viewvc?rev=1711427&view=rev
Log:
[COCOON-2347] Applying provided patches + small reworks (removing deprecates and adding Override)

Modified:
    cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/pom.xml
    cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/ResourceUtils.java
    cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/AbstractElementParser.java
    cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/BeanMapElementParser.java
    cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/WildcardBeanMap.java

Modified: cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/pom.xml?rev=1711427&r1=1711426&r2=1711427&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/pom.xml (original)
+++ cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/pom.xml Fri Oct 30
08:38:38 2015
@@ -26,11 +26,11 @@
   <parent>
     <artifactId>cocoon</artifactId>
     <groupId>org.apache.cocoon</groupId>
-    <version>9</version>
+    <version>10-COCOON-2347-SNAPSHOT</version>
     <relativePath />
   </parent>
   <artifactId>cocoon-spring-configurator</artifactId>
-  <version>2.2.2-SNAPSHOT</version>
+  <version>2.2.2-COCOON-2347-SNAPSHOT</version>
   <name>Cocoon Spring Configurator</name>
   <description>
     The Cocoon Spring Configurator is an extension for the Spring framework.
@@ -57,15 +57,14 @@
     <docs.version>2.2.1</docs.version>
     <docs.urlRelativizer>../../../../../</docs.urlRelativizer>    
 
-    <slf4j.version>1.7.0</slf4j.version>
-    <logback.version>1.0.7</logback.version>
+    <slf4j.version>1.7.12</slf4j.version>
+    <logback.version>1.1.3</logback.version>
   </properties>
 
   <dependencies>
     <dependency>
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-configuration-api</artifactId>
-      <version>1.0.4</version>
     </dependency>
     <dependency>
       <groupId>commons-io</groupId>
@@ -102,7 +101,6 @@
     <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>
-      <version>1.1.1</version>
       <scope>provided</scope>
     </dependency>
     
@@ -142,7 +140,7 @@
     <pluginManagement>
       <plugins>
         <!-- This plugin's configuration is used to store Eclipse m2e settings only. 
-             It has no influence on the Maven build itself. -->
+        It has no influence on the Maven build itself. -->
         <plugin>
           <groupId>org.eclipse.m2e</groupId>
           <artifactId>lifecycle-mapping</artifactId>
@@ -173,7 +171,7 @@
     <plugins>
       <plugin>
         <artifactId>maven-release-plugin</artifactId>
-        <version>2.2.2</version>
+        <version>2.5.2</version>
         <configuration>
           <tagBase>https://svn.apache.org/repos/asf/cocoon/subprojects/cocoon-spring-configurator/tags/</tagBase>
         </configuration>
@@ -182,14 +180,14 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
-        <version>3.1</version>
+        <version>3.4</version>
         <configuration>
           <locales>en</locales>
           <reportPlugins>
             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-project-info-reports-plugin</artifactId>
-              <version>2.5.1</version>
+              <version>2.8</version>
               <configuration>
                 <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                 <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
@@ -208,7 +206,7 @@
             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-changes-plugin</artifactId>
-              <version>2.7.1</version>
+              <version>2.11</version>
               <reportSets>
                 <reportSet>
                   <reports>

Modified: cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/ResourceUtils.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/ResourceUtils.java?rev=1711427&r1=1711426&r2=1711427&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/ResourceUtils.java
(original)
+++ cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/ResourceUtils.java
Fri Oct 30 08:38:38 2015
@@ -161,7 +161,7 @@ public abstract class ResourceUtils {
      *
      * @return A new comparator for resources.
      */
-    public static Comparator getResourceComparator() {
+    public static Comparator<Resource> getResourceComparator() {
         return new ResourceComparator();
     }
 
@@ -169,21 +169,17 @@ public abstract class ResourceUtils {
      * Class implementing a simple resource comparator as described
      * here: {@link ResourceUtils#getResourceComparator}.
      */
-    protected final static class ResourceComparator implements Comparator {
+    protected final static class ResourceComparator implements Comparator<Resource>
{
 
         protected static final String WEB_INF_CLASSES_META_INF_COCOON = "/WEB-INF/classes/META-INF/cocoon/";
 
         /**
          * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
          */
-        public int compare(Object o1, Object o2) {
-            if (!(o1 instanceof Resource) || !(o2 instanceof Resource)) {
-                return 0;
-            }
-
+        public int compare(Resource o1, Resource o2) {
             try {
-                String name1 = ((Resource) o1).getURL().toExternalForm();
-                String name2 = ((Resource) o2).getURL().toExternalForm();
+                String name1 = o1.getURL().toExternalForm();
+                String name2 = o2.getURL().toExternalForm();
                 // replace '\' with '/'
                 name1 = name1.replace('\\', '/');
                 name2 = name2.replace('\\', '/');
@@ -201,7 +197,7 @@ public abstract class ResourceUtils {
             }
 
             // default behaviour:
-            return ((Resource) o1).getFilename().compareTo(((Resource) o2).getFilename());
+            return o1.getFilename().compareTo(o2.getFilename());
         }
     }
 

Modified: cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/AbstractElementParser.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/AbstractElementParser.java?rev=1711427&r1=1711426&r2=1711427&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/AbstractElementParser.java
(original)
+++ cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/AbstractElementParser.java
Fri Oct 30 08:38:38 2015
@@ -68,16 +68,16 @@ public abstract class AbstractElementPar
      * Returns all Element children of an Element that have the given local name.
      */
     protected Element[] getChildElements(Element element, String localName) {
-        final ArrayList elements = new ArrayList();
+        final List<Element> elements = new ArrayList<Element>();
         final NodeList nodeList = element.getChildNodes();
         for (int i = 0; i < nodeList.getLength(); i++) {
             final Node node = nodeList.item(i);
             if (node instanceof Element && localName.equals(node.getLocalName()))
{
-                elements.add(node);
+                elements.add((Element) node);
             }
         }
 
-        return (Element[]) elements.toArray(new Element[elements.size()]);
+        return elements.toArray(new Element[elements.size()]);
     }
 
     /**
@@ -101,8 +101,8 @@ public abstract class AbstractElementPar
      */
     protected void register(BeanDefinition beanDef, String beanName, String alias, BeanDefinitionRegistry
registry) {
         if (this.logger.isDebugEnabled()) {
-            this.logger.debug("Registering bean with name " + beanName +
-                              (alias != null ? " (alias=" + alias + ") " : " ") + beanDef);
+            this.logger.debug("Registering bean with name " + beanName + (alias != null ?
" (alias=" + alias + ") "
+                    : " ") + beanDef);
         }
         final BeanDefinitionHolder holder;
         if (alias != null) {
@@ -128,22 +128,24 @@ public abstract class AbstractElementPar
         String id = element.getAttribute(BeanDefinitionParserDelegate.ID_ATTRIBUTE);
         String nameAttr = element.getAttribute(BeanDefinitionParserDelegate.NAME_ATTRIBUTE);
 
-        final List aliases = new ArrayList();
+        final List<String> aliases = new ArrayList<String>();
         if (StringUtils.hasLength(nameAttr)) {
-            String[] nameArr = StringUtils.tokenizeToStringArray(nameAttr, BeanDefinitionParserDelegate.BEAN_NAME_DELIMITERS);
+            String[] nameArr = StringUtils.tokenizeToStringArray(
+                    nameAttr, BeanDefinitionParserDelegate.MULTI_VALUE_ATTRIBUTE_DELIMITERS);
             aliases.addAll(Arrays.asList(nameArr));
         }
 
         String beanName = id;
         if (!StringUtils.hasText(beanName) && !aliases.isEmpty()) {
-            beanName = (String) aliases.remove(0);
+            beanName = aliases.remove(0);
             if (this.logger.isDebugEnabled()) {
-                this.logger.debug("No XML 'id' specified - using '" + beanName +
-                                  "' as bean name and " + aliases + " as aliases");
+                this.logger.debug("No XML 'id' specified - using '" + beanName + "' as bean
name and " + aliases
+                        + " as aliases");
             }
         }
 
-        final BeanDefinitionHolder holder = new BeanDefinitionHolder(beanDef, beanName, StringUtils.toStringArray(aliases));
+        final BeanDefinitionHolder holder =
+                new BeanDefinitionHolder(beanDef, beanName, StringUtils.toStringArray(aliases));
         BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry);
     }
 
@@ -152,11 +154,12 @@ public abstract class AbstractElementPar
      *
      * @param componentClass The class of the implementation.
      * @param initMethod Optional initialization method.
-     * @param requiresSettings If set to true, this bean has a property "settings" for the
-     *            settings object.
+     * @param requiresSettings If set to true, this bean has a property "settings" for the
settings object.
      * @return A new root bean definition.
      */
-    protected RootBeanDefinition createBeanDefinition(Class componentClass, String initMethod,
boolean requiresSettings) {
+    protected RootBeanDefinition createBeanDefinition(
+            Class<?> componentClass, String initMethod, boolean requiresSettings) {
+
         final RootBeanDefinition beanDef = new RootBeanDefinition();
         beanDef.setBeanClass(componentClass);
         fillBeanDefinition(beanDef, initMethod, requiresSettings);
@@ -169,10 +172,12 @@ public abstract class AbstractElementPar
      * @param componentClass The class of the implementation.
      * @param initMethod Optional initialization method.
      * @param requiresSettings If set to true, this bean has a property "settings" for the
-     *            settings object.
+     * settings object.
      * @return A new root bean definition.
      */
-    protected RootBeanDefinition createBeanDefinition(String componentClass, String initMethod,
boolean requiresSettings) {
+    protected RootBeanDefinition createBeanDefinition(
+            String componentClass, String initMethod, boolean requiresSettings) {
+
         final RootBeanDefinition beanDef = new RootBeanDefinition();
         beanDef.setBeanClassName(componentClass);
         fillBeanDefinition(beanDef, initMethod, requiresSettings);
@@ -197,12 +202,16 @@ public abstract class AbstractElementPar
      * @param beanName The name of the bean.
      * @param initMethod Optional initialization method.
      * @param requiresSettings If set to true, this bean has a property "settings" for the
-     *            settings object.
+     * settings object.
      * @param registry The bean registry.
      */
-    protected void addComponent(Class componentClass, String beanName,
-                                String initMethod, boolean requiresSettings,
-                                BeanDefinitionRegistry registry) {
+    protected void addComponent(
+            Class<?> componentClass,
+            String beanName,
+            String initMethod,
+            boolean requiresSettings,
+            BeanDefinitionRegistry registry) {
+
         final RootBeanDefinition beanDef = createBeanDefinition(componentClass, initMethod,
requiresSettings);
         register(beanDef, beanName, registry);
     }
@@ -214,12 +223,16 @@ public abstract class AbstractElementPar
      * @param beanName The name of the bean.
      * @param initMethod Optional initialization method.
      * @param requiresSettings If set to true, this bean has a property "settings" for the
-     *            settings object.
+     * settings object.
      * @param registry The bean registry.
      */
-    protected void addComponent(String componentClass, String beanName,
-                                String initMethod, boolean requiresSettings,
-                                BeanDefinitionRegistry registry) {
+    protected void addComponent(
+            String componentClass,
+            String beanName,
+            String initMethod,
+            boolean requiresSettings,
+            BeanDefinitionRegistry registry) {
+
         final RootBeanDefinition beanDef = createBeanDefinition(componentClass, initMethod,
requiresSettings);
         register(beanDef, beanName, registry);
     }

Modified: cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/BeanMapElementParser.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/BeanMapElementParser.java?rev=1711427&r1=1711426&r2=1711427&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/BeanMapElementParser.java
(original)
+++ cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/BeanMapElementParser.java
Fri Oct 30 08:38:38 2015
@@ -32,26 +32,32 @@ import org.w3c.dom.Element;
 public class BeanMapElementParser extends AbstractElementParser {
 
     /**
-     * @see org.springframework.beans.factory.xml.BeanDefinitionParser#parse(org.w3c.dom.Element,
org.springframework.beans.factory.xml.ParserContext)
+     * @see org.springframework.beans.factory.xml.BeanDefinitionParser#parse(org.w3c.dom.Element,
+     * org.springframework.beans.factory.xml.ParserContext)
      */
+    @Override
     public BeanDefinition parse(Element element, ParserContext parserContext) {
         // create a new bean definition for the aspect chain
         RootBeanDefinition beanDef = this.createBeanDefinition(BeanMap.class, null, false);
         final String type = this.getAttributeValue(element, "type", null);
         final Class typeClass;
         try {
-            typeClass = ClassUtils.forName(type);
+            typeClass = ClassUtils.forName(type, getClass().getClassLoader());
         } catch (ClassNotFoundException e) {
             throw new BeanDefinitionStoreException("Unable to load aspect class: " + type,
e);
         }
         beanDef.getPropertyValues().addPropertyValue("type", typeClass);
-        beanDef.getPropertyValues().addPropertyValue("checkParent", this.getAttributeValue(element,
"check-parent", "true"));
-        beanDef.getPropertyValues().addPropertyValue("stripPrefix", this.getAttributeValue(element,
"strip-prefix", "true"));
-        beanDef.getPropertyValues().addPropertyValue("hasProperties", this.getAttributeValue(element,
"has-properties", ""));
-        beanDef.getPropertyValues().addPropertyValue("keyProperty", this.getAttributeValue(element,
"key-property", ""));
+        beanDef.getPropertyValues().addPropertyValue(
+                "checkParent", this.getAttributeValue(element, "check-parent", "true"));
+        beanDef.getPropertyValues().addPropertyValue(
+                "stripPrefix", this.getAttributeValue(element, "strip-prefix", "true"));
+        beanDef.getPropertyValues().addPropertyValue(
+                "hasProperties", this.getAttributeValue(element, "has-properties", ""));
+        beanDef.getPropertyValues().addPropertyValue(
+                "keyProperty", this.getAttributeValue(element, "key-property", ""));
 
         // register bean if it's a global definition
-        if ( !parserContext.isNested() ) {
+        if (!parserContext.isNested()) {
             this.register(beanDef, element, parserContext.getRegistry());
         }
         return beanDef;

Modified: cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/WildcardBeanMap.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/WildcardBeanMap.java?rev=1711427&r1=1711426&r2=1711427&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/WildcardBeanMap.java
(original)
+++ cocoon/subprojects/cocoon-spring-configurator/branches/COCOON-2347/src/main/java/org/apache/cocoon/spring/configurator/impl/WildcardBeanMap.java
Fri Oct 30 08:38:38 2015
@@ -53,13 +53,13 @@ public class WildcardBeanMap extends Bea
     protected String[] lookupBeans(ListableBeanFactory factory) {
         List<String> filteredBeanNames = new ArrayList<String>();
 
-        for (String beanName : factory.getBeanNamesForType(null)) {
+         for (String beanName : factory.getBeanNamesForType(null, true, true)) {
             if (PatternMatchUtils.simpleMatch(this.wildcard, beanName)) {
                 filteredBeanNames.add(beanName);
             }
         }
 
-        return filteredBeanNames.toArray(new String[0]);
+        return filteredBeanNames.toArray(new String[filteredBeanNames.size()]);
     }
 
     @Override



Mime
View raw message