Package com.ultikits.ultitools.manager
Class ModuleJarIndex
java.lang.Object
com.ultikits.ultitools.manager.ModuleJarIndex
Which JARs in the modules folder declare which module main class, as the module loader read them
at start-up (#516).
The loader identifies a module JAR by nothing but the main: entry of its
plugin.yml (#548/#549): it reads that entry and loads exactly that class. This index keeps
what it read, per main class, together with the JAR the class was actually loaded from. It is how
an uninstall knows every file on disk that belongs to a loaded module -- including a second copy
whose plugin.yml declares a different name: -- and how the start-up warning about
duplicate copies names all of them. Nothing here reads a class out of an archive.
Thread-safe: written by the start-up scan, read by /upm commands.
- Since:
- 6.3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionMain class name -> canonical path -> JAR, for every JAR whoseplugin.ymldeclares it.Main class name -> the JAR its class was loaded from. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringcanonicalPath(File file) The main classes two or more JARs declare, each with its JARs in file-name order.jarsDeclaring(String mainClass) Every JAR recorded as declaringmainClass, in file-name order.mainClassOf(UltiToolsPlugin module) The main class the loader recorded for a loaded module: the nearest class in its hierarchy that some JAR declares -- the instance may be a subclass of the declared class, as a proxy is.voidRecords thatjar'splugin.ymldeclaresmainClass.voidrecordSupplier(String mainClass, File jar) Records the JAR the classmainClasswas loaded from.supplierOf(String mainClass) The JAR the classmainClasswas loaded from, ornullwhen it is not known.
-
Field Details
-
jarsByMainClass
Main class name -> canonical path -> JAR, for every JAR whoseplugin.ymldeclares it. -
supplierByMainClass
Main class name -> the JAR its class was loaded from.
-
-
Constructor Details
-
ModuleJarIndex
public ModuleJarIndex()
-
-
Method Details
-
record
Records thatjar'splugin.ymldeclaresmainClass.- Parameters:
mainClass- the declared main classjar- the JAR declaring it
-
recordSupplier
Records the JAR the classmainClasswas loaded from.- Parameters:
mainClass- the main classjar- the JAR its class came from
-
jarsDeclaring
Every JAR recorded as declaringmainClass, in file-name order.- Parameters:
mainClass- the main class- Returns:
- the JARs, possibly empty
-
supplierOf
The JAR the classmainClasswas loaded from, ornullwhen it is not known.- Parameters:
mainClass- the main class- Returns:
- the JAR, or
null
-
mainClassOf
The main class the loader recorded for a loaded module: the nearest class in its hierarchy that some JAR declares -- the instance may be a subclass of the declared class, as a proxy is. When none is recorded (a module registered from code rather than from the modules folder), the instance's own class name.- Parameters:
module- a loaded module- Returns:
- its main class name
-
duplicates
The main classes two or more JARs declare, each with its JARs in file-name order.- Returns:
- main class name -> its JARs; empty when there is no duplicate
-
canonicalPath
-