• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Fraction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: postInitialize

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
@Override
public void postInitialize(Fraction.PostInitContext initContext) {
    if (!proxiedServiceMappings.isEmpty()) {
        UndertowFraction undertow = (UndertowFraction) initContext.fraction("undertow");
        HandlerConfiguration handlerConfig = undertow.subresources().handlerConfiguration();
        for (String serviceName : proxiedServiceMappings.keySet()) {
            ReverseProxy proxy = new ReverseProxy(proxyHandlerName(serviceName)).hosts(Collections.emptyList());
            handlerConfig.reverseProxy(proxy);

            String contextPath = proxiedServiceMappings.get(serviceName);
            for (Server server : undertow.subresources().servers()) {
                Location location = new Location(contextPath).handler(proxyHandlerName(serviceName));
                for (Host host : server.subresources().hosts()) {
                    host.location(location);
                }
            }
        }
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-topology,代码行数:20,代码来源:TopologyWebAppFraction.java


示例2: scanInternal

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
private void scanInternal(Object instance) throws Exception {
    if (instance instanceof Fraction) {
        scanFraction((Fraction) instance);
    } else {
        scan(null, instance, false);
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:8,代码来源:ConfigurableManager.java


示例3: nameFor

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
protected ConfigKey nameFor(Fraction fraction) throws Exception {
    Configurable anno = fraction.getClass().getAnnotation(Configurable.class);
    if (anno != null) {
        return ConfigKey.parse(anno.value());
    }

    SimpleKey key = getKey(fraction);

    if (key == null) {
        key = new SimpleKey(fraction.getClass().getSimpleName().replace("Fraction", "").toLowerCase());
    }

    return ConfigKey.of("swarm").append(key);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:15,代码来源:ConfigurableManager.java


示例4: marshal

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
public void marshal(List<ModelNode> list) {
    for (Fraction each : this.fractions) {

        MarshalDMR anno = each.getClass().getAnnotation(MarshalDMR.class);

        if (anno != null) {
            try {
                try (AutoCloseable handle = Performance.time("marshall " + each.getClass().getSimpleName())) {
                    LinkedList<ModelNode> subList = Marshaller.marshal(each);
                    if (!isAlreadyConfigured(subList, list)) {
                        list.addAll(subList);
                    }
                }
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else {
            WildFlySubsystem subsysAnno = each.getClass().getAnnotation(WildFlySubsystem.class);

            if (subsysAnno != null) {
                PathAddress address = PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, subsysAnno.value()));
                if (!isAlreadyConfigured(address.toModelNode(), list)) {
                    ModelNode node = new ModelNode();
                    node.get(OP_ADDR).set(address.toModelNode());
                    node.get(OP).set(ADD);
                    list.add(node);
                }
            }
        }
    }

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


示例5: uninstalledFractionClasses

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Set<Class<? extends Fraction>> uninstalledFractionClasses(Set<Type> installedClasses) throws ModuleLoadException, IOException, ClassNotFoundException {

    Set<String> installedClassNames = installedClasses.stream().map(Type::getTypeName).collect(Collectors.toSet());

    List<String> moduleNames = ApplicationEnvironment.get().bootstrapModules();

    ClassLoader cl = Module.getBootModuleLoader().loadModule("swarm.container").getClassLoader();

    Set<Class<? extends Fraction>> fractionClasses = new HashSet<>();

    for (String moduleName : moduleNames) {
        Module module = Module.getBootModuleLoader().loadModule(moduleName);

        InputStream indexStream = module.getClassLoader().getResourceAsStream("META-INF/jandex.idx");
        if (indexStream != null) {
            IndexReader reader = new IndexReader(indexStream);
            Index index = reader.read();
            Set<ClassInfo> impls = index.getAllKnownImplementors(DotName.createSimple(Fraction.class.getName()));
            for (ClassInfo impl : impls) {
                if (!installedClassNames.contains(impl.name().toString())) {
                    Class<? extends Fraction> fractionClass = (Class<? extends Fraction>) cl.loadClass(impl.name().toString());
                    fractionClasses.add(fractionClass);
                }
            }
        }
    }
    return fractionClasses;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:30,代码来源:FractionProducingExtension.java


示例6: createDefaultLogstashFraction

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
public static Fraction createDefaultLogstashFraction() {
    return new LogstashFraction();
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:4,代码来源:LogstashFraction.java


示例7: createDefaultFluentdFraction

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
public static Fraction createDefaultFluentdFraction() {
    return new FluentdFraction();
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:4,代码来源:FluentdFraction.java


示例8: applyDefaults

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
@Override
public ODataFraction applyDefaults(boolean hasConfiguration) {
    return Fraction.super.applyDefaults(hasConfiguration);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:5,代码来源:ODataFraction.java


示例9: hasConfiguration

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
public boolean hasConfiguration(Fraction fraction) throws Exception {
    ConfigKey prefix = nameFor(fraction);
    return this.configView.hasKeyOrSubkeys(prefix);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:5,代码来源:ConfigurableManager.java


示例10: scanFraction

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
protected void scanFraction(Fraction fraction) throws Exception {
    ConfigKey prefix = nameFor(fraction);
    scan(prefix, fraction, true);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:5,代码来源:ConfigurableManager.java


示例11: withExplicitlyInstalledFractions

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
@Override
public ServerBootstrap withExplicitlyInstalledFractions(Collection<Fraction> explicitlyInstalledFractions) {
    this.explicitlyInstalledFractions = explicitlyInstalledFractions;
    return this;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:6,代码来源:ServerBootstrapImpl.java


示例12: setupFactories

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
@PostConstruct
public void setupFactories() throws Exception {
    for (Fraction fraction : this.fractions) {
        setupFactory(fraction);
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:7,代码来源:StandaloneXMLParserProducer.java


示例13: FractionProducingExtension

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
public FractionProducingExtension(Collection<Fraction> explicitlyInstalled, ConfigurableManager configurableManager) {
    this.explicitlyInstalledFractions.addAll(explicitlyInstalled);
    this.configurableManager = configurableManager;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:5,代码来源:FractionProducingExtension.java


示例14: postInitialize

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
@Override
public void postInitialize(Fraction.PostInitContext initContext) {

    if (System.getProperty("jboss.server.config.dir") == null) {
        try {
            //Path dir = Files.createTempDirectory("swarm-keycloak-config");
            File dir = TempFileManager.INSTANCE.newTempDirectory("swarm-keycloak-config", ".d");
            System.setProperty("jboss.server.config.dir", dir.getAbsolutePath());
            Files.copy(getClass().getClassLoader().getResourceAsStream("keycloak-server.json"),
                       dir.toPath().resolve("keycloak-server.json"),
                       StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    InfinispanFraction infinispan = (InfinispanFraction) initContext.fraction("infinispan");

    CacheContainer cache = infinispan.subresources().cacheContainer("keycloak");
    if (cache == null) {
        infinispan.cacheContainer("keycloak", (c) -> c.jndiName("infinispan/Keycloak")
                .localCache("realms")
                .localCache("users")
                .localCache("sessions")
                .localCache("offlineSessions")
                .localCache("loginFailures")
                .localCache("work")
                .localCache("realmVersions", (ca) -> ca.transactionComponent(new TransactionComponent()
                                                                                     .mode(TransactionComponent.Mode.BATCH)
                                                                                     .locking(TransactionComponent.Locking.PESSIMISTIC)))
        );
    }

    DatasourcesFraction datasources = (DatasourcesFraction) initContext.fraction("datasources");

    if (datasources.subresources().dataSource("KeycloakDS") == null) {
        if (datasources.subresources().jdbcDriver("h2") == null) {
            datasources.jdbcDriver("h2", (driver) -> {
                driver.driverModuleName("com.h2database.h2");
                driver.moduleSlot("main");
                driver.xaDatasourceClass("org.h2.jdbcx.JdbcDataSource");
            });
        }

        datasources.dataSource("KeycloakDS", (ds) -> {
            ds.jndiName("java:jboss/datasources/KeycloakDS");
            ds.useJavaContext(true);
            ds.connectionUrl("jdbc:h2:${wildfly.swarm.keycloak.server.db:./keycloak};AUTO_SERVER=TRUE");
            ds.driverName("h2");
            ds.userName("sa");
            ds.password("sa");
        });
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-keycloak,代码行数:55,代码来源:KeycloakServerFraction.java


示例15: withExplicitlyInstalledFractions

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
ServerBootstrap withExplicitlyInstalledFractions(Collection<Fraction> explicitlyInstalledFractions); 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:2,代码来源:ServerBootstrap.java


示例16: register

import org.wildfly.swarm.spi.api.Fraction; //导入依赖的package包/类
void register(Fraction fraction); 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:2,代码来源:FractionRegistry.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SpiFactory类代码示例发布时间:2022-05-22
下一篇:
Java PropertyInject类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap