Class Module

    • Method Detail

      • getDependencies

        public java.util.List<Dependency> getDependencies()
        Specified by:
        getDependencies in interface IModule
        Returns:
        A list of dependencies for this module. The list may contain both libraries and other modules. The dependency graph must not have cycles.
      • getSourcePath

        public java.util.List<IDirectory> getSourcePath()
        Specified by:
        getSourcePath in interface IModule
        Returns:
        The path[s] having source files that should be exposed to this module.
      • getModuleClassLoader

        public java.lang.ClassLoader getModuleClassLoader()
        Description copied from interface: IModule
        Get class loader, associated with this module.
        Specified by:
        getModuleClassLoader in interface IModule
        Returns:
      • scanPaths

        private static void scanPaths​(java.util.List<IDirectory> paths,
                                      java.util.Set<java.lang.String> extensions,
                                      java.util.List<IDirectory> roots)
      • setModuleTypeLoader

        public void setModuleTypeLoader​(ModuleTypeLoader modTypeLoader)
      • configurePaths

        public void configurePaths​(java.util.List<IDirectory> classpath,
                                   java.util.List<IDirectory> sourcePaths,
                                   java.util.List<IDirectory> backingSourcePaths)
        Description copied from interface: IModule
        Configure both source and Java classpaths of the module in a semi-automated way. First parameter is Java classpath. Second parameter is extended with all paths from Java classpath that are marked to have Gosu "sources" (through MANIFEST.MF with Contains-Sources header) and used as Gosu source path.
        Specified by:
        configurePaths in interface IModule
        Parameters:
        classpath - path to types not directly in the module's sources e.g., jar files containing .class files and other types/resources
        sourcePaths - path to the sources directly defined in this module; sources in this path are statically compiled as part of this module's build target e.g., ./src directories
        backingSourcePaths - path to sources corresponding with the classpath parameter (intended for IDE use)
      • addFromManifestClassPath

        private java.util.List<IDirectory> addFromManifestClassPath​(java.util.List<IDirectory> classpath)

        This will add items to the Gosu classpath, but only under very specific circumstances.

        If both of the following conditions are met:

        • The JAR's manifest contains a Class-Path entry
        • The Class-Path entry contains a space-delimited list of URIs

        Then the entries will be parsed and added to the Gosu classpath.

        This logic also handles strange libraries packaged pre-Maven such as xalan:xalan:2.4.1

        The xalan JAR above has a Class-Path attribute referencing the following:

           Class-Path: xercesImpl.jar xml-apis.jar
         
        These unqualified references should have been resolved by the build tooling, and if we try to interfere and resolve the references, we may cause classpath confusion. Therefore any Class-Path entry not resolvable to an absolute path on disk (and, therefore, can be listed as a URL) will be skipped.
        Parameters:
        classpath - The module's Java classpath
        Returns:
        The original classpath, possibly with dependencies listed in JAR manifests Class-Path extracted and explicitly listed
        See Also:
        Attributes.Name.CLASS_PATH
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getNativeModule

        public java.lang.Object getNativeModule()
        Specified by:
        getNativeModule in interface IModule
        Returns:
        The module/project from the execution environment that corresponds with this logical module. For example, in Eclipse the native module is of type IJavaProject.
      • initializeTypeLoaders

        public void initializeTypeLoaders()
      • createExtensionTypeLoaders

        protected void createExtensionTypeLoaders()
      • createExtensionTypeloadersImpl

        protected void createExtensionTypeloadersImpl()
      • getExtensionTypeloaderNames

        private java.util.Set<java.lang.String> getExtensionTypeloaderNames()
      • createStandardTypeLoaders

        protected void createStandardTypeLoaders()
      • maybeCreateModuleTypeLoader

        protected void maybeCreateModuleTypeLoader()
      • buildTraversalList

        private IModule[] buildTraversalList()
      • traverse

        protected void traverse​(IModule theModule,
                                java.util.List<IModule> traversalList)
      • getTypeLoaders

        public <T extends ITypeLoader> java.util.List<? extends T> getTypeLoaders​(java.lang.Class<T> typeLoaderClass)
        Description copied from interface: IModule
        Returns typeloaders of the given class that are local to this module as well as such typeloaders from dependent modules.
        Specified by:
        getTypeLoaders in interface IModule
        Returns:
      • getExtensionClassLoader

        private java.lang.ClassLoader getExtensionClassLoader()
      • getExtensionURLs

        private java.net.URL[] getExtensionURLs()
      • getConstructor

        private java.lang.reflect.Constructor getConstructor​(java.lang.Class<?> loaderClass,
                                                             java.lang.Class... argTypes)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface IModule
        Returns:
        A unique name relative to all other modules in a given execution environment.
      • setName

        public void setName​(java.lang.String name)
        Specified by:
        setName in interface IModule
      • getAdditionalSourceRoots

        protected java.util.List<IDirectory> getAdditionalSourceRoots()