SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
Who is Stefano?

●   JBoss WS[1] committer since early 2007
●   Committer of various Jboss projects
●   JBoss / Red Hat employee since July 2010
●   JBoss AS7[2] team memeber
●   IronJacamar[4] team member
●   Wise[3] project leader
●   Follow me:       www.javalinux.it, www.twitter.com/maeste
    https://plus.google.com/102371438013760231375/about
    https://github.com/maeste http://www.linkedin.com/in/maeste
    [1] http://www.jboss.org/jbossws   [2] http://www.jboss.org/jbossas

    [3] http://www.jboss.org/wise      [4] http://www.jboss.org/ironjcamar
AS7 in a nutshell


●Blazingly fast (<3s startup)
●Lightweight

●Modular core

●Hot, parallel deployment

●Elegant administration

●Domain management

●Easy testable
Dynamic Model Representation (DMR)

●   Central detyped management API
       ●   All management operations with/on DMR
       ●   Backwards compatible
●   Can be used to control standalone or
    domain
●   Detyped (i.e. string based) API uses small
    set of Java classes
●   Various transports (Java, remoting,
    JSON/HTTP)
Dynamic Model Representation (DMR)
What is CLI?

●   Command Line Interface
●   Easy to use both for standalone and
    domain mode
●   Scriptable
●   Low level management of DMR resource
    and/or high level user friendly command
●   Manage deployement and “special
    deployment”
●   Provide also a simple GUI
Why CLI instead of Web Console?

●   Both have valid use cases
●   CLI could be helpful in complex
    management but requiring programming
    skills (almost)
●   Web console give an advanced interface
    for complex operation and give a cooked
    view of resources
CLI Feature includes (1/2):
●   connect to the specific controller or server instance by specifying
    the host and the port;
●   send operation requests (providing the managed component's
    address, attribute or operation name and parameters) following
    the AS7 detyped management model;
●   view the available managed components, their attributes and
    operations;
●   tab-completion for commands and operation requests;
●   history of the executed commands and operation requests;
●   deploy and undeploy standard packages at runtime in standalone
    and domain modes;
●   CLI deployment archives;
CLI Feature includes (2/2):
●   batch mode;
●   non-interactive mode;
●   generic resource type commands and custom commands;
●   GUI mode;
●   CLI public API;
●   system properties in operations and commands;
●   try-catch-finally control flow;
●   if-else control flow
●   Single jar for remote clients
●   Advanced CLI scripting with Groovy, Rhino, Jython, etc.
connect to the specific controller or server
instance by specifying the host and the port;




                  DEMO
          (execute cli an connect)
send operation requests

●   Address (node path)
    node_type=node_name (, node_type=node_name)*
    /subsystem=datasources
    /subsystem=datasources/data-source=ExampleDS

●   Operations
    :operation-name ['(' [name=value [, name=value]*] ')']
    :shutdown
    :shutdown()
    :shutdown(restart=true)
    /subsystem=datasources/data-source=ExampleDS:write-
    attribute(name=min-pool-size,value=5)
A demo of some other features

●   view the available managed components,
    their attributes and operations;
●   tab-completion for commands and
    operation requests;
●   history of the executed commands and
    operation requests;
Deploy and Undeploy standard
               packages
●   Standalone mode
      ●   Deploy/undeploy a package
      ●   Deploy –disabled
      ●   Undeploy --keep-content
●   Domain mode
      ●   Specify a server group (or --all-server-
           groups)
      ●   Undeploy from relevant server groups
      ●   Deply/undeploy on specific server group
           and disabled deployments
CLI deployment archive

●   Standard Jar containing archives to
    deploy
●   A deploy.scr containing commands to
    execute in cli when archive is deployed
●   A undeploy.scr to rollback on undeploy
●   Multiple deploy/undeploy script can exist
    and they are addressed by --script option
    in deploy/undeploy command
Batch mode

●   The batch mode allows one to group
    commands and operations and execute
    them together as an atomic unit
●   Build them from scratch (entering batch
    mode w/ “batch” command)...demo
●   Execute (eventually modify) batch stored
    in file
●   Batches with properties (./jboss-cli
    --properties=script.properties)
Non interective

●   ./jboss-cli.sh -c –file=test.cli
●   ./jboss-cli.sh -c --commands="cd
    subsystem=web,ls"
