WebLogic Server 6.0 Code Examples, BEA Systems, Inc.

examples.io
Class FileBrowser

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

public class FileBrowser
extends java.lang.Object

This example illustrates the use of the WebLogic File API. FileBrowser is an interactive application that allows you to browse through network-visible files on WebLogic Servers.

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 FileBrowser class as shown in this example for Windows NT/2000:

        $ javac -d %CLIENT_CLASSES% FileBrowser.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 Create 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
     Field: 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 FileBrowser example from the command line of the same machine as your WebLogic Server, listening on port 7001, with a registered fileSystem called "mySys":
      $ java examples.io.FileBrowser t3://hostname:port mySys
    where:
    hostname
    Host name of the WebLogic Server.
    port
    Port where the WebLogic Server is listening for connections.

    With this FileBrowser example, you get a prompt that matches the name of your registered file system. You can toggle back and forth between your local file system and the WebLogic Server registered file system with the FileBrowser command "cf #" and "cf [fileSystem]". Type a question mark (?) to see a list of commands available in the FileBrowser.

    You may also specify the file system as the second argument to FileBrowser. If you do so, you may also specify the starting current directory as the third argument. After FileBrowser displays the prompt (the current file system and the current directory) you may type any of the following commands:

CommandUse
cs URL [fileSystem [path]] Change server, file system, current directory
cf [fileSystem [path]] Change file system, current directory
cd path Change current directory
s Print URL of current server
lf List file systems on current server
ls List entries in current directory
q quit

You may switch to the file system on the client by specifying the name #.

Author:
Copyright (c) 1997-98 by WebLogic, Inc. All Rights Reserved., Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.

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

Constructor Detail

FileBrowser

public FileBrowser()
Method Detail

main

public static void main(java.lang.String[] argv)
Runs the FileBrowser example. Supply the URL of your WebLogic Server and a fileSystemName and (optionally) a path as the arguments.

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

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