|
|||||||||
| Home >> All >> org >> vrspace >> [ client overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.vrspace.client
Class VrmlUploader

java.lang.Objectorg.vrspace.client.VrmlUploader
- All Implemented Interfaces:
- java.util.Observer
- public class VrmlUploader
- extends java.lang.Object
- implements java.util.Observer
- extends java.lang.Object
Recursively uploads files to the server.
The uploader recursively searches the files that have .wrl extensions, looking for url lists in url tags, and in EXTERNPROTOs. Each list found is searched for for files existing on the local file system. If a discovered file has a .wrl extension, then it will be searched as well. This recursion continues up to the level maxRecursion ( defaults to zero ).
After a VrmlUploader is instantiated, various options can be set for the transfer (see below). The upload method is used to initiate the transfer. Files sent to this method with a .wrl extension will be uploaded as VrmlFiles, unless uploadAllAsFile is false. In that case, all .wrl files are uploaded as Files. If includeNonWrl is false, then all non-vrml files encountered while searching (see below) are not uploaded.
Example 1: upload( "sample.wrl" ) with maxRecursion level 0, and includeNonWrl set to false. In this case, only sample.wrl is uploaded.
Example 2: now includeNonWrl is set to true. This causes sample.wrl to be searched for all url list. Every non .wrl file found will be uploaded.
Example 3: includeNonWrl false, maxRecusion 1. Sample.wrl and every .wrl file discovered within it is uploaded.
Various options are available for the upload:
inputStream - an InputStream for providing upload parameters, used in conjunction with useInputStream. Defaults to System.in.
outputStream - a PrintStream, defaulting to System.out, that writes the responses to the upload commands sent to the server.
silent - turns outputStream off.
uploadAllAsFile - files normally uploaded as VrmlFile are uploaded as File.
logger - turns the logger on and off
Warning: All files uploaded with .wrl extensions are expected to be uncompresssed.
| Nested Class Summary | |
class |
VrmlUploader.URLParser
Recursively parses given files, searching for url lists, in particular, other files on the local files system. |
| Field Summary | |
protected java.util.HashMap |
cachedFiles
|
protected org.vrspace.util.Connection |
connection
|
protected boolean |
excludeExternProto
|
protected java.util.HashMap |
files
|
protected java.lang.String |
host
|
protected boolean |
includeNonWrl
|
protected java.io.InputStream |
inputStream
|
protected java.lang.String |
login
|
protected int |
maxRecursion
|
protected int |
numberLeftToUpload
|
protected java.io.PrintStream |
outputStream
|
protected java.lang.String |
password
|
protected int |
port
|
protected boolean |
silent
|
protected boolean |
stopLoggerOnCompletion
|
protected boolean |
uploadAllAsFile
|
protected java.util.Collection |
uploadAsVrmlFile
|
protected boolean |
useInputStream
|
| Constructor Summary | |
VrmlUploader()
|
|
VrmlUploader(org.vrspace.util.Connection connection,
java.lang.String login,
java.lang.String password)
|
|
VrmlUploader(java.lang.String host,
int port,
java.lang.String login,
java.lang.String password)
|
|
| Method Summary | |
protected void |
consoleLogin()
Retrieves all upload information from input via a Console (except for the file name). |
protected void |
copyURL(java.lang.String path,
java.lang.String destPath,
java.io.OutputStream out)
Copy file/url path to destpath |
java.io.OutputStream |
getOutputStream()
|
static boolean |
hasVrmlExtension(java.lang.String path)
true if the file has the extension .wrl (not e.g. |
static void |
main(java.lang.String[] args)
Command Line Usage: java VrmlUploader [options] file |
void |
println(java.lang.String string)
Printlns the string to outputStream if silent is false. |
protected boolean |
requestUpload(java.lang.String checkedPath)
Request for the given file to be uploaded. |
protected void |
requestUploads()
Request that the cachedFiles and files be uploaded to the server. |
void |
setExcludeExternProto(boolean excludeExternProto)
|
void |
setIncludeNonWrl(boolean includeNonWrl)
|
void |
setInputStream(java.io.InputStream inputStream)
|
void |
setLogging(boolean logging)
|
void |
setMaxRecursion(int maxRecursion)
|
void |
setOutputStream(java.io.OutputStream outputStream)
|
void |
setSilent(boolean silent)
|
void |
setStopLoggerOnCompletion(boolean stopLoggerOnCompletion)
|
void |
setUploadAllAsFile(boolean uploadAllAsFile)
|
void |
setUseInputStream(boolean useInputStream)
|
void |
shutdown()
Shutdown the connection, and turn the Logger thread off if shutdownOnCompletion is true. |
void |
update(java.util.Observable conn,
java.lang.Object cmd)
Implements the observer interface. |
void |
upload(java.util.List paths)
Uploads the list of files specified. |
void |
upload(java.lang.String path)
Uploads the file specified. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
connection
protected org.vrspace.util.Connection connection
stopLoggerOnCompletion
protected boolean stopLoggerOnCompletion
outputStream
protected java.io.PrintStream outputStream
inputStream
protected java.io.InputStream inputStream
host
protected java.lang.String host
port
protected int port
login
protected java.lang.String login
password
protected java.lang.String password
maxRecursion
protected int maxRecursion
includeNonWrl
protected boolean includeNonWrl
excludeExternProto
protected boolean excludeExternProto
silent
protected boolean silent
numberLeftToUpload
protected int numberLeftToUpload
uploadAllAsFile
protected boolean uploadAllAsFile
useInputStream
protected boolean useInputStream
uploadAsVrmlFile
protected java.util.Collection uploadAsVrmlFile
cachedFiles
protected java.util.HashMap cachedFiles
files
protected java.util.HashMap files
| Constructor Detail |
VrmlUploader
public VrmlUploader()
VrmlUploader
public VrmlUploader(java.lang.String host, int port, java.lang.String login, java.lang.String password)
VrmlUploader
public VrmlUploader(org.vrspace.util.Connection connection, java.lang.String login, java.lang.String password)
| Method Detail |
setMaxRecursion
public void setMaxRecursion(int maxRecursion)
setIncludeNonWrl
public void setIncludeNonWrl(boolean includeNonWrl)
setExcludeExternProto
public void setExcludeExternProto(boolean excludeExternProto)
setSilent
public void setSilent(boolean silent)
setStopLoggerOnCompletion
public void setStopLoggerOnCompletion(boolean stopLoggerOnCompletion)
setUploadAllAsFile
public void setUploadAllAsFile(boolean uploadAllAsFile)
setLogging
public void setLogging(boolean logging)
setUseInputStream
public void setUseInputStream(boolean useInputStream)
setInputStream
public void setInputStream(java.io.InputStream inputStream)
getOutputStream
public java.io.OutputStream getOutputStream()
setOutputStream
public void setOutputStream(java.io.OutputStream outputStream)
upload
public void upload(java.lang.String path) throws org.vrspace.util.ConnectionException
- Uploads the file specified. The file is parsed
for the urls it contains, and then each of these files are recursively
searched. Once parsing is completed, the server is sent requests for file
upload. The update method handles the actual uploading.
Note that File.getAbsolutePath() is called on the file to determine the path
to upload.
upload
public void upload(java.util.List paths) throws org.vrspace.util.ConnectionException
- Uploads the list of files specified. Each individual file is parsed
for the urls they contain, and then each of these files are recursively
searched. Once parsing is completed, the server is sent requests for file
upload. The update method handles the actual uploading.
Note that File.getAbsolutePath() is called on each file to determine the path
to upload.
hasVrmlExtension
public static boolean hasVrmlExtension(java.lang.String path)
- true if the file has the extension .wrl (not e.g. .wrl.gz)
consoleLogin
protected void consoleLogin()
throws org.vrspace.util.ConnectionException
- Retrieves all upload information from input via a Console
(except for the file name). A console is created, but its thread is
not started. The console retrieves host, port, username, password
if they haven't already been set in the System properties.
requestUploads
protected void requestUploads()
- Request that the cachedFiles and files be uploaded to the server.
Exits if these lists are both empty.
requestUpload
protected boolean requestUpload(java.lang.String checkedPath) throws java.io.IOException
- Request for the given file to be uploaded. If the file has a wrl
extension, request as a VrmlFile, otherwise request File.
VrmlFile upload is overidden by uploadAllAsFile.
update
public void update(java.util.Observable conn, java.lang.Object cmd)
- Implements the observer interface. The VrmlUploader has been
added as an observer of its Connection. The purpose of this
observing is to ignore all messages sent except upload commands
and responses. Those messages implement the actual uploading.
The responses are printed to outputStream.
- Specified by:
updatein interfacejava.util.Observer
copyURL
protected void copyURL(java.lang.String path, java.lang.String destPath, java.io.OutputStream out)
- Copy file/url path to destpath
shutdown
public void shutdown()
- Shutdown the connection, and turn the Logger thread off if
shutdownOnCompletion is true.
println
public void println(java.lang.String string)
- Printlns the string to outputStream if silent is false.
main
public static void main(java.lang.String[] args)
- Command Line Usage: java VrmlUploader [options] file
options: -h=host -p=port -l=username -pw=password -r=max recursion level Default: 0 -Files Upload all as File -includeNonWrl Upload non .wrl files (including .wrl.gz) -excludeExternProto Do not upload EXTERNPROTO urls -silent Silence output -logger Debug
|
|||||||||
| Home >> All >> org >> vrspace >> [ client overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.vrspace.client.VrmlUploader