CRaSH

17
CRaSH Portal Team

description

CRaSH. Portal Team. Agenda. Introduction to CRaSH Deployment and connection Using the CRaSH command Develop the CRaSH commands yourself. Introduction to CRaSH. 3. What's CRaSH ?. A shell for JCR that bundled as a war file to deploy in eXo portal 2.5.x or Gatein - PowerPoint PPT Presentation

Transcript of CRaSH

Page 1: CRaSH

CRaSH

Portal Team

Page 2: CRaSH

2

Agenda

Introduction to CRaSH

Deployment and connection

Using the CRaSH command

Develop the CRaSH commands yourself.

Page 3: CRaSH

3

Introduction to CRaSH

Page 4: CRaSH

4

What's CRaSH ?

» A shell for JCR that bundled as a war file to deploy in eXo portal 2.5.x or Gatein

» Allow remote connection to a server and perform various operations

» Test JCR queries

» CRaSH was written in Java and Groovy

» CRaSH project hosted on Google Code under LGPL

(http://code.google.com/p/crsh/)

» Current version : 1.0.0 – beta10

Page 5: CRaSH

5

What's CRaSH ?

Page 6: CRaSH

Deployment and connection

Page 7: CRaSH

7

Deployment

» Copy crash.war into server eXo Portal 2.5.x or Gatein

» CraSH.war will be deployed in server running

» CraSH.war could be built from source code or download from hosted site

Page 8: CRaSH

8

Connect to CRaSH

» We use telnet or SSH to connect on port 5000 (with telnet) and 2000 (with SSH)

telnet localhost 5000Trying ::1...Connected to localhost.Escape character is '^]'.CRaSH 1.0.0-beta11-SNAPSHOT (http://crsh.googlecode.com)Welcome to exo!It is Wed Sep 08 15:55:56 ICT 2010 now.%

Page 9: CRaSH

Using the CraSH commands

Page 10: CRaSH

10

CraSH commands

» CraSH provide some commands to access JCR from shell

Connect to a repository

Listing the content of a node

Changing the current node

Printing the current node

Copying a node

Removing a node

.....

Page 11: CRaSH

11

Introduce useful commands

» Demo some commands with gatein

Page 12: CRaSH

Develop the CRaSH command yourself

Page 13: CRaSH

13

How to develop a command

» The shell command is based on the Groovy language

» Use args4j project to inject the options and arguments on the command class

» Each command has a corresponding Groovy file in /WEB-INF/groovy/commands

Page 14: CRaSH

14

CRaSH components

TelnetTelnet

SCPSCP

SSHSSH ConnectorsConnectors ShellEngineShell

Engine JCRConnector

JCRConnector

CommandCommand

Args4jArgs4j GroovyGroovy

Page 15: CRaSH

15

How to develop a command

ClassCommand_________________

execute() : Object

connect___________________

execute() : Object connect.groovy file

Page 16: CRaSH

16

How to develop a command

CRaSH provides some useful functions:» assertConnected() checks that the user is connected

» getCurrentNode() returns the current node

» setCurrentNode(Node node) updates the current node

» findNodeByPath() returns a node based on the provided path

» formatValue(Value value) formats a JCR value into a suite text value

» formatPropertyValue(Property property) format a JCR property value into a suite text value

Page 17: CRaSH

Q & A

Reference:

http://code.google.com/p/crsh/

http://wiki-int.exoplatform.org/display/exoproducts/CRaSH+utility+scripts

https://args4j.dev.java.net/

http://groovy.codehaus.org/