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: Keith D. <kd...@us...> - 2006-04-22 17:27:36
|
Update of /cvsroot/springframework/spring-projects/spring-webflow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13422 Modified Files: changelog.txt Log Message: polish Index: changelog.txt =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/changelog.txt,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** changelog.txt 16 Apr 2006 17:17:21 -0000 1.63 --- changelog.txt 22 Apr 2006 17:27:33 -0000 1.64 *************** *** 3,7 **** http://www.springframework.org ! Changes in version 1.0 RC1 (21.4.2006) ------------------------------------ --- 3,7 ---- http://www.springframework.org ! Changes in version 1.0 RC1 (24.4.2006) ------------------------------------ *************** *** 28,31 **** --- 28,33 ---- * Changed the 'attribute-mapper' element of the 'subflow-state' element to be consistent with the new 'input-mapper' and 'output-mapper' elements, for mapping input and output attributes to and from a subflow, respectively. + * Changed the 'output-attribute' element of the 'end-state' element to be consistent with the new + 'output-mapper' elements, for output attributes specific to a flow outcome. * Added an 'on-exception' attribute to the 'transition' element, for executing a state transition as part of state or flow exception handler logic. This supercedes use of the 'class' and 'to' attributes of the *************** *** 45,48 **** --- 47,55 ---- * Enhanced the 'view' attribute of the 'view-state' and 'end-state' elements to be fully ${expression} capable; previously expressions could only be defined for redirect parameters. + * Refined the FlowArtifactFactory interface, acting now as both a service locator and abstract factory. + * Refined the FlowBuilder interface, adding builder methods for each type of major Flow construct. + * Reworked AbstractFlowBuilder and XmlFlowBuilder to bring them in-line with the FlowArtifactFactory and FlowBuilder refinements. + * XmlFlowBuilder now respects deployment within a WebApplicationContext now, supporting access to the + ServletContext from within beans deployed in flow-local contexts. Package org.springframework.webflow.context |
From: Keith D. <kd...@us...> - 2006-04-22 17:20:36
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9220/src/java/org/springframework/webflow/builder Modified Files: FlowArtifactFactory.java Log Message: javadoc Index: FlowArtifactFactory.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder/FlowArtifactFactory.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** FlowArtifactFactory.java 22 Apr 2006 01:15:54 -0000 1.28 --- FlowArtifactFactory.java 22 Apr 2006 17:20:33 -0000 1.29 *************** *** 23,29 **** /** ! * A support interface used by FlowBuilders at configuration time to retrieve ! * dependent (but externally managed) flow artifacts needed to build a flow ! * definition. Acts a facade to accessing externally managed flow artifacts. * * @author Keith Donald --- 23,41 ---- /** ! * A support interface used by FlowBuilders at configuration time that serves ! * two roles: ! * <ol> ! * <li> As a service locator, to retrieve dependent (but externally managed flow ! * artifacts needed to build flow and state definitions. Such artifacts are ! * usually hosted in a backing registry, and may be shared by multiple flows. ! * <li> As an abstract factory, to create core flow-specific artifacts such as ! * {@link Flow}, {@link State}, {@link Transition}, and ! * {@link AbstractBeanInvokingAction bean invoking actions}. These artifacts ! * are unique to each flow and are typically not shared. ! * ! * In general, implementations of this interface act as facades to accessing and ! * creating flow artifacts during {@link FlowAssembler flow assembly}. Finally, ! * this interface also exposes access to generic infrastructure services also ! * needed by flow assemblers. * * @author Keith Donald *************** *** 32,36 **** /** ! * Retrieve the Flow to be used as a subflow with the provided id. * @param id the flow id * @return the flow to be used as a subflow --- 44,48 ---- /** ! * Returns the Flow to be used as a subflow with the provided id. * @param id the flow id * @return the flow to be used as a subflow *************** *** 69,74 **** /** ! * Retrieve the flow attribute mapper to be used in a subflow state with the ! * provided id. * @param id the id * @return the attribute mapper --- 81,86 ---- /** ! * Returns the flow attribute mapper with the provided id. Flow attribute ! * mappers are used from subflow states to map input and output attributes. * @param id the id * @return the attribute mapper *************** *** 78,82 **** /** ! * Retrieve the transition criteria to drive state transitions with the * provided id. * @param id the id --- 90,94 ---- /** ! * Returns the transition criteria to drive state transitions with the * provided id. * @param id the id *************** *** 87,92 **** /** ! * Retrieve the view selector to make view selections in view states with ! * the provided id. * @param id the id * @return the view selector --- 99,104 ---- /** ! * Returns the view selector to make view selections in view states with the ! * provided id. * @param id the id * @return the view selector *************** *** 96,100 **** /** ! * Retrieve the exception handler to handle state exceptions with the * provided id. * @param id the id --- 108,112 ---- /** ! * Returns the exception handler to handle state exceptions with the * provided id. * @param id the id *************** *** 105,109 **** /** ! * Retrieve the transition target state resolver with the specified id. * @param id the id * @return the target state resolver --- 117,121 ---- /** ! * Returns the transition target state resolver with the specified id. * @param id the id * @return the target state resolver *************** *** 112,142 **** public TargetStateResolver getTargetStateResolver(String id) throws FlowArtifactException; public Flow createFlow(String id, AttributeCollection attributes) throws FlowArtifactException; public State createViewState(String id, Flow flow, Action[] entryActions, ViewSelector viewSelector, Transition[] transitions, StateExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeCollection attributes) throws FlowArtifactException; public State createActionState(String id, Flow flow, Action[] entryActions, Action[] actions, Transition[] transitions, StateExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeCollection attributes) throws FlowArtifactException; public State createDecisionState(String id, Flow flow, Action[] entryActions, Transition[] transitions, StateExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeCollection attributes) throws FlowArtifactException; public State createSubflowState(String id, Flow flow, Action[] entryActions, Flow subflow, FlowAttributeMapper attributeMapper, Transition[] transitions, StateExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeCollection attributes) throws FlowArtifactException; public State createEndState(String id, Flow flow, Action[] entryActions, ViewSelector viewSelector, AttributeMapper outputMapper, StateExceptionHandler[] exceptionHandlers, AttributeCollection attributes) throws FlowArtifactException; public Transition createTransition(TransitionCriteria matchingCriteria, TransitionCriteria executionCriteria, TargetStateResolver targetStateResolver, AttributeCollection attributes) throws FlowArtifactException; public Action createBeanInvokingAction(String beanId, MethodSignature methodSignature, ! ResultSpecification resultSpecification, AttributeCollection attributes); /** --- 124,296 ---- public TargetStateResolver getTargetStateResolver(String id) throws FlowArtifactException; + /** + * Factory method that creates a new {@link Flow} definition object. + * <p> + * Note this method does not return a fully configured Flow instance, it + * only encapsulates the selection of implementation. A + * {@link FlowAssembler} delegating to a calling {@link FlowBuilder} is + * expected to assemble the Flow fully before returning it to external + * clients. + * @param id the flow id the flow identifier, should be unique to all flows + * in an application (required) + * @param attributes attributes to assign to the Flow, which may also be + * used to affect flow construction; may be null + * @return the initial flow instance, ready for assembly by a FlowBuilder + * @throws FlowArtifactException an exception occured creating the Flow + * instance + */ public Flow createFlow(String id, AttributeCollection attributes) throws FlowArtifactException; + /** + * Factory method that creates a new view state, a state where a user is + * allowed to participate in the flow. This method is an atomic operation + * that returns a fully initialized state. It encapsulates the selection of + * the view state implementation as well as the state assembly. + * @param id the identifier to assign to the state, must be unique to its + * owning flow (required) + * @param flow the flow that will own (contain) this state (required) + * @param entryActions any state entry actions; may be null + * @param viewSelector the state view selector strategy; may be null + * @param transitions any transitions (paths) out of this state; may be null + * @param exceptionHandlers any exception handlers; may be null + * @param exitActions any state exit actions; may be null + * @param attributes attributes to assign to the State; which may also be + * used to affect state construction. May be null. + * @return the fully initialized view state instance + * @throws FlowArtifactException an exception occured creating the state + */ public State createViewState(String id, Flow flow, Action[] entryActions, ViewSelector viewSelector, Transition[] transitions, StateExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeCollection attributes) throws FlowArtifactException; + /** + * Factory method that creates a new action state, a state where a system + * action is executed. This method is an atomic operation that returns a + * fully initialized state. It encapsulates the selection of the action + * state implementation as well as the state assembly. + * @param id the identifier to assign to the state, must be unique to its + * owning flow (required) + * @param flow the flow that will own (contain) this state (required) + * @param entryActions any state entry actions; may be null + * @param actions the actions to execute when the state is entered + * (required) + * @param transitions any transitions (paths) out of this state; may be null + * @param exceptionHandlers any exception handlers; may be null + * @param exitActions any state exit actions; may be null + * @param attributes attributes to assign to the State; which may also be + * used to affect state construction. May be null. + * @return the fully initialized action state instance + * @throws FlowArtifactException an exception occured creating the state + */ public State createActionState(String id, Flow flow, Action[] entryActions, Action[] actions, Transition[] transitions, StateExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeCollection attributes) throws FlowArtifactException; + /** + * Factory method that creates a new decision state, a state where a flow + * routing decision is made. This method is an atomic operation that returns + * a fully initialized state. It encapsulates the selection of the decision + * state implementation as well as the state assembly. + * @param id the identifier to assign to the state, must be unique to its + * owning flow (required) + * @param flow the flow that will own (contain) this state (required) + * @param entryActions any state entry actions; may be null + * @param transitions any transitions (paths) out of this state + * @param exceptionHandlers any exception handlers; may be null + * @param exitActions any state exit actions; may be null + * @param attributes attributes to assign to the State; which may also be + * used to affect state construction. May be null. + * @return the fully initialized decision state instance + * @throws FlowArtifactException an exception occured creating the state + */ public State createDecisionState(String id, Flow flow, Action[] entryActions, Transition[] transitions, StateExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeCollection attributes) throws FlowArtifactException; + /** + * Factory method that creates a new subflow state, a state where a parent + * flow spawns another flow as a subflow. This method is an atomic operation + * that returns a fully initialized state. It encapsulates the selection of + * the subflow state implementation as well as the state assembly. + * @param id the identifier to assign to the state, must be unique to its + * owning flow (required) + * @param flow the flow that will own (contain) this state (required) + * @param entryActions any state entry actions; may be null + * @param subflow the subflow definition (required) + * @param attributeMapper the subflow input and output attribute mapper; may + * be null + * @param transitions any transitions (paths) out of this state + * @param exceptionHandlers any exception handlers; may be null + * @param exitActions any state exit actions; may be null + * @param attributes attributes to assign to the State; which may also be + * used to affect state construction. May be null. + * @return the fully initialized subflow state instance + * @throws FlowArtifactException an exception occured creating the state + */ public State createSubflowState(String id, Flow flow, Action[] entryActions, Flow subflow, FlowAttributeMapper attributeMapper, Transition[] transitions, StateExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeCollection attributes) throws FlowArtifactException; + /** + * Factory method that creates a new end state, a state where an executing + * flow session terminates. This method is an atomic operation that returns + * a fully initialized state. It encapsulates the selection of the end state + * implementation as well as the state assembly. + * @param id the identifier to assign to the state, must be unique to its + * owning flow (required) + * @param flow the flow that will own (contain) this state (required) + * @param entryActions any state entry actions; may be null + * @param viewSelector the state confirmation view selector strategy; may be + * null + * @param outputMapper the state output mapper; may be null + * @param exceptionHandlers any exception handlers; may be null + * @param exitActions any state exit actions; may be null + * @param attributes attributes to assign to the State; which may also be + * used to affect state construction. May be null. + * @return the fully initialized subflow state instance + * @throws FlowArtifactException an exception occured creating the state + */ public State createEndState(String id, Flow flow, Action[] entryActions, ViewSelector viewSelector, AttributeMapper outputMapper, StateExceptionHandler[] exceptionHandlers, AttributeCollection attributes) throws FlowArtifactException; + /** + * Factory method that creates a new transition, a path from one step in a + * flow to another. This method is an atomic operation that returns a fully + * initialized transition. It encapsulates the selection of the transition + * implementation as well as the transition assembly. + * @param matchingCriteria the criteria that matches the transition; may be + * null + * @param executionCriteria the criteria that governs execution of the + * transition after match; may be null + * @param targetStateResolver the resolver for calculating the target state + * of the transition (required) + * @param attributes attributes to assign to the transition, which may also + * be used to affect transition construction. May be null. + * @return the fully initialized transition instance + * @throws FlowArtifactException an exception occured creating the + * transition + */ public Transition createTransition(TransitionCriteria matchingCriteria, TransitionCriteria executionCriteria, TargetStateResolver targetStateResolver, AttributeCollection attributes) throws FlowArtifactException; + /** + * Factory method that creates a bean invoking action, an adapter that + * adapts a method on an abitrary {@link Object} to the {@link Action} + * interface. This method is an atomic operation that returns a fully + * initialized Action. It encapsulates the selection of the action + * implementation as well as the action assembly. + * @param beanId the bean to be adapted to an Action instance + * @param methodSignature the method to invoke on the bean when the action + * is executed (required) + * @param resultSpecification the specification for what to do with the + * method return value; may be null + * @param attributes attributes that may be used to affect the bean invoking + * action's construction + * @return the fully configured bean invoking action instance + * @throws FlowArtifactException an exception occured creating the action + */ public Action createBeanInvokingAction(String beanId, MethodSignature methodSignature, ! ResultSpecification resultSpecification, AttributeCollection attributes) throws FlowArtifactException; /** |
From: Keith D. <kd...@us...> - 2006-04-22 16:49:22
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/registry In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23634/src/java/org/springframework/webflow/registry Modified Files: ExternalizedFlowDefinition.java Log Message: polish Index: ExternalizedFlowDefinition.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/registry/ExternalizedFlowDefinition.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ExternalizedFlowDefinition.java 22 Apr 2006 15:06:51 -0000 1.12 --- ExternalizedFlowDefinition.java 22 Apr 2006 16:49:15 -0000 1.13 *************** *** 19,22 **** --- 19,23 ---- import org.springframework.core.io.Resource; + import org.springframework.core.style.ToStringCreator; import org.springframework.webflow.AttributeCollection; import org.springframework.webflow.CollectionUtils; *************** *** 96,109 **** return attributes; } ! private String stripExtension(String fileName) { int extensionIndex = fileName.indexOf('.'); if (extensionIndex != -1) { return fileName.substring(0, extensionIndex); ! } else { return fileName; } } ! private void setAttributes(AttributeCollection attributes) { if (attributes != null) { --- 97,111 ---- return attributes; } ! private String stripExtension(String fileName) { int extensionIndex = fileName.indexOf('.'); if (extensionIndex != -1) { return fileName.substring(0, extensionIndex); ! } ! else { return fileName; } } ! private void setAttributes(AttributeCollection attributes) { if (attributes != null) { *************** *** 114,116 **** --- 116,123 ---- } } + + public String toString() { + return new ToStringCreator(this).append("id", id).append("location", location).append("attributes", attributes) + .toString(); + } } \ No newline at end of file |
From: Keith D. <kd...@us...> - 2006-04-22 16:47:43
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22622/src/java/org/springframework/webflow/builder Modified Files: XmlFlowBuilder.java Log Message: Index: XmlFlowBuilder.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder/XmlFlowBuilder.java,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** XmlFlowBuilder.java 22 Apr 2006 16:43:02 -0000 1.85 --- XmlFlowBuilder.java 22 Apr 2006 16:47:36 -0000 1.86 *************** *** 89,94 **** * * <pre> ! * <!DOCTYPE flow PUBLIC "-//SPRING//DTD WEBFLOW 1.0//EN" ! * "http://www.springframework.org/dtd/spring-webflow-1.0.dtd"> * </pre> * --- 89,94 ---- * * <pre> ! * <!DOCTYPE flow PUBLIC "-//SPRING//DTD WEBFLOW 1.0//EN" ! * "http://www.springframework.org/dtd/spring-webflow-1.0.dtd"> * </pre> * |
From: Keith D. <kd...@us...> - 2006-04-22 16:43:08
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19966/src/java/org/springframework/webflow/builder Modified Files: XmlFlowBuilder.java Log Message: polish Index: XmlFlowBuilder.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder/XmlFlowBuilder.java,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** XmlFlowBuilder.java 22 Apr 2006 16:13:29 -0000 1.84 --- XmlFlowBuilder.java 22 Apr 2006 16:43:02 -0000 1.85 *************** *** 19,22 **** --- 19,23 ---- import java.io.InputStream; import java.util.Arrays; + import java.util.Collections; import java.util.HashMap; import java.util.Iterator; *************** *** 74,77 **** --- 75,79 ---- import org.springframework.webflow.support.SimpleFlowVariable; import org.springframework.webflow.support.TransitionCriteriaChain; + import org.springframework.webflow.support.TransitionExecutingStateExceptionHandler; import org.w3c.dom.Document; import org.w3c.dom.Element; *************** *** 87,92 **** * * <pre> ! * <!DOCTYPE flow PUBLIC "-//SPRING//DTD WEBFLOW 1.0//EN" ! * "http://www.springframework.org/dtd/spring-webflow-1.0.dtd"> * </pre> * --- 89,94 ---- * * <pre> ! * <!DOCTYPE flow PUBLIC "-//SPRING//DTD WEBFLOW 1.0//EN" ! * "http://www.springframework.org/dtd/spring-webflow-1.0.dtd"> * </pre> * *************** *** 431,439 **** private Flow parseFlow(String id, AttributeCollection attributes, Element flowElement) { ! Assert.state(FLOW_ELEMENT.equals(flowElement.getTagName()), "This is not the '" + FLOW_ELEMENT + "' element"); initLocalFlowArtifactFactoryRegistry(flowElement); return getLocalFlowArtifactFactory().createFlow(id, attributes); } /** * Returns the document. --- 433,447 ---- private Flow parseFlow(String id, AttributeCollection attributes, Element flowElement) { ! if (!isFlowElement(flowElement)) { ! throw new IllegalStateException("This is not the '" + FLOW_ELEMENT + "' element"); ! } initLocalFlowArtifactFactoryRegistry(flowElement); return getLocalFlowArtifactFactory().createFlow(id, attributes); } + private boolean isFlowElement(Element flowElement) { + return FLOW_ELEMENT.equals(flowElement.getTagName()); + } + /** * Returns the document. *************** *** 522,528 **** private void parseAndAddGlobalTransitions(Element element, Flow flow) { ! List transitionElements = DomUtils.getChildElementsByTagName(element, GLOBAL_TRANSITIONS_ELEMENT); ! if (!transitionElements.isEmpty()) { ! Element globalTransitionsElement = (Element)transitionElements.get(0); flow.getGlobalTransitionSet().addAll(parseTransitions(globalTransitionsElement)); } --- 530,536 ---- private void parseAndAddGlobalTransitions(Element element, Flow flow) { ! List globalTransitionElements = DomUtils.getChildElementsByTagName(element, GLOBAL_TRANSITIONS_ELEMENT); ! if (!globalTransitionElements.isEmpty()) { ! Element globalTransitionsElement = (Element)globalTransitionElements.get(0); flow.getGlobalTransitionSet().addAll(parseTransitions(globalTransitionsElement)); } *************** *** 580,584 **** parseAndSetStartState(flowElement, flow); } ! private void parseAndSetStartState(Element element, Flow flow) { String startStateId = element.getAttribute(START_STATE_ATTRIBUTE); --- 588,592 ---- parseAndSetStartState(flowElement, flow); } ! private void parseAndSetStartState(Element element, Flow flow) { String startStateId = element.getAttribute(START_STATE_ATTRIBUTE); *************** *** 654,657 **** --- 662,675 ---- } + private Transition parseTransition(Element element) { + TransitionCriteria matchingCriteria = (TransitionCriteria)fromStringTo(TransitionCriteria.class).execute( + element.getAttribute(ON_ATTRIBUTE)); + TransitionCriteria executionCriteria = TransitionCriteriaChain.criteriaChainFor(parseAnnotatedActions(element)); + TargetStateResolver targetStateResolver = (TargetStateResolver)fromStringTo(TargetStateResolver.class).execute( + element.getAttribute(TO_ATTRIBUTE)); + return getLocalFlowArtifactFactory().createTransition(matchingCriteria, executionCriteria, targetStateResolver, + null); + } + private ViewSelector parseViewSelector(String stateType, Element element) { String viewName = element.getAttribute(VIEW_ATTRIBUTE); *************** *** 764,777 **** } - private Transition parseTransition(Element element) { - TransitionCriteria matchingCriteria = (TransitionCriteria)fromStringTo(TransitionCriteria.class).execute( - element.getAttribute(ON_ATTRIBUTE)); - TransitionCriteria executionCriteria = TransitionCriteriaChain.criteriaChainFor(parseAnnotatedActions(element)); - TargetStateResolver targetStateResolver = (TargetStateResolver)fromStringTo(TargetStateResolver.class).execute( - element.getAttribute(TO_ATTRIBUTE)); - return getLocalFlowArtifactFactory().createTransition(matchingCriteria, executionCriteria, targetStateResolver, - null); - } - private Transition[] parseIfs(Element element) { List transitions = new LinkedList(); --- 782,785 ---- *************** *** 873,887 **** private StateExceptionHandler[] parseExceptionHandlers(Element element) { ! List handlerElements = DomUtils.getChildElementsByTagName(element, EXCEPTION_HANDLER_ELEMENT); ! if (handlerElements.isEmpty()) { ! return null; } ! StateExceptionHandler[] exceptionHandlers = new StateExceptionHandler[handlerElements.size()]; for (int i = 0; i < handlerElements.size(); i++) { Element handlerElement = (Element)handlerElements.get(i); ! exceptionHandlers[i] = getLocalFlowArtifactFactory().getExceptionHandler( ! handlerElement.getAttribute(BEAN_ATTRIBUTE)); } ! return exceptionHandlers; } --- 881,936 ---- private StateExceptionHandler[] parseExceptionHandlers(Element element) { ! StateExceptionHandler[] transitionExecutingHandlers = parseTransitionExecutingExceptionHandlers(element); ! StateExceptionHandler[] customHandlers = parseCustomExceptionHandlers(element); ! StateExceptionHandler[] exceptionHandlers = new StateExceptionHandler[transitionExecutingHandlers.length ! + customHandlers.length]; ! System.arraycopy(transitionExecutingHandlers, 0, exceptionHandlers, 0, transitionExecutingHandlers.length); ! System.arraycopy(customHandlers, 0, exceptionHandlers, transitionExecutingHandlers.length, ! customHandlers.length); ! return exceptionHandlers; ! } ! ! private StateExceptionHandler[] parseTransitionExecutingExceptionHandlers(Element element) { ! List transitionElements = Collections.EMPTY_LIST; ! if (isFlowElement(element)) { ! List globalTransitionElements = DomUtils.getChildElementsByTagName(element, GLOBAL_TRANSITIONS_ELEMENT); ! if (!globalTransitionElements.isEmpty()) { ! Element globalTransitionsElement = (Element)globalTransitionElements.get(0); ! transitionElements = DomUtils.getChildElementsByTagName(globalTransitionsElement, TRANSITION_ELEMENT); ! } } ! else { ! transitionElements = DomUtils.getChildElementsByTagName(element, TRANSITION_ELEMENT); ! } ! List exceptionHandlers = new LinkedList(); ! for (int i = 0; i < transitionElements.size(); i++) { ! Element transitionElement = (Element)transitionElements.get(i); ! if (StringUtils.hasText(transitionElement.getAttribute(ON_EXCEPTION_ATTRIBUTE))) { ! exceptionHandlers.add(parseTransitionExecutingExceptionHandler(transitionElement)); ! } ! } ! return (StateExceptionHandler[])exceptionHandlers.toArray(new StateExceptionHandler[exceptionHandlers.size()]); ! } ! ! private StateExceptionHandler parseTransitionExecutingExceptionHandler(Element element) { ! TransitionExecutingStateExceptionHandler handler = new TransitionExecutingStateExceptionHandler(); ! Class exceptionClass = (Class)fromStringTo(Class.class).execute(element.getAttribute(ON_EXCEPTION_ATTRIBUTE)); ! handler.add(exceptionClass, (TargetStateResolver)fromStringTo(TargetStateResolver.class).execute( ! element.getAttribute(TO_ATTRIBUTE))); ! return handler; ! } ! ! private StateExceptionHandler[] parseCustomExceptionHandlers(Element element) { ! List exceptionHandlers = new LinkedList(); ! List handlerElements = DomUtils.getChildElementsByTagName(element, EXCEPTION_HANDLER_ELEMENT); for (int i = 0; i < handlerElements.size(); i++) { Element handlerElement = (Element)handlerElements.get(i); ! exceptionHandlers.add(parseCustomExceptionHandler(handlerElement)); } ! return (StateExceptionHandler[])exceptionHandlers.toArray(new StateExceptionHandler[exceptionHandlers.size()]); ! } ! ! private StateExceptionHandler parseCustomExceptionHandler(Element element) { ! return getLocalFlowArtifactFactory().getExceptionHandler(element.getAttribute(BEAN_ATTRIBUTE)); } *************** *** 976,980 **** */ private GenericApplicationContext context; ! /** * Create new registry --- 1025,1029 ---- */ private GenericApplicationContext context; ! /** * Create new registry *************** *** 984,988 **** this.resources = resources; } ! private void init(LocalFlowArtifactFactory localFactory, FlowArtifactFactory rootFactory) { BeanFactory parent = null; --- 1033,1037 ---- this.resources = resources; } ! private void init(LocalFlowArtifactFactory localFactory, FlowArtifactFactory rootFactory) { BeanFactory parent = null; *************** *** 990,997 **** try { parent = rootFactory.getServiceRegistry(); - } catch (UnsupportedOperationException e) { - } ! } else { parent = localFactory.top().context; } --- 1039,1048 ---- try { parent = rootFactory.getServiceRegistry(); } ! catch (UnsupportedOperationException e) { ! ! } ! } ! else { parent = localFactory.top().context; } *************** *** 1000,1005 **** context.refresh(); } ! ! private GenericApplicationContext createLocalFlowContext(BeanFactory parent, FlowArtifactFactory rootFactory) { if (parent instanceof WebApplicationContext) { --- 1051,1055 ---- context.refresh(); } ! private GenericApplicationContext createLocalFlowContext(BeanFactory parent, FlowArtifactFactory rootFactory) { if (parent instanceof WebApplicationContext) { *************** *** 1009,1017 **** context.setResourceLoader(rootFactory.getResourceLoader()); return context; ! } else { GenericApplicationContext context = new GenericApplicationContext(); if (parent instanceof ApplicationContext) { context.setParent((ApplicationContext)parent); ! } else { if (parent != null) { context.getBeanFactory().setParentBeanFactory(parent); --- 1059,1069 ---- context.setResourceLoader(rootFactory.getResourceLoader()); return context; ! } ! else { GenericApplicationContext context = new GenericApplicationContext(); if (parent instanceof ApplicationContext) { context.setParent((ApplicationContext)parent); ! } ! else { if (parent != null) { context.getBeanFactory().setParentBeanFactory(parent); |
From: Keith D. <kd...@us...> - 2006-04-22 16:13:33
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2675/src/java/org/springframework/webflow/builder Modified Files: XmlFlowBuilder.java Log Message: foo Index: XmlFlowBuilder.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder/XmlFlowBuilder.java,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** XmlFlowBuilder.java 22 Apr 2006 16:05:36 -0000 1.83 --- XmlFlowBuilder.java 22 Apr 2006 16:13:29 -0000 1.84 *************** *** 407,414 **** } - /** - * Load the flow definition from the configured resource and return the - * resulting DOM document. - */ private Document loadDocument() throws IOException, ParserConfigurationException, SAXException { InputStream is = null; --- 407,410 ---- *************** *** 434,441 **** } - /** - * Parse the XML flow definitions and construct a Flow object. Will not - * parse all state definitions for the flow! - */ private Flow parseFlow(String id, AttributeCollection attributes, Element flowElement) { Assert.state(FLOW_ELEMENT.equals(flowElement.getTagName()), "This is not the '" + FLOW_ELEMENT + "' element"); --- 430,433 ---- *************** *** 465,472 **** } - /** - * Initialize a local flow artifact registry to access the flow local bean - * factory. - */ private void initLocalFlowArtifactFactoryRegistry(Element flowElement) { List importElements = DomUtils.getChildElementsByTagName(flowElement, IMPORT_ELEMENT); --- 457,460 ---- *************** *** 484,493 **** localFlowArtifactFactory.push(new LocalFlowArtifactRegistry(resources)); } ! ! /** ! * Parse a list of flow variables to create when the flow starts. ! * @param flowElement the flow element ! * @param flow the flow ! */ private void parseAndAddFlowVariables(Element flowElement, Flow flow) { List varElements = DomUtils.getChildElementsByTagName(flowElement, VAR_ELEMENT); --- 472,476 ---- localFlowArtifactFactory.push(new LocalFlowArtifactRegistry(resources)); } ! private void parseAndAddFlowVariables(Element flowElement, Flow flow) { List varElements = DomUtils.getChildElementsByTagName(flowElement, VAR_ELEMENT); *************** *** 500,508 **** } - /** - * Parse the flow variable. - * @param element the var element - * @return the flow variable - */ private FlowVariable parseVariable(Element element) { ScopeType scope = null; --- 483,486 ---- *************** *** 577,586 **** } - /** - * Parse the state definitions in given element and add them to the flow - * object we're constructing. - */ private void parseAndAddStateDefinitions(Element flowElement, Flow flow) { - String startStateId = flowElement.getAttribute(START_STATE_ATTRIBUTE); NodeList nodeList = flowElement.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { --- 555,559 ---- *************** *** 605,608 **** --- 578,586 ---- } } + parseAndSetStartState(flowElement, flow); + } + + private void parseAndSetStartState(Element element, Flow flow) { + String startStateId = element.getAttribute(START_STATE_ATTRIBUTE); flow.setStartState(startStateId); } *************** *** 687,693 **** } - /** - * Parse all annotated action definitions contained in given element. - */ private AnnotatedAction[] parseAnnotatedActions(Element element) { List actions = new LinkedList(); --- 665,668 ---- *************** *** 700,706 **** } - /** - * Parse an annotated action definition and return the corresponding object. - */ private AnnotatedAction parseAnnotatedAction(Element element) { AnnotatedAction action = new AnnotatedAction(); --- 675,678 ---- *************** *** 717,723 **** } - /** - * Parse an action definition and return the corresponding object. - */ private Action parseAction(Element element) { String actionId = element.getAttribute(BEAN_ATTRIBUTE); --- 689,692 ---- *************** *** 754,762 **** } - /** - * Parse all properties defined as nested elements of given element. Returns - * the properties as a map: the name of the property is the key, the - * associated value the value. - */ private UnmodifiableAttributeMap parseAttributes(Element element) { AttributeMap attributes = new AttributeMap(); --- 723,726 ---- *************** *** 768,775 **** } - /** - * Parse a property definition from given element and add the property to - * given set. - */ private void parseAndSetAttribute(Element element, AttributeMap attributes) { String name = element.getAttribute(NAME_ATTRIBUTE); --- 732,735 ---- *************** *** 786,792 **** } - /** - * Do type conversion for given property value. - */ private Object convertPropertyValue(Element element, String stringValue) { if (element.hasAttribute(TYPE_ATTRIBUTE)) { --- 746,749 ---- *************** *** 807,814 **** } - /** - * Parse a transition definition and return a corresponding Transition - * object. - */ private Transition parseTransition(Element element) { TransitionCriteria matchingCriteria = (TransitionCriteria)fromStringTo(TransitionCriteria.class).execute( --- 764,767 ---- *************** *** 821,828 **** } - /** - * Find all "if" definitions in given state definition and return a list of - * corresponding Transition objects. - */ private Transition[] parseIfs(Element element) { List transitions = new LinkedList(); --- 774,777 ---- *************** *** 835,842 **** } - /** - * Parse an "if" transition definition and return a corresponding Transition - * object. - */ private Transition[] parseIf(Element element) { Transition thenTransition = parseThen(element); --- 784,787 ---- *************** *** 927,934 **** } - /** - * Parse the list of exception handlers present in the XML document and add - * them to the flow definition being built. - */ private StateExceptionHandler[] parseExceptionHandlers(Element element) { List handlerElements = DomUtils.getChildElementsByTagName(element, EXCEPTION_HANDLER_ELEMENT); --- 872,875 ---- *************** *** 945,954 **** } ! /** ! * Pops the local registry off the stack for the flow definition that has ! * just been constructed. ! * @param flow the built flow ! */ ! protected void destroyFlowArtifactRegistry(Flow flow) { localFlowArtifactFactory.pop(); } --- 886,890 ---- } ! private void destroyFlowArtifactRegistry(Flow flow) { localFlowArtifactFactory.pop(); } |
From: Keith D. <kd...@us...> - 2006-04-22 16:05:42
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30501/src/java/org/springframework/webflow/builder Modified Files: XmlFlowBuilder.java Log Message: polish Index: XmlFlowBuilder.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder/XmlFlowBuilder.java,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** XmlFlowBuilder.java 22 Apr 2006 16:03:38 -0000 1.82 --- XmlFlowBuilder.java 22 Apr 2006 16:05:36 -0000 1.83 *************** *** 44,48 **** import org.springframework.binding.method.MethodSignature; import org.springframework.context.ApplicationContext; - import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.io.Resource; --- 44,47 ---- |
From: Keith D. <kd...@us...> - 2006-04-22 16:03:45
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29318/src/java/org/springframework/webflow/builder Modified Files: XmlFlowBuilder.java Log Message: polish Index: XmlFlowBuilder.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder/XmlFlowBuilder.java,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** XmlFlowBuilder.java 22 Apr 2006 15:06:51 -0000 1.81 --- XmlFlowBuilder.java 22 Apr 2006 16:03:38 -0000 1.82 *************** *** 43,46 **** --- 43,47 ---- import org.springframework.binding.mapping.Mapping; import org.springframework.binding.method.MethodSignature; + import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.GenericApplicationContext; *************** *** 50,53 **** --- 51,56 ---- import org.springframework.util.xml.DomUtils; import org.springframework.util.xml.SimpleSaxErrorHandler; + import org.springframework.web.context.WebApplicationContext; + import org.springframework.web.context.support.GenericWebApplicationContext; import org.springframework.webflow.Action; import org.springframework.webflow.AnnotatedAction; *************** *** 85,90 **** * * <pre> ! * <!DOCTYPE flow PUBLIC "-//SPRING//DTD WEBFLOW 1.0//EN" ! * "http://www.springframework.org/dtd/spring-webflow-1.0.dtd"> * </pre> * --- 88,93 ---- * * <pre> ! * <!DOCTYPE flow PUBLIC "-//SPRING//DTD WEBFLOW 1.0//EN" ! * "http://www.springframework.org/dtd/spring-webflow-1.0.dtd"> * </pre> * *************** *** 409,413 **** * resulting DOM document. */ ! protected Document loadDocument() throws IOException, ParserConfigurationException, SAXException { InputStream is = null; try { --- 412,416 ---- * resulting DOM document. */ ! private Document loadDocument() throws IOException, ParserConfigurationException, SAXException { InputStream is = null; try { *************** *** 467,471 **** * factory. */ ! protected void initLocalFlowArtifactFactoryRegistry(Element flowElement) { List importElements = DomUtils.getChildElementsByTagName(flowElement, IMPORT_ELEMENT); Resource[] resources = new Resource[importElements.size()]; --- 470,474 ---- * factory. */ ! private void initLocalFlowArtifactFactoryRegistry(Element flowElement) { List importElements = DomUtils.getChildElementsByTagName(flowElement, IMPORT_ELEMENT); Resource[] resources = new Resource[importElements.size()]; *************** *** 480,489 **** } } ! GenericApplicationContext context = new GenericApplicationContext(); ! context.setResourceLoader(getFlowArtifactFactory().getResourceLoader()); ! new XmlBeanDefinitionReader(context).loadBeanDefinitions(resources); ! localFlowArtifactFactory.push(new LocalFlowArtifactRegistry(context)); } ! /** * Parse a list of flow variables to create when the flow starts. --- 483,489 ---- } } ! localFlowArtifactFactory.push(new LocalFlowArtifactRegistry(resources)); } ! /** * Parse a list of flow variables to create when the flow starts. *************** *** 980,990 **** */ public void push(LocalFlowArtifactRegistry registry) { ! if (localRegistries.isEmpty()) { ! setFirstParent(registry.context); ! } ! else { ! registry.context.setParent(top().context); ! } ! registry.context.refresh(); localRegistries.push(registry); } --- 980,984 ---- */ public void push(LocalFlowArtifactRegistry registry) { ! registry.init(this, getFlowArtifactFactory()); localRegistries.push(registry); } *************** *** 1030,1048 **** return top().context; } - - /** - * Attach a master service registry as a parent registry of the local - * context, if supported by the configured flow artifact factory. - * @param context the local context to attach a global service registry - * to - */ - private void setFirstParent(ConfigurableApplicationContext context) { - try { - context.getBeanFactory().setParentBeanFactory(getFlowArtifactFactory().getServiceRegistry()); - } - catch (UnsupportedOperationException e) { - - } - } } --- 1024,1027 ---- *************** *** 1056,1070 **** private Flow flow; /** * The local registry holding the artifacts local to the flow. */ ! private ConfigurableApplicationContext context; ! /** * Create new registry * @param context the local registry */ ! public LocalFlowArtifactRegistry(ConfigurableApplicationContext context) { ! this.context = context; } } --- 1035,1089 ---- private Flow flow; + private Resource[] resources; + /** * The local registry holding the artifacts local to the flow. */ ! private GenericApplicationContext context; ! /** * Create new registry * @param context the local registry */ ! public LocalFlowArtifactRegistry(Resource[] resources) { ! this.resources = resources; ! } ! ! private void init(LocalFlowArtifactFactory localFactory, FlowArtifactFactory rootFactory) { ! BeanFactory parent = null; ! if (localFactory.localRegistries.isEmpty()) { ! try { ! parent = rootFactory.getServiceRegistry(); ! } catch (UnsupportedOperationException e) { ! ! } ! } else { ! parent = localFactory.top().context; ! } ! context = createLocalFlowContext(parent, rootFactory); ! new XmlBeanDefinitionReader(context).loadBeanDefinitions(resources); ! context.refresh(); ! } ! ! ! private GenericApplicationContext createLocalFlowContext(BeanFactory parent, FlowArtifactFactory rootFactory) { ! if (parent instanceof WebApplicationContext) { ! GenericWebApplicationContext context = new GenericWebApplicationContext(); ! context.setServletContext(((WebApplicationContext)parent).getServletContext()); ! context.setParent((WebApplicationContext)parent); ! context.setResourceLoader(rootFactory.getResourceLoader()); ! return context; ! } else { ! GenericApplicationContext context = new GenericApplicationContext(); ! if (parent instanceof ApplicationContext) { ! context.setParent((ApplicationContext)parent); ! } else { ! if (parent != null) { ! context.getBeanFactory().setParentBeanFactory(parent); ! } ! } ! context.setResourceLoader(rootFactory.getResourceLoader()); ! return context; ! } } } |
From: Keith D. <kd...@us...> - 2006-04-22 16:03:43
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/test/org/springframework/webflow/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29318/src/test/org/springframework/webflow/builder Modified Files: testFlow1.xml Log Message: polish Index: testFlow1.xml =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/test/org/springframework/webflow/builder/testFlow1.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** testFlow1.xml 19 Apr 2006 04:15:00 -0000 1.16 --- testFlow1.xml 22 Apr 2006 16:03:38 -0000 1.17 *************** *** 113,117 **** <flow start-state="end"> <end-state id="end"> ! <output-attribute name="foo"/> </end-state> </flow> --- 113,119 ---- <flow start-state="end"> <end-state id="end"> ! <output-mapper> ! <mapping source="name" target="name"/> ! </output-mapper> </end-state> </flow> |
From: Keith D. <kd...@us...> - 2006-04-22 16:03:43
|
Update of /cvsroot/springframework/spring-projects/spring-webflow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29318 Modified Files: .classpath Log Message: polish Index: .classpath =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/.classpath,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** .classpath 5 Apr 2006 02:34:47 -0000 1.27 --- .classpath 22 Apr 2006 16:03:38 -0000 1.28 *************** *** 19,23 **** <classpathentry sourcepath="/spring-binding/src/java" kind="lib" path="lib/global/spring-binding.jar"/> <classpathentry sourcepath="/spring/src" kind="lib" path="lib/global/spring-beans.jar"/> ! <classpathentry kind="lib" path="lib/global/spring-context.jar"/> <classpathentry sourcepath="/spring/src" kind="lib" path="lib/global/spring-core.jar"/> <classpathentry kind="lib" path="lib/buildtime/spring-portlet.jar"/> --- 19,23 ---- <classpathentry sourcepath="/spring-binding/src/java" kind="lib" path="lib/global/spring-binding.jar"/> <classpathentry sourcepath="/spring/src" kind="lib" path="lib/global/spring-beans.jar"/> ! <classpathentry sourcepath="/spring" kind="lib" path="lib/global/spring-context.jar"/> <classpathentry sourcepath="/spring/src" kind="lib" path="lib/global/spring-core.jar"/> <classpathentry kind="lib" path="lib/buildtime/spring-portlet.jar"/> |
From: Keith D. <kd...@us...> - 2006-04-22 15:26:42
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8277/src/java/org/springframework/webflow/builder Modified Files: spring-webflow-1.0.dtd Log Message: end-state output mapper Index: spring-webflow-1.0.dtd =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder/spring-webflow-1.0.dtd,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** spring-webflow-1.0.dtd 16 Apr 2006 15:54:30 -0000 1.38 --- spring-webflow-1.0.dtd 22 Apr 2006 15:26:39 -0000 1.39 *************** *** 479,483 **** state that was reached. --> ! <!ELEMENT end-state ( attribute*, entry-actions?, output-attribute*, exception-handler* )> <!-- --- 479,483 ---- state that was reached. --> ! <!ELEMENT end-state ( attribute*, entry-actions?, output-mapper?, exception-handler* )> <!-- *************** *** 526,544 **** <!-- - The name of an attribute in flow scope to expose for output mapping when this end state is - entered and terminates this flow. - - Output attributes can be mapped by resuming parent flows when this flow is acting - as a subflow. See the subflow-state element, the attribute-mapper subelement, and - the "output-mapping" subelement for more information. - --> - <!ELEMENT output-attribute EMPTY> - - <!-- - The name of a attribute in flow scope to expose for output mapping when this end-state is entered. - --> - <!ATTLIST output-attribute name CDATA #IMPLIED> - - <!-- Defines flow-level transitions eligible for execution if a state-level transition cannot be matched. --> --- 526,529 ---- |
From: Keith D. <kd...@us...> - 2006-04-22 15:24:30
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/test/org/springframework/webflow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6966/src/test/org/springframework/webflow Modified Files: FlowTests.java Log Message: equals/hashcode Index: FlowTests.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/test/org/springframework/webflow/FlowTests.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** FlowTests.java 22 Apr 2006 01:15:54 -0000 1.33 --- FlowTests.java 22 Apr 2006 15:24:21 -0000 1.34 *************** *** 48,53 **** public void testAddStates() { Flow flow = new Flow("myFlow"); ! flow.add(new EndState(flow, "myState1")); ! flow.add(new EndState(flow, "myState2")); assertEquals("Wrong start state:", "myState1", flow.getStartState().getId()); assertEquals("State count wrong:", 2, flow.getStateCount()); --- 48,53 ---- public void testAddStates() { Flow flow = new Flow("myFlow"); ! new EndState(flow, "myState1"); ! new EndState(flow, "myState2"); assertEquals("Wrong start state:", "myState1", flow.getStartState().getId()); assertEquals("State count wrong:", 2, flow.getStateCount()); *************** *** 63,69 **** public void testAddDuplicateState() { Flow flow = new Flow("myFlow"); ! flow.add(new EndState(flow, "myState1")); try { ! flow.add(new EndState(flow, "myState1")); fail("Duplicate state added"); } --- 63,69 ---- public void testAddDuplicateState() { Flow flow = new Flow("myFlow"); ! new EndState(flow, "myState1"); try { ! new EndState(flow, "myState1"); fail("Duplicate state added"); } *************** *** 76,81 **** Flow flow = new Flow("myFlow"); EndState state = new EndState(flow, "myState1"); ! flow.add(state); ! flow.add(state); assertEquals("State count wrong:", 1, flow.getStateCount()); } --- 76,85 ---- Flow flow = new Flow("myFlow"); EndState state = new EndState(flow, "myState1"); ! try { ! flow.add(state); ! fail("Should have failed"); ! } catch (IllegalArgumentException e) { ! ! } assertEquals("State count wrong:", 1, flow.getStateCount()); } *************** *** 84,88 **** Flow otherFlow = new Flow("myOtherFlow"); State state = new EndState(otherFlow, "myState1"); - otherFlow.add(state); Flow flow = new Flow("myFlow"); try { --- 88,91 ---- |
From: Keith D. <kd...@us...> - 2006-04-22 15:24:30
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6966/src/java/org/springframework/webflow Modified Files: Flow.java State.java Log Message: equals/hashcode Index: State.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/State.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** State.java 22 Apr 2006 15:17:39 -0000 1.46 --- State.java 22 Apr 2006 15:24:21 -0000 1.47 *************** *** 109,114 **** Assert.hasText(getId(), "The id of the state should be set before adding the state to a flow"); Assert.notNull(flow, "The owning flow is required"); - flow.add(this); this.flow = flow; } --- 109,114 ---- Assert.hasText(getId(), "The id of the state should be set before adding the state to a flow"); Assert.notNull(flow, "The owning flow is required"); this.flow = flow; + flow.add(this); } Index: Flow.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/Flow.java,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** Flow.java 22 Apr 2006 15:17:39 -0000 1.91 --- Flow.java 22 Apr 2006 15:24:21 -0000 1.92 *************** *** 211,217 **** } if (states.contains(state)) { - return; - } - if (containsState(state.getId())) { throw new IllegalArgumentException("This flow '" + getId() + "' already contains a state with id '" + state.getId() + "' -- state ids must be locally unique to the flow definition; " --- 211,214 ---- |
From: Keith D. <kd...@us...> - 2006-04-22 15:17:44
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2805/src/java/org/springframework/webflow Modified Files: Flow.java State.java Log Message: equals/hash code Index: State.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/State.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** State.java 22 Apr 2006 01:15:54 -0000 1.45 --- State.java 22 Apr 2006 15:17:39 -0000 1.46 *************** *** 38,41 **** --- 38,43 ---- * is expected that specializations of this base class be "States" and not part * of some other inheritance hierarchy. + * <p> + * Equality: Two states are equal if they have the same id and are part of the same flow. * * @see org.springframework.webflow.TransitionableState *************** *** 159,162 **** --- 161,176 ---- } + public boolean equals(Object o) { + if (!(o instanceof State)) { + return false; + } + State other = (State)o; + return id.equals(other.id) && flow.equals(other.flow); + } + + public int hashCode() { + return id.hashCode() + flow.hashCode(); + } + /** * Enter this state in the provided flow control context. This Index: Flow.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/Flow.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** Flow.java 22 Apr 2006 01:15:54 -0000 1.90 --- Flow.java 22 Apr 2006 15:17:39 -0000 1.91 *************** *** 592,595 **** --- 592,607 ---- } + public boolean equals(Object o) { + if (!(o instanceof Flow)) { + return false; + } + Flow other = (Flow)o; + return id.equals(other.id); + } + + public int hashCode() { + return id.hashCode(); + } + /** * Start a new session for this flow in the specified state. |
From: Keith D. <kd...@us...> - 2006-04-22 15:12:33
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32317/src/java/org/springframework/webflow Modified Files: EndState.java Log Message: polish Index: EndState.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/EndState.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** EndState.java 22 Apr 2006 15:06:51 -0000 1.47 --- EndState.java 22 Apr 2006 15:12:30 -0000 1.48 *************** *** 18,21 **** --- 18,22 ---- import org.springframework.binding.mapping.AttributeMapper; import org.springframework.core.style.ToStringCreator; + import org.springframework.util.Assert; /** *************** *** 86,89 **** --- 87,91 ---- */ public void setViewSelector(ViewSelector viewSelector) { + Assert.notNull(viewSelector, "The view selector is required"); this.viewSelector = viewSelector; } |
From: Keith D. <kd...@us...> - 2006-04-22 15:12:33
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32317/src/java/org/springframework/webflow/builder Modified Files: AbstractFlowBuilder.java DefaultFlowArtifactFactory.java Log Message: polish Index: AbstractFlowBuilder.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder/AbstractFlowBuilder.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** AbstractFlowBuilder.java 22 Apr 2006 14:55:50 -0000 1.38 --- AbstractFlowBuilder.java 22 Apr 2006 15:12:30 -0000 1.39 *************** *** 52,73 **** * public class CustomerDetailFlowBuilder extends AbstractFlowBuilder { * public void buildStates() { ! * // get customer information ! * addActionState("getDetails", action("customerAction"), ! * on(success(), to("displayDetails"))); ! * ! * // view customer information ! * addViewState("displayDetails", "customerDetails", ! * on(submit(), to("bindAndValidate")); ! * ! * // bind and validate customer information updates ! * addActionState("bindAndValidate", action("customerAction"), ! * new Transition[] { ! * on(error(), to("displayDetails")), ! * on(success(), to("finish")) ! * }); ! * ! * // finish ! * addEndState("finish"); ! * } * } * </pre> --- 52,73 ---- * public class CustomerDetailFlowBuilder extends AbstractFlowBuilder { * public void buildStates() { ! * // get customer information ! * addActionState("getDetails", action("customerAction"), ! * on(success(), to("displayDetails"))); ! * ! * // view customer information ! * addViewState("displayDetails", "customerDetails", ! * on(submit(), to("bindAndValidate")); ! * ! * // bind and validate customer information updates ! * addActionState("bindAndValidate", action("customerAction"), ! * new Transition[] { ! * on(error(), to("displayDetails")), ! * on(success(), to("finish")) ! * }); ! * ! * // finish ! * addEndState("finish"); ! * } * } * </pre> *************** *** 238,259 **** } ! protected State addSubflowState(String stateId, Flow subflow, FlowAttributeMapper flowAttributeMapper, Transition transition) { ! return getFlowArtifactFactory().createSubflowState(stateId, getFlow(), null, subflow, flowAttributeMapper, new Transition[] { transition }, null, null, null); } ! protected State addSubflowState(String stateId, Flow subflow, FlowAttributeMapper flowAttributeMapper, Transition[] transitions) { ! return getFlowArtifactFactory().createSubflowState(stateId, getFlow(), null, subflow, flowAttributeMapper, transitions, null, null, null); } protected State addSubflowState(String stateId, Action[] entryActions, Flow subflow, ! FlowAttributeMapper flowAttributeMapper, Transition[] transitions, ! StateExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeCollection attributes) ! throws IllegalArgumentException { ! return getFlowArtifactFactory().createSubflowState(stateId, getFlow(), entryActions, subflow, ! flowAttributeMapper, transitions, exceptionHandlers, exitActions, attributes); } --- 238,258 ---- } ! protected State addSubflowState(String stateId, Flow subflow, FlowAttributeMapper attributeMapper, Transition transition) { ! return getFlowArtifactFactory().createSubflowState(stateId, getFlow(), null, subflow, attributeMapper, new Transition[] { transition }, null, null, null); } ! protected State addSubflowState(String stateId, Flow subflow, FlowAttributeMapper attributeMapper, Transition[] transitions) { ! return getFlowArtifactFactory().createSubflowState(stateId, getFlow(), null, subflow, attributeMapper, transitions, null, null, null); } protected State addSubflowState(String stateId, Action[] entryActions, Flow subflow, ! FlowAttributeMapper attributeMapper, Transition[] transitions, StateExceptionHandler[] exceptionHandlers, ! Action[] exitActions, AttributeCollection attributes) throws IllegalArgumentException { ! return getFlowArtifactFactory().createSubflowState(stateId, getFlow(), entryActions, subflow, attributeMapper, ! transitions, exceptionHandlers, exitActions, attributes); } *************** *** 267,271 **** protected State addEndState(String stateId, ViewSelector viewSelector, AttributeMapper outputMapper) { ! return getFlowArtifactFactory().createEndState(stateId, getFlow(), null, viewSelector, outputMapper, null, null); } --- 266,271 ---- protected State addEndState(String stateId, ViewSelector viewSelector, AttributeMapper outputMapper) { ! return getFlowArtifactFactory() ! .createEndState(stateId, getFlow(), null, viewSelector, outputMapper, null, null); } *************** *** 336,340 **** * * <pre> ! * ${methodName} * </pre> * --- 336,340 ---- * * <pre> ! * ${methodName} * </pre> * *************** *** 342,346 **** * * <pre> ! * ${methodName}(${arg1}, ${arg2}, ${arg n}) * </pre> * --- 342,346 ---- * * <pre> ! * ${methodName}(${arg1}, ${arg2}, ${arg n}) * </pre> * Index: DefaultFlowArtifactFactory.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder/DefaultFlowArtifactFactory.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DefaultFlowArtifactFactory.java 22 Apr 2006 01:15:54 -0000 1.12 --- DefaultFlowArtifactFactory.java 22 Apr 2006 15:12:30 -0000 1.13 *************** *** 162,166 **** AttributeCollection attributes) throws FlowArtifactException { ViewState viewState = new ViewState(flow, id); ! viewState.setViewSelector(viewSelector); configureCommonProperties(viewState, entryActions, transitions, exceptionHandlers, exitActions, attributes); return viewState; --- 162,168 ---- AttributeCollection attributes) throws FlowArtifactException { ViewState viewState = new ViewState(flow, id); ! if (viewSelector != null) { ! viewState.setViewSelector(viewSelector); ! } configureCommonProperties(viewState, entryActions, transitions, exceptionHandlers, exitActions, attributes); return viewState; *************** *** 188,191 **** --- 190,196 ---- Action[] exitActions, AttributeCollection attributes) throws FlowArtifactException { SubflowState subflowState = new SubflowState(flow, id, subflow); + if (attributeMapper != null) { + subflowState.setAttributeMapper(attributeMapper); + } configureCommonProperties(subflowState, entryActions, transitions, exceptionHandlers, exitActions, attributes); return subflowState; *************** *** 196,200 **** throws FlowArtifactException { EndState endState = new EndState(flow, id); ! endState.setViewSelector(viewSelector); configureCommonProperties(endState, entryActions, exceptionHandlers, attributes); return endState; --- 201,207 ---- throws FlowArtifactException { EndState endState = new EndState(flow, id); ! if (viewSelector != null) { ! endState.setViewSelector(viewSelector); ! } configureCommonProperties(endState, entryActions, exceptionHandlers, attributes); return endState; |
From: Keith D. <kd...@us...> - 2006-04-22 15:06:58
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29045/src/java/org/springframework/webflow Modified Files: EndState.java Log Message: polish Index: EndState.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/EndState.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** EndState.java 22 Apr 2006 01:15:54 -0000 1.46 --- EndState.java 22 Apr 2006 15:06:51 -0000 1.47 *************** *** 127,131 **** */ protected AttributeMap createSessionOutput(AttributeMap scope) { ! if (outputMapper != null) { return new AttributeMap(); } --- 127,131 ---- */ protected AttributeMap createSessionOutput(AttributeMap scope) { ! if (outputMapper == null) { return new AttributeMap(); } |
From: Keith D. <kd...@us...> - 2006-04-22 15:06:58
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/registry In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29045/src/java/org/springframework/webflow/registry Modified Files: ExternalizedFlowDefinition.java Log Message: polish Index: ExternalizedFlowDefinition.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/registry/ExternalizedFlowDefinition.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ExternalizedFlowDefinition.java 22 Apr 2006 01:15:54 -0000 1.11 --- ExternalizedFlowDefinition.java 22 Apr 2006 15:06:51 -0000 1.12 *************** *** 16,19 **** --- 16,21 ---- package org.springframework.webflow.registry; + import java.io.Serializable; + import org.springframework.core.io.Resource; import org.springframework.webflow.AttributeCollection; *************** *** 26,30 **** * @author Keith Donald */ ! public class ExternalizedFlowDefinition { /** --- 28,32 ---- * @author Keith Donald */ ! public class ExternalizedFlowDefinition implements Serializable { /** *************** *** 49,54 **** */ public ExternalizedFlowDefinition(Resource location) { ! this(location.getFilename(), location); this.location = location; } --- 51,57 ---- */ public ExternalizedFlowDefinition(Resource location) { ! this.id = stripExtension(location.getFilename()); this.location = location; + setAttributes(null); } *************** *** 70,79 **** this.id = id; this.location = location; ! if (attributes != null) { ! this.attributes = attributes.unmodifiable(); ! } ! else { ! this.attributes = CollectionUtils.EMPTY_ATTRIBUTE_MAP; ! } } --- 73,77 ---- this.id = id; this.location = location; ! setAttributes(attributes); } *************** *** 98,100 **** --- 96,116 ---- return attributes; } + + private String stripExtension(String fileName) { + int extensionIndex = fileName.indexOf('.'); + if (extensionIndex != -1) { + return fileName.substring(0, extensionIndex); + } else { + return fileName; + } + } + + private void setAttributes(AttributeCollection attributes) { + if (attributes != null) { + this.attributes = attributes.unmodifiable(); + } + else { + this.attributes = CollectionUtils.EMPTY_ATTRIBUTE_MAP; + } + } } \ No newline at end of file |
From: Keith D. <kd...@us...> - 2006-04-22 15:06:58
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29045/src/java/org/springframework/webflow/builder Modified Files: XmlFlowBuilder.java Log Message: polish Index: XmlFlowBuilder.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/java/org/springframework/webflow/builder/XmlFlowBuilder.java,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** XmlFlowBuilder.java 22 Apr 2006 01:15:54 -0000 1.80 --- XmlFlowBuilder.java 22 Apr 2006 15:06:51 -0000 1.81 *************** *** 1004,1008 **** } ! public Flow createFlow(String id, UnmodifiableAttributeMap attributes) throws FlowArtifactException { top().flow = getFlowArtifactFactory().createFlow(id, attributes); return top().flow; --- 1004,1008 ---- } ! public Flow createFlow(String id, AttributeCollection attributes) throws FlowArtifactException { top().flow = getFlowArtifactFactory().createFlow(id, attributes); return top().flow; |
From: Keith D. <kd...@us...> - 2006-04-22 14:55:54
|
Update of /cvsroot/springframework/spring-projects/spring-webflow/src/test/org/springframework/webflow/execution In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22615/src/test/org/springframework/webflow/execution Modified Files: FlowExecutionTests.java Log Message: abstract builder simplifcation Index: FlowExecutionTests.java =================================================================== RCS file: /cvsroot/springframework/spring-projects/spring-webflow/src/test/org/springframework/webflow/execution/FlowExecutionTests.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** FlowExecutionTests.java 22 Apr 2006 01:15:54 -0000 1.53 --- FlowExecutionTests.java 22 Apr 2006 14:55:50 -0000 1.54 *************** *** 161,165 **** } }, transition(on(success()), to("startSubFlow"))); ! addSubflowState("startSubFlow", childFlow, new Transition[] { transition(on(finish()), to("startSubFlow")), transition(on("stopTest"), to("stopTest")) }); addEndState("stopTest"); --- 161,165 ---- } }, transition(on(success()), to("startSubFlow"))); ! addSubflowState("startSubFlow", childFlow, null, new Transition[] { transition(on(finish()), to("startSubFlow")), transition(on("stopTest"), to("stopTest")) }); addEndState("stopTest"); |
From: Juergen H. <jho...@us...> - 2006-04-22 09:00:31
|
Update of /cvsroot/springframework/spring/src/org/springframework/jdbc/object In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11412/src/org/springframework/jdbc/object Modified Files: Tag: mbranch-1-2 BatchSqlUpdate.java SqlQuery.java SqlUpdate.java Log Message: polishing Index: BatchSqlUpdate.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/object/BatchSqlUpdate.java,v retrieving revision 1.7.4.2 retrieving revision 1.7.4.3 diff -C2 -d -r1.7.4.2 -r1.7.4.3 *** BatchSqlUpdate.java 7 Jan 2006 20:49:51 -0000 1.7.4.2 --- BatchSqlUpdate.java 22 Apr 2006 09:00:27 -0000 1.7.4.3 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not *************** *** 6,10 **** * the License at * ! * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software --- 6,10 ---- * the License at * ! * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software *************** *** 152,156 **** * If the specified batch size is reached, an implicit flush will happen; * you still need to finally call <code>flush</code> to flush all statements. ! * @param args array of object arguments * @return the number of rows affected by the update (always -1, * meaning "not applicable", as the statement is not actually --- 152,156 ---- * If the specified batch size is reached, an implicit flush will happen; * you still need to finally call <code>flush</code> to flush all statements. ! * @param params array of parameter objects * @return the number of rows affected by the update (always -1, * meaning "not applicable", as the statement is not actually *************** *** 158,164 **** * @see #flush */ ! public int update(Object[] args) throws DataAccessException { ! validateParameters(args); ! this.parameterQueue.add(args.clone()); if (this.parameterQueue.size() == this.batchSize) { --- 158,164 ---- * @see #flush */ ! public int update(Object[] params) throws DataAccessException { ! validateParameters(params); ! this.parameterQueue.add(params.clone()); if (this.parameterQueue.size() == this.batchSize) { Index: SqlQuery.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/object/SqlQuery.java,v retrieving revision 1.15 retrieving revision 1.15.4.1 diff -C2 -d -r1.15 -r1.15.4.1 *** SqlQuery.java 13 Sep 2005 21:23:17 -0000 1.15 --- SqlQuery.java 22 Apr 2006 09:00:27 -0000 1.15.4.1 *************** *** 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, *************** *** 31,37 **** * complete. That is, after they are constructed and configured via their * setter methods, they can be used safely from multiple threads. ! * <p> ! * Subclasses must implement the <code>newResultReader</code> method to provide an object ! * that can save the results of iterating over the ResultSet. * * <p>This class provides a number of public <code>execute</code> methods that are --- 31,37 ---- * complete. That is, after they are constructed and configured via their * setter methods, they can be used safely from multiple threads. ! * ! * <p>Subclasses must implement the <code>newRowMapper</code> method to provide an object ! * that can extract the results of iterating over the ResultSet. * * <p>This class provides a number of public <code>execute</code> methods that are *************** *** 39,43 **** * can either rely on one of these inherited methods, or can add their own * custom execution methods, with meaningful names and typed parameters. Each ! * custom query method will invoke one of this class's untype query methods. * * @author Rod Johnson --- 39,43 ---- * can either rely on one of these inherited methods, or can add their own * custom execution methods, with meaningful names and typed parameters. Each ! * custom query method will invoke one of this class's untyped query methods. * * @author Rod Johnson *************** *** 50,57 **** - //------------------------------------------------------------------------- - // Constructors - //------------------------------------------------------------------------- - /** * Constructor to allow use as a JavaBean. DataSource and SQL --- 50,53 ---- *************** *** 73,80 **** - //------------------------------------------------------------------------- - // Bean properties - //------------------------------------------------------------------------- - /** * Set the number of rows expected. This can be used to ensure --- 69,72 ---- *************** *** 94,131 **** - //------------------------------------------------------------------------- - // Execute methods - //------------------------------------------------------------------------- - /** * Central execution method. All execution goes through this method. ! * @param parameters parameters, similar to JDO query parameters. * Primitive parameters must be represented by their Object wrapper type. * The ordering of parameters is significant. ! * @param context contextual information passed to the callback mapRow method. ! * This parameter doesn't rely on the JDBC request itself, but can be useful ! * for creating the objects of the result list. * @return a List of objects, one per row of the ResultSet. Normally all these * will be of the same class, although it is possible to use different types. */ ! public List execute(final Object[] parameters, Map context) throws DataAccessException { ! validateParameters(parameters); ! ResultReader rr = newResultReader(getRowsExpected(), parameters, context); ! return getJdbcTemplate().query(newPreparedStatementCreator(parameters), rr); } /** * Convenient method to execute without context. ! * @param parameters parameters, as to JDO queries. Primitive parameters must * be represented by their Object wrapper type. The ordering of parameters is * significant. */ ! public List execute(final Object[] parameters) throws DataAccessException { ! return execute(parameters, null); } /** * Convenient method to execute without parameters. ! * @param context The contextual information for object creation */ public List execute(Map context) throws DataAccessException { --- 86,119 ---- /** * Central execution method. All execution goes through this method. ! * @param params parameters, similar to JDO query parameters. * Primitive parameters must be represented by their Object wrapper type. * The ordering of parameters is significant. ! * @param context contextual information passed to the callback <code>mapRow</code> method. ! * The JDBC operation itself doesn't rely on this parameter, but can be useful for ! * creating the objects of the result list. * @return a List of objects, one per row of the ResultSet. Normally all these * will be of the same class, although it is possible to use different types. */ ! public List execute(Object[] params, Map context) throws DataAccessException { ! validateParameters(params); ! ResultReader rr = newResultReader(getRowsExpected(), params, context); ! return getJdbcTemplate().query(newPreparedStatementCreator(params), rr); } /** * Convenient method to execute without context. ! * @param params parameters for the query. Primitive parameters must * be represented by their Object wrapper type. The ordering of parameters is * significant. */ ! public List execute(Object[] params) throws DataAccessException { ! return execute(params, null); } /** * Convenient method to execute without parameters. ! * @param context the contextual information for object creation */ public List execute(Map context) throws DataAccessException { *************** *** 210,223 **** } /** ! * Generic findObject method, used by all other findObject() methods. ! * findObject() methods are like EJB entity bean finders, in that it is * considered an error if they return more than one result. ! * @return null if not found. Subclasses may choose to treat this ! * as an error and throw an exception. * @see org.springframework.dao.support.DataAccessUtils#uniqueResult */ ! public Object findObject(Object[] parameters, Map context) throws DataAccessException { ! List results = execute(parameters, context); return DataAccessUtils.uniqueResult(results); } --- 198,218 ---- } + /** ! * Generic object finder method, used by all other <code>findObject</code> methods. ! * Object finder methods are like EJB entity bean finders, in that it is * considered an error if they return more than one result. ! * @param params parameters, similar to JDO query parameters. ! * Primitive parameters must be represented by their Object wrapper type. ! * The ordering of parameters is significant. ! * @param context contextual information passed to the callback <code>mapRow</code> method. ! * The JDBC operation itself doesn't rely on this parameter, but can be useful for ! * creating the objects of the result list. ! * @return the result object, or <code>null</code> if not found. Subclasses may ! * choose to treat this as an error and throw an exception. * @see org.springframework.dao.support.DataAccessUtils#uniqueResult */ ! public Object findObject(Object[] params, Map context) throws DataAccessException { ! List results = execute(params, context); return DataAccessUtils.uniqueResult(results); } *************** *** 226,231 **** * Convenient method to find a single object without context. */ ! public Object findObject(Object[] parameters) throws DataAccessException { ! return findObject(parameters, null); } --- 221,226 ---- * Convenient method to find a single object without context. */ ! public Object findObject(Object[] params) throws DataAccessException { ! return findObject(params, null); } Index: SqlUpdate.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/object/SqlUpdate.java,v retrieving revision 1.20 retrieving revision 1.20.4.1 diff -C2 -d -r1.20 -r1.20.4.1 *** SqlUpdate.java 11 Sep 2005 15:25:10 -0000 1.20 --- SqlUpdate.java 22 Apr 2006 09:00:27 -0000 1.20.4.1 *************** *** 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.jdbc.object; + import java.util.Map; + import javax.sql.DataSource; *************** *** 28,33 **** * objects, an update can have parameters and is defined in SQL. * ! * <p>This class provides a number of update() methods analogous to the ! * execute() methods of query objects. * * <p>This class is concrete. Although it can be subclassed (for example --- 30,35 ---- * objects, an update can have parameters and is defined in SQL. * ! * <p>This class provides a number of <code>update()</code> methods, ! * analogous to the <code>execute()</code> methods of query objects. * * <p>This class is concrete. Although it can be subclassed (for example *************** *** 148,160 **** } /** ! * Generic method to execute the update given arguments. * All other update methods invoke this method. ! * @param args array of object arguments * @return the number of rows affected by the update */ ! public int update(Object[] args) throws DataAccessException { ! validateParameters(args); ! int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(args)); checkRowsAffected(rowsAffected); return rowsAffected; --- 150,163 ---- } + /** ! * Generic method to execute the update given parameters. * All other update methods invoke this method. ! * @param params array of parameters objects * @return the number of rows affected by the update */ ! public int update(Object[] params) throws DataAccessException { ! validateParameters(params); ! int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(params)); checkRowsAffected(rowsAffected); return rowsAffected; *************** *** 164,174 **** * Method to execute the update given arguments and * retrieve the generated keys using a KeyHolder. ! * @param args array of object arguments * @param generatedKeyHolder KeyHolder that will hold the generated keys * @return the number of rows affected by the update */ ! public int update(Object[] args, KeyHolder generatedKeyHolder) throws DataAccessException { ! validateParameters(args); ! int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(args), generatedKeyHolder); checkRowsAffected(rowsAffected); return rowsAffected; --- 167,177 ---- * Method to execute the update given arguments and * retrieve the generated keys using a KeyHolder. ! * @param params array of parameter objects * @param generatedKeyHolder KeyHolder that will hold the generated keys * @return the number of rows affected by the update */ ! public int update(Object[] params, KeyHolder generatedKeyHolder) throws DataAccessException { ! validateParameters(params); ! int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(params), generatedKeyHolder); checkRowsAffected(rowsAffected); return rowsAffected; |
From: Juergen H. <jho...@us...> - 2006-04-22 09:00:31
|
Update of /cvsroot/springframework/spring/src/org/springframework/jdbc/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11412/src/org/springframework/jdbc/core Modified Files: Tag: mbranch-1-2 CallableStatementCreatorFactory.java ParameterMapper.java PreparedStatementCreatorFactory.java Log Message: polishing Index: CallableStatementCreatorFactory.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/core/CallableStatementCreatorFactory.java,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -C2 -d -r1.18 -r1.18.2.1 *** CallableStatementCreatorFactory.java 5 Nov 2005 19:27:25 -0000 1.18 --- CallableStatementCreatorFactory.java 22 Apr 2006 09:00:27 -0000 1.18.2.1 *************** *** 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, *************** *** 132,136 **** implements CallableStatementCreator, SqlProvider, ParameterDisposer { ! private final ParameterMapper inParameterMapper; private Map inParameters; --- 132,136 ---- implements CallableStatementCreator, SqlProvider, ParameterDisposer { ! private ParameterMapper inParameterMapper; private Map inParameters; *************** *** 138,156 **** /** * Create a new CallableStatementCreatorImpl. ! * @param inParams list of SqlParameter objects. May not be <code>null</code>. */ ! public CallableStatementCreatorImpl(Map inParams) { ! this.inParameterMapper = null; ! this.inParameters = inParams; } /** * Create a new CallableStatementCreatorImpl. ! * @param inParamMapper ParameterMapper implementation for mapping input parameters. ! * May not be <code>null</code>. */ ! public CallableStatementCreatorImpl(ParameterMapper inParamMapper) { ! this.inParameterMapper = inParamMapper; ! this.inParameters = null; } --- 138,154 ---- /** * Create a new CallableStatementCreatorImpl. ! * @param inParamMapper ParameterMapper implementation for mapping input parameters. ! * May not be <code>null</code>. */ ! public CallableStatementCreatorImpl(ParameterMapper inParamMapper) { ! this.inParameterMapper = inParamMapper; } /** * Create a new CallableStatementCreatorImpl. ! * @param inParams list of SqlParameter objects. May not be <code>null</code>. */ ! public CallableStatementCreatorImpl(Map inParams) { ! this.inParameters = inParams; } *************** *** 176,180 **** } ! // determine CallabeStatement to pass to custom types CallableStatement csToUse = cs; if (nativeJdbcExtractor != null) { --- 174,178 ---- } ! // Determine CallabeStatement to pass to custom types. CallableStatement csToUse = cs; if (nativeJdbcExtractor != null) { *************** *** 191,195 **** "Required input parameter '" + declaredParameter.getName() + "' is missing"); } ! // the value may still be <code>null</code> Object inValue = this.inParameters.get(declaredParameter.getName()); if (!(declaredParameter instanceof SqlOutParameter) && !(declaredParameter instanceof SqlReturnResultSet)) { --- 189,193 ---- "Required input parameter '" + declaredParameter.getName() + "' is missing"); } ! // The value may still be null. Object inValue = this.inParameters.get(declaredParameter.getName()); if (!(declaredParameter instanceof SqlOutParameter) && !(declaredParameter instanceof SqlReturnResultSet)) { *************** *** 197,201 **** } else { ! // It's an output parameter. Skip SqlReturnResultSet parameters // It need not (but may be) supplied by the caller. if (declaredParameter instanceof SqlOutParameter) { --- 195,199 ---- } else { ! // It's an output parameter: Skip SqlReturnResultSet parameters. // It need not (but may be) supplied by the caller. if (declaredParameter instanceof SqlOutParameter) { *************** *** 231,240 **** public String toString() { StringBuffer buf = new StringBuffer("CallableStatementCreatorFactory.CallableStatementCreatorImpl: sql=["); ! buf.append(callString); ! buf.append("]: params=["); ! if (inParameters != null) { ! buf.append(inParameters.toString()); ! } ! buf.append(']'); return buf.toString(); } --- 229,233 ---- public String toString() { StringBuffer buf = new StringBuffer("CallableStatementCreatorFactory.CallableStatementCreatorImpl: sql=["); ! buf.append(callString).append("]; parameters=").append(this.inParameters); return buf.toString(); } Index: ParameterMapper.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/core/ParameterMapper.java,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -d -r1.6 -r1.6.4.1 *** ParameterMapper.java 27 May 2005 19:50:02 -0000 1.6 --- ParameterMapper.java 22 Apr 2006 09:00:27 -0000 1.6.4.1 *************** *** 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, *************** *** 41,45 **** * @throws SQLException if a SQLException is encountered setting * parameter values (that is, there's no need to catch SQLException) ! * @return Map of input parameters, keyed by name */ Map createMap(Connection con) throws SQLException; --- 41,45 ---- * @throws SQLException if a SQLException is encountered setting * parameter values (that is, there's no need to catch SQLException) ! * @return Map of input parameters, keyed by name (never <code>null</code>) */ Map createMap(Connection con) throws SQLException; Index: PreparedStatementCreatorFactory.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/core/PreparedStatementCreatorFactory.java,v retrieving revision 1.24 retrieving revision 1.24.4.1 diff -C2 -d -r1.24 -r1.24.4.1 *** PreparedStatementCreatorFactory.java 13 Sep 2005 21:23:16 -0000 1.24 --- PreparedStatementCreatorFactory.java 22 Apr 2006 09:00:27 -0000 1.24.4.1 *************** *** 29,32 **** --- 29,33 ---- import org.springframework.dao.InvalidDataAccessResourceUsageException; import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor; + import org.springframework.util.Assert; /** *************** *** 51,55 **** private boolean returnGeneratedKeys = false; ! private String[] generatedKeysColumnNames = null; --- 52,56 ---- private boolean returnGeneratedKeys = false; ! private String[] generatedKeysColumnNames = null; *************** *** 87,90 **** --- 88,92 ---- } + /** * Add a new declared parameter. *************** *** 145,151 **** */ public PreparedStatementCreator newPreparedStatementCreator(Object[] params) { ! return new PreparedStatementCreatorImpl((params != null) ? Arrays.asList(params) : Collections.EMPTY_LIST); } ! /** * Return a new PreparedStatementCreator for the given parameters. --- 147,153 ---- */ public PreparedStatementCreator newPreparedStatementCreator(Object[] params) { ! return new PreparedStatementCreatorImpl(params != null ? Arrays.asList(params) : Collections.EMPTY_LIST); } ! /** * Return a new PreparedStatementCreator for the given parameters. *************** *** 161,165 **** */ public PreparedStatementSetter newPreparedStatementSetter(Object[] params) { ! return new PreparedStatementCreatorImpl((params != null) ? Arrays.asList(params) : Collections.EMPTY_LIST); } --- 163,167 ---- */ public PreparedStatementSetter newPreparedStatementSetter(Object[] params) { ! return new PreparedStatementCreatorImpl(params != null ? Arrays.asList(params) : Collections.EMPTY_LIST); } *************** *** 180,184 **** private final List parameters; ! /** * Create a new PreparedStatementCreatorImpl. --- 182,186 ---- private final List parameters; ! /** * Create a new PreparedStatementCreatorImpl. *************** *** 186,189 **** --- 188,192 ---- */ public PreparedStatementCreatorImpl(List parameters) { + Assert.notNull(parameters, "Parameters List must not be null"); this.parameters = parameters; if (this.parameters.size() != declaredParameters.size()) *************** *** 192,196 **** " parameters but expected " + declaredParameters.size()); } ! public PreparedStatement createPreparedStatement(Connection con) throws SQLException { PreparedStatement ps = null; --- 195,199 ---- " parameters but expected " + declaredParameters.size()); } ! public PreparedStatement createPreparedStatement(Connection con) throws SQLException { PreparedStatement ps = null; *************** *** 223,227 **** public void setValues(PreparedStatement ps) throws SQLException { ! // determine PreparedStatement to pass to custom types PreparedStatement psToUse = ps; if (nativeJdbcExtractor != null) { --- 226,230 ---- public void setValues(PreparedStatement ps) throws SQLException { ! // Determine PreparedStatement to pass to custom types. PreparedStatement psToUse = ps; if (nativeJdbcExtractor != null) { *************** *** 248,260 **** public String toString() { StringBuffer buf = new StringBuffer("PreparedStatementCreatorFactory.PreparedStatementCreatorImpl: sql=["); ! buf.append(sql); ! buf.append("]: params=["); ! for (int i = 0; i < this.parameters.size(); i++) { ! if (i > 0) { ! buf.append(','); ! } ! buf.append(this.parameters.get(i)); ! } ! return buf.toString() + "]"; } } --- 251,256 ---- public String toString() { StringBuffer buf = new StringBuffer("PreparedStatementCreatorFactory.PreparedStatementCreatorImpl: sql=["); ! buf.append(sql).append("]; parameters=").append(this.parameters); ! return buf.toString(); } } |
From: Juergen H. <jho...@us...> - 2006-04-21 19:40:44
|
Update of /cvsroot/springframework/spring/src/org/springframework/orm/jdo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7077/src/org/springframework/orm/jdo Modified Files: Tag: mbranch-1-2 JdoAccessor.java JdoDialect.java JdoInterceptor.java JdoTransactionManager.java PersistenceManagerFactoryUtils.java TransactionAwarePersistenceManagerFactoryProxy.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: PersistenceManagerFactoryUtils.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/orm/jdo/PersistenceManagerFactoryUtils.java,v retrieving revision 1.27 retrieving revision 1.27.4.1 diff -C2 -d -r1.27 -r1.27.4.1 *** PersistenceManagerFactoryUtils.java 13 Sep 2005 21:23:19 -0000 1.27 --- PersistenceManagerFactoryUtils.java 21 Apr 2006 19:39:58 -0000 1.27.4.1 *************** *** 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, *************** *** 92,96 **** /** ! * Get a JDO PersistenceManager via the given factory. Is aware of a * corresponding PersistenceManager bound to the current thread, * for example when using JdoTransactionManager. Will create a new --- 92,96 ---- /** ! * Obtain a JDO PersistenceManager via the given factory. Is aware of a * corresponding PersistenceManager bound to the current thread, * for example when using JdoTransactionManager. Will create a new *************** *** 100,105 **** * when no transactional PersistenceManager can be found for the current thread * @return the PersistenceManager ! * @throws DataAccessResourceFailureException if the PersistenceManager couldn't be created * @throws IllegalStateException if no thread-bound PersistenceManager found and allowCreate false */ public static PersistenceManager getPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate) --- 100,106 ---- * when no transactional PersistenceManager can be found for the current thread * @return the PersistenceManager ! * @throws DataAccessResourceFailureException if the PersistenceManager couldn't be obtained * @throws IllegalStateException if no thread-bound PersistenceManager found and allowCreate false + * @see JdoTransactionManager */ public static PersistenceManager getPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate) *************** *** 110,119 **** } catch (JDOException ex) { ! throw new DataAccessResourceFailureException("Could not open JDO PersistenceManager", ex); } } /** ! * Get a JDO PersistenceManager via the given factory. Is aware of a * corresponding PersistenceManager bound to the current thread, * for example when using JdoTransactionManager. Will create a new --- 111,120 ---- } catch (JDOException ex) { ! throw new DataAccessResourceFailureException("Could not obtain JDO PersistenceManager", ex); } } /** ! * Obtain a JDO PersistenceManager via the given factory. Is aware of a * corresponding PersistenceManager bound to the current thread, * for example when using JdoTransactionManager. Will create a new *************** *** 126,129 **** --- 127,132 ---- * @throws JDOException if the PersistenceManager couldn't be created * @throws IllegalStateException if no thread-bound PersistenceManager found and allowCreate false + * @see #getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean) + * @see JdoTransactionManager */ public static PersistenceManager doGetPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate) *************** *** 135,138 **** --- 138,147 ---- (PersistenceManagerHolder) TransactionSynchronizationManager.getResource(pmf); if (pmHolder != null) { + if (!pmHolder.isSynchronizedWithTransaction() && + TransactionSynchronizationManager.isSynchronizationActive()) { + pmHolder.setSynchronizedWithTransaction(true); + TransactionSynchronizationManager.registerSynchronization( + new PersistenceManagerSynchronization(pmHolder, pmf, false)); + } return pmHolder.getPersistenceManager(); } *************** *** 153,157 **** pmHolder.setSynchronizedWithTransaction(true); TransactionSynchronizationManager.registerSynchronization( ! new PersistenceManagerSynchronization(pmHolder, pmf)); TransactionSynchronizationManager.bindResource(pmf, pmHolder); } --- 162,166 ---- pmHolder.setSynchronizedWithTransaction(true); TransactionSynchronizationManager.registerSynchronization( ! new PersistenceManagerSynchronization(pmHolder, pmf, true)); TransactionSynchronizationManager.bindResource(pmf, pmHolder); } *************** *** 200,205 **** /** * Convert the given JDOException to an appropriate exception from the ! * org.springframework.dao hierarchy. ! * <p>The most important cases like object not found or optimistic verification * failure are covered here. For more fine-granular conversion, JdoAccessor and * JdoTransactionManager support sophisticated translation of exceptions via a --- 209,214 ---- /** * Convert the given JDOException to an appropriate exception from the ! * <code>org.springframework.dao</code> hierarchy. ! * <p>The most important cases like object not found or optimistic locking * failure are covered here. For more fine-granular conversion, JdoAccessor and * JdoTransactionManager support sophisticated translation of exceptions via a *************** *** 215,237 **** throw new JdoObjectRetrievalFailureException((JDOObjectNotFoundException) ex); } ! else if (ex instanceof JDOOptimisticVerificationException) { throw new JdoOptimisticLockingFailureException((JDOOptimisticVerificationException) ex); } ! else if (ex instanceof JDODataStoreException) { return new JdoResourceFailureException((JDODataStoreException) ex); } ! else if (ex instanceof JDOFatalDataStoreException) { return new JdoResourceFailureException((JDOFatalDataStoreException) ex); } ! else if (ex instanceof JDOUserException) { return new JdoUsageException((JDOUserException) ex); } ! else if (ex instanceof JDOFatalUserException) { return new JdoUsageException((JDOFatalUserException) ex); } ! else { ! // fallback: assuming internal exception ! return new JdoSystemException(ex); ! } } --- 224,244 ---- throw new JdoObjectRetrievalFailureException((JDOObjectNotFoundException) ex); } ! if (ex instanceof JDOOptimisticVerificationException) { throw new JdoOptimisticLockingFailureException((JDOOptimisticVerificationException) ex); } ! if (ex instanceof JDODataStoreException) { return new JdoResourceFailureException((JDODataStoreException) ex); } ! if (ex instanceof JDOFatalDataStoreException) { return new JdoResourceFailureException((JDOFatalDataStoreException) ex); } ! if (ex instanceof JDOUserException) { return new JdoUsageException((JDOUserException) ex); } ! if (ex instanceof JDOFatalUserException) { return new JdoUsageException((JDOFatalUserException) ex); } ! // fallback ! return new JdoSystemException(ex); } *************** *** 298,306 **** private final PersistenceManagerFactory persistenceManagerFactory; private boolean holderActive = true; ! public PersistenceManagerSynchronization(PersistenceManagerHolder pmHolder, PersistenceManagerFactory pmf) { this.persistenceManagerHolder = pmHolder; this.persistenceManagerFactory = pmf; } --- 305,317 ---- private final PersistenceManagerFactory persistenceManagerFactory; + private final boolean newPersistenceManager; + private boolean holderActive = true; ! public PersistenceManagerSynchronization( ! PersistenceManagerHolder pmHolder, PersistenceManagerFactory pmf, boolean newPersistenceManager) { this.persistenceManagerHolder = pmHolder; this.persistenceManagerFactory = pmf; + this.newPersistenceManager = newPersistenceManager; } *************** *** 323,331 **** public void beforeCompletion() { ! TransactionSynchronizationManager.unbindResource(this.persistenceManagerFactory); ! this.holderActive = false; ! releasePersistenceManager( ! this.persistenceManagerHolder.getPersistenceManager(), ! this.persistenceManagerFactory); } } --- 334,347 ---- public void beforeCompletion() { ! if (this.newPersistenceManager) { ! TransactionSynchronizationManager.unbindResource(this.persistenceManagerFactory); ! this.holderActive = false; ! releasePersistenceManager( ! this.persistenceManagerHolder.getPersistenceManager(), this.persistenceManagerFactory); ! } ! } ! ! public void afterCompletion(int status) { ! this.persistenceManagerHolder.setSynchronizedWithTransaction(false); } } Index: JdoTransactionManager.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/orm/jdo/JdoTransactionManager.java,v retrieving revision 1.43.2.1 retrieving revision 1.43.2.2 diff -C2 -d -r1.43.2.1 -r1.43.2.2 *** JdoTransactionManager.java 23 Dec 2005 13:50:14 -0000 1.43.2.1 --- JdoTransactionManager.java 21 Apr 2006 19:39:58 -0000 1.43.2.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"); *************** *** 50,55 **** * transactional data access. JTA (usually through JtaTransactionManager) is necessary for * accessing multiple transactional resources. Note that you need to configure your JDO ! * provider accordingly to make it participate in JTA transactions. In contrast to Hibernate, ! * this cannot be transparently provided by the Spring transaction manager implementation. * * <p>With a JdoDialect specified, this implementation also supports direct DataSource --- 50,54 ---- * transactional data access. JTA (usually through JtaTransactionManager) is necessary for * accessing multiple transactional resources. Note that you need to configure your JDO ! * provider accordingly to make it participate in JTA transactions. * * <p>With a JdoDialect specified, this implementation also supports direct DataSource *************** *** 378,382 **** } catch (JDOException ex) { ! // assumably failed to flush changes to database throw convertJdoAccessException(ex); } --- 377,381 ---- } catch (JDOException ex) { ! // Assumably failed to flush changes to database. throw convertJdoAccessException(ex); } *************** *** 448,458 **** /** * Convert the given JDOException to an appropriate exception from the ! * org.springframework.dao hierarchy. Delegates to the JdoDialect if set, falls ! * back to PersistenceManagerFactoryUtils' standard exception translation else. * May be overridden in subclasses. * @param ex JDOException that occured * @return the corresponding DataAccessException instance * @see JdoDialect#translateException - * @see PersistenceManagerFactoryUtils#convertJdoAccessException */ protected DataAccessException convertJdoAccessException(JDOException ex) { --- 447,456 ---- /** * Convert the given JDOException to an appropriate exception from the ! * <code>org.springframework.dao</code> hierarchy. ! * <p>Default implementation delegates to the JdoDialect. * May be overridden in subclasses. * @param ex JDOException that occured * @return the corresponding DataAccessException instance * @see JdoDialect#translateException */ protected DataAccessException convertJdoAccessException(JDOException ex) { Index: JdoInterceptor.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/orm/jdo/JdoInterceptor.java,v retrieving revision 1.9 retrieving revision 1.9.4.1 diff -C2 -d -r1.9 -r1.9.4.1 *** JdoInterceptor.java 2 May 2005 23:48:14 -0000 1.9 --- JdoInterceptor.java 21 Apr 2006 19:39:58 -0000 1.9.4.1 *************** *** 74,77 **** --- 74,80 ---- * @author Juergen Hoeller * @since 13.06.2003 + * @see PersistenceManagerFactoryUtils#getPersistenceManager + * @see JdoTransactionManager + * @see JdoTemplate */ public class JdoInterceptor extends JdoAccessor implements MethodInterceptor { Index: JdoAccessor.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/orm/jdo/JdoAccessor.java,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -C2 -d -r1.15 -r1.15.2.1 *** JdoAccessor.java 19 Oct 2005 13:53:46 -0000 1.15 --- JdoAccessor.java 21 Apr 2006 19:39:58 -0000 1.15.2.1 *************** *** 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"); *************** *** 141,145 **** */ public void flushIfNecessary(PersistenceManager pm, boolean existingTransaction) throws JDOException { ! if (this.flushEager) { logger.debug("Eagerly flushing JDO persistence manager"); getJdoDialect().flush(pm); --- 141,145 ---- */ public void flushIfNecessary(PersistenceManager pm, boolean existingTransaction) throws JDOException { ! if (isFlushEager()) { logger.debug("Eagerly flushing JDO persistence manager"); getJdoDialect().flush(pm); *************** *** 149,160 **** /** * Convert the given JDOException to an appropriate exception from the ! * <code>org.springframework.dao</code> hierarchy. Delegates to the JdoDialect ! * if set, falling back to PersistenceManagerFactoryUtils' standard exception ! * translation else. ! * <p>May be overridden in subclasses. * @param ex JDOException that occured * @return the corresponding DataAccessException instance * @see JdoDialect#translateException - * @see PersistenceManagerFactoryUtils#convertJdoAccessException */ public DataAccessException convertJdoAccessException(JDOException ex) { --- 149,158 ---- /** * Convert the given JDOException to an appropriate exception from the ! * <code>org.springframework.dao</code> hierarchy. ! * <p>Default implementation delegates to the JdoDialect. ! * May be overridden in subclasses. * @param ex JDOException that occured * @return the corresponding DataAccessException instance * @see JdoDialect#translateException */ public DataAccessException convertJdoAccessException(JDOException ex) { Index: JdoDialect.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/orm/jdo/JdoDialect.java,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** JdoDialect.java 12 Oct 2005 20:26:05 -0000 1.14 --- JdoDialect.java 21 Apr 2006 19:39:58 -0000 1.14.2.1 *************** *** 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, *************** *** 32,36 **** /** * SPI strategy that encapsulates certain functionality that standard JDO 1.0 does ! * not offer despite being relevant in the context of O/R mapping, like access to * the underlying JDBC Connection and explicit flushing of changes to the database. * Also defines various further hooks that even go beyond standard JDO 2.0. --- 32,36 ---- /** * SPI strategy that encapsulates certain functionality that standard JDO 1.0 does ! * not offer despite being relevant in the context of O/R mapping, such as access to * the underlying JDBC Connection and explicit flushing of changes to the database. * Also defines various further hooks that even go beyond standard JDO 2.0. Index: TransactionAwarePersistenceManagerFactoryProxy.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/orm/jdo/TransactionAwarePersistenceManagerFactoryProxy.java,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** TransactionAwarePersistenceManagerFactoryProxy.java 12 Sep 2005 20:35:32 -0000 1.3 --- TransactionAwarePersistenceManagerFactoryProxy.java 21 Apr 2006 19:39:58 -0000 1.3.4.1 *************** *** 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"); *************** *** 112,116 **** } ! public boolean isAllowCreate() { return allowCreate; } --- 112,121 ---- } ! /** ! * Return whether the PersistenceManagerFactory proxy is allowed to create ! * a non-transactional PersistenceManager when no transactional ! * PersistenceManager can be found for the current thread. ! */ ! protected boolean isAllowCreate() { return allowCreate; } |
From: Juergen H. <jho...@us...> - 2006-04-21 19:40:35
|
Update of /cvsroot/springframework/spring/src/org/springframework/validation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7077/src/org/springframework/validation Modified Files: Tag: mbranch-1-2 Errors.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: Errors.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/validation/Errors.java,v retrieving revision 1.15 retrieving revision 1.15.4.1 diff -C2 -d -r1.15 -r1.15.4.1 *** Errors.java 13 Sep 2005 21:23:20 -0000 1.15 --- Errors.java 21 Apr 2006 19:39:59 -0000 1.15.4.1 *************** *** 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, *************** *** 61,65 **** * "address" of a customer object. * @param nestedPath nested path within this object, ! * e.g. "address" (defaults to "", null is also acceptable). * Can end with a dot: both "address" and "address." are valid. */ --- 61,65 ---- * "address" of a customer object. * @param nestedPath nested path within this object, ! * e.g. "address" (defaults to "", <code>null</code> is also acceptable). * Can end with a dot: both "address" and "address." are valid. */ *************** *** 217,220 **** --- 217,221 ---- /** * Get the first error associated with the given field, if any. + * @param field the field name * @return the field-specific error, or <code>null</code> */ |
From: Juergen H. <jho...@us...> - 2006-04-21 19:40:33
|
Update of /cvsroot/springframework/spring/src/org/springframework/scheduling/quartz In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7077/src/org/springframework/scheduling/quartz Modified Files: Tag: mbranch-1-2 SchedulerFactoryBean.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: SchedulerFactoryBean.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/scheduling/quartz/SchedulerFactoryBean.java,v retrieving revision 1.29 retrieving revision 1.29.4.1 diff -C2 -d -r1.29 -r1.29.4.1 *** SchedulerFactoryBean.java 22 Aug 2005 09:01:08 -0000 1.29 --- SchedulerFactoryBean.java 21 Apr 2006 19:39:58 -0000 1.29.4.1 *************** *** 37,40 **** --- 37,41 ---- import org.quartz.JobDetail; import org.quartz.JobListener; + import org.quartz.ObjectAlreadyExistsException; import org.quartz.Scheduler; import org.quartz.SchedulerException; *************** *** 504,516 **** } - // Get Scheduler instance from SchedulerFactory. ! this.scheduler = createScheduler(schedulerFactory, this.schedulerName); ! ! if (this.dataSource != null) { ! configTimeDataSourceHolder.set(null); } ! if (this.nonTransactionalDataSource != null) { ! configTimeNonTransactionalDataSourceHolder.set(null); } --- 505,519 ---- } // Get Scheduler instance from SchedulerFactory. ! try { ! this.scheduler = createScheduler(schedulerFactory, this.schedulerName); } ! finally { ! if (this.dataSource != null) { ! configTimeDataSourceHolder.set(null); ! } ! if (this.nonTransactionalDataSource != null) { ! configTimeNonTransactionalDataSourceHolder.set(null); ! } } *************** *** 527,530 **** --- 530,534 ---- } + /** * Load and/or apply Quartz properties to the given SchedulerFactory. *************** *** 594,597 **** --- 598,602 ---- protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) throws SchedulerException { + // StdSchedulerFactory's default "getScheduler" implementation // uses the scheduler name specified in the Quartz properties, *************** *** 621,624 **** --- 626,630 ---- } + /** * Register all specified listeners with the Scheduler. *************** *** 698,715 **** for (Iterator it = this.triggers.iterator(); it.hasNext();) { Trigger trigger = (Trigger) it.next(); ! if (this.scheduler.getTrigger(trigger.getName(), trigger.getGroup()) == null) { ! // Check if the Trigger is aware of an associated JobDetail. ! if (trigger instanceof JobDetailAwareTrigger) { ! JobDetail jobDetail = ((JobDetailAwareTrigger) trigger).getJobDetail(); ! // Automatically register the JobDetail too. ! if (!this.jobDetails.contains(jobDetail) && addJobToScheduler(jobDetail)) { ! this.jobDetails.add(jobDetail); ! } ! } ! this.scheduler.scheduleJob(trigger); ! } ! else if (this.overwriteExistingJobs) { ! this.scheduler.rescheduleJob(trigger.getName(), trigger.getGroup(), trigger); ! } } } --- 704,708 ---- for (Iterator it = this.triggers.iterator(); it.hasNext();) { Trigger trigger = (Trigger) it.next(); ! addTriggerToScheduler(trigger); } } *************** *** 745,750 **** * Overwrites the job in any case if "overwriteExistingJobs" is set. * @param jobDetail the job to add ! * @return true if the job was actually added, ! * false if it already existed before * @see #setOverwriteExistingJobs */ --- 738,743 ---- * Overwrites the job in any case if "overwriteExistingJobs" is set. * @param jobDetail the job to add ! * @return <code>true</code> if the job was actually added, ! * <code>false</code> if it already existed before * @see #setOverwriteExistingJobs */ *************** *** 797,800 **** --- 790,837 ---- /** + * Add the given trigger to the Scheduler, if it doesn't already exist. + * Overwrites the trigger in any case if "overwriteExistingJobs" is set. + * @param trigger the trigger to add + * @return <code>true</code> if the trigger was actually added, + * <code>false</code> if it already existed before + * @see #setOverwriteExistingJobs + */ + private boolean addTriggerToScheduler(Trigger trigger) throws SchedulerException { + boolean triggerExists = (this.scheduler.getTrigger(trigger.getName(), trigger.getGroup()) != null); + if (!triggerExists || this.overwriteExistingJobs) { + // Check if the Trigger is aware of an associated JobDetail. + if (trigger instanceof JobDetailAwareTrigger) { + JobDetail jobDetail = ((JobDetailAwareTrigger) trigger).getJobDetail(); + // Automatically register the JobDetail too. + if (!this.jobDetails.contains(jobDetail) && addJobToScheduler(jobDetail)) { + this.jobDetails.add(jobDetail); + } + } + if (!triggerExists) { + try { + this.scheduler.scheduleJob(trigger); + } + catch (ObjectAlreadyExistsException ex) { + if (logger.isDebugEnabled()) { + logger.debug("Unexpectedly found existing trigger, assumably due to cluster race condition: " + + ex.getMessage() + " - can safely be ignored"); + } + if (this.overwriteExistingJobs) { + this.scheduler.rescheduleJob(trigger.getName(), trigger.getGroup(), trigger); + } + } + } + else { + this.scheduler.rescheduleJob(trigger.getName(), trigger.getGroup(), trigger); + } + return true; + } + else { + return false; + } + } + + + /** * Start the Quartz Scheduler, respecting the "startupDelay" setting. * @param scheduler the Scheduler to start |