Transcript
Page 1: Rapid Application Development with Cocoon

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

::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

::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

::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

::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

::features

• compiling + reloading of classes

• compiling + reloading of javaflow

• compiling + reloading of components

• reloading of jars

6

Page 7: Rapid Application Development with Cocoon

::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

::store 8

<map:components> ... <map:classpath> <class-dir src=”...”> <store class=”...”/> </class-dir> </map:classpath> ...

Page 9: Rapid Application Development with Cocoon

::eclipse 9

DEMO

Page 10: Rapid Application Development with Cocoon

::hmmm 10

So how does it work?

Page 11: Rapid Application Development with Cocoon

::sitemap 11

• own component manager

• can have a dedicated classpath

• uses a paranoid* classloader

*parent-last classloader

Page 12: Rapid Application Development with Cocoon

::reloading 12

Page 13: Rapid Application Development with Cocoon

::adding flow 13

• resources transformed on-the-fly

• similar to pipelines

Page 14: Rapid Application Development with Cocoon

::...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

::dimensions 15

Page 16: Rapid Application Development with Cocoon

::gotchas 16

• objects in sessions

• parent component manager component interactions

• old continuations

Page 17: Rapid Application Development with Cocoon

::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

::cocoon block

• flow interpreter

• flow object model

• base classes

• integration with CForms

18

Page 19: Rapid Application Development with Cocoon

::example 19

public class MyFlow extends AbstractContinuable {

public void run() { ... sendPageAndWait( ”page”, data); ... }

Page 20: Rapid Application Development with Cocoon

::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

::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

::jci API 22

FilesystemAlterationMonitor fam = new F..A..M();

fam.start();

fam.addListener( new CompilingListener( dir));

Page 23: Rapid Application Development with Cocoon

::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

::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

::javaflow API 25

Continuation continuation = Continuation.startWith( new Calculator()); ... Continuation.continueWith( continuation);

Page 26: Rapid Application Development with Cocoon

::continuations 26

Page 27: Rapid Application Development with Cocoon

::instrumentation 27

Page 28: Rapid Application Development with Cocoon

::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

::limitations 29

• suspend in synchronized blocks

• suspend in a catch/finally

Page 30: Rapid Application Development with Cocoon

::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

::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

::thanks 32

questions?


Top Related