●   Why? Cron for example, or in any case
    you need to run scripts triggered from
    operating system
Generic type CLI commands

●   is a command that is assigned to a
    specific node type
●   Data-source example
●   Add a new command (only in current
    session...but you can create a batch for
    your own commands...)
CLI GUI

●   Browse the domain model
●   To see the operations available for a
    node, right-click the node.
●   Context-sensitive help is available
    throughout the Command Builder
●   You can also edit the command line
    manually and submit a command at any
    time
Public API
                  (Since JBoss AS 7.1.1)
final CommandContext ctx;
try {
   ctx = CommandContextFactory.getInstance().newCommandContext();
} catch(CliInitializationException e) {
   throw new IllegalStateException("Failed to initialize CLI context", e);
}

try {
   // connect to the server controller
   ctx.connectController();

   // execute commands and operations
   ctx.handle(":take-snapshot");
   ctx.handle("deploy myapp.ear");
} catch (CommandLineException e) {
   // the operation or the command has failed
} finally {
   // terminate the session and
   // close the connection to the controller
   ctx.terminateSession();

 }
try-catch-finally control flow

Try
 /subsystem=datasources/data-source=myds:add(connection-url=xxx,jndi-
name=java:/myds,driver-name=h2)
catch
 /subsystem=datasources/data-source=myds:remove
 /subsystem=datasources/data-source=myds:add(connection-url=xxx,jndi-
name=java:/myds,driver-name=h2)
finally
 /subsystem=datasources/data-source=myds:enable
end-try
if-else control flow

 if (outcome != success) of /system-property=test:read-resource
     /system-property=test:add(value=true)
 end-if


[standalone@localhost:9999 /] /system-property=test:read-resource
{
    "outcome" => "failed",
    "failure-description" => "JBAS014807: Management resource
'[("system-property" => "test")]' not found",
    "rolled-back" => true
}



 [standalone@localhost:9999 /] /system-property=test:read-resource
 {
     "outcome" => "success",
     "result" => {"value" => "true"}
 }
Scripting with Groovy
    (and all Java lib enabled scripting language)
groovy -cp jboss-cli-client.jar uptime.groovy
 import org.jboss.as.cli.scriptsupport.*
  
 cli = CLI.newInstance()
 cli.connect()
  
 if (cli.getCommandContext().isDomainMode()) {
   cli.cmd("cd /host=master/core-service=platform-mbean/type=runtime")
 } else {
   cli.cmd("cd /core-service=platform-mbean/type=runtime")
 }
  
 result = cli.cmd(":read-attribute(name=start-time)")
 response = result.getResponse()
 startTime = response.get("result").asLong()
  
 result = cli.cmd(":read-attribute(name=uptime)")
 response = result.getResponse()
 serveruptime = response.get("result").asString()
  
 println()
 println("The server was started on " + new Date(startTime))
 println("It has been running for " + serveruptime + "ms")
  
 cli.disconnect()
Community

●   Get involved !
       ●   Base for JBoss Enterprise Application
            Platform 6.x
●   Download
       ●   http://www.jboss.org/jbossas/downloads
●   Forum
       ●   http://community.jboss.org/en/jbossas/as7_us
            ers
Community

●   Hacking on AS 7
       ●   http://community.jboss.org/wiki/HackingonAS
            7
●   Command Line Interface
       ●   https://community.jboss.org/wiki/CommandLin
●   Operations, Administration & Management
    of JBoss AS7
       ●   http://vimeo.com/25855285

Mais conteúdo relacionado

Mais procurados

Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptKenny (netman)
 
Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"Fwdays
 
OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!Tobias Schneck
 
Scala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouJ On The Beach
 
vert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Javavert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in JavaClément Escoffier
 
Riding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamRiding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamJean-François Gagné
 
An Introduction to Subversion (Bahasa Indonesia)
An Introduction to Subversion (Bahasa Indonesia)An Introduction to Subversion (Bahasa Indonesia)
An Introduction to Subversion (Bahasa Indonesia)Gibransyah Fakhri
 
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021Valeriy Kravchuk
 
CIbox - OpenSource solution for making your #devops better
CIbox - OpenSource solution for making your #devops betterCIbox - OpenSource solution for making your #devops better
CIbox - OpenSource solution for making your #devops betterAndrii Podanenko
 
