Class AppModuleReferences

java.lang.Object
com.iizix.server.app.AppModuleReferences

public final class AppModuleReferences extends Object
The Module project references of a project application (CC-FIX-APP-MODULE-REFERENCES): an application loaded from Module project directories (-app X -project <dir>, the development server) whose App Distribution properties (.iiziApp, the modules list) name other Module projects includes those projects as COPIES, loaded from the directories of the applications that load them, as the distributor packs them into the jar of a compiled application - the referrer owns its copies and the referenced application is untouched.

The rules (owner, 2026-10-16): the referenced projects MUST be given as applications (-app SignIn -project <dir>) - the server does not guess a directory, and a reference to a Module project that no application loads refuses the referring application with a SEVERE naming it; the resolution is transitive (a referenced project may reference further projects, all are included); every referrer gets its own copies; a circular reference, direct or through a chain, is a SEVERE naming the cycle - at the server's start the server does not start, at a hot deploy the reloading application is not accepted and the one loaded before stays. The copies' bin directories enter the application's class loader exactly as its own Module projects' do (M-1).

How a reference finds its application: by the application ID or an alias equal to the Module project name (ServerShell.getAppDefinition(String)), else by the name of an own Module project of a loaded project application (the ID may differ from the project name: -app signin -project .../SignIn); an application of a compiled iiziApp Jar or of the database cannot be referenced by a project application (its Module projects live in the jar).

Author:
Christopher Mindus
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A Module project reference that cannot be resolved: a project that no application loads, an application that is not a project application, a project the found application does not have, or a circular reference.
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<String>
    Gets the names of the Module projects a Module project references in its App Distribution properties.
    Orders the project applications of the server's start so that every application loads after the applications it references: the references are read from the .project and .iiziApp files of the applications' directories, before any of them is loaded.
    resolve(ServerShell server, AppDefinition referrer, AppFactory factory, boolean isHotDeploy)
    Resolves the Module project references of a project application being loaded: the Module projects named by its own Module projects, and transitively by the copies, are loaded from the directories of the applications that load them and added to the application's root container as copies.
  • Method Details

    • getReferencedModuleNames

      public static List<String> getReferencedModuleNames(ModuleProjectPropCnr module)
      Gets the names of the Module projects a Module project references in its App Distribution properties.
      Parameters:
      module - The Module project.
      Returns:
      The trimmed, non-empty names, in the order of the modules property; empty for none.
    • resolve

      public static Map<AppDefinition, Long> resolve(ServerShell server, AppDefinition referrer, AppFactory factory, boolean isHotDeploy) throws AppModuleReferences.ReferenceException, IOException, PropException
      Resolves the Module project references of a project application being loaded: the Module projects named by its own Module projects, and transitively by the copies, are loaded from the directories of the applications that load them and added to the application's root container as copies. Called by the application definition after its own directories are loaded and before the factory is prepared (the class loader, the reference resolution).
      Parameters:
      server - The server.
      referrer - The application definition being loaded.
      factory - Its factory, with the own Module projects loaded.
      isHotDeploy - Flag for a hot deploy reload (the messages differ: the application keeps running as before).
      Returns:
      The referenced application definitions with the load generation each copy was taken from, in order of inclusion; empty for an application without references.
      Throws:
      AppModuleReferences.ReferenceException - When a reference cannot be resolved or is circular: the application is refused.
      IOException - For file errors of a copy.
      PropException - For property errors of a copy.
    • orderForLoad

      Orders the project applications of the server's start so that every application loads after the applications it references: the references are read from the .project and .iiziApp files of the applications' directories, before any of them is loaded. A circular reference is refused here, naming the cycle.

      A reference to a Module project that none of the applications loads is NOT refused here: the application's own load does that (an application of a compiled jar may be meant, which is refused as well, naming it).

      Parameters:
      loader - The server (the file loader of the .iiziApp files).
      apps - The project application definitions, in their command-line order.
      Returns:
      The same definitions, the referenced ones before the referring ones; the command-line order otherwise.
      Throws:
      AppModuleReferences.ReferenceException - For a circular reference among the applications: the server does not start.
      IOException - For file errors.
      PropException - For property errors of a .iiziApp file.