-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
None
Remote client console no longer works with M5.
Goal
Allows a remote java client application to run Groovy scripts against a Magnolia server.
How To
In order to run the remote client, you can either use the internal Main class provided with the groovy module
*java -jar magnolia-module-groovy-1.2.jar *info.magnolia.module.groovy.remote.RemoteClientConsoleMain -user superuser -pass superuser ....
Command line arguments usage
usage: RemoteClientConsoleMain [-cmd <arg>] [-file <arg>] [-help] [-pass <arg>] [-uri <arg>] [-user <arg>] -cmd,--cmd <arg> Groovy command line to be executed. Can have one to n cmd arguments like "name='World1'; println \"Hello $name!\"; println \"Hello $name1!\" ;" -file,--file <arg> Groovy File to execute. Can have one to n file arguments -help,--help Print this usage information -pass,--password <arg> Enter password -uri,--uri <arg> Enter Magnolia Uri like http://localhost:8080/contextpath -user,--user <arg> Enter user
or write your own Main class:
Create a java project.
Refer the magnolia-module-groovy (either the jar or the Java Project).
Create a Main Class referring the MgnlGroovyRemoteClientConsole.class
... import info.magnolia.module.groovy.util.MgnlGroovyRemoteClientConsole; import java.io.File; /** * ... public class MainGroovyClient { /** * @param args */ public static void main(String[] args) throws Exception { //Get incomming parameter from the args[] String userName = args[0]; ... //Connect to Magnolia app MgnlGroovyRemoteClientConsole groovyClient = new MgnlGroovyRemoteClientConsole(magnoliaUri, userName, password); if(groovyClient.isConnected()){ for(int i=3;i<args.length;i++) { ..... String groovyScriptInArg = args[i]; Object toExecute = null; //Check if the groovyScriptInArg is a File or a command line ... System.out.println(" "+groovyClient.execute(toExecute)); ... groovyClient.disconnect();
Notes
Once MgnlGroovyRemoteClientConsole instance is connected, you can send 1 to n files. The connection will remain the same for the whole file list.
Variable/context defined in a script will not be accessible to the other scripts.
- Wiki Page
-
Wiki Page Loading...