|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jaw.impl.agent.services.mlet.MLetSrv | +--com.sun.jaw.impl.agent.services.mlet.MLetCacheVersionSrv
This class extends the MLetSrv
class to provide caching and
version control. This is achieved by overriding the check
method of the MLetSrv
class.
The check
method is invoked to determine whether a
.jar
file is to be downloaded across the network from the
server, or locally from the cache. It does this by comparing the value of
the VERSION
attribute in the MLET
tag with the
version number of the .jar
file stored locally.
If the version in the cache is older than that specified in the
MLET
tag, the .jar
file is loaded
from the server. Otherwise, it is loaded from the cache. If the caching
directory does not exist on the system or the agent does not have the
permission to write to it, then the .jar
files will be always
loaded from the server and versioning will not be carried out.
Information on the version numbers of cached .jar
files is
stored in a file named VERSION
in the cache directory. The m-let service
updates the version number of a .jar
file with the value of the
VERSION
attribute in the MLET
tag each time it loads
the .jar
file from the server.
The VERSION
file is an ASCII file in which each line contains
the name of a .jar
file and its version number. The version
number is a series of non-negative decimal integers each separated by a period from the one
that precedes it.
Example VERSION
file:
firstfile.jar 1.0 secondfile.jar 3.0 thirdfile.jar 1.0.1 fourthfile.jar 2.1 ...
The directory in which cache files are stored by default is specified in the following order:
jaw.mlet.cache.dir
property.
getVarDir("mletcache")
in class DefaultPaths.
MLet
,
MLetSrv
, Serialized FormField Summary | |
protected java.lang.String |
cacheDir
The local path for versioning. |
Fields inherited from class com.sun.jaw.impl.agent.services.mlet.MLetSrv |
cmf,
mletList |
Constructor Summary | |
MLetCacheVersionSrv()
Instantiates the m-let service that provides caching and version control. |
Method Summary | |
java.net.URL |
check(java.lang.String version,
java.net.URL codebase,
java.lang.String jarfile,
MLet mlet)
Determines whether a .jar file is to be downloaded across
the network from the server, or locally from the cache. |
java.lang.String |
getCacheDirectory()
Gets the cache directory. |
static java.lang.String |
getClassVersion()
Gets the version of this class. |
void |
setCacheDirectory(java.lang.String cache_dir)
Sets the cache directory. |
Methods inherited from class com.sun.jaw.impl.agent.services.mlet.MLetSrv |
deleteCmf,
getLibraryDirectory,
initCmf,
performGetResource,
performGetResource,
performGetResourceAsStream,
performGetResourceAsStream,
performLoadURL,
performLoadURL,
performLocalLoadURL,
performLocalLoadURL,
performRemoteLoadURL,
performRemoteLoadURL,
setLibraryDirectory |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.lang.String cacheDir
Constructor Detail |
public MLetCacheVersionSrv()
Method Detail |
public java.net.URL check(java.lang.String version, java.net.URL codebase, java.lang.String jarfile, MLet mlet)
.jar
file is to be downloaded across
the network from the server, or locally from the cache.
The method does this by comparing the value of the VERSION
attribute in the MLET
tag with the version number of the .jar
file stored locally.
If the version in the cache is older than that specified in the
MLET
tag, the .jar
file is loaded
from the server. Otherwise, it is loaded from the cache.
version
- The version number of the .jar
file stored locally.codebase
- The base URL of the remote .jar
file.jarfile
- The name of the .jar
file to be loaded.mlet
- The MLet
instance that represents the
MLET
tag..jar
file is to be loaded from.public static java.lang.String getClassVersion()
public java.lang.String getCacheDirectory()
public void setCacheDirectory(java.lang.String cache_dir)
cache_dir
- The absolute path to the cache directory. The directory must exist.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |