Java Directory Tree Walker Sample

(with NetImpact Dynamo)


 

This sample, given a directory, will print out a list of the files with their attributes. It will also do the same for the subdirectories.


 

Installation Instructions

To run this sample on your machine, you will need to install the following components:

 

To configure NetImpact Dynamo via SQL Central

  1. Run SQL Central and connect to NetImpact Dynamo by clicking on Tools\Connect\NetImpact Dynamo
  2. Type in "Dynamo Demo" for 'Connection name', choose "NetImpact Dynamo Demo" for 'ODBC data source' and type in "dba" for 'User ID:' and "sql" for 'Password'. Then click on Ok.
  3. If you want this Dynamo Demo to start up every time you load SQL Central, click on 'Tools\Connection Profiles'. Then choose "Dynamo Demo" and click on 'Set Startup". Now, the field for 'Use on Startup' should be set to 'Yes'. Please note that this won't take effect until you restart SQL Central
  4. Now double click on the "Dynamo Demo" icon and go to \Site\system.
  5. Double click on the file 'autoexec.ssc' and insert this statement after the last line of typing, but before the line with '-->':
    -- BEGIN CUT HERE --
    site.AddExtension( 'JAVA_DYNAMO', '%Starbuck%/system/javadynamo.dll' );
    -- END CUT --
    where %Starbuck% is the directory where you installed Starbuck. Please note the use of forward slashes in the path.
    For example: site.AddExtension( 'JAVA_DYNAMO', 'd:/starbuck20/system/javadynamo.dll' );
  6. Now save the file by clicking on 'File\Save to Database'. Now close the file
  7. Execute this script by right-clicking on the 'autoexec.ssc' icon. If there were no errors, the output screen will be blank.
  8. Create a new template by double-clicking on the "Add Template". You don't want a SQL statement and can accept all the defaults. Double click on the icon of your new template and add this tag:
    --- BEGIN CUT HERE --
    <!--JAVA_DYNAMO
    DDir_Walker
    classpath=$d:/dev/DDir_Walker/Debug
    directory_name
    -->
    -- END CUT --
    The first line in the script is the name of the Java class with main(), in this case DDir_Walker.
    The second line is the classpath for the Microsoft Java VM. Type '$' followed immediately by the path to the class files for the 'DDir_Walker' project. The Java class files are in the \Debug directory of the project. Again, please note the use of forward slashes in the paths.
    * The third line is the name of the directory whose files you want to print out. For example: "d:\testing" *
  9. Click on 'File\Save to Database' to save this template into the database

To run this sample from SQL Central

  1. Right click on the new template you created in Step 9 in the above instructions and choose 'View Output'

To run this sample from a browser with Dynamo Personal Web Server

  1. Fire up the Dynamo Personal Web Server
  2. From your browser, type in the following URL:
    "http://localhost/template_name"
    where template_name is the path to the new template you created in Step 5.
    For example, if my template name was called 'test.stm' and it was saved in the \Site\app (in SQL Central), then I would type: "http://localhost/Site/app/test.stm"