Asadmin Webinar 12 Feb 2009


Published on

ASAdmin, the GlassFish CLI console. Second try

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Asadmin Webinar 12 Feb 2009

  1. 1. GlassFish Admin CLI - asadmin (Past, Present and Future) Kedar Mhaswade Jane Young February 12th 2009
  2. 2. Agenda • What asadmin is ... • GlassFish V2.x asadmin • What GlassFish V2 asadmin Lacked • Enter GlassFish V3 • Interactive Command Development • Exciting Features Planned • References • Questions? 2
  3. 3. What asadmin is ... Asadmin is: > Well, a Hidden Gem ;) > Extensive, Powerful, Scriptable Administrative Command Line Interface for GlassFish CLIP Compliant Grammar > A Very Stable Interface Countless Scripts Depend on it Savior for Automated Test Scripts 3
  4. 4. What asadmin is … (Quiz Time) Did you know? > Asadmin Manages Multiple Domains > Securely Administers on Single Port Speaks Beloved (?) HTTP > Has ~ 250 Commands (+/-) > Has a DSL (well, sort of) in Dotted Names Number of Commands is Reduced Cryptic Till You Get Them > Has a Minimal Shell 4
  5. 5. What asadmin is … (Architecture, sort of) Server Software is Complex, Needs Setup Commands (Local) Create-domain, create-node-agent ... Server Management Commands (Remote) Server Implements Most Commands Parsed Command Line + RPC Transport is HTTP Admin Admin Server (DAS) CLI Server (DAS) 5
  6. 6. GlassFish V2.x asadmin A Java HTTP/JMX Client to DAS Several Generic JMX Commands Uses JSR-160 (Little-Known) Implementation HTTP/S Has Parsing Framework and Commands Used Elsewhere (cli-framework) Some Form of Pluggability OpenESB Integration CLIDescriptor.xml 6
  7. 7. GlassFish V2.x asadmin Provides CRUD Support (Configuration) Generic Set/Get/List Monitoring (vmstat/prstat) Super-set of GUI Properties Files Not Just Domain.xml Keyword Search/Manpages List Set/Get Integration Database Operating System (SMF) 7
  8. 8. What it Lacks ... •Rather Monolithic >Hard to Extend, Plug Commands In >Not Dynamic •A Powerful/Useful Shell >Too Many Commands to Remember and Key-in! •Integration with Scripting Languages •Separation of Options (Command, asadmin) 8
  9. 9. Enter V3 (Prelude) 9
  10. 10. Changes in v3 asadmin Server Became Pluggable/Modular Asadmin Had to Follow A Rigorous Look at Command A Command Line With a Grammar A Set of Options and Operands (Parameters) A Java Class Implementing Functionality Adequate Hooks Into Infrastructure Data Transfer Between Client and Server Strings, Baby! 10
  11. 11. Changes in v3 asadmin – II Command Line Remains Parsing Moves to Server A General Purpose Injection Manager Injects Params into Object A Command is a POJO with AdminCommand Annotation A Set of @Params @AdminCommand (name=”mycmd”) A Report Filled In public class FooCommand { @Param String name; //--name @Param String value; // -- value @Param Boolean enabled; // public void execute(AdminCommandContext Context) { …} } 11
  12. 12. Changes in v3 asadmin – III Data Transfer A Simple Get/Post HTTP Request Get for URI Post for FileUpload Grizzly Adapter at the Server End java.util.Manifest (Yikes!) Coming Back Other Formats Totally Possible (hk2-agent) 12
  13. 13. Changes in v3 asadmin – IV As a Result, You as a Command Developer (and App Server Enhancer) Create Your Module/Container/Whatever Identify Admin Commands and Name Them Create Pojo's With @Param(s) Write Business Logic and Return the Result Drop in Module.jar in /modules Folder Run asadmin mycmd –opt1=v1 –opt2=v2 ... Forget Command Line Parsing And Get CLI for your Module for Free 13
  14. 14. V3 asadmin – How Commands Are Received Grizzly Adapter Called AdminAdapter Entertains Authenticated Requests Only Context Root: host:admin-port/__asadmin Supports Streaming Intercepts ALL Admin Requests Reads the Input Stream for POST and Uploads Files (Deploy) Invokes the Commands Returns the Result to OutputStream Writes a Manifest for CLI/NetBeans Writes an HTML for Browser Invocation 14
  15. 15. V3 asadmin – How Authentication Works Only Admin Users Should Be Able to Manage Requires HTTP BASE64 Authentication Admin-Realm (A File Realm – Remember admin-keyfile)? CLI Sends a BASE64-Encoded UserName and Password Provision of the so-called Anonymous Login Of Course Not Secure Need SSL Certificate Exchange 15
  16. 16. V3 asadmin – Are We Doing Enough? Enter V3 FCS 16
  17. 17. V3 FCS asadmin Build the Icing on the Cake No Changes to Basic API A Powerful Shell Alias History Completion, Navigation Separation of Options --host is NOT an option for create-cluster! 17
  18. 18. V3 FCS asadmin – II A Shell In the Browser? Cool and Useful, No Installation Required Add a Ruby Gem irb>> require 'asadmin' Gem install asadmin! irb>> domain =“localhost”); irb>> domain.each_application do { |app| puts “app: #{}, type: #{app.type}” } app: trade2 type: web app: Twitterfeed type: jruby 18
  19. 19. V3 FCS asadmin – III A Client-side Preferences File Should asadmin be an OSGi System? Local Commands Made Pluggable Many More Commands Feature Parity With V2 Developer Profile And Compatibility 19
  20. 20. What Are Others Doing? JBoss 5.0 GA: • No changes in administration for the past 3 years. Same scripts: run, shutdown, twiddle (JMX based) • No commands for deployment. Applications are manually copied to the deploy directory. • No monitoring and diagnostics support BEA (Oracle) WebLogic 10g: • WLST – manages server lifecycle, deployment, diagnostics, navigation of MBeans • Hard to follow syntax. e.g. Invoke a Mbean Object: wls> obj s = j ar r ay. ar r ay( [ j ava. l ang. St r i ng( quot; oam ver quot; ) ] , j ava. l ang. O ect ) ser bj wls> st r s = j ar r ay. ar r ay( [ quot; j ava. l ang. St r i ngquot; ] , j ava. l ang. St r i ng) wls> i nvoke( ' l ookupSer ver ' , obj s, st r s) • Command category to WLST is not extensible GF asadmin : Most powerful and user friendly amongst 20 all others!
  21. 21. References 21
  22. 22. Got Questions? 22