Revision 6 as of 2006-08-29 10:37:00

Clear message

Ponder2 Shell

Ponder2 has a built-in shell to allow a user to interact with the SMC using simple commands.

The shell acts in some way similarly to the Unix Bourn Shell, you can move around the domain hierarchy using the change domain (cd) command, you can list things with the ls command etc. etc.

The syntax for shell commands is:

<shellcommand> [<arg>]+  where <command> is an internal or managed object command or XML

Internal Commands

Internal commands are built into the shell and can be used to manipulate the domain structure and to look at managed objects within the system.

Managed Object Commands

If the command is not recognised by the shell to be an internal command, the shell looks within the system and tries to find a managed object of the same name. It will match either an object in the current domain or maybe one from the root domain is the name starts with a '/'. If such a manged object is located, the command line is turned into an XML structure and sent to that managed object as a command. See the [:Ponder2Example#shell:worked example] for an example use of this type of command.

Managed Object Commands are turned into XML structures in the following manner:

<!ManagedObjectName> [useattribute=value]* [MOcommand1 [cmnd1att=value2]*]*
Where [...]* means optional argument which may be repeated

Example Managed Object Shell Commands

Command

Description

alarmclock show=true

<use name='/alarmclock' show='true'/>

alarmclock show

<use name!='/alarmclock><show/></use>

alarmclock show=true ring duration=5 hide

<use name='/alarmclock' show='true'><ring duration='5'/><hide/></use>

XML

The Managed Object Commands described above are only capable of creating simple commands for managed objects. If more complex commands are required then full XML has to be written. [:Ponder2XML:Ponder2] XML can be given to the shell using the special <xml> command. XML is terminated by a '.' on a line by itself after the final </xml> e.g. Note: depending how you cut and paste your XML you may get one or more [XML or . to terminate] lines.

$ <xml>
   <use name='/alarmclock'>
     <alarm state='on'>
       <texttoshow>
         This is an alarm
       </texttoshow>
     </alarm>
[XML or . to terminate]$    </use>
[XML or . to terminate]$ </xml>
[XML or . to terminate]$ .
Parsed XML input
$