Top Banner
GlassFish Admin CLI - asadmin (Past, Present and Future) Kedar Mhaswade [email protected] Jane Young [email protected] February 12 th 2009
22

Asadmin Webinar 12 Feb 2009

May 20, 2015

Download

Technology

ASAdmin, the GlassFish CLI console. Second try
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Asadmin Webinar 12 Feb 2009

GlassFish Admin CLI - asadmin(Past, Present and Future)

Kedar Mhaswade [email protected] Young [email protected] 12th 2009

Page 2: Asadmin Webinar 12 Feb 2009

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?

Page 3: Asadmin Webinar 12 Feb 2009

3

What asadmin is ...

Asadmin is:> Well, a Hidden Gem ;)> Extensive, Powerful, Scriptable Administrative

Command Line Interface for GlassFishCLIP Compliant Grammar

> A Very Stable InterfaceCountless Scripts Depend on itSavior for Automated Test Scripts

Page 4: Asadmin Webinar 12 Feb 2009

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 ReducedCryptic Till You Get Them

> Has a Minimal Shell

Page 5: Asadmin Webinar 12 Feb 2009

5

What asadmin is … (Architecture, sort of)

Server Software is Complex, NeedsSetup Commands (Local)

Create-domain, create-node-agent ...Server Management Commands (Remote)

Server Implements Most CommandsParsed Command Line + RPC Transport is HTTP

Admin

Server (DAS)CLI Admin Server (DAS)

Page 6: Asadmin Webinar 12 Feb 2009

6

GlassFish V2.x asadmin

A Java HTTP/JMX Client to DASSeveral Generic JMX Commands

Uses JSR-160 (Little-Known) ImplementationHTTP/S

Has Parsing Framework and CommandsUsed Elsewhere (cli-framework)

Some Form of PluggabilityOpenESB IntegrationCLIDescriptor.xml

Page 7: Asadmin Webinar 12 Feb 2009

7

GlassFish V2.x asadmin

Provides CRUD Support (Configuration)Generic Set/Get/ListMonitoring (vmstat/prstat)Super-set of GUI

Not Just Domain.xmlKeyword Search/ManpagesIntegration

DatabaseOperating System (SMF)

Properties

Files

List Set/Get

Page 8: Asadmin Webinar 12 Feb 2009

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)

Page 9: Asadmin Webinar 12 Feb 2009

9

Enter V3 (Prelude)

Page 10: Asadmin Webinar 12 Feb 2009

10

Changes in v3 asadminServer Became Pluggable/Modular

Asadmin Had to FollowA Rigorous Look at Command

A Command Line With a GrammarA Set of Options and Operands (Parameters)A Java Class Implementing Functionality

Adequate Hooks Into InfrastructureData Transfer Between Client and Server

Strings, Baby!

Page 11: Asadmin Webinar 12 Feb 2009

11

Changes in v3 asadmin – II Command Line Remains

Parsing Moves to ServerA General Purpose Injection Manager

Injects Params into ObjectA Command is a POJO with

AdminCommand AnnotationA Set of @ParamsA Report Filled In

@AdminCommand (name=”mycmd”)public class FooCommand {@Param String name; //--name@Param String value; // -- value@Param Boolean enabled; //

public void execute(AdminCommandContextContext) { …}}

Page 12: Asadmin Webinar 12 Feb 2009

12

Changes in v3 asadmin – III Data Transfer

A Simple Get/Post HTTP RequestGet for URIPost for FileUploadGrizzly Adapter at the Server End

java.util.Manifest (Yikes!) Coming BackOther Formats Totally Possible (hk2-agent)

Page 13: Asadmin Webinar 12 Feb 2009

13

Changes in v3 asadmin – IV As a Result, You as a Command Developer (and App Server Enhancer)

Create Your Module/Container/WhateverIdentify Admin Commands and Name ThemCreate Pojo's With @Param(s)Write Business Logic and Return the ResultDrop in Module.jar in /modules FolderRun asadmin mycmd –opt1=v1 –opt2=v2 ...Forget Command Line Parsing

And Get CLI for your Module for Free

Page 14: Asadmin Webinar 12 Feb 2009

14

V3 asadmin – How Commands Are Received

Grizzly Adapter Called AdminAdapterEntertains Authenticated Requests OnlyContext Root: host:admin-port/__asadminSupports StreamingIntercepts ALL Admin RequestsReads the Input Stream for POST and Uploads Files (Deploy)Invokes the CommandsReturns the Result to OutputStream

Writes a Manifest for CLI/NetBeansWrites an HTML for Browser Invocation

Page 15: Asadmin Webinar 12 Feb 2009

15

V3 asadmin – How Authentication Works

Only Admin Users Should Be Able to ManageRequires HTTP BASE64 Authentication

Admin-Realm (A File Realm – Remember admin-keyfile)?CLI Sends a BASE64-Encoded UserName and PasswordProvision of the so-called Anonymous LoginOf Course Not Secure

Need SSLCertificate Exchange

Page 16: Asadmin Webinar 12 Feb 2009

16

V3 asadmin – Are We Doing Enough?

Enter V3 FCS

Page 17: Asadmin Webinar 12 Feb 2009

17

V3 FCS asadmin

Build the Icing on the CakeNo Changes to Basic API

A Powerful ShellAliasHistoryCompletion, Navigation

Separation of Options--host is NOT an option for create-cluster!

Page 18: Asadmin Webinar 12 Feb 2009

18

V3 FCS asadmin – II

A Shell In the Browser?Cool and Useful, No Installation Required

Add a Ruby GemGem install asadmin!

irb>> require 'asadmin'irb>> domain = Domain.new(“localhost”);irb>> domain.each_application do { |app|puts “app: #{app.name}, type: #{app.type}”

}

app: trade2 type: webapp: Twitterfeed type: jruby

Page 19: Asadmin Webinar 12 Feb 2009

19

V3 FCS asadmin – III

A Client-side Preferences FileShould asadmin be an OSGi System?

Local Commands Made Pluggable

Many More CommandsFeature Parity With V2 Developer Profile

And Compatibility

Page 20: Asadmin Webinar 12 Feb 2009

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 array array j ava l ang St r i ng oamserver j ava l ang Obj ect

wls> = . ( [ " . . " ] , . . )st rs j array array j ava l ang St r i ng j ava l ang St r i ng

wls> ( ' ' , , )i nvoke l ookupServer obj s st rs

• Command category to WLST is not extensible

GF asadmin : Most powerful and user friendly amongst all others!

Page 22: Asadmin Webinar 12 Feb 2009

22

Got Questions?