wyvern.kernel.maps
Class MapFileServer

java.lang.Object
  extended bywyvern.kernel.maps.MapFileServer

public class MapFileServer
extends java.lang.Object

This class handles requests to upload and download files from map editor clients. It used to be just for map files, but now it can serve up any file type, since wizards need to send other kinds of files back and forth (e.g. source files).

Version:
1.0, Jul 11, 2000
Author:
Steve Yegge

Field Summary
static int MAXLENGTH
          Arbitrary limit on the file size to be uploaded or downloaded.
 
Constructor Summary
MapFileServer()
           
 
Method Summary
static byte[] downloadFile(java.lang.String user, java.lang.String password, java.lang.String path)
          Returns the contents of the specified file.
static boolean isBogusFile(java.io.File f)
          Returns true if this is a file we don't want to save.
static boolean isWizard(java.lang.String user, java.lang.String password)
          Returns true if this player is a valid wizard on this server.
static java.lang.String uploadFile(java.lang.String user, java.lang.String password, java.lang.String path, byte[] data)
          Handles a MapEditor request to upload a file to the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAXLENGTH

public static final int MAXLENGTH
Arbitrary limit on the file size to be uploaded or downloaded.

See Also:
Constant Field Values
Constructor Detail

MapFileServer

public MapFileServer()
Method Detail

downloadFile

public static byte[] downloadFile(java.lang.String user,
                                  java.lang.String password,
                                  java.lang.String path)
                           throws org.apache.xmlrpc.XmlRpcException
Returns the contents of the specified file.

Parameters:
user - the wizard name
password - password
path - path to the file
Returns:
the file contents
Throws:
org.apache.xmlrpc.XmlRpcException

uploadFile

public static java.lang.String uploadFile(java.lang.String user,
                                          java.lang.String password,
                                          java.lang.String path,
                                          byte[] data)
Handles a MapEditor request to upload a file to the server.

Parameters:
user - the wizard name
password - password
path - where to save the file, relative to the wizard's personal directory, e.g. "foo/bar.arch"
data - the file contents
Returns:
"OK" if successful, else an error message

isWizard

public static boolean isWizard(java.lang.String user,
                               java.lang.String password)
Returns true if this player is a valid wizard on this server. Probably need to restructure this to give better error reporting.


isBogusFile

public static boolean isBogusFile(java.io.File f)
Returns true if this is a file we don't want to save.

Returns:
true if it's some sort of temp file or other garbage