All 6 entries tagged Swf

No other Warwick Blogs use the tag Swf on entries | View entries tagged Swf at Technorati | There are no images tagged Swf on this blog

July 04, 2006

So my book is doing well :)

Writing about web page http://www.amazon.com/gp/product/customer-reviews/159059584X/103-6827141-9792643

So the book I contributed to (I did the last two chapters on Spring Web Flow) seems to be doing well.

No idea about the number of sales (although I did receive my first commission cheque ;)), but all the reviews seem to like it.

Anyways, if you understand the title (Expert Spring MVC + Web Flow) then go and buy the book :) If you are really lucky and bring it to me in elab before the end of the week I might even sign it for you ;) :)


May 05, 2006

Spring Web Flow RC1.0 – mapping comments

Writing about web page http://www.springframework.org/documentation

So I have downloaded SWF RC1.0 and doing the upgrade. This post if really just for me to keep track of things :)

Input mapping when calling a subflow

The source must be an expression, i.e. ${model.someProperty} whereas the target must be text:
<mapping source="${model.uploadedFiles}" target="uploadedFiles"/>

Output mapping when calling a subflow

The source must be text i.e. someProperty whereas the target must also be text, but qualify the scope:
<mapping source="emptyFiles" target="flowScope.emptyFiles"/>

Input mapping for the subflow itself

The subflow must now explicitly slurp the inputs.
The source must be text i.e. someProperty whereas the target must also be text, but qualify the scope:
<mapping source="uploadedFiles" target="flowScope.uploadedFiles"/>

Output mapping for the subflow itself (i.e. end state)

The subflow must now explicitly export the results that the calling flow can slurp.
The source must be an expression i.e. ${flowScope.someProperty} whereas the target must be text:
<mapping source="${model.emptyFiles}" target="emptyFiles"/>

Essentially, when a subflow starts, the calling flow exports bits of its context into a generic map, so source is an expression, target is the key in the map. The subflow (when it starts) can slurp from that generic map using the known key, so source is the key, target is where in the subflow context it must be placed (as plain text, not expression).

When the subflow ends, it exports bits of its context using the same rationale; source is an expression, target is the key in the generic map. The calling flow can then slurp from that generic map; source is key, target is plain text description of where it is placed.

example:

  <flow ...>
    <subflow-state ...>
   <attribute-mapper>
      <input-mapper>
       <mapping source="${model.uploadedFiles}" target="uploadedFiles"/>
      </input-mapper>
      <output-mapper>
        <mapping source="emptyFiles" target="flowScope.emptyFiles"/>
        <mapping source="invalidFileNames" target="flowScope.invalidFileNames"/>
        <mapping source="invalidFileTypes" target="flowScope.invalidFileTypes"/>
        <mapping source="duplicateFiles" target="flowScope.duplicateFiles"/>
        <mapping source="createdFiles" target="flowScope.createdFiles"/>
      </output-mapper>
    </attribute-mapper>
    </subflow-state>
  </flow>

  



...









Note: nothing in here is the definitive way; but it does work :)


March 21, 2006

Expert Spring MVC + Spring Web Flow errata

Writing about web page http://apress.com/book/bookDisplay.html?bID=10048

Below are the changes in Chapter 11 + Chapter 12 as a result of upgrading to Spring Web Flow 1.0 EA:

[global changes]
_flowExecutionId has been renamed to _flowExecutionKey
org.springframework.webflow.manager has been renamed to org.springframework.webflow.executor
FlowExecutionManager has been renamed to FlowExecutor
FlowExecutionManagerImpl has been renamed to FlowExecutorImpl
FlowExecutionContinuationKey has been renamed to FlowExecutionKey
FlowExecutionManagerParameterExtractor has been renamed to FlowExecutorArgumentExtractor

Chapter 11

– Figure 11–3 (page 7) has four boxes which all contain text starting "webflow.manager.". The word "manager" needs to be replaced with the word "executor", i.e the first box should read webflow.executor.struts.FlowAction etc.

– The first line of the last paragraph on page 7 refers to "FlowExecutionManager". This has been renamed to "FlowExecutor".

– Page 8 refers to "org.springframework.webflow.execution.FlowExecutionRepository". This has been renamed to "org.springframework.webflow.execution.repository.FlowExecutionRepository".

– Page 17 refers to "AbstractFlowexecutionTests" but the e after "Flow" should be capitalised: "AbstractFlowExecutionTests".

– The first two methods in Listing 11–8 are duplicates. Please remove the first method. The second method needs to change from:

protected Resource getFlowLocation() {

File flowDir = new File(.......);

return new FileSyste…..
}

to:

