Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.vrspace.client
Class VrmlUploader.URLParser  view VrmlUploader.URLParser download VrmlUploader.URLParser.java

java.lang.Object
  extended byjava.util.Observable
      extended byorg.vrspace.client.VrmlParser
          extended byorg.vrspace.client.VrmlUploader.URLParser
Enclosing class:
VrmlUploader

public class VrmlUploader.URLParser
extends VrmlParser

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  java.util.HashMap files
           
protected  int maxRecursion
           
 
Fields inherited from class org.vrspace.client.VrmlParser
childCount, childDepth, childPos, countChildren, DEFDepths, DEFIndexes, DEFNames, DEFs, depth, errors, InlineDEFs, inputDir, lod, maxDepth, name, nodeName, output, outputDir, route, use, USEPos
 
Fields inherited from class java.util.Observable
 
Constructor Summary
protected VrmlUploader.URLParser(java.util.HashMap cachedFiles, java.util.HashMap files, int maxRecursion)
          Constructor designed for the recursive creation of this parser.
  VrmlUploader.URLParser(int maxRecursion)
           
 
Method Summary
protected  void cacheFile(java.lang.String path)
          Stores an entry in cachedFiles with key = path, and value = output.toString(), and resets the parser.
 java.util.HashMap getCachedFiles()
           
 java.util.HashMap getFiles()
           
 void parseFile(java.lang.String path)
          Parses the given file for all instances of urls.
protected  void parseFile(java.lang.String path, int recursionLevel)
          The actual file parsing workhorse.
protected  void parseFile(java.lang.String path, java.lang.String relRefPath, int recursionLevel)
          Resolves path against relRefPath and calls parseFile on the result.
protected  void parseURL(java.lang.String urlString, java.lang.String path, int recursionLevel)
          Determines if the given urlString is a .wrl file, and continues recursive search if it is.
protected  java.lang.String resolvePath(java.lang.String path, java.lang.String relRefPath)
          Resolves the given path against relRefPath and returns the result.
protected  void storeFileReference(java.lang.String path)
          Checks to see if the absolute path exists and if so, stores an entry in files with key = path, and value = path.
 
Methods inherited from class org.vrspace.client.VrmlParser
copyURL, copyURL, indent, main, reset, write
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cachedFiles

protected java.util.HashMap cachedFiles

files

protected java.util.HashMap files

maxRecursion

protected int maxRecursion
Constructor Detail

VrmlUploader.URLParser

public VrmlUploader.URLParser(int maxRecursion)

VrmlUploader.URLParser

protected VrmlUploader.URLParser(java.util.HashMap cachedFiles,
                                 java.util.HashMap files,
                                 int maxRecursion)
Constructor designed for the recursive creation of this parser.

Method Detail

getCachedFiles

public java.util.HashMap getCachedFiles()

getFiles

public java.util.HashMap getFiles()

parseFile

public void parseFile(java.lang.String path)
Parses the given file for all instances of urls. When these are found, if they reference .wrl files, then those files are recursively parsed. This recursion occurs up to the level set by maxRecursion. If the file is non-vrml, it is simply added to the list of uncached files.

VRML97 spec url is not java url - TODO

Overrides:
parseFile in class VrmlParser

parseFile

protected void parseFile(java.lang.String path,
                         java.lang.String relRefPath,
                         int recursionLevel)
Resolves path against relRefPath and calls parseFile on the result.


resolvePath

protected java.lang.String resolvePath(java.lang.String path,
                                       java.lang.String relRefPath)
Resolves the given path against relRefPath and returns the result.


parseFile

protected void parseFile(java.lang.String path,
                         int recursionLevel)
The actual file parsing workhorse. ParseFile is called recursively on each file found in the url tags. Then the file being parsed is cached. If the file specified does not have a vrml extension, it simply stores the file reference in files. If recursionLevel > maxRecursion the method returns.


parseURL

protected void parseURL(java.lang.String urlString,
                        java.lang.String path,
                        int recursionLevel)
Determines if the given urlString is a .wrl file, and continues recursive search if it is.


cacheFile

protected void cacheFile(java.lang.String path)
Stores an entry in cachedFiles with key = path, and value = output.toString(), and resets the parser. The path is expected to be absolute.


storeFileReference

protected void storeFileReference(java.lang.String path)
Checks to see if the absolute path exists and if so, stores an entry in files with key = path, and value = path.