WebLogic Server 7.0 Code Examples, BEA Systems, Inc.

examples.io
Class SpeedTrap

java.lang.Object
  |
  +--examples.io.SpeedTrap

public class SpeedTrap
extends java.lang.Object

This example writes a 10 MB file to the server, reads it back in again, and then reports the data transfer rates.

The following sections cover what to do:

  1. Build the Example
  2. Configure the Server
  3. Run the Example

Build the Example

  1. Set up your development shell, as described in Setting up your environment for building and running the examples.

  2. Compile the example by executing the following command or by executing the build script provided for this example in the samples\examples\io directory. The script will perform the following step:

    1. Compile the SpeedTrap class as shown in this example for Windows NT/2000:

        prompt> javac -d %CLIENT_CLASSES% SpeedTrap.java

Configure the Server

  1. Start the server with the examples configuration in a new command shell.
  2. Bring up the Administration Console in your browser.
  3. Click to expand the Services node in the left-hand pane.
  4. Select the FileT3 node in the left-hand pane.
  5. Click on Register a new File T3 link in the right-hand pane to display Configuration, Targets and Notes tab.
  6. Select the Configuration tab in the right-hand pane to display the Name and Path field.
  7. Register a fileSystem that the WebLogic Server maps to a real path that is valid on the server host. For example, to map the fileSystem "mySys" to "c:\temp" :
     Name: mySys
     Path: c:\\temp
  8. Click the Create button to save the assignment.
  9. Select the Targets tab in the right-hand pane to display the Available and Chosen targets.
  10. Move the examplesServer from the Target column to the Chosen column.
  11. Click the Apply button to save the assignment.

Run the Example

  1. In your development shell, run the SpeedTrap example using the registered file system "mySys":
      prompt> java examples.io.SpeedTrap t3://hostname:port mySys myfile
    where:
    hostname
    Host name of the WebLogic Server.
    port
    Port where the WebLogic Server is listening for connections.
    myfile
    Name of a target file to write to and read from.

    Example:

    prompt> java examples.io.SpeedTrap t3://localhost:7001 mySys myfile
    Getting the file //mySys/myfile
    Writing to the file ...
    Write speed = 20.22 Mbits/sec
    Reading from the file ...
    Read speed = 51.18 Mbits/sec

  2. In your development shell, run the SpeedTrap example using the local file system:
      prompt> java examples.io.SpeedTrap t3://hostname:port myfile

    When a registered file system name is not specified, the local file system is used. File names are always absolute on a remote file system, but may be relative on a local file system.

Author:
Copyright (c) 1999-2002 by BEA Systems, Inc. All Rights Reserved.

Constructor Summary
SpeedTrap()
           
 
Method Summary
static void main(java.lang.String[] argv)
          Runs the SpeedTrap file example.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpeedTrap

public SpeedTrap()
Method Detail

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Runs the SpeedTrap file example.

Documentation is available at
http://e-docs.bea.com/wls/docs70

Copyright © 2002 BEA Systems, Inc. All Rights Reserved.