Publicité
Publicité

Contenu connexe

Publicité
Publicité

CRaSH the shell for the Java Virtual Machine

  1. w w w . c r a s h u b . o r g CRaSH The shell for the JVM w w w . c r a s h u b . o r g Julien Viet exoplatform
  2. w w w . c r a s h u b . o r g All semicolons characters appearing in this work are fictitious. Any resemblance to real characters, living or dead, is purely coincidental. Disclaimer
  3. w w w . c r a s h u b . o r g http://www.julienviet.com / @julienviet 10 years of portal development (you know Portlets…) Working at eXoPlatform delivering enterprise social networks > me --verbose
  4. w w w . c r a s h u b . o r g You can use @crashub or #crashub Try it online try.crashub.org/gists/ e61cb08d93746e576209 (pro tip follow @crashub) About this talk
  5. w w w . c r a s h u b . o r g Once upon a time … Why did I do that ? what is CRaSH
  6. w w w . c r a s h u b . o r g Latest 1.2.9 / 1.3.0-cr5 Java 6+ / Groovy 1.7+ Base commands : jdbc, jmx, thread, jpa, log, etc.. Extensions: mail, cron CRaSH
  7. w w w . c r a s h u b . o r g Modes Standalone / attach (download / brew / gvm) Embedded Connectors jvm (standalone & attach) ssh, telnet crash.js over websocket Concepts
  8. w w w . c r a s h u b . o r g Standalone mode
  9. w w w . c r a s h u b . o r g Return "hello world" Command script
  10. w w w . c r a s h u b . o r g class helloworld { @Command String main() { return "Hello World" } } Command class
  11. w w w . c r a s h u b . o r g class hello { @Command String world() { return "Hello World" } } Git style
  12. w w w . c r a s h u b . o r g Command pipelining
  13. w w w . c r a s h u b . o r g Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface. - Ken Thompson Unix philosophy
  14. w w w . c r a s h u b . o r g % thread ls | thread dump | mail -s "something you should look at" julien@julienviet.com Pipeline example
  15. w w w . c r a s h u b . o r g <Void, Thread> is a producer <Thread, Object> is a pipe <String, String> is a pipe Pipeline example
  16. w w w . c r a s h u b . o r g class daemon { @Command Pipe<Thread, Thread> main() { [provide: { if (it.daemon) context.provide(it) }] as Pipe<Thread, Thread> } } Pipe command
  17. w w w . c r a s h u b . o r g # log ls -f org.crsh.* | log send -m "hello" # system propls | filter -p NAME:java.* | sort -f NAME # jmx query -p java.lang:type=GarbageCollector,name=* | jmx get -a Name -a CollectionCount -a CollectionTime Other examples
  18. w w w . c r a s h u b . o r g Read Eval Print Loop aka REPL
  19. w w w . c r a s h u b . o r g By default the script REPL parses CLI familiar for most CLI users Script REPL
  20. w w w . c r a s h u b . o r g very much like groovysh evaluates Groovy expressions DSL for creating CLI compose pipes and closures New Groovy REPL since 1.3
  21. w w w . c r a s h u b . o r g % (thread.ls | thread.dump | mail { S="something you should look at” "admin@domain.com" })() Our command pipeline in Groovy
  22. w w w . c r a s h u b . o r g More cool stuff
  23. w w w . c r a s h u b . o r g Completers Renderers Keyboard: interruption / events Screen: streaming / styling More cool stuff
  24. w w w . c r a s h u b . o r g Attach mode
  25. w w w . c r a s h u b . o r g Embedding CRaSH
  26. w w w . c r a s h u b . o r g Bootstrap: programmatic / Spring / Servlet Designed for embedding Lighweight : core jar about 600kb Modular : pay for what you need Virtual File System integration Embedding
  27. w w w . c r a s h u b . o r g Ecosystem
  28. w w w . c r a s h u b . o r g Created in Nov 2012 by Stephan Jaetzold Contributions by Burt Beckwith Recently updated to CRaSH 1.3 with additional features Grails Plugin
  29. w w w . c r a s h u b . o r g And the story just begins
  30. w w w . c r a s h u b . o r g Multi facet, powerful and extensible tool for all of us Join the community www.crashub.org @crashub crash-users@googlegroups.com Wrap up
  31. w w w . c r a s h u b . o r g Extra slides
  32. w w w . c r a s h u b . o r g new UIBuilder().table { header { label("key") label("value") } System.properties.each { k,v -> row { label(k).style(Color.red.fg()); label(v).style(Color.blue.fg()) } } } Building more complex UI with a DSL
Publicité