3.4.4. Script lifecycle management

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

If GroovyScript2RestLoader is configured as described in the previous section, all "autoload" scripts will be deployed. In the first section, the script from /home/andrew/JcrGroovyTest.groovy is copied to the JCR node: /script/groovy/JcrGroovyTest.groovy - repository "repository" and workspace "production". Similarly to Loading a script via HTTP, you can use curl commands to manage the script lifecycle.

  1. Undeploy the script, which is already deployed:

    andrew@ossl:~> curl -u root:exo \
    -X GET \
    http://localhost:8080/rest/script/groovy/load/repository/production/script/groovy/JcrGroovyTest.groovy?state=false
  2. Deploy it again:

    andrew@ossl:~> curl -u root:exo \
    -X GET \
    http://localhost:8080/rest/script/groovy/load/repository/production/script/groovy/JcrGroovyTest.groovy?state=true

    Or more simple:

    andrew@ossl:~> curl -u root:exo \
    -X GET \
    http://localhost:8080/rest/script/groovy/load/repository/production/script/groovy/JcrGroovyTest.groovy
  3. Disable the scripts autoloading:

    Note

    This does not change the current state.

    andrew@ossl:~> curl -u root:exo \
    -X GET \
    http://localhost:8080/rest/script/groovy/repository/production/script/groovy/JcrGroovyTest.groovy/autoload?state=false
  4. Enable it again:

    andrew@ossl:~> curl -u root:exo \
    -X GET \
    http://localhost:8080/rest/script/groovy/autoload/repository/production/script/groovy/JcrGroovyTest.groovy?state=true

    Or more simpe:

    andrew@ossl:~> curl -u root:exo \
    -X GET \
    http://localhost:8080/rest/script/groovy/autoload/repository/production/script/groovy/JcrGroovyTest.groovy
  5. Change the script source code:

    andrew@ossl:~> curl -u root:exo \
    -X POST \
    -H 'Content-type:script/groovy' \
    --data-binary @JcrGroovyTest.groovy \
    http://localhost:8080/rest/script/groovy/update/repository/production/script/groovy/JcrGroovyTest.groovy

    This example imitates sending data with HTML form ('multipart/form-data'):

    andrew@ossl:~> curl -u root:exo \
    -X POST \
    -F "file=@JcrGroovyTest.groovy;name=test" \
    http://localhost:8080/rest/script/groovy/update/repository/production/script/groovy/JcrGroovyTest.groovy
  6. Remove script from JCR:

    andrew@ossl:~> curl -u root:exo \
    -X GET \
    http://localhost:8080/rest/script/groovy/delete/repository/production/script/groovy/JcrGroovyTest.groovy
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus