当前位置: 首页>>代码示例>>Java>>正文


Java Module类代码示例

本文整理汇总了Java中org.jboss.modules.Module的典型用法代码示例。如果您正苦于以下问题:Java Module类的具体用法?Java Module怎么用?Java Module使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Module类属于org.jboss.modules包,在下文中一共展示了Module类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deploy

import org.jboss.modules.Module; //导入依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    Module module = deploymentUnit.getAttachment(Attachments.MODULE);

    WildFlyConfigBuilder builder = new WildFlyConfigBuilder();
    builder.forClassLoader(module.getClassLoader())
            .addDefaultSources()
            .addDiscoveredSources()
            .addDiscoveredConverters();
    addConfigSourcesFromServices(builder, phaseContext.getServiceRegistry(), module.getClassLoader());
    Config config = builder.build();

    WildFlyConfigProviderResolver.INSTANCE.registerConfig(config, module.getClassLoader());

    if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
        WeldPortableExtensions extensions = WeldPortableExtensions.getPortableExtensions(deploymentUnit);
        extensions.registerExtensionInstance(new ConfigExtension(), deploymentUnit);
    }

}
 
开发者ID:wildfly-extras,项目名称:wildfly-microprofile-config,代码行数:22,代码来源:SubsystemDeploymentProcessor.java

示例2: deploy

import org.jboss.modules.Module; //导入依赖的package包/类
/**
 * Add dependencies for modules required for NoSQL deployments
 */
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final Map<String, String> nosqlDriverModuleNameMap = DriverScanDependencyProcessor.getPerDeploymentDeploymentModuleName(deploymentUnit);
    if (nosqlDriverModuleNameMap == null) {
        return;
    }
    for (String nosqlDriverModuleName : nosqlDriverModuleNameMap.values()) {
        if (nosqlDriverModuleName != null) {
            final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
            final ModuleLoader moduleLoader = Module.getBootModuleLoader();
            addDependency(moduleSpecification, moduleLoader, ModuleIdentifier.fromString(nosqlDriverModuleName));
            addMongoCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
            addCassandraCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
            addNeo4jCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
            addOrientCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:22,代码来源:DriverDependencyProcessor.java

示例3: customize

import org.jboss.modules.Module; //导入依赖的package包/类
@Override
public void customize() throws ModuleLoadException, IOException {

    if (!this.keycloakServer.subresources().themes().isEmpty()) {
        return;
    }

    Module module = Module.getBootModuleLoader().loadModule("org.keycloak.keycloak-themes");
    URL resource = module.getExportedResource("keycloak-themes.jar");

    JARArchive themesArtifact = ShrinkWrap.create(JARArchive.class);
    themesArtifact.as(ZipImporter.class).importFrom(resource.openStream());

    File root = TempFileManager.INSTANCE.newTempDirectory("keycloak-themes", ".d");
    File exportedDir = themesArtifact.as(ExplodedExporter.class).exportExplodedInto(root);
    File themeDir = new File(exportedDir, "theme");

    this.keycloakServer.theme("defaults", (theme) -> {
        theme.dir(themeDir.getAbsolutePath());
        theme.staticmaxage(2592000L);
        theme.cachethemes(true);
        theme.cachetemplates(true);
    });

}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:26,代码来源:KeycloakThemesCustomizer.java

示例4: loadTranslators

import org.jboss.modules.Module; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private void loadTranslators(String moduleName) {
    ClassLoader translatorLoader = this.getClass().getClassLoader();
    try {
        final Module module = Module.getBootModuleLoader().loadModule(moduleName);
        if (module != null) {
            translatorLoader = module.getClassLoader();
            final ServiceLoader<ExecutionFactory> serviceLoader = ServiceLoader.load(ExecutionFactory.class,
                    translatorLoader);
            if (serviceLoader != null) {
                for (ExecutionFactory ef : serviceLoader) {
                    Translator t = ef.getClass().getAnnotation(Translator.class);
                    fraction.translator(t.name(), x -> x.module(moduleName));
                }
            }
        }
    } catch (ModuleLoadException e) {
        //no-op
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:TranslatorCustomizer.java

示例5: main

import org.jboss.modules.Module; //导入依赖的package包/类
public static void main(String... args) throws Exception {
    Path tmpFile = null;
    if (System.getProperty("jboss.cli.config") == null) {
        tmpFile = Files.createTempFile("jboss-cli", ".xml");
        Files.copy(Main.class.getResourceAsStream("/jboss-cli.xml"),
                tmpFile,
                StandardCopyOption.REPLACE_EXISTING);
        System.setProperty("jboss.cli.config", tmpFile.toAbsolutePath().toString());
    }
    Module cli = Module.getBootModuleLoader().loadModule("org.jboss.as.cli");
    try {
        cli.run(args);
    } finally {
        if (tmpFile != null) {
            Files.delete(tmpFile);
        }
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:19,代码来源:Main.java

示例6: start

import org.jboss.modules.Module; //导入依赖的package包/类
/**
 * Start the container.
 *
 * <p>This is a blocking call, which guarateens that when it returns without error, the
 * container is fully started.</p>
 *
 * @return The container.
 * @throws Exception if an error occurs.
 */
public Swarm start() throws Exception {
    INSTANCE = this;

    try (AutoCloseable handle = Performance.time("Swarm.start()")) {

        Module module = Module.getBootModuleLoader().loadModule(CONTAINER_MODULE_NAME);
        Class<?> bootstrapClass = module.getClassLoader().loadClass("org.wildfly.swarm.container.runtime.ServerBootstrapImpl");

        ServerBootstrap bootstrap = (ServerBootstrap) bootstrapClass.newInstance();
        bootstrap
                .withArguments(this.args)
                .withBootstrapDebug(this.debugBootstrap)
                .withExplicitlyInstalledFractions(this.explicitlyInstalledFractions)
                .withSocketBindings(this.socketBindings)
                .withOutboundSocketBindings(this.outboundSocketBindings)
                .withUserComponents(this.userComponentClasses)
                .withXmlConfig(this.xmlConfig)
                .withConfigView(this.configView.get(true));

        this.server = bootstrap.bootstrap();

        return this;
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:34,代码来源:Swarm.java

示例7: stop

import org.jboss.modules.Module; //导入依赖的package包/类
/**
 * Stop the container, first undeploying all deployments.
 *
 * @return THe container.
 * @throws Exception If an error occurs.
 */
public Swarm stop() throws Exception {

    if (this.server == null) {
        throw SwarmMessages.MESSAGES.containerNotStarted("stop()");
    }

    this.server.stop();
    this.server = null;

    Module module = Module.getBootModuleLoader().loadModule(CONTAINER_MODULE_NAME);
    Class<?> shutdownClass = module.getClassLoader().loadClass("org.wildfly.swarm.container.runtime.WeldShutdownImpl");

    WeldShutdown shutdown = (WeldShutdown) shutdownClass.newInstance();
    shutdown.shutdown();

    return this;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:24,代码来源:Swarm.java

示例8: createShrinkWrapDomain

import org.jboss.modules.Module; //导入依赖的package包/类
private void createShrinkWrapDomain() {
    ClassLoader originalCl = Thread.currentThread().getContextClassLoader();
    try {
        if (isFatJar()) {
            Module appModule = Module.getBootModuleLoader().loadModule(APPLICATION_MODULE_NAME);
            Thread.currentThread().setContextClassLoader(appModule.getClassLoader());
        }
        Domain domain = ShrinkWrap.getDefaultDomain();
        domain.getConfiguration().getExtensionLoader().addOverride(ZipExporter.class, ZipExporterImpl.class);
        domain.getConfiguration().getExtensionLoader().addOverride(ZipImporter.class, ZipImporterImpl.class);
        domain.getConfiguration().getExtensionLoader().addOverride(ExplodedExporter.class, ExplodedExporterImpl.class);
        domain.getConfiguration().getExtensionLoader().addOverride(ExplodedImporter.class, ExplodedImporterImpl.class);
        domain.getConfiguration().getExtensionLoader().addOverride(JavaArchive.class, JavaArchiveImpl.class);
        domain.getConfiguration().getExtensionLoader().addOverride(WebArchive.class, WebArchiveImpl.class);
    } catch (Exception e) {
        SwarmMessages.MESSAGES.shrinkwrapDomainSetupFailed(e);
    } finally {
        Thread.currentThread().setContextClassLoader(originalCl);
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:Swarm.java

示例9: getRawUsageText

import org.jboss.modules.Module; //导入依赖的package包/类
@Override
public String getRawUsageText() throws Exception {
    Module module = Module.getBootModuleLoader().loadModule("swarm.application");
    ClassLoader cl = module.getClassLoader();

    InputStream in = cl.getResourceAsStream(META_INF_USAGE_TXT);

    if (in == null) {
        in = cl.getResourceAsStream(WEB_INF_USAGE_TXT);
    }

    if (in == null) {
        in = cl.getResourceAsStream(USAGE_TXT);
    }

    if (in != null) {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
            return reader
                    .lines()
                    .collect(Collectors.joining("\n"));
        }
    }

    return null;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:26,代码来源:ModuleUsageProvider.java

示例10: createDelegate

import org.jboss.modules.Module; //导入依赖的package包/类
private XmlConfigurationPersister createDelegate(File configFile) {

        QName rootElement = new QName(Namespace.CURRENT.getUriString(), "server");
        ExtensionRegistry extensionRegistry = new ExtensionRegistry(
                ProcessType.SELF_CONTAINED,
                new RunningModeControl(RunningMode.NORMAL),
                null,
                null,
                null,
                RuntimeHostControllerInfoAccessor.SERVER
        );
        StandaloneXml parser = new StandaloneXml(Module.getBootModuleLoader(), Executors.newSingleThreadExecutor(), extensionRegistry);

        XmlConfigurationPersister persister = new XmlConfigurationPersister(
                configFile, rootElement, parser, parser, false
        );

        return persister;

    }
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:BootstrapPersister.java

示例11: fromSwarmApplicationModule

import org.jboss.modules.Module; //导入依赖的package包/类
@Produces
@XMLConfig
public URL fromSwarmApplicationModule() {
    try {
        Module app = Module.getBootModuleLoader().loadModule("swarm.application");
        ClassLoader cl = app.getClassLoader();
        URL result = cl.getResource(STANDALONE_XML_FILE);
        if (result != null) {
            SwarmConfigMessages.MESSAGES.loadingStandaloneXml("'swarm.application' module", result.toExternalForm());
        }
        return result;
    } catch (ModuleLoadException e) {
        SwarmConfigMessages.MESSAGES.errorLoadingModule(e);
    }
    return null;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:StandaloneXMLConfigProducer.java

示例12: displayConfigHelp

import org.jboss.modules.Module; //导入依赖的package包/类
public void displayConfigHelp(PrintStream out, String fraction) throws IOException, ModuleLoadException {
    ModuleClassLoader cl = Module.getBootModuleLoader().loadModule("swarm.application").getClassLoader();
    Enumeration<URL> docs = cl.getResources("META-INF/configuration-meta.properties");

    Properties props = new Properties();

    while (docs.hasMoreElements()) {
        URL each = docs.nextElement();
        Properties fractionDocs = new Properties();
        fractionDocs.load(each.openStream());
        if (fraction.equals(ALL) || fraction.equals(fractionDocs.getProperty(FRACTION))) {
            fractionDocs.remove(FRACTION);
            props.putAll(fractionDocs);
        }
    }

    props.stringPropertyNames().stream()
            .sorted()
            .forEach(key -> {
                out.println("# " + key);
                out.println();
                out.println(formatDocs("    ", props.getProperty(key)));
                out.println();
            });
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:26,代码来源:CommandLine.java

示例13: dumpYaml

import org.jboss.modules.Module; //导入依赖的package包/类
public void dumpYaml(PrintStream out, String fraction) throws IOException, ModuleLoadException {
    ModuleClassLoader cl = Module.getBootModuleLoader().loadModule("swarm.application").getClassLoader();
    Enumeration<URL> docs = cl.getResources("META-INF/configuration-meta.properties");

    Properties props = new Properties();

    while (docs.hasMoreElements()) {
        URL each = docs.nextElement();
        Properties fractionDocs = new Properties();
        fractionDocs.load(each.openStream());
        if (fraction.equals(ALL) || fraction.equals(fractionDocs.getProperty(FRACTION))) {
            fractionDocs.remove(FRACTION);
            props.putAll(fractionDocs);
        }
    }

    YamlDumper.dump(out, props);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:19,代码来源:CommandLine.java

示例14: stop

import org.jboss.modules.Module; //导入依赖的package包/类
public void stop() throws Exception {
    Method stopMethod = null;
    Class<?> mainClass = mainMethod.getDeclaringClass();
    try {
        stopMethod = mainClass.getDeclaredMethod("stopMain");
    } catch (NoSuchMethodException e) {
    }

    if (stopMethod != null) {
        stopMethod.invoke(mainClass, (Object[]) null);
    } else {
        Module module = Module.getBootModuleLoader().loadModule("swarm.container");
        Class<?> swarmClass = module.getClassLoader().loadClass("org.wildfly.swarm.Swarm");
        Field instanceField = swarmClass.getField("INSTANCE");
        Object swarmInstance = instanceField.get(null);
        if (swarmInstance != null) {
            stopMethod = swarmClass.getMethod("stop");
            stopMethod.invoke(swarmInstance);
        }
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:22,代码来源:MainInvoker.java

示例15: start

import org.jboss.modules.Module; //导入依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
    try {
        final String artifactName = System.getProperty(BootstrapProperties.APP_ARTIFACT);
        if (artifactName == null) {
            throw new StartException("Failed to find artifact name under " + BootstrapProperties.APP_ARTIFACT);
        }

        final ModuleLoader serviceLoader = this.serviceLoader.getValue();
        final String moduleName = "deployment." + artifactName;
        final Module module = serviceLoader.loadModule(ModuleIdentifier.create(moduleName));
        if (module == null) {
            throw new StartException("Failed to find deployment module under " + moduleName);
        }

        //TODO: allow overriding the default port?
        this.server = Server.create("localhost", 12345, module.getClassLoader());
        this.server.start();
    } catch (ModuleLoadException | ServerLifecycleException e) {
        throw new StartException(e);
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:23,代码来源:DaemonServiceActivator.java


注:本文中的org.jboss.modules.Module类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。