Cocoon & WebDAV Gianugo Rabellino, Matthew Langham Cocoon GetTogether 2003
Rapid Application Development with Cocoon
description
Transcript of Rapid Application Development with Cocoon
![Page 1: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/1.jpg)
Torsten [email protected]<vafer/>.org
Rapid Application Developmentwith Cocoon
javaflow and the compiling classloader
Cocoon GetTogether 2005, Amsterdam
![Page 2: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/2.jpg)
::about me
• with Cocoon since 1.x
• member of the Cocoon PMC
• member of the Jakarta PMC
• ASF member
2
![Page 3: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/3.jpg)
::quote 3
“Rapid Application Development is exactly the opposite of what Cocoon
provided a fears ago - but gladly enough times have changed”
Torsten Curdt
![Page 4: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/4.jpg)
::agenda
• general environment hints
• Cocoon features for RAD
• web application and IDE config
• live demonstration
• behind the scenes
• overview of jci and javaflow
4
![Page 5: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/5.jpg)
::hints
• stripped down version of Cocoon
• build the source jars
• relocate the webapp with the COCOON_WEBAPP_HOME environment variable
• use “cocoon servlet-debug”
5
![Page 6: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/6.jpg)
::features
• compiling + reloading of classes
• compiling + reloading of javaflow
• compiling + reloading of components
• reloading of jars
6
![Page 7: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/7.jpg)
::map:classpath 7
<map:components> ... <map:classpath> <class-dir src=”...”/> <src-dir src=”...”/> <lib-dir src=”...”/> </map:classpath> ...
![Page 8: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/8.jpg)
::store 8
<map:components> ... <map:classpath> <class-dir src=”...”> <store class=”...”/> </class-dir> </map:classpath> ...
![Page 9: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/9.jpg)
::eclipse 9
DEMO
![Page 10: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/10.jpg)
::hmmm 10
So how does it work?
![Page 11: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/11.jpg)
::sitemap 11
• own component manager
• can have a dedicated classpath
• uses a paranoid* classloader
*parent-last classloader
![Page 12: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/12.jpg)
::reloading 12
![Page 13: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/13.jpg)
::adding flow 13
• resources transformed on-the-fly
• similar to pipelines
![Page 14: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/14.jpg)
::...but! 14
• does not help for core development
• be careful on a live system upgrade
• object types defined per classloader
![Page 15: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/15.jpg)
::dimensions 15
![Page 16: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/16.jpg)
::gotchas 16
• objects in sessions
• parent component manager component interactions
• old continuations
![Page 17: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/17.jpg)
::commons 17
• commons jci does the
• monitoring
• compilation
• commons javaflow provides
• java continuations
• cocoon javaflow block
• evolved out of cocoon 2.1
• now being used in cocoon trunk
![Page 18: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/18.jpg)
::cocoon block
• flow interpreter
• flow object model
• base classes
• integration with CForms
18
![Page 19: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/19.jpg)
::example 19
public class MyFlow extends AbstractContinuable {
public void run() { ... sendPageAndWait( ”page”, data); ... }
![Page 20: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/20.jpg)
::jci 20
• compiler abstraction
• supports eclipse, janino, groovy
• filesystem monitoring
• events for create, change and delete
• compiling/reloading class loader
http://jakarta.apache.org/commons/sandbox/jci
![Page 21: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/21.jpg)
::jci API 21
CompilationResult result = compiler.compiler( classNames, new FileResourceReader(dir), new MemoryResourceStore());
if (result.getErrors() .length > 0) { ...
![Page 22: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/22.jpg)
::jci API 22
FilesystemAlterationMonitor fam = new F..A..M();
fam.start();
fam.addListener( new CompilingListener( dir));
![Page 23: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/23.jpg)
::future
• almost ready for a release(94% testcase coverage!!)
• better dependencies support
• adding more compilers
• javac, pizza, jikes, gcj
• maven might switch to jci
23
![Page 24: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/24.jpg)
::javaflow 24
• java continuations throughbytecode instrumentation
• works hand in hand with jci
• ant-task for jar/class rewriting
• supports serialization(!!)
http://jakarta.apache.org/commons/sandbox/javaflow
![Page 25: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/25.jpg)
::javaflow API 25
Continuation continuation = Continuation.startWith( new Calculator()); ... Continuation.continueWith( continuation);
![Page 26: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/26.jpg)
::continuations 26
![Page 27: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/27.jpg)
::instrumentation 27
![Page 28: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/28.jpg)
::scalability
• the deeper your flow, the more memory used per continuation
• increases linearly
• avoid recursion
• the more method calls, the more overhead
• can be heavily optimized
28
![Page 29: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/29.jpg)
::limitations 29
• suspend in synchronized blocks
• suspend in a catch/finally
![Page 30: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/30.jpg)
::future plans 30
• remove current limitations
• call graph analysis for optimization
• switching from BCEL to ASM(?)
• support for external suspends(?)
• talking with the guys from RIFE
• release within the next few months
![Page 31: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/31.jpg)
::summary
• auto-compiling and reloading of
• classes
• javaflow
• components
• full IDE support
• debugging
• refactoring
• (potential) serialization support
• persisting continuations across restarts
• session and flow replication
31
![Page 32: Rapid Application Development with Cocoon](https://reader033.fdocuments.net/reader033/viewer/2022052823/5558148fd8b42a5e468b49ca/html5/thumbnails/32.jpg)
::thanks 32
questions?