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

Quick Search    Search Deep

wal
Class CacheServiceImpl  view CacheServiceImpl download CacheServiceImpl.java

java.lang.Object
  extended bywal.CacheServiceImpl
All Implemented Interfaces:
CacheService, FileStateListener

public class CacheServiceImpl
extends java.lang.Object
implements CacheService


Nested Class Summary
(package private)  class CacheServiceImpl.CacheClassLoader
          ClassLoader which looks up class and resource files from cache directory.
 
Field Summary
private  java.lang.String cachedir
          cache directory
private  wal.net.ResourceUpdater cru
           
private  java.io.File[] files
          holds any files from cache directory
 
Fields inherited from interface wal.CacheService
CACHE
 
Fields inherited from interface wal.FileStateListener
DEATH, FINISHED, NEW, STARTED
 
Constructor Summary
CacheServiceImpl()
          CacheServiceImpl use as cache dir user.dir/cache.
 
Method Summary
 void addResourceUpdater(wal.net.ResourceUpdater ru)
          Installs an ResourceUpdater which is responsible to keep cache directory up to date.
private  java.lang.String extractFilename(java.lang.String url)
          Returns file name based on parameter url
private  java.lang.String extractFilename(java.net.URL url)
          Returns file name based on parameter url
 FileHandle getFileHandle(java.net.URL url)
          Take a FileHandle if you want cache a new resource.
private  java.util.Iterator getJarFilesIterator()
          Returns a JarFile Iterator from Jar files found along cache directory.
private  void initCache()
          Inspects the cache directory and collect all files.
private  void initJNLP()
          Parse JNLP file and stores it results into JNLPStore
 boolean isResourceCached(java.net.URL url, java.lang.String version)
           
 void removeResource(java.net.URL url, java.lang.String str)
           
 void runClass(java.lang.String name, java.lang.String[] args)
          Invokes main class which is looked up from a jar file within cache directory.
 void stateChanged(byte state, java.lang.String url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cru

private wal.net.ResourceUpdater cru

cachedir

private java.lang.String cachedir
cache directory


files

private java.io.File[] files
holds any files from cache directory

Constructor Detail

CacheServiceImpl

public CacheServiceImpl()
                 throws WALException
CacheServiceImpl use as cache dir user.dir/cache.

Method Detail

addResourceUpdater

public void addResourceUpdater(wal.net.ResourceUpdater ru)
Description copied from interface: CacheService
Installs an ResourceUpdater which is responsible to keep cache directory up to date.

Specified by:
addResourceUpdater in interface CacheService

runClass

public void runClass(java.lang.String name,
                     java.lang.String[] args)
Description copied from interface: CacheService
Invokes main class which is looked up from a jar file within cache directory.

Specified by:
runClass in interface CacheService

isResourceCached

public boolean isResourceCached(java.net.URL url,
                                java.lang.String version)
Specified by:
isResourceCached in interface CacheService

removeResource

public void removeResource(java.net.URL url,
                           java.lang.String str)
                    throws java.io.IOException
Specified by:
removeResource in interface CacheService

stateChanged

public void stateChanged(byte state,
                         java.lang.String url)
Specified by:
stateChanged in interface CacheService

getFileHandle

public FileHandle getFileHandle(java.net.URL url)
                         throws java.io.IOException
Description copied from interface: CacheService
Take a FileHandle if you want cache a new resource. It should be the only way for adding new resources to cache directory.

Specified by:
getFileHandle in interface CacheService

initCache

private void initCache()
Inspects the cache directory and collect all files.


initJNLP

private void initJNLP()
               throws WALException
Parse JNLP file and stores it results into JNLPStore


extractFilename

private java.lang.String extractFilename(java.net.URL url)
Returns file name based on parameter url


extractFilename

private java.lang.String extractFilename(java.lang.String url)
Returns file name based on parameter url


getJarFilesIterator

private java.util.Iterator getJarFilesIterator()
Returns a JarFile Iterator from Jar files found along cache directory.