protected Resource getFlowLocation() {

File flowDir = new File(.......);

FileSystemResource resource = new FileSystemResource(new File(flowDir, "purchase-flow.xml"));

return new ExternalizedFlowDefinition("purchaseFlow", resource);
}

so essentially the first line stays the same, and the second line is replaced with two new lines.

– Listing 11–13 on page 22 refers to "org.springframework.webflow.manager.
mvc.FlowController" The word "manager" needs to be replaced with the word "executor".

– The next paragragh on page 22 contains a reference to "org.springframework.webflow.mvc.FlowController". This should be "org.springframework.webflow.executor.mvc.FlowController".

– Page 26 refers to " org.springframework.webflow.config.FlowBuilder". This should be "org.springframework.webflow.builder.FlowBuilder".

Chapter 12

[global and specific changes]
– Page 8, first sentence contains " org.springframework.binding.AttributeMapper". Should be "org.springframework.binding.mapping.AttributeMapper".

– Page 9, first paragraph contains "ParameterizableFlowAttributeMapper", should be DefaultFlowAttributeMapper.

– Page 9, Listing 12–9 first method signature is "public Map createSubflowInput(Request…..". Should be "public AttributeMap createSubflowInput(Request….".
First line in first method is "Map map = new HashMap()" should be "AttributeMap map = new AttributeMap()".
Second method signature is "public void mapSubflowOuput(Map subflowOutput…." should be "public void mapSubflowOutput(UnmodifiableAttributeMap…".

– Page 12, In "Integration With Web Frameworks" the term FlowExecutionManager needs to be replaced with FlowExecutor. There are 5 occurences (although any others you spot should also be changed).

The last but one sentence "Both methods accept org…... and return org…." should read "Both methods accept org.springframework.webflow.ExternalContext in their parameters and return org.springframework.webflow.executor.ResponseInstruction , from which the org.springframework.webflow.ViewSelection can be obtained."

Listing 12–11 has completely changed:

public interface ExternalContext {

public String getContextPath();

public String getDispatcherPath();

public String getRequestPathInfo();

public ParameterMap getRequestParameterMap();

public AttributeMap getRequestMap();

public SharedAttributeMap getSessionMap();

public SharedAttributeMap getApplicationMap();

public interface SharedMap extends Map {

public Object getMutex();

}

public static class SharedAttributeMap extends AttributeMap {

public SharedAttributeMap(SharedMap sharedMap) {

super(sharedMap);

}

public SharedMap getSharedMap() {

return (SharedMap)getMapInternal();

}

public Object getMutex() {

return getSharedMap().getMutex();

}

}
}

– Page 13 Last entry in Table 12–2 contains the word "manager." should be "executor."

"The FlowExecutionManager" should be renamed "FlowExecutor".
Listing 12–12 heading should be changed to "org.springframework.webflow.executor.FlowExecutor".
Both methods return "ViewSelection". They should return "ResponseInstruction".
Within the Note, "FlowExecutionManager" should be renamed to "FlowExecutor".
The next two paragraphs require all instances of "FlowExecutionManager" to be changed to "FlowExecutor". I count 2 instances
The next two paragraphs require all instances of "_flowExecutionId" to be changed to "_flowExecutionKey". I count 2 instances
The "org.springframework.webflow.executor.support.FlowExecutionManagerParameterExtractor" needs to be "org.springframework.webflow.executor.FlowExecutorArgumentExtractor".

-Page 15, Listing 12–13 Please remove the last method "rehydrate".

Listing 12–14 FlowExecutionContext has changed. It essentially needs to be:

public interface FlowExecutionContext extends FlowExecutionStatistics {

public Flow getFlow();

public AttributeMap getScope();

FlowSession getActiveSession();
}

The next paragraph contains the phrase "the active flow definition, the current state, and" which needs to be replaced with "conversation scope and".

The next paragraph contains the phrase "The root flow" which needs to be replaced with "The flow". The last sentence contains "getActiveFlow()" which needs to be "getFlow()".

Page 17, Listing 12–15 has changed. It should now be:

public interface RequestContext {

public Flow getActiveFlow() throws IllegalStateException;

public State getCurrentState() throws IllegalStateException;

public AttributeMap getRequestScope();

public AttributeMap getFlowScope();

public AttributeMap getConversationScope();

public ParameterMap getRequestParameters();

public ExternalContext getExternalContext();

public FlowExecutionContext getFlowExecutionContext();

public Event getLastEvent();

public Transition getLastTransition();

public UnmodifiableAttributeMap getAttributes();

public void setAttributes(AttributeCollection attributes);

public UnmodifiableAttributeMap getModel();
}

Page 18 contains two references to "org.springframework.webflow.manager.ConditionalFlowExecutionListenerLoader". They should be "org.springframework.webflow.executor.ConditionalFlowExecutionListenerLoader ".

Listing 12–17 on Page 18 contains a reference to "org.springframework.webflow.manager.FlowExecutionManagerImpl". It should be "org.springframework.webflow.executor.FlowExecutorImpl".

Page 19, Listing 12–18 has completely changed:

public interface FlowExecutionRepository {

public FlowExecution createFlowExecution(String flowId);

public FlowExecutionKey generateKey(FlowExecution flowExecution) throws FlowExecutionRepositoryException;

public FlowExecutionKey generateKey(FlowExecution flowExecution, Serializable conversationId) throws FlowExecutionRepositoryException;

public ConversationLock getLock(Serializable conversationId);

public FlowExecution getFlowExecution(FlowExecutionKey key) throws FlowExecutionRepositoryException;

public void putFlowExecution(FlowExecutionKey key, FlowExecution flowExecution) throws FlowExecutionRepositoryException;

public FlowExecutionKey getCurrentFlowExecutionKey(Serializable conversationId) throws FlowExecutionRepositoryException;

public ViewSelection getCurrentViewSelection(Serializable conversationId) throws FlowExecutionRepositoryException;

public void setCurrentViewSelection(Serializable conversationId, ViewSelection viewSelection) throws FlowExecutionRepositoryException;

public void invalidateConversation(Serializable conversationId) throws FlowExecutionRepositoryException;
}

– Page 22 contains a number of references to FlowExecutionContinuationKey. This has been renamed to FlowExecutionKey.

– Page 22 contains a number of references to _flowExecutionId. This has been renamed to _flowExecutionKey.

– Page 22 at the bottom contains a reference to "org.springframework.webflow.execution.repository.SimpleFlowExecutionRepository ". It should be "org.springframework.webflow.execution.repository.support.SimpleFlowExecutionRepository".

Page 23. The note should read "This is the default implementation."

Page 23 contains a reference to "_flowExecutionId", it should be "_flowExecutionKey".

Page 24 contains two references to "_flowExecutionId", they should be "_flowExecutionKey".

Page 30, Table 12–10 contains a reference to "RedirectViewSelector". Should be "ExternalRedirectSelector".

Table 12–11 is wrong, should be:

ApplicationViewSelector If viewName is specified.
ApplicationViewSelector If redirect:viewName is specified.
ExternalRedirectSelector If externalRedirect:/url?par1=x is specified
FlowRedirectSelector If flowRedrect:/url is specified
YourViewSelector If bean=yourBean is specified.

– Page 31 contains three references to "FlowExecutionManagerParameterExtractor". They should all be "FlowExecutorArgumentExtractor".

– Page 31 contains three references to "FEMPE". They should all be "FEAE".

– Page 34 contains a reference to "InvalidConversionationContinuationException". Should be "CannotContinueConversationException".


March 05, 2006

So the reviews are trickling in

Follow-up to Spring Web Flow book is now released! from Colin's blog

So I have been keeping an eye on any reviews that have been posted, and spotted a few:

link

and

link

Any more, please let me know as this is a first time experience for me and it is always good to get feedback ;)


February 22, 2006

Spring Web Flow book is now released!

Writing about web page http://www.amazon.co.uk/exec/obidos/ASIN/159059584X/qid%3D1140629254/202-1067120-0416610

Yeah, so the new Spring Web Flow + Spring MVC book has finally been released :)

This makes me happy because I wrote the two chapters regarding Spring Web Flow, so go and buy a copy :) :)


February 03, 2006

Interesting little problem upgrading to Spring 2.0M2 :)

Details here:

link

Essentially I upgraded my project from Spring 1.2.4 to Spring 2.0M2. Despite the addition of org.springframework.web.servlet.View#getContentType(); the upgrade appeared to be very smooth. The extensive unit tests passed, and all appeared to be well…..until I deployed it :)


