NASA World Wind

gov.nasa.worldwind.cache
Class AbstractFileStore

java.lang.Object
  extended by gov.nasa.worldwind.cache.AbstractFileStore
All Implemented Interfaces:
FileStore
Direct Known Subclasses:
BasicDataFileStore

public class AbstractFileStore
extends Object
implements FileStore


Nested Class Summary
protected static class AbstractFileStore.StoreLocation
           
 
Field Summary
protected  List<AbstractFileStore.StoreLocation> readLocations
           
protected  AbstractFileStore.StoreLocation writeLocation
           
 
Fields inherited from interface gov.nasa.worldwind.cache.FileStore
OS_SPECIFIC_DATA_PATH
 
Constructor Summary
AbstractFileStore()
           
 
Method Summary
 void addLocation(int index, String newPath, boolean isInstall)
           
 void addLocation(String newPath, boolean isInstall)
           
protected static String appendPathPart(String firstPart, String secondPart)
           
protected static String buildLocationPath(String property, String append, String wwDir)
           
protected  void buildReadPaths(Node dataFileStoreNode)
           
protected  void buildWritePaths(Node dataFileCacheNode)
           
 boolean containsFile(String fileName)
           
protected static String determineAllUserLocation()
           
protected static String determineSingleUserLocation()
           
protected  void doFindDataDescriptors(AbstractFileStore.StoreLocation location, File dir, List<DataDescriptor> descriptors)
           
 List<? extends DataDescriptor> findAllDataDescriptors()
           
 List<? extends DataDescriptor> findDataDescriptors(String path)
           
 URL findFile(String fileName, boolean checkClassPath)
           
 List<? extends File> getLocations()
           
protected static String getUserHomeDir()
           
 File getWriteLocation()
           
protected  void initialize(InputStream xmlConfigStream)
           
 boolean isInstallLocation(String path)
           
protected static File makeAbsoluteFile(File file, String fileName)
           
protected static String makeAbsolutePath(File dir, String fileName)
           
protected static void markFileUsed(File file)
           
 File newFile(String fileName)
           
protected static String propertyToPath(String propName)
           
protected  boolean readDataDescriptor(AbstractFileStore.StoreLocation location, File descriptorFile, List<DataDescriptor> descriptors)
           
 void removeFile(URL url)
           
 void removeLocation(String path)
           
protected  AbstractFileStore.StoreLocation storeLocationFor(String path)
           
protected static String storePathForFile(AbstractFileStore.StoreLocation location, File file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

readLocations

protected final List<AbstractFileStore.StoreLocation> readLocations

writeLocation

protected AbstractFileStore.StoreLocation writeLocation
Constructor Detail

AbstractFileStore

public AbstractFileStore()
Method Detail

addLocation

public void addLocation(int index,
                        String newPath,
                        boolean isInstall)
Specified by:
addLocation in interface FileStore

addLocation

public void addLocation(String newPath,
                        boolean isInstall)
Specified by:
addLocation in interface FileStore

appendPathPart

protected static String appendPathPart(String firstPart,
                                       String secondPart)

buildLocationPath

protected static String buildLocationPath(String property,
                                          String append,
                                          String wwDir)

buildReadPaths

protected void buildReadPaths(Node dataFileStoreNode)

buildWritePaths

protected void buildWritePaths(Node dataFileCacheNode)

containsFile

public boolean containsFile(String fileName)
Specified by:
containsFile in interface FileStore

determineAllUserLocation

protected static String determineAllUserLocation()

determineSingleUserLocation

protected static String determineSingleUserLocation()

doFindDataDescriptors

protected void doFindDataDescriptors(AbstractFileStore.StoreLocation location,
                                     File dir,
                                     List<DataDescriptor> descriptors)

findAllDataDescriptors

public List<? extends DataDescriptor> findAllDataDescriptors()
Specified by:
findAllDataDescriptors in interface FileStore

findDataDescriptors

public List<? extends DataDescriptor> findDataDescriptors(String path)
Specified by:
findDataDescriptors in interface FileStore

findFile

public URL findFile(String fileName,
                    boolean checkClassPath)
Specified by:
findFile in interface FileStore
Parameters:
fileName - the name of the file to find
checkClassPath - if true, the class path is first searched for the file, otherwise the class path is not searched unless it's one of the explicit paths in the cache search directories
Returns:
a handle to the requested file if it exists in the cache, otherwise null
Throws:
IllegalArgumentException - if fileName is null

getLocations

public List<? extends File> getLocations()
Specified by:
getLocations in interface FileStore

getUserHomeDir

protected static String getUserHomeDir()

getWriteLocation

public File getWriteLocation()
Specified by:
getWriteLocation in interface FileStore

initialize

protected void initialize(InputStream xmlConfigStream)

isInstallLocation

public boolean isInstallLocation(String path)
Specified by:
isInstallLocation in interface FileStore

makeAbsoluteFile

protected static File makeAbsoluteFile(File file,
                                       String fileName)

makeAbsolutePath

protected static String makeAbsolutePath(File dir,
                                         String fileName)

markFileUsed

protected static void markFileUsed(File file)

newFile

public File newFile(String fileName)
Specified by:
newFile in interface FileStore
Parameters:
fileName - the name to give the newly created file
Returns:
a handle to the newly created file if it could be created and added to the file store, otherwise null
Throws:
IllegalArgumentException - if fileName is null

propertyToPath

protected static String propertyToPath(String propName)

readDataDescriptor

protected boolean readDataDescriptor(AbstractFileStore.StoreLocation location,
                                     File descriptorFile,
                                     List<DataDescriptor> descriptors)

removeFile

public void removeFile(URL url)
Specified by:
removeFile in interface FileStore
Parameters:
url - the "file:" URL of the file to remove from the file store
Throws:
IllegalArgumentException - if url is null

removeLocation

public void removeLocation(String path)
Specified by:
removeLocation in interface FileStore

storeLocationFor

protected AbstractFileStore.StoreLocation storeLocationFor(String path)

storePathForFile

protected static String storePathForFile(AbstractFileStore.StoreLocation location,
                                         File file)

NASA World Wind