|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vrspace.client.VrmlUploader
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.
uploadAs - files normally uploaded as VrmlFile are uploaded as whatever class is specified.
logger - turns the logger on and off
Warning: All files uploaded with .wrl extensions are expected to be uncompresssed, and will be automatically compressed by the server.
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 boolean |
closeConnectionOnCompletion
|
protected 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 java.util.Collection |
nonVrmlPaths
|
protected int |
numberLeftToUpload
|
protected java.io.PrintStream |
outputStream
|
protected java.lang.String |
password
|
protected int |
port
|
protected boolean |
silent
|
protected boolean |
stopLoggerOnCompletion
|
protected java.lang.String |
uploadAs
|
protected boolean |
useInputStream
|
protected java.util.Collection |
vrmlPaths
|
Constructor Summary | |
VrmlUploader()
|
|
VrmlUploader(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 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 |
setUploadAs(java.lang.String uploadAs)
|
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.util.List paths,
java.util.List uploadPaths)
|
void |
upload(java.lang.String path)
Uploads the file specified. |
void |
upload(java.lang.String path,
java.lang.String uploadPath)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Connection connection
protected boolean stopLoggerOnCompletion
protected boolean closeConnectionOnCompletion
protected java.io.PrintStream outputStream
protected java.io.InputStream inputStream
protected java.lang.String host
protected int port
protected java.lang.String login
protected java.lang.String password
protected int maxRecursion
protected boolean includeNonWrl
protected boolean excludeExternProto
protected boolean silent
protected int numberLeftToUpload
protected java.lang.String uploadAs
protected boolean useInputStream
protected java.util.Collection vrmlPaths
protected java.util.Collection nonVrmlPaths
protected java.util.HashMap cachedFiles
protected java.util.HashMap files
Constructor Detail |
public VrmlUploader()
public VrmlUploader(java.lang.String host, int port, java.lang.String login, java.lang.String password)
public VrmlUploader(Connection connection, java.lang.String login, java.lang.String password)
Method Detail |
public void setMaxRecursion(int maxRecursion)
public void setIncludeNonWrl(boolean includeNonWrl)
public void setExcludeExternProto(boolean excludeExternProto)
public void setSilent(boolean silent)
public void setStopLoggerOnCompletion(boolean stopLoggerOnCompletion)
public void setUploadAs(java.lang.String uploadAs)
public void setLogging(boolean logging)
public void setUseInputStream(boolean useInputStream)
public void setInputStream(java.io.InputStream inputStream)
public java.io.OutputStream getOutputStream()
public void setOutputStream(java.io.OutputStream outputStream)
public void upload(java.lang.String path) throws ConnectionException
ConnectionException
public void upload(java.lang.String path, java.lang.String uploadPath) throws ConnectionException
ConnectionException
public void upload(java.util.List paths) throws ConnectionException
ConnectionException
public void upload(java.util.List paths, java.util.List uploadPaths) throws ConnectionException
ConnectionException
protected void consoleLogin() throws ConnectionException
ConnectionException
protected void requestUploads()
protected boolean requestUpload(java.lang.String checkedPath) throws java.io.IOException
java.io.IOException
public void update(java.util.Observable conn, java.lang.Object cmd)
update
in interface java.util.Observer
protected void copyURL(java.lang.String path, java.lang.String destPath, java.io.OutputStream out)
public void shutdown()
public void println(java.lang.String string)
public static void main(java.lang.String[] args)
options: -h=host -p=port -l=username -pw=password -r=max recursion level Default: 0 -uploadPath=path uploads as if this was full path of file -uploadAs=Class upload .wrl as given Class. Default: VrmlFile -includeNonWrl Upload non .wrl files (including .wrl.gz) -excludeExternProto Do not upload EXTERNPROTO urls -silent Silence output -logger Debug
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |