Uploaded image for project: 'Magnolia Groovy Module'
  1. Magnolia Groovy Module
  2. MGNLGROOVY-137

RemoteClientConsole doesn't work on M5

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major 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.

        Acceptance criteria

              Unassigned Unassigned
              fgrilli Federico Grilli
              Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:

                  Bug DoR
                  Task DoD