14:50:36,676 ERROR [ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'siteBuilderDAO' defined in ServletContext
resource [/WEB-INF/persistence-context.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessio
nFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFact
ory' defined in ServletContext resource [/WEB-INF/persistence-context.xml]: Cannot create inner bean 'uk.ac.warwick.sbr.hibernate.
ClassFilteringLoadEventListener#159f498' while setting bean property 'eventListeners' with key [post-load]; nested exception is or
g.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uk.ac.warwick.sbr.hibernate.ClassFilteringLo
adEventListener#159f498' defined in ServletContext resource [/WEB-INF/persistence-context.xml]: Instantiation of bean failed; nest
ed exception is java.lang.IllegalStateException: BeanWrapper does not hold a bean instance
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext
resource [/WEB-INF/persistence-context.xml]: Cannot create inner bean 'uk.ac.warwick.sbr.hibernate.ClassFilteringLoadEventListener
#159f498' while setting bean property 'eventListeners' with key [post-load]; nested exception is org.springframework.beans.factory
.BeanCreationException: Error creating bean with name 'uk.ac.warwick.sbr.hibernate.ClassFilteringLoadEventListener#159f498' define
d in ServletContext resource [/WEB-INF/persistence-context.xml]: Instantiation of bean failed; nested exception is java.lang.Illeg
alStateException: BeanWrapper does not hold a bean instance
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uk.ac.warwick.sbr.hibernate.ClassFiltering
LoadEventListener#159f498' defined in ServletContext resource [/WEB-INF/persistence-context.xml]: Instantiation of bean failed; ne
sted exception is java.lang.IllegalStateException: BeanWrapper does not hold a bean instance
java.lang.IllegalStateException: BeanWrapper does not hold a bean instance
        at org.springframework.util.Assert.state(Assert.java:341)
        at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:274)
        at org.springframework.beans.BeanWrapperImpl.getPropertyType(BeanWrapperImpl.java:323)
        at org.springframework.beans.PropertyEditorRegistrySupport.findCustomEditor(PropertyEditorRegistrySupport.java:233)
        at org.springframework.beans.PropertyTypeConverter.doTypeConversionIfNecessary(PropertyTypeConverter.java:100)
        at org.springframework.beans.PropertyTypeConverter.doTypeConversionIfNecessary(PropertyTypeConverter.java:73)
        at org.springframework.beans.PropertyTypeConverter.convertToTypedMap(PropertyTypeConverter.java:277)
        at org.springframework.beans.PropertyTypeConverter.doTypeConversionIfNecessary(PropertyTypeConverter.java:131)
        at org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary(BeanWrapperImpl.java:853)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doTypeConversionIfNecessary(AbstractBeanFactory.java:672)

        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:370)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:126)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapabl
eBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFact
ory.java:368)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBeanDefinition(BeanDefinitionValueRes
olver.java:151)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolv
er.java:97)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedMap(BeanDefinitionValueResolver.jav
a:235)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolv
er.java:118)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapabl
eBeanFactory.java:764)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFa
ctory.java:575)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFact
ory.java:405)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:238)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:148)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java
:186)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolv
er.java:106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapabl
eBeanFactory.java:764)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFa
ctory.java:575)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFact
ory.java:405)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:238)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:148)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactor
y.java:253)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:331)
        at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicat
ionContext.java:155)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:240)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:178)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)

was thrown up. OK, I thought; lets look at the class in question (bear in mind this has all been working previously ;)):

The constructor looked like:


    public ClassFilteringLoadEventListener(final Map> theListeners) {
        }
    }

And it was being wired up:


  >bean class="uk.ac.warwick.sbr.hibernate.ClassFilteringLoadEventListener"<
            >constructor-arg index="0"<
              >map<
                >entry key="uk.ac.warwick.sbr.linksgenerator.SiteNavigationContentFetcher"<
                  >list<
                    >bean class="uk.ac.warwick.sbr.hibernate.AutoWiringLoadedObjectListener"/<
                  >/list<
                >/entry<
        >/map<
    >constructor-arg<
>/class<

Hmm, nothing strange there either (apart from me getting my < and > mixed up ;))

And then it occurred to me that Spring 2.0M2 understands generics :) Modifying the constructor argument to take a non typed Map fixed the problem.

Very subtle; took me most of the afternoon to catch this one ;)

JIRA is here: link

All this is redundant anyway because I found SWF (Spring Web Flow) PR5 uses a few classes which have been moved (PropertyEditorRegistrar etc.)


December 2019

Mo Tu We Th Fr Sa Su
Nov |  Today  |
                  1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31               

Search this blog

Tags

Galleries

Most recent comments

  • Interesting… While I'm not completely convinced in such microbenchmarks, I'm pretty sure that 1ms … by Alexander Snaps on this entry
  • Hello. I bought the book yesterday. I was trying to find the source code for chapter 11 and chapter … by Suleman on this entry
  • http://woosight.net/account/login?username=demo by live mashup demo on this entry
  • Thanks mate ….. This blog was really helpful. by Maaz Hurzuk on this entry
  • Ty. Not directly helpful for my problem, but pointed me in the right direction. You will also get th… by Mike E. on this entry

Blog archive

Loading…
RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder
© MMXIX