| Modifier and Type | Class and Description |
|---|---|
| private static class | CachedJarsPackageManager.
Used when representing the classes in a particular package. |
| public static class | CachedJarsPackageManager.
Class of object used to represent a cache file and last modification time, internally and to
|
| Modifier and Type | Field and Description |
|---|---|
| private File | cachedir
Directory in which cache files are stored. |
| private Map | index
Map from some source of class definitions to the name of a file used to cache lists of classes in that source. |
| private boolean | indexModified
Set |
| protected static Logger |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | |
| public void | addJarToPackages(File jarfile, boolean cache)
Gathers package and class lists from a jar specified by a |
| private void | addJarToPackages(URL
identifying the JAR if jarurl, File jarfile is nullidentifying the JAR jarfile, boolean re-write the cache if it was out of date (and caching is active). writeCache)Create (or ensure we have) a |
| protected void | |
| private void | addPackages(Map<String, String>
source of mappings packageToClasses, String becomes the __file__ attribute of the jarfile)PyJavaPackageFrom a map of package name to comma/@-separated list of classes therein, relating to a
particular JAR file, create a |
| private void | addZipEntry(Map<String, CachedJarsPackageManager.
map (to update) from package name to class names by accessibility zipPackages,possibly representing a class entry, ZipInputStream the JAR or ZIP to which the entry belongs zip)Process one entry from a JAR/ZIP, and if the entry is a (qualifying) Java class, add its name
to that package's entry in the map passed in. A class is added only if
|
| protected void | |
| protected void | |
| protected void | |
| protected boolean | Returns: true if name should be filtered outclass name name, int class access permissions as int acc)Filter class by access perms helper method - hook. |
| protected boolean | Returns: true if name should be filtered outclass/pkg name name, boolean if true, name refers to a pkg pkg)Filter class/pkg by name helper method - hook. |
| private Map | Returns: map from packages to classesup to and including the name of the module modulePath)Detect all of the packages in a single module, that contain any classes for which
|
| private Map | Returns: map from package name to comma/@-separated list of class namesan open JAR/ZIP file jarin)Detect all of the packages in an open JAR/ZIP file, that contain any classes for which
|
| protected void | initCache()
Initialise the cache by reading the index from storage, through |
| protected DataInputStream | |
| protected DataInputStream | |
| protected void | |
| protected DataOutputStream | Returns: stream on which to represent the package to class-list textuallycache file description entry,new or use existing file named in create)entry.cachefileCreate/open cache file for rewriting back to persistent storage – hook. |
| protected DataOutputStream | |
| private Map | readCacheFile(CachedJarsPackageManager.
Read in cache file storing package info for a single jar. |
| public void | |
| protected static String[] | Returns: - An array of strings, each of which will not be larger than maxLength- The string to split up into chunks str, int - The max size a string should be maxLength)Split up a string into several chunks based on a certain size The writeCacheFile method will use the writeUTF method on a DataOutputStream which only allows writing 64k chunks, so use this utility method to split it up |
| protected boolean | useCacheDir(File cachedir)
Initialize off-the-shelf (default) local file-system cache implementation. |
| protected void | |
| private void | writeCacheFile(CachedJarsPackageManager.
in entry,index corresponding to the JARcanonical name of the JAR (used as key into jarcanon, Map<String, String> index)a map from package name to class names for that pacjkage in the JAR zipPackages, boolean if the cache file must be created (vs. being re-written) brandNew)Write a cache file storing package info for a single JAR. |
| cachedir | back to summary |
|---|---|
| private File cachedir Directory in which cache files are stored. | |
| index | back to summary |
|---|---|
| private Map<String, CachedJarsPackageManager. Map from some source of class definitions to the name of a file used to cache lists of
classes in that source. | |
| indexModified | back to summary |
|---|---|
| private boolean indexModified Set | |
| logger | back to summary |
|---|---|
| protected static Logger logger | |
| CachedJarsPackageManager | back to summary |
|---|---|
| public CachedJarsPackageManager() | |
| addJarToPackages | back to summary |
|---|---|
| public void addJarToPackages(URL jarurl) Gathers classes info from jar specified by a URL. Eventually just using previously cached info. Eventually updated info is not cached. Persistent cache storage access goes through inOpenCacheFile() and outCreateCacheFile(). | |
| addJarToPackages | back to summary |
|---|---|
| public void addJarToPackages(URL jarurl, boolean cache) Gathers classes info from jar specified by URL. Eventually just using previously cached info. Eventually updated info is (re-)cached if param cache is true. Persistent cache storage access goes through inOpenCacheFile() and outCreateCacheFile(). | |
| addJarToPackages | back to summary |
|---|---|
| public void addJarToPackages(File jarfile) Gathers classes info from jar specified by File jarfile. Eventually just using previously cached info. Eventually updated info is not cached. Persistent cache storage access goes through inOpenCacheFile() and outCreateCacheFile(). | |
| addJarToPackages | back to summary |
|---|---|
| public void addJarToPackages(File jarfile, boolean cache) Gathers package and class lists from a jar specified by a | |
| addJarToPackages | back to summary |
|---|---|
| private void addJarToPackages(URL jarurl, File jarfile, boolean writeCache) Create (or ensure we have) a | |
| addModuleToPackages | back to summary |
|---|---|
| protected void addModuleToPackages(Path modulePath) Scan a Java module, creating package objects. | |
| addPackages | back to summary |
|---|---|
| private void addPackages(Map<String, String> packageToClasses, String jarfile) From a map of package name to comma/@-separated list of classes therein, relating to a
particular JAR file, create a
| |
| addZipEntry | back to summary |
|---|---|
| private void addZipEntry(Map<String, CachedJarsPackageManager. Process one entry from a JAR/ZIP, and if the entry is a (qualifying) Java class, add its name
to that package's entry in the map passed in. A class is added only if
| |
| comment | back to summary |
|---|---|
| protected void comment(String msg, Object... params) Comment log method - hook. This default implementation does nothing. | |
| debug | back to summary |
|---|---|
| protected void debug(String msg, Object... params) Debug log method - hook. This default implementation does nothing. | |
| deleteCacheFile | back to summary |
|---|---|
| protected void deleteCacheFile(String cachefile) Delete (invalidated) cache file from persistent storage - hook. This default implementation is part of the off-the-shelf local file-system cache implementation. Can be overridden. | |
| filterByAccess | back to summary |
|---|---|
| protected boolean filterByAccess(String name, int acc) Filter class by access perms helper method - hook. The default implementation is used by
| |
| filterByName | back to summary |
|---|---|
| protected boolean filterByName(String name, boolean pkg) Filter class/pkg by name helper method - hook. The default implementation is used by
| |
| getModularPackages | back to summary |
|---|---|
| private Map Detect all of the packages in a single module, that contain any classes for which
| |
| getZipPackages | back to summary |
|---|---|
| private Map Detect all of the packages in an open JAR/ZIP file, that contain any classes for which
| |
| initCache | back to summary |
|---|---|
| protected void initCache() Initialise the cache by reading the index from storage, through | |
| inOpenCacheFile | back to summary |
|---|---|
| protected DataInputStream inOpenCacheFile(String cachefile) throws IOException Open a particular cache file for reading from persistent storage. This default implementation is part of the off-the-shelf local file-system cache implementation. Can be overridden. | |
| inOpenIndex | back to summary |
|---|---|
| protected DataInputStream inOpenIndex() throws IOException Open cache index for reading from persistent storage – hook. Must Return null if this is absent. This default implementation is part of the off-the-shelf local file-system cache implementation. Can be overridden. | |
| message | back to summary |
|---|---|
| protected void message(String msg, Object... params) Message log method - hook. This default implementation does nothing. | |
| outCreateCacheFile | back to summary |
|---|---|
| protected DataOutputStream outCreateCacheFile(CachedJarsPackageManager. Create/open cache file for rewriting back to persistent storage – hook. If
stream on which to represent the package to class-list textually | |
| outOpenIndex | back to summary |
|---|---|
| protected DataOutputStream outOpenIndex() throws IOException Open cache index for writing back to persistent storage – hook. This default implementation is part of the off-the-shelf local file-system cache implementation. Can be overridden. | |
| readCacheFile | back to summary |
|---|---|
| private Map Read in cache file storing package info for a single jar. Return null and delete this cache file if it is invalid.
| |
| saveCache | back to summary |
|---|---|
| public void saveCache() Write back cache index. The index is a mapping from each source of class definitions to the file where the cache for that source is held. This list is accessed through outOpenIndex(). | |
| splitString | back to summary |
|---|---|
| protected static String[] splitString(String str, int maxLength) Split up a string into several chunks based on a certain size The writeCacheFile method will use the writeUTF method on a DataOutputStream which only allows writing 64k chunks, so use this utility method to split it up
- An array of strings, each of which will not be larger than maxLength | |
| useCacheDir | back to summary |
|---|---|
| protected boolean useCacheDir(File cachedir) Initialize off-the-shelf (default) local file-system cache implementation. Must be called
before | |
| warning | back to summary |
|---|---|
| protected void warning(String msg, Object... params) Warning log method - hook. This default implementation does nothing. | |
| writeCacheFile | back to summary |
|---|---|
| private void writeCacheFile(CachedJarsPackageManager. Write a cache file storing package info for a single JAR. *
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv List | accessible
Class names of accessible classes |
| pack-priv List | inaccessible
Class names of inaccessible classes |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| public String | toString()
Overrides java. Retrieve the two lists in "cache file" format |
| accessible | back to summary |
|---|---|
| pack-priv List<String> accessible Class names of accessible classes | |
| inaccessible | back to summary |
|---|---|
| pack-priv List<String> inaccessible Class names of inaccessible classes | |
| ClassList | back to summary |
|---|---|
| private ClassList() | |
| appendList | back to summary |
|---|---|
| private static void appendList(StringBuilder buf, List<String> names) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Retrieve the two lists in "cache file" format
| |
CachedJarsPackageManager#outCreateCacheFile. When caching, a JarXEntry is
created for each JAR processed for classes, and corresponds to a file in the package cache
directory. The name is based on the name of the JAR.
| Modifier and Type | Field and Description |
|---|---|
| public String | cachefile
Specifies the actual cache file once that is created or opened. |
| public long |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| cachefile | back to summary |
|---|---|
| public String cachefile Specifies the actual cache file once that is created or opened. | |
| mtime | back to summary |
|---|---|
| public long mtime | |
| JarXEntry | back to summary |
|---|---|
| public JarXEntry(String cachefile) | |
| JarXEntry | back to summary |
|---|---|
| public JarXEntry(String cachefile, long mtime) | |