Example usage for java.lang Module Module

List of usage examples for java.lang Module Module

Introduction

In this page you can find the example usage for java.lang Module Module.

Prototype

Module(ClassLoader loader, ModuleDescriptor descriptor) 

Source Link

Document

Creates a named module but without defining the module to the VM.

Usage

From source file:org.cloudcoder.builder2.ccompiler.Compiler.java

/**
 * Add a module to be compiled./*from   w  w  w . j  a  v  a2  s . c  o  m*/
 * 
 * @param sourceFileName the source file name
 * @param code           the code
 */
public void addModule(String sourceFileName, String code) {
    this.modules.add(new Module(sourceFileName, code));
}

From source file:net.sf.eclipsecs.core.config.ConfigurationReader.java

private static List<Module> getModules(final Document document) {

    final List<Module> modules = new ArrayList<Module>();

    document.accept(new VisitorSupport() {

        @Override/*w w w  .j a  va2s.c o  m*/
        public void visit(final Element node) {

            if (XMLTags.MODULE_TAG.equals(node.getName())) {

                final String name = node.attributeValue(XMLTags.NAME_TAG);

                final RuleMetadata metadata = MetadataFactory.getRuleMetadata(name);
                Module module = null;
                if (metadata != null) {
                    module = new Module(metadata, true);
                } else {
                    module = new Module(name);
                }

                addProperties(node, module);
                addMessages(node, module);
                addMetadata(node, module);

                // if the module has not metadata attached we create some
                // generic metadata
                if (module.getMetaData() == null) {
                    MetadataFactory.createGenericMetadata(module);
                }

                modules.add(module);
            }
        }
    });
    return modules;
}

From source file:cn.org.once.cstack.model.Application.java

public Module addModule(Image image) {
    Module module = new Module(this, image);
    modules.add(module);

    return module;
}

From source file:com.sap.dirigible.runtime.scripting.AbstractScriptExecutor.java

public Module retrieveModule(IRepository repository, String module, String extension, String... rootPaths)
        throws IOException {

    for (String rootPath : rootPaths) {
        String resourcePath = createResourcePath(rootPath, module, extension);
        final IResource resource = repository.getResource(resourcePath);
        if (resource.exists()) {
            return new Module(getModuleName(resource.getPath()), readResourceData(repository, resourcePath));
        }// w  ww  .  j a  v a2s  .co m
    }

    logger.error(String.format(THERE_IS_NO_RESOURCE_AT_THE_SPECIFIED_SERVICE_PATH, (module + extension),
            Arrays.toString(rootPaths)));
    throw new FileNotFoundException(THERE_IS_NO_RESOURCE_AT_THE_SPECIFIED_SERVICE_PATH + module + extension);
}

From source file:com.sap.dirigible.runtime.scripting.AbstractScriptExecutor.java

public List<Module> retrieveModulesByExtension(IRepository repository, String extension, String... rootPaths)
        throws IOException {
    Map<String, Module> modules = new HashMap<String, Module>();
    for (int i = rootPaths.length - 1; i >= 0; i--) {
        List<IEntity> entities = repository.searchName(rootPaths[i], "%" + extension, false);
        for (IEntity entity : entities) {
            if (entity.exists()) {
                String path = entity.getPath();
                String moduleName = getModuleName(path);
                Module module = new Module(moduleName, readResourceData(repository, path));
                modules.put(moduleName, module);
            }//  w ww  .j  av  a2  s.co m
        }
    }
    return Arrays.asList(modules.values().toArray(new Module[] {}));
}