JBoss.orgCommunity Documentation
Using the S-RAMP cmdline tool s-ramp.sh
In the bin
directory of the distribution you can find the s-ramp.sh
. Run this command to fire up the shell
./s-ramp.sh ********************************************************************** _____ ______ ___ ___ ________ / ___| | ___ \/ _ \| \/ | ___ \ \ `--. ______| |_/ / /_\ \ . . | |_/ / `--. \______| /| _ | |\/| | __/ /\__/ / | |\ \| | | | | | | | \____/ \_| \_\_| |_|_| |_|_| JBoss S-RAMP Kurt Stam and Eric Wittmann, Licensed under the Apache License, V2.0, Copyright 2012 ********************************************************************** s-ramp>
The shell supports auto-completion and keeps a command history for duration of the session.
To connect the shell to the server type connect
and hit the tab key. It should auto-complete
to say s-ramp:connect http://localhost:8080/s-ramp-server
and when hitting the return key
you will be prompted for user credentials. If everything is successful, the cursor should go
from red to green. Of course you will need to update the server and port information if your
S-RAMP repository runs elsewhere.
To browse the artifacts in the repository run the following query:
s-ramp> s-ramp:query /s-ramp Querying the S-RAMP repository: /s-ramp Atom Feed (9 entries) Idx Type Name --- ---- ---- 1 ImageDocument user-properties.png 2 Document overlord.demo.CheckDeployment-taskform.flt 3 BrmsPkgDocument SRAMPPackage.pkg 4 ImageDocument overlord.demo.SimpleReleaseProcess-image.png 5 ImageDocument run-build-install.png 6 Document overlord.demo.SimpleReleaseProcess-taskform.flt 7 ImageDocument audio-input-microphone-3.png 8 BpmnDocument overlord.demo.SimpleReleaseProcess.bpmn 9 TextDocument HttpClientWorkDefinitions.wid
To obtain the metaData of overlord.demo.SimpleReleaseProcess.bpmn
, which is number 8 in the list, issue
s-ramp> s-ramp:getMetaData feed:8 Meta Data for: 31b3acbc-cda8-4856-9e34-d3e645283035 -------------- -- Core S-RAMP Info -- Type: BpmnDocument Model: ext UUID: 31b3acbc-cda8-4856-9e34-d3e645283035 Name: overlord.demo.SimpleReleaseProcess.bpmn Derived: false Created By: <anonymous> Created On: 2013-03-08T14:00:37.036-05:00 Modified By: <anonymous> Modified On: 2013-03-18T14:58:46.328-04:00 s-ramp>
To update a property on the artifact use s-ramp:property set
and hit the tab
key
s-ramp> s-ramp:property set description name version
this shows a list of properties that can be updated. To add a description to this artifact use
s-ramp> s-ramp:property set description "BPMN2 artifact representing the SimpleReleaseProcess" Successfully set property description. s-ramp> s-ramp:updateMetaData Successfully updated artifact overlord.demo.SimpleReleaseProcess.bpmn.
To verify issue
s-ramp> s-ramp:getMetaData feed:8 Meta Data for: 31b3acbc-cda8-4856-9e34-d3e645283035 -------------- -- Core S-RAMP Info -- Type: BpmnDocument Model: ext UUID: 31b3acbc-cda8-4856-9e34-d3e645283035 Name: overlord.demo.SimpleReleaseProcess.bpmn Derived: false Created By: <anonymous> Created On: 2013-03-08T14:00:37.036-05:00 Modified By: <anonymous> Modified On: 2013-03-18T16:09:56.879-04:00 -- Description -- BPMN2 artifact representing the SimpleReleaseProcess
and you can see the added description at the bottom of the printout.
To add a custom property
called kurt
with value stam
you can run
s-ramp> s-ramp:property set kurt stam Successfully set property kurt. s-ramp> s-ramp:updateMetaData Successfully updated artifact overlord.demo.SimpleReleaseProcess.bpmn.
and to verify that the custom property
was added issue
s-ramp> s-ramp:getMetaData feed:8 Meta Data for: 31b3acbc-cda8-4856-9e34-d3e645283035 -------------- -- Core S-RAMP Info -- Type: BpmnDocument Model: ext UUID: 31b3acbc-cda8-4856-9e34-d3e645283035 Name: overlord.demo.SimpleReleaseProcess.bpmn Derived: false Created By: <anonymous> Created On: 2013-03-08T14:00:37.036-05:00 Modified By: <anonymous> Modified On: 2013-03-18T16:21:16.119-04:00 -- Description -- BPMN2 artifact representing the SimpleReleaseProcess -- Custom Properties -- kurt: stam s-ramp>
When hitting the tab
key on s-ramp:property set
results in
s-ramp> s-ramp:property set description kurt name version
which now had the added custom property
kurt
.
To add a classification
of deployment-status
to your artifact use
s-ramp> s-ramp:classification add "http://www.jboss.org/overlord/deployment-status.owl#Dev" Successfully added classification 'http://www.jboss.org/overlord/deployment-status.owl#Dev'. s-ramp> s-ramp:updateMetaData Successfully updated artifact overlord.demo.SimpleReleaseProcess.bpmn.
and to verify that it was added
s-ramp> s-ramp:getMetaData feed:8 Meta Data for: 31b3acbc-cda8-4856-9e34-d3e645283035 -------------- -- Core S-RAMP Info -- Type: BpmnDocument Model: ext UUID: 31b3acbc-cda8-4856-9e34-d3e645283035 Name: overlord.demo.SimpleReleaseProcess.bpmn Derived: false Created By: <anonymous> Created On: 2013-03-08T14:00:37.036-05:00 Modified By: <anonymous> Modified On: 2013-03-18T16:30:42.641-04:00 -- Description -- BPMN2 artifact representing the SimpleReleaseProcess -- Classifications -- Classified By: http://www.jboss.org/overlord/deployment-status.owl#Dev -- Custom Properties -- kurt: stam s-ramp>
S-RAMP supports an XPath2 Syntax for querying. For example to obtain all WSDL models in the repository use
s-ramp> s-ramp:query /s-ramp/wsdl/WsdlDocument Querying the S-RAMP repository: /s-ramp/wsdl/WsdlDocument Atom Feed (1 entries) Idx Type Name --- ---- ---- 1 WsdlDocument OrderService.wsdl s-ramp>
When this WSDL file was uploaded derived
information was extracted from it and stored a WSDL model. TO see the various data structures it derived simply hit the tab on s-ramp:query /s-ramp/wsdl
s-ramp> s-ramp:query /s-ramp/wsdl/ Binding BindingOperation BindingOperationFault BindingOperationInput BindingOperationOutput Fault Message Operation OperationInput OperationOutput Part Port PortType WsdlDocument WsdlExtension WsdlService s-ramp>
Note that derived data is read only
, and cannot be updated by the user.
To obtain all Operations in this WSDL use
s-ramp:query /s-ramp/wsdl/Operation Querying the S-RAMP repository: /s-ramp/wsdl/Operation Atom Feed (1 entries) Idx Type Name --- ---- ---- 1 Operation submitOrder s-ramp>
You can narrow this query down even more by adding that the name needs to start with submit
s-ramp:query "/s-ramp/wsdl/Operation[xp2:matches(@name, 'submit.*')]" Querying the S-RAMP repository: /s-ramp/wsdl/Operation[xp2:matches(@name, 'submit.*')] Atom Feed (1 entries) Idx Type Name --- ---- ---- 1 Operation submitOrder s-ramp>
don’t forget to use the surrounding quotes, and a .
after submit
as required by XPath2.
To obtain all the artifacts that were derived from an artifact you can use
/s-ramp[relatedDocument[@uuid = '<uuid>'
In this case we use the uuid of a wsdl and get all the artifacts derived from the wsdl
s-ramp:query "/s-ramp[relatedDocument[@uuid = '15a94308-a088-4a03-ad83-e60239af74e4']]" Querying the S-RAMP repository: /s-ramp[relatedDocument[@uuid = '15a94308-a088-4a03-ad83-e60239af74e4']] Atom Feed (16 entries) Idx Type Name --- ---- ---- 1 OperationInput submitOrder 2 WsdlService OrderService 3 SoapAddress soap:address 4 BindingOperationInput wsdl:input 5 SoapBinding soap:binding 6 Part parameters 7 Binding OrderServiceBinding 8 BindingOperationOutput wsdl:output 9 Message submitOrderResponse 10 OperationOutput submitOrderResponse 11 BindingOperation submitOrder 12 Message submitOrder 13 Operation submitOrder 14 Port OrderServicePort 15 Part parameters 16 PortType OrderService
To get a list of all artifacts that were extracted from another archive use
s-ramp:query "/s-ramp[expandedFromDocument[@uuid = '<uuid>']"
let’s say we uploaded a jar file containing switchyard artifacts, with uddi 67c6f2d3-0f10-4f0d-ada6-d85f92f02a33:
s-ramp:query "/s-ramp[expandedFromDocument[@uuid = '67c6f2d3-0f10-4f0d-ada6-d85f92f02a33']]" Querying the S-RAMP repository: /s-ramp[expandedFromDocument[@uuid = '67c6f2d3-0f10-4f0d-ada6-d85f92f02a33']] Atom Feed (3 entries) Idx Type Name --- ---- ---- 1 XmlDocument switchyard.xml 2 XmlDocument beans.xml 3 XmlDocument faces-config.xml
For more information about querying the repository see the S-RAMP Query Language section of this guide.
The S-RAMP CLI has a number of built-in commands that are ready to be used. However, it is also possible to extend the CLI with new custom commands. This section describes how to do it.
New CLI commands are contributed by creating a class that implements the ShellCommandProvider interface. The provider will indicate a namespace for its commands along with a Map of commands (command name → command). The provider and command implementations should be packaged up into a JAR along with a file named:
META-INF/services/org.overlord.sramp.shell.api.ShellCommandProvider
The JAR must be made available to the S-RAMP CLI, either by putting it on the classpath, or else by putting it in the following directory:
~/.s-ramp/commands
For a working example of a custom S-RAMP CLI command, there is a demo in the S-RAMP distribution called s-ramp-demos-shell-command.