Magento 2 Capistrano Deploy
Magento 2 Capistrano DeployMagento 2 Capistrano Deploy
Magento 2 Capistrano DeployDuke Dao
 
OpenCmsDays 2013 - Using OpenCms 9 folders as a network drive
OpenCmsDays 2013 - Using OpenCms 9 folders as a network driveOpenCmsDays 2013 - Using OpenCms 9 folders as a network drive
OpenCmsDays 2013 - Using OpenCms 9 folders as a network driveAlkacon Software GmbH & Co. KG
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
Jbpm4 Deployer
Jbpm4 DeployerJbpm4 Deployer
Jbpm4 Deployerhbraun
 
ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?Tetsuyuki Kobayashi
 

Mais procurados (19)

Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell script
 
Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"
 
GlassFish v2.1
GlassFish v2.1GlassFish v2.1
GlassFish v2.1
 
Node js
Node jsNode js
Node js
 
OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!
 
Scala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camou
 
Beyond Puppet
Beyond PuppetBeyond Puppet
Beyond Puppet
 
vert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Javavert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Java
 
Riding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamRiding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication Stream
 
An Introduction to Subversion (Bahasa Indonesia)
An Introduction to Subversion (Bahasa Indonesia)An Introduction to Subversion (Bahasa Indonesia)
An Introduction to Subversion (Bahasa Indonesia)
 
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
CIbox - OpenSource solution for making your #devops better
CIbox - OpenSource solution for making your #devops betterCIbox - OpenSource solution for making your #devops better
CIbox - OpenSource solution for making your #devops better
 
Magento 2 Capistrano Deploy
Magento 2 Capistrano DeployMagento 2 Capistrano Deploy
Magento 2 Capistrano Deploy
 
OpenCmsDays 2013 - Using OpenCms 9 folders as a network drive
OpenCmsDays 2013 - Using OpenCms 9 folders as a network driveOpenCmsDays 2013 - Using OpenCms 9 folders as a network drive
OpenCmsDays 2013 - Using OpenCms 9 folders as a network drive
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitations
 
Jbpm4 Deployer
Jbpm4 DeployerJbpm4 Deployer
Jbpm4 Deployer
 
Android - ADB
Android - ADBAndroid - ADB
Android - ADB
 
ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?
 

Semelhante a Cli jbug

airflowpresentation1-180717183432.pptx
airflowpresentation1-180717183432.pptxairflowpresentation1-180717183432.pptx
airflowpresentation1-180717183432.pptxVIJAYAPRABAP
 
Airflow presentation
Airflow presentationAirflow presentation
Airflow presentationIlias Okacha
 
airflow web UI and CLI.pptx
airflow web UI and CLI.pptxairflow web UI and CLI.pptx
airflow web UI and CLI.pptxVIJAYAPRABAP
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVMSylvain Wallez
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.ILEran Harel
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager Alison Chaiken
 
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfOrtus Solutions, Corp
 
A3Sec Advanced Deployment System
A3Sec Advanced Deployment SystemA3Sec Advanced Deployment System
A3Sec Advanced Deployment Systema3sec
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient waySylvain Rayé
 
Techtalks: taking docker to production
Techtalks: taking docker to productionTechtalks: taking docker to production
Techtalks: taking docker to productionmuayyad alsadi
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them AllTim Fairweather
 
Dragoncraft Architectural Overview
Dragoncraft Architectural OverviewDragoncraft Architectural Overview
Dragoncraft Architectural Overviewjessesanford
 
Privilege Escalation with Metasploit
Privilege Escalation with MetasploitPrivilege Escalation with Metasploit
Privilege Escalation with Metasploitegypt
 
OSGi Cloud Ecosystems - David Bosschaert
OSGi Cloud Ecosystems - David BosschaertOSGi Cloud Ecosystems - David Bosschaert
OSGi Cloud Ecosystems - David Bosschaertmfrancis
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3kognate
 

Semelhante a Cli jbug (20)

airflowpresentation1-180717183432.pptx
airflowpresentation1-180717183432.pptxairflowpresentation1-180717183432.pptx
airflowpresentation1-180717183432.pptx
 
Airflow presentation
Airflow presentationAirflow presentation
Airflow presentation
 
