All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ceylon.modules.bootstrap.loader.InitialModuleLoader Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
package ceylon.modules.bootstrap.loader;

import java.util.Set;

import org.jboss.modules.DependencySpec;
import org.jboss.modules.LocalModuleFinder;
import org.jboss.modules.ModuleFinder;
import org.jboss.modules.ModuleIdentifier;
import org.jboss.modules.ModuleLoadException;
import org.jboss.modules.ModuleLoader;
import org.jboss.modules.ModuleSpec;

import com.redhat.ceylon.model.cmr.JDKUtils;

public class InitialModuleLoader extends ModuleLoader {

    public InitialModuleLoader() {
        super(new ModuleFinder[] { new LocalModuleFinder() });
    }
    
    @Override
    protected ModuleSpec findModule(ModuleIdentifier module) throws ModuleLoadException {
    	if(JDKUtils.isJDKModule(module.getName())){
            ModuleSpec.Builder builder = ModuleSpec.build(module);
            Set jdkPaths = JDKUtils.getJDKPathsByModule(module.getName());
            builder.addDependency(DependencySpec.createSystemDependencySpec(jdkPaths, true));
            return builder.create();
    	}
    	if(JDKUtils.isOracleJDKModule(module.getName())){
            ModuleSpec.Builder builder = ModuleSpec.build(module);
            Set jdkPaths = JDKUtils.getOracleJDKPathsByModule(module.getName());
            builder.addDependency(DependencySpec.createSystemDependencySpec(jdkPaths, true));
            return builder.create();
    	}
    	return super.findModule(module);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy