[x3d-public] X3DJSAIL running generated Java program to produce Java

John Carlson yottzumm at gmail.com
Tue Jul 24 05:06:05 PDT 2018


Whew, finally communication.

Thanks,

John

On Tue, Jul 24, 2018 at 2:27 AM Don Brutzman <brutzman at nps.edu> wrote:

> On 7/20/2018 7:32 AM, yottzumm at gmail.com wrote:
> > What’s important to realize is that I may only have a .class file, and I
> want to recover xml or JSON encoding. With your way of handling parameters,
> I have no way of doing that, afaict, without a decompiler.  Please correct
> me with an example invocation.
>
> OK starting to understand better.  You have a class and want to do
> something with it.
>
> For a given Java model produced from .x3d or from X3DJSAIL X3DObject by
> X3dToJava.xslt, the main(args) method controls what happens on execution.
>
> Here is an example main method produced in HelloWorldOutput.  Looks like
> it validates itself but will do little else.
>
> Your goals are much clearer now.  Sounds like excellent functionality to
> add, will let us recover models from .class files some day.
>
> Will work on it.  When ready will also add some smoke tests to the pile.
> Thanks John.
>
> ============================================================
>
>      /** Default main() method provided for test purposes, uses
> CommandLine to set global ConfigurationProperties for this object.
>       * @param args array of input parameters, provided as arguments
>          * @see <a href="
> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3DObject.html#handleArguments-java.lang.String:A-
> ">X3DObject.handleArguments(args)</a>
>          * @see <a href="
> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3DObject.html#validationReport--
> ">X3DObject.validationReport()</a>
>       * @see <a href="
> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/CommandLine.html
> ">CommandLine</a>
>       * @see <a href="
> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/CommandLine.html#USAGE
> ">CommandLine.USAGE</a>
>       * @see <a href="
> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/ConfigurationProperties.html
> ">ConfigurationProperties</a>
>       */
>      public static void main(String args[])
>      {
>          X3DObject thisExampleX3dObject = new
> HelloWorldProgramOutput().getX3dModel();
>
>                 boolean hasArguments = (args != null) && (args.length > 0);
>                 boolean validate = true; // default
>                 boolean argumentsLoadNewModel = false;
>                 String  fileName = new String();
>
>                 if (args != null)
>                 {
>                         for (String arg : args)
>                         {
>                                 if (arg.toLowerCase().startsWith("-v") ||
> arg.toLowerCase().contains("validate"))
>                                 {
>                                         validate = true; // making sure
>                                 }
>                                 if
> (arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_X3D) ||
>
> arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_CLASSICVRML) ||
>
> arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_X3DB) ||
>
> arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_VRML97) ||
>
> arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_EXI) ||
>
> arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_GZIP) ||
>
> arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_ZIP) ||
>
> arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_HTML) ||
>
> arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_XHTML))
>                                 {
>                                         argumentsLoadNewModel = true;
>                                         fileName = arg;
>                                 }
>                         }
>                 }
>                 if      (argumentsLoadNewModel)
>                         System.out.println("WARNING:
> \"HelloWorldProgramOutput\" model invocation is attempting to load file \""
> + fileName + "\" instead of simply validating itself... file loading
> ignored.");
>                 else if (hasArguments) // if no arguments provided, this
> method produces usage warning
>                         thisExampleX3dObject.handleArguments(args);
>
>                 if (validate)
>                 {
>                         System.out.print("Java program
> \"HelloWorldProgramOutput\" self-validation test results: ");
>                         String validationResults =
> thisExampleX3dObject.validationReport();
>                         System.out.println(validationResults);
>                 }
>      }
> }
>
>
> all the best, Don
> --
> Don Brutzman  Naval Postgraduate School, Code USW/Br
> brutzman at nps.edu
> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
> X3D graphics, virtual worlds, navy robotics
> http://faculty.nps.edu/brutzman
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180724/65a2e9d2/attachment-0001.html>


More information about the x3d-public mailing list