airflow web UI and CLI.pptx
airflow web UI and CLI.pptxairflow web UI and CLI.pptx
airflow web UI and CLI.pptx
 
Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager
 
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
 
A3Sec Advanced Deployment System
A3Sec Advanced Deployment SystemA3Sec Advanced Deployment System
A3Sec Advanced Deployment System
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
JOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to ProductionJOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to Production
 
Techtalks: taking docker to production
Techtalks: taking docker to productionTechtalks: taking docker to production
Techtalks: taking docker to production
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
 
Dragoncraft Architectural Overview
Dragoncraft Architectural OverviewDragoncraft Architectural Overview
Dragoncraft Architectural Overview
 
Privilege Escalation with Metasploit
Privilege Escalation with MetasploitPrivilege Escalation with Metasploit
Privilege Escalation with Metasploit
 
Grails 101
Grails 101Grails 101
Grails 101
 
Catalyst MVC
Catalyst MVCCatalyst MVC
Catalyst MVC
 
OSGi Cloud Ecosystems - David Bosschaert
OSGi Cloud Ecosystems - David BosschaertOSGi Cloud Ecosystems - David Bosschaert
OSGi Cloud Ecosystems - David Bosschaert
 
Knolx session
Knolx sessionKnolx session
Knolx session
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3
 

