Content Server Manual / Version 2101
Table Of ContentsDeprecation Notice
As of CoreMedia Content Cloud 2004.1 groovysh
is deprecated. Use cm jshell
instead.
For details see Section 3.13.2.8, “JShell”.
With the groovysh
utility program, you can interactively access the Content Server, using
Unified API commands. The Groovy Shell is a third-party tool maintained by the
Groovy community. See http://groovy-lang.org/groovysh.html for
details
Before you can start the Groovy Shell, copy the file apps/content-server/modules/cmd-tools/cms-tools-application/target/cms-tools/bin/groovysh.profile
into your home directory as .groovy/groovysh.profile
. This file defines the login parameter (username, password, IOR URL for the
Content Server and creates connections to the Unified API
repositories. Adjust the iorUrl
property to the
corresponding URL of the Content Server. The profile defines some variables, which you can use
to work with the repositories.
Variable name | Calls | Description of return type |
---|---|---|
connection |
Cap.connect(params)
|
CapConnection, the connection to the Content Server |
cr |
connection.getContentRepository();
|
ContentRepository, the content repository. |
root |
cr.getRoot()
|
Content, the root folder of the content repository. |
ac |
cr.getAccessControl()
|
AccessControl, all access control aspects of content. |
pu |
cr.getPublicationService()
|
PublicationService, all publication aspects of content. |
qs |
cr.getQueryService()
|
QueryService, query aspects of content. Allows making structured queries against the content repository. |
ur |
connection.getUserRepository()
|
UserRepository, gives access to users and groups. |
wr |
connection.getWorkflowRepository()
|
WorkflowRepository, gives access to workflows. |
Table 3.31. Variables for Groovy Shell
You can either start the Groovy Shell as a command line client (default) or the Groovy Console which offers a GUI.
In order to start the Groovy Console, open
the groovysh.jpif
file and assign the groovy.ui.Console
class to the JAVA_MAIN_CLASS
property. The Groovy Console does not load the content from the profile file. So, copy the content of the profile file into
the console and execute the script to set the required variables.
The program is executed with:
modules/cmd-tools/cms-tools-application/target/cms-tools/bin/cm groovysh
The shell is now active or the console opens and you can enter your UAPI commands. Find the UAPI Javadoc at https://documentation.coremedia.com/cmcc-10 following the CMS Javadoc link.
Get, for example, the user named "Rick":
ur.getUserByName('Rick')