|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectecologylab.generic.Debug
ecologylab.io.Assets
public class Assets
Used to manage cachable assets.
This class must not be called until codeBase is properly set! Here's how it works: (1) There is a file called assets.xml. It lives only in applicationDataDir(), the cache root. There is *no* version of this file in
| Field Summary | |
|---|---|
static float |
IGNORE_VERSION
|
static java.lang.String |
INTERFACE
current known assets (although arbitrary ones can exist) |
static java.lang.String |
PREFERENCES
|
static java.lang.String |
SEMANTICS
|
| Fields inherited from interface ecologylab.appframework.ApplicationProperties |
|---|
USE_ASSETS_CACHE |
| Fields inherited from interface ecologylab.appframework.ApplicationPropertyNames |
|---|
CODEBASE, FRAME, GO_PREFIX, PREFERENCES_SET, PREFERENCES_SET_ASSET |
| Method Summary | |
|---|---|
static ParsedURL |
assetsRoot()
Get the source URL root of the tree of assets for this application. |
static java.io.File |
cacheRoot()
Get the root file path for caching. |
static boolean |
downloadInterfaceZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload)
Download an interface assets zip file from the interfaceAssetsRoot. |
static boolean |
downloadInterfaceZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload,
float version)
|
static void |
downloadPreferencesZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload)
|
static void |
downloadPreferencesZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload,
float version)
|
static void |
downloadSemanticsZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload)
Download an semantics assets zip file from the semanticsAssetsRoot. |
static void |
downloadSemanticsZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload,
float version)
|
static void |
downloadXML(ParsedURL sourceXML,
java.io.File targetDir,
StatusReporter status)
Download an XML file from a source to a target location with minimal effort, unless the XML file already exists at the target location, in which case, do nothing. |
static void |
downloadXML(java.lang.String sourcePath,
java.lang.String targetPath,
StatusReporter status)
Download XML from the sourcePath, within the assetsRoot (the application's config dir), to the target path within the applicationDir. |
static void |
downloadZip(ParsedURL sourceZip,
java.io.File targetFile,
boolean forceDownload,
float version)
|
static void |
downloadZip(ParsedURL sourceZip,
java.io.File targetDir,
StatusReporter status,
boolean forceDownload,
float version)
Download and uncompress a zip file from a source to a target location with minimal effort, unless the zip file already exists at the target location, in which case, do nothing. |
static void |
downloadZip(java.lang.String assetRelativePath,
boolean forceDownload,
float version)
Download the assets zip file from the assetsRoot. |
static void |
downloadZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload,
float version)
Download the assets zip file from the assetsRoot. |
static java.io.File |
getAndPerhapsCreateAsset(java.lang.String relativePath)
Same as getAsset(String), but creates the Asset location if it doesn't exist |
static java.io.File |
getAndPerhapsCreateAsset(java.lang.String relativePath,
java.lang.String additionalContext)
Same as getAndPerhapsCreateAsset(String, String), but creates the Asset location if it doesn't exist |
static java.io.File |
getAsset(java.lang.String relativePath)
Given a relative path, return a file reference to this path from the cache root. |
static java.io.File |
getAsset(java.lang.String relativePath,
java.lang.String additionalContext)
Same as getAsset(String), but allows additional relative file/directory to be specified against the relativePath |
static java.io.File |
getCachedInterfaceFile(java.lang.String assetRelativePath)
Use the interfaceCacheRoot to produce a File object using the specified relative path. |
static java.lang.String |
getCacheFilename(ParsedURL location,
java.io.File directory,
java.lang.String additional,
java.lang.String separator,
java.lang.String extension)
Derive a non-duplicate cache filename given a ParsedURL location |
static java.io.File |
getInterfaceFile(java.lang.String assetRelativePath)
|
static java.io.File |
getPreferencesFile(java.lang.String assetRelativePath)
|
static java.io.File |
getSemanticsFile(java.lang.String assetRelativePath)
|
static boolean |
localVersionIsUpToDate(java.lang.String id,
float requiredVersion)
Determines if a file should be downloaded again, based upon it's file version. |
static void |
setAssetsRoot(ParsedURL assetsRoot)
Set the source URL root of the tree of assets for this application. |
static void |
setCacheRoot(java.io.File cacheRoot)
Sets the root file path for caching. |
static void |
updateAssetsXml(java.lang.String sourceSpot)
When necessary, re-write the local (and only) assets.xml file. |
| Methods inherited from class ecologylab.generic.Debug |
|---|
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String INTERFACE
public static final java.lang.String SEMANTICS
public static final java.lang.String PREFERENCES
public static final float IGNORE_VERSION
| Method Detail |
|---|
public static java.io.File getAsset(java.lang.String relativePath)
relativePath - A string representing the relative file path.
public static java.io.File getAsset(java.lang.String relativePath,
java.lang.String additionalContext)
relativePath - A string representing the relative file pathadditionalContext - A string representing an additional relative path.
This path is relative to the relativePath parameter (rather than the cache root).
public static java.io.File getAndPerhapsCreateAsset(java.lang.String relativePath)
relativePath - A string representing the relative file path.
public static java.io.File getAndPerhapsCreateAsset(java.lang.String relativePath,
java.lang.String additionalContext)
relativePath - A string representing the relative file path.additionalContext - A string representing an additional relative path.
This path is relative to the relativePath parameter (rather than the cache root).
getAsset(String, String)public static java.io.File getInterfaceFile(java.lang.String assetRelativePath)
assetRelativePath -
public static java.io.File getCachedInterfaceFile(java.lang.String assetRelativePath)
assetRelativePath -
public static java.io.File getSemanticsFile(java.lang.String assetRelativePath)
assetRelativePath -
public static java.io.File getPreferencesFile(java.lang.String assetRelativePath)
public static boolean downloadInterfaceZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload)
assetRelativePath - -- This is the name of the interface. It does not end in .zip!status - Provide feedback to the user at the bottom of a window, or such.
public static boolean downloadInterfaceZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload,
float version)
public static void downloadSemanticsZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload)
assetRelativePath - status - Provide feedback to the user at the bottom of a window, or such.
public static void downloadSemanticsZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload,
float version)
public static void downloadPreferencesZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload)
public static void downloadPreferencesZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload,
float version)
public static void downloadZip(java.lang.String assetRelativePath,
StatusReporter status,
boolean forceDownload,
float version)
assetRelativePath - status - Provide feedback to the user at the bottom of a window, or such.
public static void downloadZip(java.lang.String assetRelativePath,
boolean forceDownload,
float version)
assetRelativePath -
public static void downloadZip(ParsedURL sourceZip,
java.io.File targetFile,
boolean forceDownload,
float version)
public static void downloadZip(ParsedURL sourceZip,
java.io.File targetDir,
StatusReporter status,
boolean forceDownload,
float version)
status - The Status object that provides a source of state change visiblity;
can be null.forceDownload - version - public static void setAssetsRoot(ParsedURL assetsRoot)
public static void setCacheRoot(java.io.File cacheRoot)
cacheRoot - The root file path for caching assets.public static ParsedURL assetsRoot()
public static java.io.File cacheRoot()
public static void downloadXML(java.lang.String sourcePath,
java.lang.String targetPath,
StatusReporter status)
sourcePath - targetPath - status -
public static void downloadXML(ParsedURL sourceXML,
java.io.File targetDir,
StatusReporter status)
status - The Status object that provides a source of state change visiblity;
can be null.sourceXML - The location of the zip file to download and uncompress.targetDir - The location where the zip file should be uncompressed. This
directory structure will be created if it doesn't exist.
public static boolean localVersionIsUpToDate(java.lang.String id,
float requiredVersion)
id - the name of the file to checkrequiredVersion - the version of that file
\
public static void updateAssetsXml(java.lang.String sourceSpot)
public static java.lang.String getCacheFilename(ParsedURL location,
java.io.File directory,
java.lang.String additional,
java.lang.String separator,
java.lang.String extension)
location - The location of the file to be cached.directory - The directory to cache the fileadditional - An additional text to add to the end of the filename, but before the extensionseparator - Separator used to divide sections of filename (e.g. "-", ".")extension - Extension to add to file name if it doesn't already exist
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||