Último

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Último (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Cli jbug

  • 1.
  • 2. Who is Stefano? ● JBoss WS[1] committer since early 2007 ● Committer of various Jboss projects ● JBoss / Red Hat employee since July 2010 ● JBoss AS7[2] team memeber ● IronJacamar[4] team member ● Wise[3] project leader ● Follow me: www.javalinux.it, www.twitter.com/maeste https://plus.google.com/102371438013760231375/about https://github.com/maeste http://www.linkedin.com/in/maeste [1] http://www.jboss.org/jbossws [2] http://www.jboss.org/jbossas [3] http://www.jboss.org/wise [4] http://www.jboss.org/ironjcamar
  • 3. AS7 in a nutshell ●Blazingly fast (<3s startup) ●Lightweight ●Modular core ●Hot, parallel deployment ●Elegant administration ●Domain management ●Easy testable
  • 4. Dynamic Model Representation (DMR) ● Central detyped management API ● All management operations with/on DMR ● Backwards compatible ● Can be used to control standalone or domain ● Detyped (i.e. string based) API uses small set of Java classes ● Various transports (Java, remoting, JSON/HTTP)
  • 6. What is CLI? ● Command Line Interface ● Easy to use both for standalone and domain mode ● Scriptable ● Low level management of DMR resource and/or high level user friendly command ● Manage deployement and “special deployment” ● Provide also a simple GUI
  • 7. Why CLI instead of Web Console? ● Both have valid use cases ● CLI could be helpful in complex management but requiring programming skills (almost) ● Web console give an advanced interface for complex operation and give a cooked view of resources
  • 8. CLI Feature includes (1/2): ● connect to the specific controller or server instance by specifying the host and the port; ● send operation requests (providing the managed component's address, attribute or operation name and parameters) following the AS7 detyped management model; ● view the available managed components, their attributes and operations; ● tab-completion for commands and operation requests; ● history of the executed commands and operation requests; ● deploy and undeploy standard packages at runtime in standalone and domain modes; ● CLI deployment archives;
  • 9. CLI Feature includes (2/2): ● batch mode; ● non-interactive mode; ● generic resource type commands and custom commands; ● GUI mode; ● CLI public API; ● system properties in operations and commands; ● try-catch-finally control flow; ● if-else control flow ● Single jar for remote clients ● Advanced CLI scripting with Groovy, Rhino, Jython, etc.
  • 10. connect to the specific controller or server instance by specifying the host and the port; DEMO (execute cli an connect)
  • 11. send operation requests ● Address (node path) node_type=node_name (, node_type=node_name)* /subsystem=datasources /subsystem=datasources/data-source=ExampleDS ● Operations :operation-name ['(' [name=value [, name=value]*] ')'] :shutdown :shutdown() :shutdown(restart=true) /subsystem=datasources/data-source=ExampleDS:write- attribute(name=min-pool-size,value=5)
  • 12. A demo of some other features ● view the available managed components, their attributes and operations; ● tab-completion for commands and operation requests; ● history of the executed commands and operation requests;
  • 13. Deploy and Undeploy standard packages ● Standalone mode ● Deploy/undeploy a package ● Deploy –disabled ● Undeploy --keep-content ● Domain mode ● Specify a server group (or --all-server- groups) ● Undeploy from relevant server groups ● Deply/undeploy on specific server group and disabled deployments
  • 14. CLI deployment archive ● Standard Jar containing archives to deploy ● A deploy.scr containing commands to execute in cli when archive is deployed ● A undeploy.scr to rollback on undeploy ● Multiple deploy/undeploy script can exist and they are addressed by --script option in deploy/undeploy command
  • 15. Batch mode ● The batch mode allows one to group commands and operations and execute them together as an atomic unit ● Build them from scratch (entering batch mode w/ “batch” command)...demo ● Execute (eventually modify) batch stored in file ● Batches with properties (./jboss-cli --properties=script.properties)
  • 16. Non interective ● ./jboss-cli.sh -c –file=test.cli ● ./jboss-cli.sh -c --commands="cd subsystem=web,ls" ● Why? Cron for example, or in any case you need to run scripts triggered from operating system
  • 17. Generic type CLI commands ● is a command that is assigned to a specific node type ● Data-source example ● Add a new command (only in current session...but you can create a batch for your own commands...)
  • 18. CLI GUI ● Browse the domain model ● To see the operations available for a node, right-click the node. ● Context-sensitive help is available throughout the Command Builder ● You can also edit the command line manually and submit a command at any time
  • 19. Public API (Since JBoss AS 7.1.1) final CommandContext ctx; try { ctx = CommandContextFactory.getInstance().newCommandContext(); } catch(CliInitializationException e) { throw new IllegalStateException("Failed to initialize CLI context", e); } try { // connect to the server controller ctx.connectController(); // execute commands and operations ctx.handle(":take-snapshot"); ctx.handle("deploy myapp.ear"); } catch (CommandLineException e) { // the operation or the command has failed } finally { // terminate the session and // close the connection to the controller ctx.terminateSession(); }
  • 20. try-catch-finally control flow Try /subsystem=datasources/data-source=myds:add(connection-url=xxx,jndi- name=java:/myds,driver-name=h2) catch /subsystem=datasources/data-source=myds:remove /subsystem=datasources/data-source=myds:add(connection-url=xxx,jndi- name=java:/myds,driver-name=h2) finally /subsystem=datasources/data-source=myds:enable end-try
  • 21. if-else control flow if (outcome != success) of /system-property=test:read-resource     /system-property=test:add(value=true) end-if [standalone@localhost:9999 /] /system-property=test:read-resource {     "outcome" => "failed",     "failure-description" => "JBAS014807: Management resource '[("system-property" => "test")]' not found",     "rolled-back" => true } [standalone@localhost:9999 /] /system-property=test:read-resource {     "outcome" => "success",     "result" => {"value" => "true"} }
  • 22. Scripting with Groovy (and all Java lib enabled scripting language) groovy -cp jboss-cli-client.jar uptime.groovy import org.jboss.as.cli.scriptsupport.*   cli = CLI.newInstance() cli.connect()   if (cli.getCommandContext().isDomainMode()) {   cli.cmd("cd /host=master/core-service=platform-mbean/type=runtime") } else {   cli.cmd("cd /core-service=platform-mbean/type=runtime") }   result = cli.cmd(":read-attribute(name=start-time)") response = result.getResponse() startTime = response.get("result").asLong()   result = cli.cmd(":read-attribute(name=uptime)") response = result.getResponse() serveruptime = response.get("result").asString()   println() println("The server was started on " + new Date(startTime)) println("It has been running for " + serveruptime + "ms")   cli.disconnect()
  • 23. Community ● Get involved ! ● Base for JBoss Enterprise Application Platform 6.x ● Download ● http://www.jboss.org/jbossas/downloads ● Forum ● http://community.jboss.org/en/jbossas/as7_us ers
  • 24. Community ● Hacking on AS 7 ● http://community.jboss.org/wiki/HackingonAS 7 ● Command Line Interface ● https://community.jboss.org/wiki/CommandLin ● Operations, Administration & Management of JBoss AS7 ● http://vimeo.com/25855285