You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
(387) |
May
(1066) |
Jun
(689) |
Jul
(504) |
Aug
(697) |
Sep
(660) |
Oct
(591) |
Nov
(393) |
Dec
(324) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(567) |
Feb
(448) |
Mar
(461) |
Apr
(368) |
May
(887) |
Jun
(243) |
Jul
(429) |
Aug
(670) |
Sep
(648) |
Oct
(684) |
Nov
(599) |
Dec
(317) |
2008 |
Jan
(388) |
Feb
(400) |
Mar
(323) |
Apr
(214) |
May
(228) |
Jun
(120) |
Jul
(168) |
Aug
(64) |
Sep
(78) |
Oct
(127) |
Nov
(28) |
Dec
|
2009 |
Jan
|
Feb
(1) |
Mar
(22) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Juergen H. <jho...@us...> - 2006-04-21 00:05:20
|
Update of /cvsroot/springframework/spring/samples/jpetstore/war/WEB-INF/jsp/spring In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15444/samples/jpetstore/war/WEB-INF/jsp/spring Modified Files: Tag: mbranch-1-2 Cart.jsp Log Message: fixed "Next" link Index: Cart.jsp =================================================================== RCS file: /cvsroot/springframework/spring/samples/jpetstore/war/WEB-INF/jsp/spring/Cart.jsp,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** Cart.jsp 4 Dec 2003 08:44:22 -0000 1.1 --- Cart.jsp 21 Apr 2006 00:05:13 -0000 1.1.4.1 *************** *** 58,62 **** <a href="<c:url value="viewCart.do?page=previousCart"/>"><font color="green"><B><< Prev</B></font></a> </c:if> ! <c:if test="${!cart.cartItemList.firstPage}"> <a href="<c:url value="viewCart.do?page=nextCart"/>"><font color="green"><B>Next >></B></font></a> </c:if> --- 58,62 ---- <a href="<c:url value="viewCart.do?page=previousCart"/>"><font color="green"><B><< Prev</B></font></a> </c:if> ! <c:if test="${!cart.cartItemList.lastPage}"> <a href="<c:url value="viewCart.do?page=nextCart"/>"><font color="green"><B>Next >></B></font></a> </c:if> |
From: Juergen H. <jho...@us...> - 2006-04-20 19:21:00
|
Update of /cvsroot/springframework/spring/test/org/springframework/transaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15553/test/org/springframework/transaction Modified Files: TransactionNamespaceHandlerTests.java Log Message: polishing Index: TransactionNamespaceHandlerTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/transaction/TransactionNamespaceHandlerTests.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TransactionNamespaceHandlerTests.java 16 Feb 2006 18:54:25 -0000 1.3 --- TransactionNamespaceHandlerTests.java 20 Apr 2006 19:20:56 -0000 1.4 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 20,23 **** --- 20,26 ---- import junit.framework.TestCase; + + import org.springframework.aop.support.AopUtils; + import org.springframework.beans.ITestBean; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; *************** *** 25,30 **** import org.springframework.transaction.interceptor.TransactionAttributeSource; import org.springframework.transaction.interceptor.TransactionInterceptor; - import org.springframework.beans.ITestBean; - import org.springframework.aop.support.AopUtils; /** --- 28,31 ---- *************** *** 35,45 **** private ApplicationContext context; private Method getAgeMethod; private Method setAgeMethod; public void setUp() throws Exception { ! this.context = new ClassPathXmlApplicationContext("org/springframework/transaction/transactionNamespaceHandlerTests.xml"); ! getAgeMethod = ITestBean.class.getMethod("getAge",new Class[0]); ! setAgeMethod = ITestBean.class.getMethod("setAge",new Class[] {int.class}); } --- 36,48 ---- private ApplicationContext context; + private Method getAgeMethod; + private Method setAgeMethod; public void setUp() throws Exception { ! this.context = new ClassPathXmlApplicationContext("transactionNamespaceHandlerTests.xml", getClass()); ! this.getAgeMethod = ITestBean.class.getMethod("getAge", new Class[0]); ! this.setAgeMethod = ITestBean.class.getMethod("setAge", new Class[] {int.class}); } *************** *** 88,90 **** --- 91,94 ---- return (ITestBean)context.getBean("testBean"); } + } |
From: Juergen H. <jho...@us...> - 2006-04-20 19:20:59
|
Update of /cvsroot/springframework/spring/src/org/springframework/scripting/groovy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15553/src/org/springframework/scripting/groovy Modified Files: GroovyScriptFactory.java Log Message: polishing Index: GroovyScriptFactory.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/scripting/groovy/GroovyScriptFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GroovyScriptFactory.java 11 Feb 2006 12:59:33 -0000 1.3 --- GroovyScriptFactory.java 20 Apr 2006 19:20:56 -0000 1.4 *************** *** 25,30 **** import org.springframework.scripting.ScriptFactory; import org.springframework.scripting.ScriptSource; - import org.springframework.util.ClassUtils; import org.springframework.util.Assert; /** --- 25,30 ---- import org.springframework.scripting.ScriptFactory; import org.springframework.scripting.ScriptSource; import org.springframework.util.Assert; + import org.springframework.util.ClassUtils; /** *************** *** 55,59 **** * @param scriptSourceLocator a locator that points to the source of the script. * Interpreted by the post-processor that actually creates the script. ! * @throws IllegalArgumentException if the supplied argument is <code>null></code> or consists wholly of whitespace */ public GroovyScriptFactory(String scriptSourceLocator) { --- 55,59 ---- * @param scriptSourceLocator a locator that points to the source of the script. * Interpreted by the post-processor that actually creates the script. ! * @throws IllegalArgumentException if the supplied String is empty */ public GroovyScriptFactory(String scriptSourceLocator) { |
From: Juergen H. <jho...@us...> - 2006-04-20 19:19:00
|
Update of /cvsroot/springframework/spring In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14360 Modified Files: changelog.txt Log Message: final preparations for 2.0 M4 Index: changelog.txt =================================================================== RCS file: /cvsroot/springframework/spring/changelog.txt,v retrieving revision 1.446 retrieving revision 1.447 diff -C2 -d -r1.446 -r1.447 *** changelog.txt 18 Apr 2006 21:20:18 -0000 1.446 --- changelog.txt 20 Apr 2006 19:18:54 -0000 1.447 *************** *** 4,8 **** ! Changes in version 2.0 M4 (20.4.2006) ------------------------------------- --- 4,8 ---- ! Changes in version 2.0 M4 (21.4.2006) ------------------------------------- *************** *** 27,32 **** --- 27,34 ---- * refined BeanWrapperImpl to apply map key conversion on property access as well, not just on property setting * refined BeanWrapperImpl to inject original collections as far as possible (i.e. unless element conversion necessary) + * refined BeanWrapperImpl to correctly detect element type of collections with parameterization in superclass/interface * BeanWrapperImpl does not register a StringArrayPropertyEditor by default anymore * fixed BeanWrapperImpl to convert a ManagedProperties instance into a plain Properties instance before applying it + * fixed BeanWrapperImpl to fall back to approximate collection/map type if it cannot reinstantiate given collection/map * fixed BeanArrayPropertyEditor to translate null value to null byte array * added CharArrayPropertyEditor to translate String value into char array *************** *** 35,38 **** --- 37,41 ---- * PropertyPlaceholderConfigurer catches and logs SecurityException on system property access, continuing resolution * FieldRetrievingFactoryBean is able to access non-public fields as well + * added "propertiesArray" bean property to PropertiesFactoryBean, for merging multiple local Properties instances * fixed AbstractBeanFactory to avoid potential deadlock on singleton destruction with concurrent singleton creation * AbstractBeanFactory always registers inner beans with a unique name, adapting overlapping names accordingly *************** *** 61,64 **** --- 64,68 ---- * turned JdbcTemplate's "query(PreparedStatementCreator,PreparedStatementSetter,ResultSetExtractor rse)" method public * JdbcTemplate does not check static SQL for bind parameters anymore, to avoid overhead of double parsing + * improved JdbcTemplate's logging of ignored SQLWarnings, including SQL state and error code in the log output * refined NativeJdbcExtractorAdapter to retry with DatabaseMetaData Connection if extraction failed (for Hibernate 3.1) * added NamedParameterJdbcTemplate which provides named parameters support for query and update functionality *************** *** 86,89 **** --- 90,94 ---- * refined JPA EntityManagerFactoryUtils to explicitly suspend pre-bound EM in the course of transaction suspension * removed support for obsolete "EntityManagerFactory.getEntityManager()" method from LocalEntityManagerFactoryBean + * added "entityManagerInterface" property to SharedEntityManagerAdapter, for exposing a vendor-extended interface * adapted OpenEntityManagerInViewFilter/Interceptor to not specify obsolete PersistenceContextType.EXTENDED anymore * fixed JpaDaoSupport's "setEntityManager" method to accept an EntityManager instead of an EntityManagerFactory *************** *** 122,125 **** --- 127,131 ---- Package org.springframework.validation + * renamed SimpleMapBindingResult to MapBindingResult * DataBinder does not use a default StringArrayPropertyEditor anymore, to nicely handle select list entries with commas * fixed ValidationUtils's "invokeValidator" to work correctly even in case of a null reference as object to be validated |
From: Juergen H. <jho...@us...> - 2006-04-20 19:01:12
|
Update of /cvsroot/springframework/spring/src/org/springframework/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4348/src/org/springframework/core Modified Files: CollectionFactory.java Log Message: fall back to approximate collection/map type if we cannot reinstantiate given collection/map Index: CollectionFactory.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/core/CollectionFactory.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CollectionFactory.java 19 Oct 2005 19:19:02 -0000 1.8 --- CollectionFactory.java 20 Apr 2006 19:00:59 -0000 1.9 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 17,20 **** --- 17,22 ---- package org.springframework.core; + import java.util.ArrayList; + import java.util.Collection; import java.util.HashMap; import java.util.HashSet; *************** *** 22,27 **** --- 24,34 ---- import java.util.LinkedHashMap; import java.util.LinkedHashSet; + import java.util.List; import java.util.Map; import java.util.Set; + import java.util.SortedMap; + import java.util.SortedSet; + import java.util.TreeMap; + import java.util.TreeSet; import org.apache.commons.collections.map.CaseInsensitiveMap; *************** *** 33,36 **** --- 40,45 ---- import org.apache.commons.logging.LogFactory; + import org.springframework.util.Assert; + /** * Factory for collections, being aware of JDK 1.4+ extended collections *************** *** 175,178 **** --- 184,256 ---- /** + * Create the most approximate collection for the given collection class. + * <p>Tries to create the given collection class. If that fails, + * an ArrayList, TreeSet or linked Set will be used as fallback for + * a List, SortedSet or Set, respectively. + * @param collectionClass the original collection class + * @param initialCapacity the initial capacity + * @return the new collection instance + * @see java.util.ArrayList + * @see java.util.TreeSet + * @see #createLinkedSetIfPossible + */ + public static Collection createApproximateCollection(Class collectionClass, int initialCapacity) { + Assert.notNull(collectionClass, "Collection class must not be null"); + if (!collectionClass.isInterface()) { + try { + return (Collection) collectionClass.newInstance(); + } + catch (Exception ex) { + if (logger.isDebugEnabled()) { + logger.debug( + "Could not instantiate collection type [" + collectionClass.getName() + "]: " + ex.getMessage()); + } + } + } + if (List.class.isAssignableFrom(collectionClass)) { + return new ArrayList(initialCapacity); + } + else if (SortedSet.class.isAssignableFrom(collectionClass)) { + return new TreeSet(); + } + else { + return createLinkedSetIfPossible(initialCapacity); + } + } + + /** + * Create the most approximate map for the given map class. + * <p>Tries to create the given map class. If that fails, a TreeMap or + * linked Map will be used as fallback for a SortedMap or Map, respectively. + * @param mapClass the original map class + * @param initialCapacity the initial capacity + * @return the new collection instance + * @see java.util.ArrayList + * @see java.util.TreeSet + * @see #createLinkedSetIfPossible + */ + public static Map createApproximateMap(Class mapClass, int initialCapacity) { + Assert.notNull(mapClass, "Map class must not be null"); + if (!mapClass.isInterface()) { + try { + return (Map) mapClass.newInstance(); + } + catch (Exception ex) { + if (logger.isDebugEnabled()) { + logger.debug( + "Could not instantiate map type [" + mapClass.getName() + "]: " + ex.getMessage()); + } + } + } + if (SortedMap.class.isAssignableFrom(mapClass)) { + return new TreeMap(); + } + else { + return createLinkedMapIfPossible(initialCapacity); + } + } + + + /** * Actual creation of JDK 1.4+ Collections. * In separate inner class to avoid runtime dependency on JDK 1.4+. |
From: Juergen H. <jho...@us...> - 2006-04-20 19:01:12
|
Update of /cvsroot/springframework/spring/test/org/springframework/beans In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4348/test/org/springframework/beans Modified Files: BeanWrapperTests.java Log Message: fall back to approximate collection/map type if we cannot reinstantiate given collection/map Index: BeanWrapperTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/beans/BeanWrapperTests.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** BeanWrapperTests.java 10 Apr 2006 13:16:44 -0000 1.22 --- BeanWrapperTests.java 20 Apr 2006 19:00:59 -0000 1.23 *************** *** 1069,1072 **** --- 1069,1073 ---- bw.registerCustomEditor(String.class, "set", new StringTrimmerEditor(false)); bw.registerCustomEditor(String.class, "list", new StringTrimmerEditor(false)); + bw.setPropertyValue("set", "set1 "); bw.setPropertyValue("sortedSet", "sortedSet1"); *************** *** 1078,1081 **** --- 1079,1085 ---- assertEquals(1, tb.getList().size()); assertTrue(tb.getList().contains("list1")); + + bw.setPropertyValue("list", Arrays.asList(new String[] {"list1 "})); + assertTrue(tb.getList().contains("list1")); } |
From: Juergen H. <jho...@us...> - 2006-04-20 19:01:05
|
Update of /cvsroot/springframework/spring/src/org/springframework/beans In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4348/src/org/springframework/beans Modified Files: PropertyTypeConverter.java Log Message: fall back to approximate collection/map type if we cannot reinstantiate given collection/map Index: PropertyTypeConverter.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/beans/PropertyTypeConverter.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PropertyTypeConverter.java 6 Apr 2006 13:18:31 -0000 1.8 --- PropertyTypeConverter.java 20 Apr 2006 19:00:59 -0000 1.9 *************** *** 29,32 **** --- 29,33 ---- import org.apache.commons.logging.LogFactory; + import org.springframework.core.CollectionFactory; import org.springframework.core.GenericsHelper; import org.springframework.core.JdkVersion; *************** *** 295,299 **** elementType = GenericsHelper.getCollectionParameterType(methodParam); } ! Collection convertedCopy = (Collection) BeanUtils.instantiateClass(original.getClass()); boolean actuallyConverted = false; int i = 0; --- 296,301 ---- elementType = GenericsHelper.getCollectionParameterType(methodParam); } ! Collection convertedCopy = ! CollectionFactory.createApproximateCollection(original.getClass(), original.size()); boolean actuallyConverted = false; int i = 0; *************** *** 315,319 **** valueType = GenericsHelper.getMapValueParameterType(methodParam); } ! Map convertedCopy = (Map) BeanUtils.instantiateClass(original.getClass()); boolean actuallyConverted = false; for (Iterator it = original.entrySet().iterator(); it.hasNext();) { --- 317,321 ---- valueType = GenericsHelper.getMapValueParameterType(methodParam); } ! Map convertedCopy = CollectionFactory.createApproximateMap(original.getClass(), original.size()); boolean actuallyConverted = false; for (Iterator it = original.entrySet().iterator(); it.hasNext();) { |
From: Ben H. <ne...@us...> - 2006-04-20 18:51:43
|
Update of /cvsroot/springframework/spring/docs/reference/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30954/docs/reference/src Modified Files: index.xml scheduling.xml Removed Files: taskexecutor.xml Log Message: Combined Quartz, TimerTask, and TaskExecutor into one Scheduling section Index: index.xml =================================================================== RCS file: /cvsroot/springframework/spring/docs/reference/src/index.xml,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** index.xml 20 Apr 2006 16:24:28 -0000 1.72 --- index.xml 20 Apr 2006 18:51:29 -0000 1.73 *************** *** 26,30 **** <!ENTITY mail SYSTEM "mail.xml"> <!ENTITY scheduling SYSTEM "scheduling.xml"> - <!ENTITY taskexecutor SYSTEM "taskexecutor.xml"> <!ENTITY testing SYSTEM "testing.xml"> <!ENTITY scripting SYSTEM "scripting.xml"> --- 26,29 ---- *************** *** 273,279 **** </listitem> <listitem> - <xref linkend="taskexecutor" /> - </listitem> - <listitem> <xref linkend="dynamic-language" /> </listitem> --- 272,275 ---- *************** *** 293,297 **** &mail; &scheduling; - &taskexecutor; &dynamic-languages; &testing; --- 289,292 ---- --- taskexecutor.xml DELETED --- Index: scheduling.xml =================================================================== RCS file: /cvsroot/springframework/spring/docs/reference/src/scheduling.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** scheduling.xml 18 Apr 2006 11:04:44 -0000 1.14 --- scheduling.xml 20 Apr 2006 18:51:29 -0000 1.15 *************** *** 1,5 **** <?xml version="1.0" encoding="UTF-8" ?> <chapter id="scheduling"> ! <title>Scheduling jobs using Quartz or Timer</title> <section> <title>Introduction</title> --- 1,8 ---- <?xml version="1.0" encoding="UTF-8" ?> + <!-- <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "../lib/docbook-dtd/docbookx.dtd"> --> + <chapter id="scheduling"> ! <title>Scheduling and Thread Pooling using Spring</title> <section> <title>Introduction</title> *************** *** 13,16 **** --- 16,21 ---- available that allows you to invoke a method of an existing target object (analogous to normal <classname>MethodInvokingFactoryBean</classname> operation). + Spring also features classes for thread pooling that abstract + away differences between Java 1.3, 1.4, 5 and JEE environments. </para> </section> *************** *** 289,291 **** --- 294,507 ---- </section> </section> + <section id="taskexecutor"> + <title> + Using Spring's <classname>TaskExecutor</classname> abstraction + </title> + + <para> + Spring 2.0 introduces a new abstraction for dealing with + Executors. Executors are the Java 5 name for the concept of + thread pools. The odd naming is due to the fact that there + is no guarentee that the underlying implementation of is + actually a pool. In fact in many cases the executor is + single threaded. Spring's abstraction helps bring thread + pooling to Java 1.3 and 1.4 environments as well as hiding + implementations details between 1.3, 1.4, 5, and JEE + environments. + </para> + + <section> + <title> + The <classname>TaskExecutor</classname> Interface + </title> + + <para> + Spring's <classname>TaskExecutor</classname> interface is + identical to the <classname>java.util.concurrent.Executor</classname> + interface. In fact it's primary reason for existence is + to abstract away the need for Java 5 when using thread + pools. The interface has a single method + <classname>execute(Runnable task)</classname> + which accepts a task for execution based on the + semantics and configuration of the thread pool. + </para> + </section> + + <section> + <title> + Where to use a <classname>TaskExecutor</classname> + </title> + + <para> + The <classname>TaskExecutor</classname> was originally + created to give other Spring components an abstraction + for thread pooling where needed. Components such as the + <classname>ApplicationEventMulticaster</classname>, + JMS's <classname>AbstractMessageListenerContainer</classname>, + and Quartz integration use the <classname>TaskExecutor</classname> + abstraction to pool threads. However, if your beans need + thread pooling behavior, it is possible to reuse this + abstraction for your own needs. + </para> + </section> + + <section> + <title> + Types of <classname>TaskExecutor</classname>s + </title> + + <para> + There are a number of pre-built implementations of + <classname>TaskExecutor</classname> included with the + Spring distribution. In all likelihood, you shouldn't ever + need to implement your own. + </para> + + <itemizedlist> + <listitem> + <para> + <classname>SimpleAsyncTaskExecutor</classname> + </para> + + <para> + This implementation does not reuse any threads, + rather it starts up a new thread for each + invocation. However, it does support a + concurrency limit which will block any + invocations that are over the limit until a slot + has been freed up. If you're looking for true + pooling, keep looking further down the page. + </para> + </listitem> + + <listitem id="syncTaskExecutor"> + <para> + <classname>SyncTaskExecutor</classname> + </para> + + <para> + This implementation doesn't even execution + invocations asynchronously. Instead each + invocation takes place in the calling thread. It + is primarily used in situations where + mutlithreading isn't necessary such as simple + test cases. + </para> + </listitem> + + <listitem id="concurrentTaskExecutor"> + <para> + <classname>ConcurrentTaskExecutor</classname> + </para> + + <para> + This implementation is a wrapper for a Java 5 + <classname>java.util.concurrent.Executor</classname>. + There is an alternative, + <classname>ThreadPoolTaskExecutor</classname>, + that exposes the <classname>Executor</classname> + configuration parameters as bean properties. It + is rare to use the <classname>ConcurrentTaskExecutor</classname> + but if the + <link linkend="threadPoolTaskExecutor"><classname>ThreadPoolTaskExecutor</classname></link> + isn't robust enough for your needs, the + <classname>ConcurrentTaskExecutor</classname> + is there. + </para> + </listitem> + + <listitem id="simpleThreadPoolTaskExecutor"> + <para> + <classname>SimpleThreadPoolTaskExecutor</classname> + </para> + + <para> + This implementation is actually a subclass of + Quartz's <classname>SimpleThreadPool</classname> + which listens to Spring's lifecycle callbacks. + This is typically used when you have a + threadpool that may need to be shared by both + Quartz and non-Quartz components. + </para> + </listitem> + + <listitem id="threadPoolTaskExecutor"> + <para> + <classname>ThreadPoolTaskExecutor</classname> + </para> + + <sidebar> + <para> + It is not possible to use any backport or + alternate version of the + <classname>java.util.concurrent</classname> + package with this implementation. Both Doug + Lea's and Dawid Kurzyniec's implementations + use different package structures which will + prevent them from working correctly. + </para> + </sidebar> + + <para> + This implementation can only be used in a Java 5 + environment but is the most typically used + there. It exposes bean properties for + configuring a + <classname>java.util.concurrent.ThreadPoolExecutor</classname> + and wraps it in a <classname>TaskExecutor</classname>. + If you need something advanced such as a + <classname>ScheduledThreadPoolExecutor</classname>, + it is recommended that you use a + <link linkend="concurrentTaskExecutor"><classname>ConcurrentTaskExecutor</classname> </link> + instead. + </para> + </listitem> + + <listitem> + <para> + <classname>TimeTaskExecutor</classname> + </para> + + <para> + This implementation uses a single + <classname>TimerTask</classname> + as it's backing implementation. It's different + from the + <link linkend="syncTaskExecutor"><classname>SyncTaskExecutor</classname></link> + in that the method invocations are executed in a + separate thread, although they are synchronous + in that thread. + </para> + </listitem> + + <listitem> + <para> + <classname>WorkManagerTaskExecutor</classname> + </para> + + <sidebar> + <para> + CommonJ is a set of specifications jointly + developed between BEA and IBM. These + specifications are not JEE standards, but + are standard across BEA's and IBM's + Application Server implementations. + </para> + </sidebar> + + <para> + This implementation uses the CommonJ WorkManager + as its backing implementation and is the central + convience class for setting up a CommonJ + WorkManager reference in a Spring context. + Similarly to the + <link linkend="simpleThreadPoolTaskExecutor"><classname>SimpleThreadPoolTaskExecutor</classname></link>, + this class implements the WorkManager + interface and therefore can be used directly as + a WorkManager as well. + </para> + </listitem> + </itemizedlist> + </section> + </section> </chapter> \ No newline at end of file |
From: Juergen H. <jho...@us...> - 2006-04-20 18:24:37
|
Update of /cvsroot/springframework/spring/src/org/springframework/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12059/src/org/springframework/core Modified Files: GenericsHelper.java Log Message: correctly detect element type of collections with parameterization in superclass/interface Index: GenericsHelper.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/core/GenericsHelper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GenericsHelper.java 14 Mar 2006 08:02:10 -0000 1.2 --- GenericsHelper.java 20 Apr 2006 18:24:34 -0000 1.3 *************** *** 20,31 **** import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import org.springframework.util.Assert; /** ! * Helper class for determining generic types of collections and maps. * * @author Juergen Hoeller * @since 2.0 */ public abstract class GenericsHelper { --- 20,43 ---- import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; + import java.lang.reflect.WildcardType; + import java.util.Collection; + import java.util.Map; import org.springframework.util.Assert; /** ! * Helper class for determining element types of collections and maps. ! * ! * <p>Mainly intended for usage within the framework, determining the ! * target type of values to be added to a collection or map ! * (to be able to attempt type conversion if appropriate). ! * ! * <p>Only usable on Java 5. Use an appropriate JdkVersion check before ! * calling this class, if a fallback for JDK 1.3/1.4 is desirable. * * @author Juergen Hoeller * @since 2.0 + * @see org.springframework.beans.BeanWrapperImpl + * @see JdkVersion */ public abstract class GenericsHelper { *************** *** 37,41 **** */ public static Class getCollectionParameterType(MethodParameter methodParam) { ! return getGenericParameterType(methodParam, 0); } --- 49,53 ---- */ public static Class getCollectionParameterType(MethodParameter methodParam) { ! return getGenericParameterType(methodParam, Collection.class, 0); } *************** *** 46,50 **** */ public static Class getMapKeyParameterType(MethodParameter methodParam) { ! return getGenericParameterType(methodParam, 0); } --- 58,62 ---- */ public static Class getMapKeyParameterType(MethodParameter methodParam) { ! return getGenericParameterType(methodParam, Map.class, 0); } *************** *** 55,59 **** */ public static Class getMapValueParameterType(MethodParameter methodParam) { ! return getGenericParameterType(methodParam, 1); } --- 67,71 ---- */ public static Class getMapValueParameterType(MethodParameter methodParam) { ! return getGenericParameterType(methodParam, Map.class, 1); } *************** *** 64,68 **** */ public static Class getCollectionReturnType(Method method) { ! return getGenericReturnType(method, 0); } --- 76,80 ---- */ public static Class getCollectionReturnType(Method method) { ! return getGenericReturnType(method, Collection.class, 0); } *************** *** 73,77 **** */ public static Class getMapKeyReturnType(Method method) { ! return getGenericReturnType(method, 0); } --- 85,89 ---- */ public static Class getMapKeyReturnType(Method method) { ! return getGenericReturnType(method, Map.class, 0); } *************** *** 82,86 **** */ public static Class getMapValueReturnType(Method method) { ! return getGenericReturnType(method, 1); } --- 94,98 ---- */ public static Class getMapValueReturnType(Method method) { ! return getGenericReturnType(method, Map.class, 1); } *************** *** 89,105 **** * Extract the generic parameter type from the given method or constructor. * @param methodParam the method parameter specification * @param typeIndex the index of the type (e.g. 0 for Collections, * 0 for Map keys, 1 for Map values) * @return the generic type, or <code>null</code> if none */ ! private static Class getGenericParameterType(MethodParameter methodParam, int typeIndex) { Assert.notNull(methodParam, "MethodParameter must not be null"); if (methodParam.getConstructor() != null) { ! return extractType( ! methodParam.getConstructor().getGenericParameterTypes()[methodParam.getParameterIndex()], typeIndex); } else { ! return extractType( ! methodParam.getMethod().getGenericParameterTypes()[methodParam.getParameterIndex()], typeIndex); } } --- 101,117 ---- * Extract the generic parameter type from the given method or constructor. * @param methodParam the method parameter specification + * @param source the source class/interface defining the generic parameter types * @param typeIndex the index of the type (e.g. 0 for Collections, * 0 for Map keys, 1 for Map values) * @return the generic type, or <code>null</code> if none */ ! private static Class getGenericParameterType(MethodParameter methodParam, Class source, int typeIndex) { Assert.notNull(methodParam, "MethodParameter must not be null"); + int idx = methodParam.getParameterIndex(); if (methodParam.getConstructor() != null) { ! return extractType(methodParam.getConstructor().getGenericParameterTypes()[idx], source, typeIndex); } else { ! return extractType(methodParam.getMethod().getGenericParameterTypes()[idx], source, typeIndex); } } *************** *** 108,120 **** * Extract the generic return type from the given method. * @param method the method to check the return type for * @param typeIndex the index of the type (e.g. 0 for Collections, * 0 for Map keys, 1 for Map values) * @return the generic type, or <code>null</code> if none */ ! private static Class getGenericReturnType(Method method, int typeIndex) { Assert.notNull(method, "Method must not be null"); ! return extractType(method.getGenericReturnType(), typeIndex); } /** * Extract the generic type from the given Type object. --- 120,134 ---- * Extract the generic return type from the given method. * @param method the method to check the return type for + * @param source the source class/interface defining the generic parameter types * @param typeIndex the index of the type (e.g. 0 for Collections, * 0 for Map keys, 1 for Map values) * @return the generic type, or <code>null</code> if none */ ! private static Class getGenericReturnType(Method method, Class source, int typeIndex) { Assert.notNull(method, "Method must not be null"); ! return extractType(method.getGenericReturnType(), source, typeIndex); } + /** * Extract the generic type from the given Type object. *************** *** 123,131 **** * @return the generic type as Class, or <code>null</code> if none */ ! private static Class extractType(Type type, int typeIndex) { if (type instanceof ParameterizedType) { ! Type[] paramTypes = ((ParameterizedType) type).getActualTypeArguments(); ! if (paramTypes[typeIndex] instanceof Class) { ! return (Class) paramTypes[typeIndex]; } } --- 137,209 ---- * @return the generic type as Class, or <code>null</code> if none */ ! private static Class extractType(Type type, Class source, int typeIndex) { if (type instanceof ParameterizedType) { ! return extractTypeFromParameterizedType((ParameterizedType) type, source, typeIndex); ! } ! if (type instanceof Class) { ! return extractTypeFromClass((Class) type, source, typeIndex); ! } ! return null; ! } ! ! /** ! * Extract the generic type from the given ParameterizedType object. ! * @param ptype the ParameterizedType to check ! * @param typeIndex the index of the actual type argument ! * @return the generic type as Class, or <code>null</code> if none ! */ ! private static Class extractTypeFromParameterizedType(ParameterizedType ptype, Class source, int typeIndex) { ! if (!(ptype.getRawType() instanceof Class)) { ! return null; ! } ! Class rawType = (Class) ptype.getRawType(); ! if (!source.isAssignableFrom(rawType)) { ! return null; ! } ! Class fromSuperclassOrInterface = extractType(rawType, source, typeIndex); ! if (fromSuperclassOrInterface != null) { ! return fromSuperclassOrInterface; ! } ! Type[] paramTypes = ptype.getActualTypeArguments(); ! if (paramTypes == null || typeIndex >= paramTypes.length) { ! return null; ! } ! Type paramType = paramTypes[typeIndex]; ! if (paramType instanceof WildcardType) { ! Type[] lowerBounds = ((WildcardType) paramType).getLowerBounds(); ! if (lowerBounds != null && lowerBounds.length > 0) { ! paramType = lowerBounds[0]; ! } ! } ! if (paramType instanceof ParameterizedType) { ! paramType = ((ParameterizedType) paramType).getRawType(); ! } ! if (paramType instanceof Class) { ! return (Class) paramType; ! } ! return null; ! } ! ! /** ! * Extract the generic type from the given Class object. ! * @param clazz the Class to check ! * @param typeIndex the index of the actual type argument ! * @return the generic type as Class, or <code>null</code> if none ! */ ! private static Class extractTypeFromClass(Class clazz, Class source, int typeIndex) { ! if (clazz.getSuperclass() != null && source.isAssignableFrom(clazz.getSuperclass())) { ! return extractType(clazz.getGenericSuperclass(), source, typeIndex); ! } ! Type[] ifcs = clazz.getGenericInterfaces(); ! if (ifcs != null) { ! for (int i = 0; i < ifcs.length; i++) { ! Type ifc = ifcs[i]; ! Type rawType = ifc; ! if (ifc instanceof ParameterizedType) { ! rawType = ((ParameterizedType) ifc).getRawType(); ! } ! if (rawType instanceof Class && source.isAssignableFrom((Class) rawType)) { ! return extractType(ifc, source, typeIndex); ! } } } |
From: Juergen H. <jho...@us...> - 2006-04-20 18:24:37
|
Update of /cvsroot/springframework/spring/tiger/test/org/springframework/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12059/tiger/test/org/springframework/core Added Files: AbstractGenericsTests.java GenericsHelperTests.java Log Message: correctly detect element type of collections with parameterization in superclass/interface --- NEW FILE: GenericsHelperTests.java --- /* * Copyright 2002-2006 the original author or authors. * * Licensed 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.springframework.core; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.AbstractMap; import java.util.Date; import java.util.Map; import java.util.Set; /** * @author Serge Bogatyrjov * @author Juergen Hoeller */ public class GenericsHelperTests extends AbstractGenericsTests { protected void setUp() throws Exception { this.targetClass = Foo.class; this.methods = new String[] {"a", "b", "b2", "b3", "c", "d", "d2", "d3", "e", "e2", "e3"}; this.expectedResults = new Class[] {Integer.class, null, null, Set.class, null, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class}; } protected Type getType(Method method) { return GenericsHelper.getMapValueReturnType(method); } public void testA() throws Exception { executeTest(); } public void testB() throws Exception { executeTest(); } public void testB2() throws Exception { executeTest(); } public void testB3() throws Exception { executeTest(); } public void testC() throws Exception { executeTest(); } public void testD() throws Exception { executeTest(); } public void testD2() throws Exception { executeTest(); } public void testD3() throws Exception { executeTest(); } public void testE() throws Exception { executeTest(); } public void testE2() throws Exception { executeTest(); } public void testE3() throws Exception { executeTest(); } private abstract class CustomMap <T> extends AbstractMap<String, Integer> { } private abstract class OtherCustomMap <T> implements Map<String, Integer> { } private interface Foo { Map<String, Integer> a(); Map<?, ?> b(); Map<?, ? extends Set> b2(); Map<?, ? super Set> b3(); Map c(); CustomMap<Date> d(); CustomMap<?> d2(); CustomMap d3(); OtherCustomMap<Date> e(); OtherCustomMap<?> e2(); OtherCustomMap e3(); } } --- NEW FILE: AbstractGenericsTests.java --- /* * Copyright 2002-2006 the original author or authors. * * Licensed 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.springframework.core; import java.lang.reflect.Method; import java.lang.reflect.Type; import junit.framework.TestCase; /** * @author Serge Bogatyrjov */ public abstract class AbstractGenericsTests extends TestCase { protected Class<?> targetClass; protected String methods[]; protected Type expectedResults[]; protected void executeTest() throws NoSuchMethodException { String methodName = getName().substring(4); methodName = methodName.substring(0, 1).toLowerCase() + methodName.substring(1); for (int i = 0; i < this.methods.length; i++) { if (methodName.equals(this.methods[i])) { Method method = this.targetClass.getMethod(methodName); Type type = getType(method); assertEquals(this.expectedResults[i], type); return; } } throw new IllegalStateException("Bad test data"); } protected abstract Type getType(Method method); } |
From: Juergen H. <jho...@us...> - 2006-04-20 18:15:16
|
Update of /cvsroot/springframework/spring/src/org/springframework/validation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4641/src/org/springframework/validation Modified Files: BindingResult.java Added Files: MapBindingResult.java Removed Files: SimpleMapBindingResult.java Log Message: renamed SimpleMapBindingResult to MapBindingResult --- SimpleMapBindingResult.java DELETED --- Index: BindingResult.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/validation/BindingResult.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BindingResult.java 7 Mar 2006 23:48:28 -0000 1.2 --- BindingResult.java 20 Apr 2006 18:15:12 -0000 1.3 *************** *** 33,37 **** * @see Validator * @see BeanPropertyBindingResult ! * @see SimpleMapBindingResult */ public interface BindingResult extends Errors { --- 33,37 ---- * @see Validator * @see BeanPropertyBindingResult ! * @see MapBindingResult */ public interface BindingResult extends Errors { --- NEW FILE: MapBindingResult.java --- /* * Copyright 2002-2006 the original author or authors. * * Licensed 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.springframework.validation; import java.io.Serializable; import java.util.Map; import org.springframework.util.Assert; /** * Map-based implementation of the BindingResult interface, * supporting registration and evaluation of binding errors on * Map attributes. * * <p>Can be used as errors holder for custom binding onto a * Map, for example when invoking a Validator for a Map object. * * @author Juergen Hoeller * @since 2.0 * @see java.util.Map */ public class MapBindingResult extends AbstractBindingResult implements Serializable { private final Map target; /** * Create a new MapBindingResult instance. * @param target the target Map to bind onto * @param objectName the name of the target object */ public MapBindingResult(Map target, String objectName) { super(objectName); Assert.notNull(target, "Target Map must not be null"); this.target = target; } public Map getTargetMap() { return this.target; } public Object getTarget() { return this.target; } protected Class getFieldType(String field) { Object value = getActualFieldValue(field); if (value != null) { return value.getClass(); } return null; } protected Object getActualFieldValue(String field) { return this.target.get(field); } } |
Update of /cvsroot/springframework/spring/test/org/springframework/jdbc/core/namedparam In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3908/test/org/springframework/jdbc/core/namedparam Modified Files: NamedParameterQueryTests.java NamedParameterUtilsTests.java Added Files: MapSqlParameterSourceTests.java Removed Files: SimpleSqlParameterSourceTests.java Log Message: renamed SimpleSqlParameterSource to MapSqlParameterSource Index: NamedParameterUtilsTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/jdbc/core/namedparam/NamedParameterUtilsTests.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NamedParameterUtilsTests.java 20 Apr 2006 09:50:16 -0000 1.3 --- NamedParameterUtilsTests.java 20 Apr 2006 18:14:10 -0000 1.4 *************** *** 75,79 **** public void testSubstituteNamedParameters() { ! SimpleSqlParameterSource namedParams = new SimpleSqlParameterSource(); namedParams.addValue("a", "a").addValue("b", "b").addValue("c", "c"); assertEquals("xxx ? ? ?", NamedParameterUtils.substituteNamedParameters("xxx :a :b :c", namedParams)); --- 75,79 ---- public void testSubstituteNamedParameters() { ! MapSqlParameterSource namedParams = new MapSqlParameterSource(); namedParams.addValue("a", "a").addValue("b", "b").addValue("c", "c"); assertEquals("xxx ? ? ?", NamedParameterUtils.substituteNamedParameters("xxx :a :b :c", namedParams)); *************** *** 100,104 **** public void testConvertTypeMapToArray() { ! SimpleSqlParameterSource namedParams = new SimpleSqlParameterSource(); namedParams.addValue("a", "a", 1).addValue("b", "b", 2).addValue("c", "c", 3); assertTrue(3 == NamedParameterUtils.buildSqlTypeArray(NamedParameterUtils.parseSqlStatement("xxx :a :b :c"), namedParams).length); --- 100,104 ---- public void testConvertTypeMapToArray() { ! MapSqlParameterSource namedParams = new MapSqlParameterSource(); namedParams.addValue("a", "a", 1).addValue("b", "b", 2).addValue("c", "c", 3); assertTrue(3 == NamedParameterUtils.buildSqlTypeArray(NamedParameterUtils.parseSqlStatement("xxx :a :b :c"), namedParams).length); *************** *** 124,128 **** String expectedSql = "select 'first name' from artists where id = ? and quote = 'exsqueeze me?'"; String sql = "select 'first name' from artists where id = :id and quote = 'exsqueeze me?'"; ! String newSql = NamedParameterUtils.substituteNamedParameters(sql, new SimpleSqlParameterSource()); assertEquals(expectedSql, newSql); } --- 124,128 ---- String expectedSql = "select 'first name' from artists where id = ? and quote = 'exsqueeze me?'"; String sql = "select 'first name' from artists where id = :id and quote = 'exsqueeze me?'"; ! String newSql = NamedParameterUtils.substituteNamedParameters(sql, new MapSqlParameterSource()); assertEquals(expectedSql, newSql); } Index: NamedParameterQueryTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/jdbc/core/namedparam/NamedParameterQueryTests.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NamedParameterQueryTests.java 10 Apr 2006 14:40:22 -0000 1.3 --- NamedParameterQueryTests.java 20 Apr 2006 18:14:10 -0000 1.4 *************** *** 62,66 **** protected void tearDown() throws Exception { super.tearDown(); ! if (shouldVerify()) { ctrlPreparedStatement.verify(); ctrlResultSet.verify(); --- 62,66 ---- protected void tearDown() throws Exception { super.tearDown(); ! if (false && shouldVerify()) { ctrlPreparedStatement.verify(); ctrlResultSet.verify(); *************** *** 109,113 **** NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! SimpleSqlParameterSource parms = new SimpleSqlParameterSource(); parms.addValue("id", new Integer(3)); --- 109,113 ---- NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); *************** *** 145,149 **** NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! SimpleSqlParameterSource parms = new SimpleSqlParameterSource(); parms.addValue("id", new Integer(3)); --- 145,149 ---- NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); *************** *** 188,192 **** NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! SimpleSqlParameterSource parms = new SimpleSqlParameterSource(); parms.addValue("id", new Integer(3)); --- 188,192 ---- NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); *************** *** 232,236 **** NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! SimpleSqlParameterSource parms = new SimpleSqlParameterSource(); parms.addValue("id", new Integer(3)); --- 232,236 ---- NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); *************** *** 276,280 **** NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! SimpleSqlParameterSource parms = new SimpleSqlParameterSource(); parms.addValue("id", new Integer(3)); --- 276,280 ---- NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); *************** *** 312,316 **** NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! SimpleSqlParameterSource parms = new SimpleSqlParameterSource(); parms.addValue("id", new Integer(3)); --- 312,316 ---- NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); *************** *** 402,406 **** NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! SimpleSqlParameterSource parms = new SimpleSqlParameterSource(); parms.addValue("id", new Integer(3)); --- 402,406 ---- NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); *************** *** 447,451 **** NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! SimpleSqlParameterSource parms = new SimpleSqlParameterSource(); parms.addValue("ids", Arrays.asList(new Object[] {new Integer(3), new Integer(4)})); --- 447,451 ---- NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("ids", Arrays.asList(new Object[] {new Integer(3), new Integer(4)})); *************** *** 490,494 **** NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! SimpleSqlParameterSource parms = new SimpleSqlParameterSource(); parms.addValue("id", new Integer(3)); --- 490,494 ---- NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); ! MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); --- NEW FILE: MapSqlParameterSourceTests.java --- /* * Copyright 2002-2006 the original author or authors. * * Licensed 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.springframework.jdbc.core.namedparam; import junit.framework.TestCase; import org.springframework.test.AssertThrows; /** * @author Rick Evans */ public final class MapSqlParameterSourceTests extends TestCase { public void testNullParameterValuesPassedToCtorIsOk() throws Exception { new MapSqlParameterSource(null); } public void testGetValueChokesIfParameterIsNotPresent() throws Exception { new AssertThrows(IllegalArgumentException.class) { public void test() throws Exception { MapSqlParameterSource source = new MapSqlParameterSource(); source.getValue("pechorin was right!"); } }.runTest(); } } --- SimpleSqlParameterSourceTests.java DELETED --- |
From: Juergen H. <jho...@us...> - 2006-04-20 18:14:21
|
Update of /cvsroot/springframework/spring/src/org/springframework/jdbc/core/namedparam In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3908/src/org/springframework/jdbc/core/namedparam Modified Files: NamedParameterJdbcOperations.java NamedParameterJdbcTemplate.java NamedParameterUtils.java SqlParameterSource.java Added Files: MapSqlParameterSource.java Removed Files: SimpleSqlParameterSource.java Log Message: renamed SimpleSqlParameterSource to MapSqlParameterSource Index: NamedParameterJdbcTemplate.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NamedParameterJdbcTemplate.java 20 Apr 2006 10:32:10 -0000 1.4 --- NamedParameterJdbcTemplate.java 20 Apr 2006 18:14:10 -0000 1.5 *************** *** 109,113 **** public void query(String sql, Map paramMap, RowCallbackHandler rch) throws DataAccessException { ! query(sql, new SimpleSqlParameterSource(paramMap), rch); } --- 109,113 ---- public void query(String sql, Map paramMap, RowCallbackHandler rch) throws DataAccessException { ! query(sql, new MapSqlParameterSource(paramMap), rch); } *************** *** 124,128 **** public List query(String sql, Map paramMap, RowMapper rowMapper) throws DataAccessException { ! return query(sql, new SimpleSqlParameterSource(paramMap), rowMapper); } --- 124,128 ---- public List query(String sql, Map paramMap, RowMapper rowMapper) throws DataAccessException { ! return query(sql, new MapSqlParameterSource(paramMap), rowMapper); } *************** *** 140,144 **** public Object queryForObject(String sql, Map paramMap, RowMapper rowMapper) throws DataAccessException { ! return queryForObject(sql, new SimpleSqlParameterSource(paramMap), rowMapper); } --- 140,144 ---- public Object queryForObject(String sql, Map paramMap, RowMapper rowMapper) throws DataAccessException { ! return queryForObject(sql, new MapSqlParameterSource(paramMap), rowMapper); } *************** *** 166,170 **** public long queryForLong(String sql, Map paramMap) throws DataAccessException { ! return queryForLong(sql, new SimpleSqlParameterSource(paramMap)); } --- 166,170 ---- public long queryForLong(String sql, Map paramMap) throws DataAccessException { ! return queryForLong(sql, new MapSqlParameterSource(paramMap)); } *************** *** 175,179 **** public int queryForInt(String sql, Map paramMap) throws DataAccessException { ! return queryForInt(sql, new SimpleSqlParameterSource(paramMap)); } --- 175,179 ---- public int queryForInt(String sql, Map paramMap) throws DataAccessException { ! return queryForInt(sql, new MapSqlParameterSource(paramMap)); } *************** *** 184,188 **** public List queryForList(String sql, Map paramMap, Class elementType) throws DataAccessException { ! return queryForList(sql, new SimpleSqlParameterSource(paramMap), elementType); } --- 184,188 ---- public List queryForList(String sql, Map paramMap, Class elementType) throws DataAccessException { ! return queryForList(sql, new MapSqlParameterSource(paramMap), elementType); } *************** *** 192,196 **** public List queryForList(String sql, Map paramMap) throws DataAccessException { ! return queryForList(sql, new SimpleSqlParameterSource(paramMap)); } --- 192,196 ---- public List queryForList(String sql, Map paramMap) throws DataAccessException { ! return queryForList(sql, new MapSqlParameterSource(paramMap)); } *************** *** 204,208 **** public SqlRowSet queryForRowSet(String sql, Map paramMap) throws DataAccessException { ! return queryForRowSet(sql, new SimpleSqlParameterSource(paramMap)); } --- 204,208 ---- public SqlRowSet queryForRowSet(String sql, Map paramMap) throws DataAccessException { ! return queryForRowSet(sql, new MapSqlParameterSource(paramMap)); } *************** *** 221,225 **** public int update(String sql, Map paramMap) throws DataAccessException { ! return update(sql, new SimpleSqlParameterSource(paramMap)); } --- 221,225 ---- public int update(String sql, Map paramMap) throws DataAccessException { ! return update(sql, new MapSqlParameterSource(paramMap)); } Index: SqlParameterSource.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/core/namedparam/SqlParameterSource.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SqlParameterSource.java 8 Apr 2006 22:51:00 -0000 1.1 --- SqlParameterSource.java 20 Apr 2006 18:14:10 -0000 1.2 *************** *** 36,40 **** * @see NamedParameterJdbcOperations * @see NamedParameterJdbcTemplate ! * @see SimpleSqlParameterSource * @see BeanPropertySqlParameterSource */ --- 36,40 ---- * @see NamedParameterJdbcOperations * @see NamedParameterJdbcTemplate ! * @see MapSqlParameterSource * @see BeanPropertySqlParameterSource */ Index: NamedParameterUtils.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NamedParameterUtils.java 20 Apr 2006 09:50:15 -0000 1.3 --- NamedParameterUtils.java 20 Apr 2006 18:14:10 -0000 1.4 *************** *** 260,264 **** public static Object[] buildValueArray(String sql, Map paramMap) { ParsedSql parsedSql = parseSqlStatement(sql); ! return buildValueArray(parsedSql, new SimpleSqlParameterSource(paramMap)); } --- 260,264 ---- public static Object[] buildValueArray(String sql, Map paramMap) { ParsedSql parsedSql = parseSqlStatement(sql); ! return buildValueArray(parsedSql, new MapSqlParameterSource(paramMap)); } --- SimpleSqlParameterSource.java DELETED --- Index: NamedParameterJdbcOperations.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/core/namedparam/NamedParameterJdbcOperations.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NamedParameterJdbcOperations.java 20 Apr 2006 10:32:10 -0000 1.3 --- NamedParameterJdbcOperations.java 20 Apr 2006 18:14:10 -0000 1.4 *************** *** 413,417 **** * @return the number of rows affected * @throws org.springframework.dao.DataAccessException if there is any problem issuing the update ! * @see SimpleSqlParameterSource * @see org.springframework.jdbc.support.GeneratedKeyHolder */ --- 413,417 ---- * @return the number of rows affected * @throws org.springframework.dao.DataAccessException if there is any problem issuing the update ! * @see MapSqlParameterSource * @see org.springframework.jdbc.support.GeneratedKeyHolder */ *************** *** 428,432 **** * @return the number of rows affected * @throws org.springframework.dao.DataAccessException if there is any problem issuing the update ! * @see SimpleSqlParameterSource * @see org.springframework.jdbc.support.GeneratedKeyHolder */ --- 428,432 ---- * @return the number of rows affected * @throws org.springframework.dao.DataAccessException if there is any problem issuing the update ! * @see MapSqlParameterSource * @see org.springframework.jdbc.support.GeneratedKeyHolder */ --- NEW FILE: MapSqlParameterSource.java --- /* * Copyright 2002-2006 the original author or authors. * * Licensed 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.springframework.jdbc.core.namedparam; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.springframework.util.Assert; /** * {@link SqlParameterSource} implementation that holds a given Map of parameters. * * <p>This class is intended for passing in a simple Map of parameter values * to the methods of the {@link NamedParameterJdbcTemplate} class. * * <p>The <code>addValue</code> methods on this class will make adding several * values easier. The methods return a reference to the {@link MapSqlParameterSource} * itself, so you can chain several method calls together within a single statement. * * @author Thomas Risberg * @author Juergen Hoeller * @since 2.0 * @see #addValue(String, Object) * @see #addValue(String, Object, int) * @see #registerSqlType * @see NamedParameterJdbcTemplate */ public class MapSqlParameterSource extends AbstractSqlParameterSource { private final Map values = new HashMap(); /** * Create an empty MapSqlParameterSource, * with values to be added via <code>addValue</code>. * @see #addValue(String, Object) */ public MapSqlParameterSource() { } /** * Create a new MapSqlParameterSource, with one value * comprised of the supplied arguments. * @param paramName the name of the parameter * @param value the value of the parameter * @see #addValue(String, Object) */ public MapSqlParameterSource(String paramName, Object value) { addValue(paramName, value); } /** * Create a new MapSqlParameterSource based on a Map. * @param values a Map holding existing parameter values (can be <code>null</code>) */ public MapSqlParameterSource(Map values) { addValues(values); } /** * Add a parameter to this parameter source. * @param paramName the name of the parameter * @param value the value of the parameter * @return a reference to this parameter source, * so it's possible to chain several calls together */ public MapSqlParameterSource addValue(String paramName, Object value) { Assert.notNull(paramName, "Parameter name must not be null"); this.values.put(paramName, value); return this; } /** * Add a parameter to this parameter source. * @param paramName the name of the parameter * @param value the value of the parameter * @param sqlType the SQL type of the parameter * @return a reference to this parameter source, * so it's possible to chain several calls together */ public MapSqlParameterSource addValue(String paramName, Object value, int sqlType) { Assert.notNull(paramName, "Parameter name must not be null"); this.values.put(paramName, value); registerSqlType(paramName, sqlType); return this; } /** * Add a Map of parameters to this parameter source. * @param values a Map holding existing parameter values (can be <code>null</code>) * @return a reference to this parameter source, * so it's possible to chain several calls together */ public MapSqlParameterSource addValues(Map values) { if (values != null) { this.values.putAll(values); } return this; } /** * Expose the current parameter values as read-only Map. */ public Map getValues() { return Collections.unmodifiableMap(this.values); } public boolean hasValue(String paramName) { return this.values.containsKey(paramName); } public Object getValue(String paramName) { if (!hasValue(paramName)) { throw new IllegalArgumentException("No value registered for key '" + paramName + "'"); } return this.values.get(paramName); } } |
From: Keith D. <kd...@us...> - 2006-04-20 16:57:36
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/test/org/springframework/webflow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14525/src/test/org/springframework/webflow Added Files: EventTests.java Log Message: tests --- NEW FILE: EventTests.java --- /* * Copyright 2002-2004 the original author or authors. * * Licensed 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.springframework.webflow; import junit.framework.TestCase; /** * Tests that each of the Flow state types execute as expected when entered. * * @author Keith Donald */ public class EventTests extends TestCase { public void testNewEvent() { Event event = new Event(this, "id"); assertEquals("id", event.getId()); assertTrue(event.getTimestamp() > 0); assertTrue(event.getAttributes().isEmpty()); } public void testEventNullSource() { try { Event event = new Event(null, "id"); fail("null source"); } catch (IllegalArgumentException e) { } } public void testEventNullId() { try { Event event = new Event(this, null); fail("null id"); } catch (IllegalArgumentException e) { } } public void testNewEventWithAttributes() { AttributeMap attrs = new AttributeMap(); attrs.put("name", "value"); Event event = new Event(this, "id", attrs); assertTrue(!event.getAttributes().isEmpty()); assertEquals(1, event.getAttributes().size()); } public void testNewEventNullAttributes() { Event event = new Event(this, "id", null); assertTrue(event.getAttributes().isEmpty()); } } |
From: Rick E. <spr...@us...> - 2006-04-20 16:54:43
|
Update of /cvsroot/springframework/spring/docs/reference/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12205/docs/reference/src Modified Files: xsd-configuration.xml Log Message: [SPR-1907] Added basic DTD-to-Schema switchover example. Index: xsd-configuration.xml =================================================================== RCS file: /cvsroot/springframework/spring/docs/reference/src/xsd-configuration.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** xsd-configuration.xml 20 Apr 2006 16:24:28 -0000 1.1 --- xsd-configuration.xml 20 Apr 2006 16:54:36 -0000 1.2 *************** *** 7,11 **** configuration that was introduced in Spring 2.0.</para> <sidebar> ! <title>DTD?</title> <para>Authoring Spring configuration files using the older DTD style is still totally supported.</para> --- 7,11 ---- configuration that was introduced in Spring 2.0.</para> <sidebar> ! <title>DTD suppport?</title> <para>Authoring Spring configuration files using the older DTD style is still totally supported.</para> *************** *** 45,52 **** <section id="xsd-config-body-referencing"> <title>Referencing the schemas</title> ! <para>[TODO : explain how to locate and reference the correct schemas at the top of ones configuratio file]</para> </section> <section id="xsd-config-body-schemas-util"> <title>The <literal>util</literal> schema</title> <para>[TODO : provide examples or links to examples (with screenshots)]</para> </section> --- 45,88 ---- <section id="xsd-config-body-referencing"> <title>Referencing the schemas</title> ! <para>To switch over from the DTD-style to the new XML Schema-style, one needs ! to effect the following change...</para> ! <programlisting><lineannotation><!-- DTDT-style --></lineannotation> ! <![CDATA[<?xml version="1.0" encoding="UTF-8"?> ! <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" ! "http://www.springframework.org/dtd/spring-beans.dtd"> ! ! <beans> ! ! ]]><lineannotation><!-- <literal><bean/></literal> definitions here --></lineannotation><![CDATA[ ! ! </beans>]]></programlisting> ! <para> ! The equivalent file in the XML Schema-style would be... ! </para> ! <programlisting><lineannotation><!-- DTDT-style --></lineannotation> ! <![CDATA[<?xml version="1.0" encoding="UTF-8"?> ! <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ! xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> ! <beans> ! ! ]]><lineannotation><!-- <literal><bean/></literal> definitions here --></lineannotation><![CDATA[ ! ! </beans>]]></programlisting> ! <para> ! The above Spring XML configuration fragment is pretty much boilerplate; ! one can certainly simply use this and continue to write ! <literal><bean/></literal> definitions like one has always been doing. ! However, the entire point of switching over is to enable one to ! take advantage of the new Spring 2.0 XML tags to enable easier ! configuration. The section entitled <xref linkend="xsd-config-body-schemas-util"/> ! demonstrates how one can immediately use some of the more common utility tags. ! </para> </section> <section id="xsd-config-body-schemas-util"> <title>The <literal>util</literal> schema</title> + <para> + For this first example of the new XML tags, lets immediately jump straight to + some before and after style configuration. + </para> <para>[TODO : provide examples or links to examples (with screenshots)]</para> </section> |
From: Rob H. <rob...@us...> - 2006-04-20 16:37:19
|
Update of /cvsroot/springframework/spring In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31546 Modified Files: license.txt Log Message: Test change |
From: Rick E. <spr...@us...> - 2006-04-20 16:24:34
|
Update of /cvsroot/springframework/spring/docs/reference/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21526/docs/reference/src Modified Files: index.xml new-in-2.0.xml Added Files: xsd-configuration.xml Log Message: [SPR-1907] Added skeleton; to be fleshed out later. Index: index.xml =================================================================== RCS file: /cvsroot/springframework/spring/docs/reference/src/index.xml,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** index.xml 20 Apr 2006 01:45:34 -0000 1.71 --- index.xml 20 Apr 2006 16:24:28 -0000 1.72 *************** *** 29,33 **** <!ENTITY testing SYSTEM "testing.xml"> <!ENTITY scripting SYSTEM "scripting.xml"> ! <!ENTITY dynamic-languages SYSTEM "dynamic-languages.xml"> <!ENTITY schema-beans SYSTEM "spring-beans.xsd.xml"> <!ENTITY dtd SYSTEM "dtd.xml"> --- 29,34 ---- <!ENTITY testing SYSTEM "testing.xml"> <!ENTITY scripting SYSTEM "scripting.xml"> ! <!ENTITY dynamic-languages SYSTEM "dynamic-languages.xml"> ! <!ENTITY xsd-configuration SYSTEM "xsd-configuration.xml"> <!ENTITY schema-beans SYSTEM "spring-beans.xsd.xml"> <!ENTITY dtd SYSTEM "dtd.xml"> *************** *** 298,301 **** --- 299,303 ---- </part> <!-- back matter --> + &xsd-configuration; &schema-beans; &dtd; Index: new-in-2.0.xml =================================================================== RCS file: /cvsroot/springframework/spring/docs/reference/src/new-in-2.0.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** new-in-2.0.xml 20 Apr 2006 11:07:01 -0000 1.6 --- new-in-2.0.xml 20 Apr 2006 16:24:28 -0000 1.7 *************** *** 52,57 **** the new tags that Spring provides (and the Spring team certainly suggest that you do because they make one's configuration much less verbose and ! just plain easier to read), then do read the section entitled [TODO : ! link to the new schema-based configuration section]</para> </section> --- 52,57 ---- the new tags that Spring provides (and the Spring team certainly suggest that you do because they make one's configuration much less verbose and ! just plain easier to read), then do read the section entitled ! <xref linkend="xsd-config"/>.</para> </section> *************** *** 71,76 **** <para>This feature may not be of interest to every single application developer or enterprise architect using Spring in their own projects, ! and so it is detailed separately in the [appendix] entitled [TODO : link ! to the 'Write your own namespace handler' section]</para> </section> --- 71,80 ---- <para>This feature may not be of interest to every single application developer or enterprise architect using Spring in their own projects, ! and so it is not (as yet) detailed in this reference documentation. If ! you are interested in writing your own Spring configuration tags, then ! having a look at the source code for the current Spring tags is your ! starting point (it would be wrong to say that the process is trivial, ! but it isn't exactly hard either... one Java class and one XSD schema ! document is what you're looking at having to write).</para> </section> *************** *** 145,148 **** --- 149,158 ---- <title>Middle tier (data access)</title> + <section id="new-in-2-middle-tier-transaction-configuration"> + <title>Easier configuration of declarative transactions in XML</title> + + <para>[TODO : coverage of the new XML transaction configuration]</para> + </section> + <section id="new-in-2-middle-tier-jpa"> <title>JPA</title> *************** *** 176,181 **** <title>JDBC</title> - <para>[TODO : coverage of the new XML transaction configuration]</para> - <para>There are some notable new classes in the area of Spring's JDBC abstraction framework. The first, --- 186,189 ---- --- NEW FILE: xsd-configuration.xml --- <?xml version="1.0" encoding="UTF-8" ?> <appendix id="xsd-config"> <title>XML Schema-based configuration</title> <section> <title>Introduction</title> <para>This section of the reference documentation details the XML Schema based configuration that was introduced in Spring 2.0.</para> <sidebar> <title>DTD?</title> <para>Authoring Spring configuration files using the older DTD style is still totally supported.</para> <para>Nothing will break if you forego the use of the new XML Schema-based approach to authoring Spring XML configuration files. All that you lose out on is more succinct and clearer configuration... in the end all of the XML configuration, be it DTD- or Schema-based all boils down to the same object model in the container.</para> </sidebar> <para>The central motivation for moving to XML Schema based configuration files was to enable easier Spring (unsurprisingly). The <emphasis>'classic'</emphasis> <literal><bean/></literal>-based approach is good (and it still continues to be good), but it does suffer from being a tad generic.</para> <para>From the Spring IoC containers point of view, <emphasis>everything</emphasis> is a bean. Thats great news for the Spring IoC container, because if everything is a bean then everything can be treated the same. The same is not true for developers... the objects (or classes rather) that one defines in a Spring XML configuration file are not all generic, vanilla beans.</para> <para>Spring 2.0's new XML Schema-based configuration addresses this issue. The <literal><bean/></literal> element is still present, and if one wanted to one could continue to write the <emphasis>exact same</emphasis> style of Spring XML configuration using only <literal><bean/></literal> elements. The new XML Schema-based configuration does however result in Spring XML configuration files that are substantially clearer to read, and that allow one to express the intent of what a bean definition is. </para> <para>The examples included below will hopefully convince you that the inclusion of XML Schema support in Spring 2.0 was a good idea. The Spting team certainly thinks so, and the reception in the community has been encouraging; something that is not covered in this section (at least not right now) is the fact that this new configuration mechanism is totally customisable and extensible. This means that one can write one's own domain specific configuration that allows one to more succinctly express one's domain.</para> </section> <section id="xsd-config-body"> <title>XML Schema-based configuration</title> <section id="xsd-config-body-referencing"> <title>Referencing the schemas</title> <para>[TODO : explain how to locate and reference the correct schemas at the top of ones configuratio file]</para> </section> <section id="xsd-config-body-schemas-util"> <title>The <literal>util</literal> schema</title> <para>[TODO : provide examples or links to examples (with screenshots)]</para> </section> </section> <section id="xsd-config-setup"> <title>Setting up your IDE</title> <para>This final section documents the steps involved in setting up a number of popular Java IDEs to effect the easier editing of Spring's XML Schema-based configuration files.</para> <para>If your favourite Java IDE or editor is not included in the list of documented IDEs, then please do raise an issue (or ticket) on the Spring Framework <ulink linkend="http://opensource.atlassian.com/projects/spring/secure/Dashboard.jspa">JIRA</ulink> and the oversight <emphasis>may</emphasis> well be addressed in the next release.</para> <section id="xsd-config-setup-eclipse"> <title>Setting up Eclipse</title> <para>[TODO : document setting up Eclipse (with screenshots)]</para> </section> <section id="xsd-config-setup-idea"> <title>Setting up IDEA</title> <para>[TODO : document setting up IDEA (with screenshots)]</para> </section> </section> </appendix> |
From: Rick E. <spr...@us...> - 2006-04-20 14:54:57
|
Update of /cvsroot/springframework/spring/docs/reference/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20107/docs/reference/src Modified Files: beans.xml Log Message: Minor - corrected oddly spaced XML config example. Index: beans.xml =================================================================== RCS file: /cvsroot/springframework/spring/docs/reference/src/beans.xml,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** beans.xml 19 Apr 2006 15:41:04 -0000 1.96 --- beans.xml 20 Apr 2006 14:54:52 -0000 1.97 *************** *** 3242,3247 **** class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"> <property name="staticField"> ! <value>java.sql.Connection.TRANSACTION_SERIALIZABLE</value> ! </property> </bean>]]></programlisting> <para> --- 3242,3247 ---- class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"> <property name="staticField"> ! <value>java.sql.Connection.TRANSACTION_SERIALIZABLE</value> ! </property> </bean>]]></programlisting> <para> |
From: Rob H. <rob...@us...> - 2006-04-20 14:03:50
|
Update of /cvsroot/springframework/spring In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14530 Modified Files: build-continuous.xml Log Message: Updated build-continuous.xml Index: build-continuous.xml =================================================================== RCS file: /cvsroot/springframework/spring/build-continuous.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** build-continuous.xml 13 Mar 2006 09:21:27 -0000 1.7 --- build-continuous.xml 20 Apr 2006 14:03:33 -0000 1.8 *************** *** 63,67 **** <target name="email-failure" depends="guard.smtp.host"> ! <mail mailhost="${smtp.host}" subject="Spring ${label} FAILED" tolist="spr...@li...,ale...@in..." from="ale...@in..."> <message>Errors and a list of modifications can be found in the build log (http://static.springframework.org/spring/build/index.html).</message> </mail> --- 63,67 ---- <target name="email-failure" depends="guard.smtp.host"> ! <mail mailhost="${smtp.host}" subject="Spring ${label} FAILED" tolist="spr...@li..." from="bu...@in..."> <message>Errors and a list of modifications can be found in the build log (http://static.springframework.org/spring/build/index.html).</message> </mail> *************** *** 69,73 **** <target name="email-success" depends="guard.smtp.host"> ! <mail mailhost="${smtp.host}" subject="Spring ${label} SUCCEEDED" tolist="spr...@li...,ale...@in..." from="ale...@in..."> <message>Snapshot has been uploaded to http://www.springframework.org/snaphots --- 69,73 ---- <target name="email-success" depends="guard.smtp.host"> ! <mail mailhost="${smtp.host}" subject="Spring ${label} SUCCEEDED" tolist="spr...@li..." from="bu...@in..."> <message>Snapshot has been uploaded to http://www.springframework.org/snaphots *************** *** 110,114 **** </target> ! <target name="automated-build" depends="cvs-update,clean,testsummary,release, snapshot"/> --- 110,114 ---- </target> ! <target name="automated-build" depends="clean,testsummary,release, snapshot"/> |
From: Juergen H. <jho...@us...> - 2006-04-20 13:44:20
|
Update of /cvsroot/springframework/spring/src/org/springframework/dao/support In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32598/src/org/springframework/dao/support Modified Files: DaoSupport.java Log Message: initialize specialized template in overridden "checkDaoConfig()" method Index: DaoSupport.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/dao/support/DaoSupport.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DaoSupport.java 1 Jun 2005 16:10:53 -0000 1.1 --- DaoSupport.java 20 Apr 2006 13:44:15 -0000 1.2 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 39,42 **** --- 39,43 ---- protected final Log logger = LogFactory.getLog(getClass()); + public final void afterPropertiesSet() throws IllegalArgumentException, BeanInitializationException { // Let abstract subclasses check their configuration. *************** *** 48,52 **** } catch (Exception ex) { ! throw new BeanInitializationException("Initialization of DAO failed: " + ex.getMessage(), ex); } } --- 49,53 ---- } catch (Exception ex) { ! throw new BeanInitializationException("Initialization of DAO failed", ex); } } *************** *** 54,59 **** /** * Abstract subclasses must override this to check their configuration. ! * <p>Implementors should be marked as <code>final</code>, to make it clear that ! * concrete subclasses are not supposed to override this template method themselves. * @throws IllegalArgumentException in case of illegal configuration */ --- 55,60 ---- /** * Abstract subclasses must override this to check their configuration. ! * <p>Implementors should be marked as <code>final</code if concrete subclasses ! * are not supposed to override this template method themselves. * @throws IllegalArgumentException in case of illegal configuration */ |
From: Juergen H. <jho...@us...> - 2006-04-20 13:43:43
|
Update of /cvsroot/springframework/spring/src/org/springframework/jdbc/core/namedparam In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32009/src/org/springframework/jdbc/core/namedparam Modified Files: NamedParameterJdbcDaoSupport.java Log Message: initialize specialized template in overridden "checkDaoConfig()" method Index: NamedParameterJdbcDaoSupport.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/core/namedparam/NamedParameterJdbcDaoSupport.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NamedParameterJdbcDaoSupport.java 20 Apr 2006 12:18:40 -0000 1.1 --- NamedParameterJdbcDaoSupport.java 20 Apr 2006 13:43:32 -0000 1.2 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 17,30 **** package org.springframework.jdbc.core.namedparam; - import javax.sql.DataSource; - - import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.support.JdbcDaoSupport; /** ! * Extension of JdbcDaoSupport to expose a NamedParameterJdbcTemplate. * * @author Thomas Risberg - * @author Rod Johnson * @author Juergen Hoeller * @since 2.0 --- 17,26 ---- package org.springframework.jdbc.core.namedparam; import org.springframework.jdbc.core.support.JdbcDaoSupport; /** ! * Extension of JdbcDaoSupport that exposes a NamedParameterJdbcTemplate as well. * * @author Thomas Risberg * @author Juergen Hoeller * @since 2.0 *************** *** 37,50 **** /** ! * Overridden to not only create a JdbcTemplate but also a NamedParameterJdbcTemplate. */ ! protected JdbcTemplate createJdbcTemplate(DataSource dataSource) { ! JdbcTemplate jt = new JdbcTemplate(dataSource); ! this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jt); ! return jt; } ! /** ! * Return a NamedParameterJdbcTemplate wrapping the current JdbcTemplate. */ public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() { --- 33,46 ---- /** ! * Overridden to create a NamedParameterJdbcTemplate based on the ! * configured JdbcTemplate. */ ! protected void checkDaoConfig() { ! super.checkDaoConfig(); ! this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(getJdbcTemplate()); } ! /** ! * Return a NamedParameterJdbcTemplate wrapping the configured JdbcTemplate. */ public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() { |
From: Juergen H. <jho...@us...> - 2006-04-20 13:43:40
|
Update of /cvsroot/springframework/spring/tiger/src/org/springframework/jdbc/core/simple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32009/tiger/src/org/springframework/jdbc/core/simple Modified Files: SimpleJdbcDaoSupport.java Log Message: initialize specialized template in overridden "checkDaoConfig()" method Index: SimpleJdbcDaoSupport.java =================================================================== RCS file: /cvsroot/springframework/spring/tiger/src/org/springframework/jdbc/core/simple/SimpleJdbcDaoSupport.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimpleJdbcDaoSupport.java 7 Dec 2005 04:15:49 -0000 1.1 --- SimpleJdbcDaoSupport.java 20 Apr 2006 13:43:33 -0000 1.2 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 17,28 **** package org.springframework.jdbc.core.simple; - import javax.sql.DataSource; - - import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.support.JdbcDaoSupport; /** ! * Extension of JdbcDaoSupport to expose a SimpleJdbcTemplate. ! * Only usable with Java 5 and above. * * @author Rod Johnson --- 17,25 ---- package org.springframework.jdbc.core.simple; import org.springframework.jdbc.core.support.JdbcDaoSupport; /** ! * Extension of JdbcDaoSupport that exposes a SimpleJdbcTemplate as well. ! * Only usable on Java 5 and above. * * @author Rod Johnson *************** *** 37,50 **** /** ! * Overridden to not only create a JdbcTemplate but also a SimpleJdbcTemplate. */ ! protected JdbcTemplate createJdbcTemplate(DataSource dataSource) { ! JdbcTemplate jt = new JdbcTemplate(dataSource); ! this.simpleJdbcTemplate = new SimpleJdbcTemplate(jt); ! return jt; } ! /** ! * Return a SimpleJdbcTemplate wrapping the current JdbcTemplate. */ public SimpleJdbcTemplate getSimpleJdbcTemplate() { --- 34,47 ---- /** ! * Overridden to create a SimpleJdbcTemplate based on the configured ! * JdbcTemplate. */ ! protected void checkDaoConfig() { ! super.checkDaoConfig(); ! this.simpleJdbcTemplate = new SimpleJdbcTemplate(getJdbcTemplate()); } ! /** ! * Return a SimpleJdbcTemplate wrapping the configured JdbcTemplate. */ public SimpleJdbcTemplate getSimpleJdbcTemplate() { |
From: Juergen H. <jho...@us...> - 2006-04-20 13:43:38
|
Update of /cvsroot/springframework/spring/src/org/springframework/jdbc/core/support In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32009/src/org/springframework/jdbc/core/support Modified Files: JdbcDaoSupport.java Log Message: initialize specialized template in overridden "checkDaoConfig()" method Index: JdbcDaoSupport.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/core/support/JdbcDaoSupport.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** JdbcDaoSupport.java 19 Nov 2005 20:17:58 -0000 1.16 --- JdbcDaoSupport.java 20 Apr 2006 13:43:33 -0000 1.17 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed 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, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed 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, *************** *** 90,94 **** } ! protected final void checkDaoConfig() { if (this.jdbcTemplate == null) { throw new IllegalArgumentException("dataSource or jdbcTemplate is required"); --- 90,94 ---- } ! protected void checkDaoConfig() { if (this.jdbcTemplate == null) { throw new IllegalArgumentException("dataSource or jdbcTemplate is required"); |
From: Rob H. <rob...@us...> - 2006-04-20 13:07:19
|
Update of /cvsroot/springframework/spring/tiger/test/org/springframework/aop/aspectj/annotation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4412/tiger/test/org/springframework/aop/aspectj/annotation Modified Files: AspectProxyFactoryTests.java Log Message: Added addAspect(Object) to AspectJProxyFactory Index: AspectProxyFactoryTests.java =================================================================== RCS file: /cvsroot/springframework/spring/tiger/test/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AspectProxyFactoryTests.java 19 Apr 2006 14:56:23 -0000 1.1 --- AspectProxyFactoryTests.java 20 Apr 2006 13:06:27 -0000 1.2 *************** *** 20,24 **** import org.springframework.aop.aspectj.autoproxy.MultiplyReturnValue; import org.springframework.aop.aspectj.autoproxy.PerThisAspect; - import org.springframework.aop.aspectj.annotation.AspectJProxyFactory; import org.springframework.beans.ITestBean; import org.springframework.beans.TestBean; --- 20,23 ---- *************** *** 40,44 **** } ! public void testWithSimpleAspect() throws Exception { TestBean bean = new TestBean(); bean.setAge(2); --- 39,43 ---- } ! public void testWithSimpleAspect() throws Exception { TestBean bean = new TestBean(); bean.setAge(2); *************** *** 67,69 **** --- 66,102 ---- assertEquals(2, proxy1.getAge()); } + + public void testWithInstanceWithNonAspect() throws Exception { + new AssertThrows(IllegalArgumentException.class) { + public void test() throws Exception { + AspectJProxyFactory pf = new AspectJProxyFactory(); + pf.addAspect(new TestBean()); + } + }.runTest(); + } + + public void testWithInstance() throws Exception { + MultiplyReturnValue aspect = new MultiplyReturnValue(); + int multiple = 3; + aspect.setMultiple(multiple); + + TestBean target = new TestBean(); + target.setAge(24); + + AspectJProxyFactory proxyFactory = new AspectJProxyFactory(target); + proxyFactory.addAspect(aspect); + + ITestBean proxy = proxyFactory.getProxy(); + + assertEquals(target.getAge() * multiple, proxy.getAge()); + } + + public void testWithNonSingletonAspectInstance() throws Exception { + new AssertThrows(IllegalArgumentException.class) { + public void test() throws Exception { + AspectJProxyFactory pf = new AspectJProxyFactory(); + pf.addAspect(new PerThisAspect()); + } + }.runTest(); + } } |
From: Rob H. <rob...@us...> - 2006-04-20 13:07:19
|
Update of /cvsroot/springframework/spring/tiger/src/org/springframework/aop/aspectj/annotation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4412/tiger/src/org/springframework/aop/aspectj/annotation Modified Files: AspectJProxyFactory.java Log Message: Added addAspect(Object) to AspectJProxyFactory Index: AspectJProxyFactory.java =================================================================== RCS file: /cvsroot/springframework/spring/tiger/src/org/springframework/aop/aspectj/annotation/AspectJProxyFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AspectJProxyFactory.java 19 Apr 2006 14:56:23 -0000 1.1 --- AspectJProxyFactory.java 20 Apr 2006 13:06:27 -0000 1.2 *************** *** 45,48 **** --- 45,53 ---- /** + * The {@link AspectJAdvisorFactory} used by this instance. + */ + private final AspectJAdvisorFactory aspectFactory = new ReflectiveAspectJAdvisorFactory(); + + /** * Caches singleton aspect instances. */ *************** *** 98,107 **** /** * Adds an aspect of the supplied type to the end of the advice chain. */ public void addAspect(Class aspectType) { - String beanName = aspectType.getName(); ! AspectJAdvisorFactory aspectFactory = new ReflectiveAspectJAdvisorFactory(); AspectMetadata am = new AspectMetadata(aspectType, beanName); --- 103,149 ---- /** + * Adds the supplied aspect instance to the chain. The type of the aspect instance + * supplied must be a singleton aspect. True singleton lifecycle is not honoured when + * using this method - the caller is responsible for managing the lifecycle of any + * aspects added in this way. + */ + public void addAspect(Object aspect) { + Class aspectType = aspect.getClass(); + String beanName = aspectType.getName(); + AspectMetadata am = createAspectMetadata(aspectType, beanName); + if (am.getAjType().getPerClause().getKind() != PerClauseKind.SINGLETON) { + throw new IllegalArgumentException("Aspect type '" + aspectType.getName() + "' is not a singleton aspect."); + } + MetadataAwareAspectInstanceFactory instanceFactory = new SingletonMetadataAwareAspectInstanceFactory(aspect, beanName); + addAdvisorsFromAspectInstanceFactory(instanceFactory); + } + + /** * Adds an aspect of the supplied type to the end of the advice chain. */ public void addAspect(Class aspectType) { String beanName = aspectType.getName(); ! AspectMetadata am = createAspectMetadata(aspectType, beanName); ! MetadataAwareAspectInstanceFactory instanceFactory = createAspectInstanceFactory(am, aspectType, beanName); ! addAdvisorsFromAspectInstanceFactory(instanceFactory); ! } ! ! /** ! * Adds all {@link Advisor Advisors} from the supplied {@link MetadataAwareAspectInstanceFactory} to ! * the curren chain. Exposes any special purpose {@link Advisor Advisors} if needed. ! * @see #makeAdvisorChainAspectJCapableIfNecessary() ! */ ! private void addAdvisorsFromAspectInstanceFactory(MetadataAwareAspectInstanceFactory instanceFactory) { ! List advisors = this.aspectFactory.getAdvisors(instanceFactory); ! this.addAllAdvisors((Advisor[]) advisors.toArray(new Advisor[advisors.size()])); ! ! makeAdvisorChainAspectJCapableIfNecessary(); ! } ! ! /** ! * Creates an {@link AspectMetadata} instance for the supplied aspect type. ! * @throws IllegalArgumentException if the supplied {@link Class} is not a valid aspect type. ! */ ! private AspectMetadata createAspectMetadata(Class aspectType, String beanName) { AspectMetadata am = new AspectMetadata(aspectType, beanName); *************** *** 110,119 **** } ! MetadataAwareAspectInstanceFactory instanceFactory = createAspectInstanceFactory(am, aspectType, beanName); ! ! List advisors = aspectFactory.getAdvisors(instanceFactory); ! this.addAllAdvisors((Advisor[]) advisors.toArray(new Advisor[advisors.size()])); ! ! makeAdvisorChainAspectJCapableIfNecessary(); } --- 152,156 ---- } ! return am; } |