Script Command

Description
provides commands that run a Felix shell script with the ShellService.
provides also extra utility commands for scripting.

Contributors

License
ASL2.0

Services

Properties

Requirements

  • org.apache.felix.shell
  • org.osgi.util.tracker

  • List of added commands

    # [<any comment>]      - useful to comment scripts
    // [<any comment>]     - useful to comment scripts
    rem [<any comment>]    - useful to comment scripts
    echo <msg>             - echos a message
    gc                     - invokes garbage collection
    properties             - lists the bundle and system properties
    run [-help]            - runs a script downloaded from a url
    wait <seconds>         - wait for seconds
    waitfor [help|bundle|package|class|service|socket|url]
                           - waits for events in the framework
    failif [help|filter]   - fails if filter matches system properties, bundles properties or headers
    failifnot [help|filter]- fails if filter does not match system properties, bundles properties or headers
    
    Help for run
    run[options] <url>
    -help   - Show this help message.
    -e      - echo commands.
    -p      - prompt each command.
    -s      - stop on error.
    -nonvar - disable variables substitution.
    
    Help for failif and failifnot
    failif help [bundle|filter]
    failif filter <ldapfilter on properties>
    failifnot help [bundle|filter]
    failifnot filter <ldapfilter on properties>
    
    Help for waitfor
    waitfor help [bundle|package|class|service|socket|url]
    waitfor bundle [-timeout <second>] <url> <state>
    waitfor package [-timeout <second>] <packagename>[;<version>]
    waitfor class [-timeout <second>] <classname>
    waitfor service [-timeout <second>] <ldap-filter>
    waitfor socket [-timeout <second>] <host>:<port> <polling-time>
    waitfor url [-timeout <second>] <url> <polling-time>
    

    Download

    Build

    1. build with "mvn clean install"

    Settings
    None

    Run the demo
    To run the demo of this bundle, enter the following commands in the Felix shell

    -> start http://www.apache.org/~donsez/dev/osgi/shell.scriptcmd/shell.scriptcmd.jar
    -> gc
    -> run -help
    -> run -s -e -p http://www.apache.org/~donsez/dev/osgi/script/testscriptcmd.txt
    -> run file:c:\dev\osgi\script\testscriptcmd.txt
    
    -> waitfor service -timeout 10 (objectClass=org.apache.felix.*)
    a service matching (objectClass=org.apache.felix.*) is available
    -> waitfor service -timeout 10 (objectClass=foo.*)
    no service matching (objectClass=foo.*) are available after a 10 seconds wait
    -> waitfor class -timeout 10 hello.HelloService
    class hello.HelloService is available
    -> waitfor class -timeout 10 foo.Bar
    class foo.Bar is not available after a 10 seconds wait
    -> waitfor bundle -timeout 10 4 STOP
    -> waitfor package -timeout 10 toto
    -> waitfor socket -timeout 60 localhost 8080 5
    -> waitfor url -timeout 60 http://www.apache.org/~donsez/ 1
    

    Typical Usages

  • demo
  • Versions history

    TODO (contributions are welcome)