Class LoaderIndex
java.lang.Object
de.oktoflow.platform.tools.lib.loader.LoaderIndex
- All Implemented Interfaces:
Serializable
Represents the class loader index.
- Author:
- Holger Eichelberger, SSE
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddToIndex(LoaderIndex index, boolean isClass, String name, String location) Adds the resourcenameinlocationinindex.static voidaddToIndex(LoaderIndex index, File jarFile, String location) Adds the givenjarFiletoindex.static LoaderIndexaddToIndex(LoaderIndex index, List<Path> jars) Adds the givenjarstoindex.private static voidaddToIndex(LoaderIndex index, Map<String, String> map, String name, String location) Adds the resourcenameinlocationtomapand adjusts the location index inindex.static LoaderIndexcreateIndex(List<Path> jars) Creates an index for a given set of JAR files.static LoaderIndexReads an index file, basically via serialization.Returns the class index.Returns the location index.Returns the resource index.static voidrelocateIndex(LoaderIndex index, String prefix, String replacement) Relocates an index instance.private static voidRelocates an index map.static voidtoFile(LoaderIndex index, File file) Savesindextofile.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
locationIndex
-
classIndex
-
resourceIndex
-
-
Constructor Details
-
LoaderIndex
public LoaderIndex()
-
-
Method Details
-
createIndex
Creates an index for a given set of JAR files. Paths will be stored relatively to ease relocation.- Parameters:
jars- list of jar files- Returns:
- plugin index
- Throws:
IOException- if adding files fails
-
addToIndex
Adds the givenjarstoindex. Paths will be stored relatively to ease relocation.- Parameters:
index- the index to add the information tojars- list of jar files- Returns:
index- Throws:
IOException- if adding files fails
-
addToIndex
Adds the givenjarFiletoindex. If given,locationreplaces the relative path ofjarFilein the index entry.- Parameters:
index- the indexjarFile- the jarFile to indexlocation- optional actual location ofjarFile, e.g., for relocation; if null or empty, use the relative path ofjarFileinstead- Throws:
IOException- ifjarFilecannot be opened
-
addToIndex
private static void addToIndex(LoaderIndex index, Map<String, String> map, String name, String location) Adds the resourcenameinlocationtomapand adjusts the location index inindex.- Parameters:
index- the index instancemap- the map to modifyname- the resource name-keylocation- the resource file location-value
-
relocateIndex
Relocates an index instance.- Parameters:
index- the indexprefix- the path prefix indicating a path to relocatereplacement- the replacement for prefix if prefix was found at the beginning of a path
-
relocateIndex
Relocates an index map.- Parameters:
index- the index map, entry values may be modified as a side effectprefix- the path prefix indicating a path to relocatereplacement- the replacement for prefix if prefix was found at the beginning of a path
-
fromFile
Reads an index file, basically via serialization.- Parameters:
indexFile- the index file- Returns:
- the index object
- Throws:
IOException- if the file cannot be read
-
toFile
Savesindextofile.- Parameters:
index- the index to writefile- the file to write to- Throws:
IOException- if the index cannot be written
-
addToIndex
Adds the resourcenameinlocationinindex. [testing]- Parameters:
index- the index instanceisClass- whether we shall register a class or a resourcename- the resource name-keylocation- the resource file location-value
-
getLocationIndex
Returns the location index.- Returns:
- the locationIndex
-
getClassIndex
Returns the class index.- Returns:
- the classIndex
-
getResourceIndex
Returns the resource index.- Returns:
- the resourceIndex
-