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


Java Endpoint.getConnectionProviderInterface方法代码示例

本文整理汇总了Java中org.jboss.remoting3.Endpoint.getConnectionProviderInterface方法的典型用法代码示例。如果您正苦于以下问题:Java Endpoint.getConnectionProviderInterface方法的具体用法?Java Endpoint.getConnectionProviderInterface怎么用?Java Endpoint.getConnectionProviderInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.remoting3.Endpoint的用法示例。


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

示例1: create

import org.jboss.remoting3.Endpoint; //导入方法依赖的package包/类
public static ChannelServer create(final Configuration configuration) throws IOException {
    if (configuration == null) {
        throw new IllegalArgumentException("Null configuration");
    }
    configuration.validate();

    // Hack WFCORE-3302/REM3-303 workaround
    if (firstCreate) {
        firstCreate = false;
    } else {
        try {
            // wait in case the previous socket has not closed
            Thread.sleep(100);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new RuntimeException(e);
        }
    }

    // TODO WFCORE-3302 -- Endpoint.getCurrent() should be ok
    final Endpoint endpoint = Endpoint.builder().setEndpointName(configuration.getEndpointName()).build();

    final NetworkServerProvider networkServerProvider = endpoint.getConnectionProviderInterface(configuration.getUriScheme(), NetworkServerProvider.class);
    final SecurityDomain.Builder domainBuilder = SecurityDomain.builder();
    final SimpleMapBackedSecurityRealm realm = new SimpleMapBackedSecurityRealm();
    domainBuilder.addRealm("default", realm).build();
    domainBuilder.setDefaultRealmName("default");
    domainBuilder.setPermissionMapper((permissionMappable, roles) -> PermissionVerifier.ALL);
    SecurityDomain testDomain = domainBuilder.build();
    SaslAuthenticationFactory saslAuthenticationFactory = SaslAuthenticationFactory.builder()
        .setSecurityDomain(testDomain)
        .setMechanismConfigurationSelector(mechanismInformation -> "ANONYMOUS".equals(mechanismInformation.getMechanismName()) ? MechanismConfiguration.EMPTY : null)
        .setFactory(new AnonymousServerFactory())
        .build();
    System.out.println(configuration.getBindAddress());
    AcceptingChannel<StreamConnection> streamServer = networkServerProvider.createServer(configuration.getBindAddress(), OptionMap.EMPTY, saslAuthenticationFactory, null);

    return new ChannelServer(endpoint, null, streamServer);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:40,代码来源:ChannelServer.java

示例2: create

import org.jboss.remoting3.Endpoint; //导入方法依赖的package包/类
public static ChannelServer create(final Configuration configuration) throws IOException {
    if (configuration == null) {
        throw new IllegalArgumentException("Null configuration");
    }
    configuration.validate();

    // Hack WFCORE-3302/REM3-303 workaround
    if (firstCreate) {
        firstCreate = false;
    } else {
        try {
            // wait in case the previous socket has not closed
            Thread.sleep(100);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new RuntimeException(e);
        }
    }

    // TODO WFCORE-3302 -- Endpoint.getCurrent() should be ok
    final Endpoint endpoint = Endpoint.builder().setEndpointName(configuration.getEndpointName()).build();

    final NetworkServerProvider networkServerProvider = endpoint.getConnectionProviderInterface(configuration.getUriScheme(), NetworkServerProvider.class);
    final SecurityDomain.Builder domainBuilder = SecurityDomain.builder();
    final SimpleMapBackedSecurityRealm realm = new SimpleMapBackedSecurityRealm();
    realm.setPasswordMap("bob", ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, "pass".toCharArray()));
    domainBuilder.addRealm("default", realm).build();
    domainBuilder.setDefaultRealmName("default");
    domainBuilder.setPermissionMapper((permissionMappable, roles) -> PermissionVerifier.ALL);
    SecurityDomain testDomain = domainBuilder.build();
    SaslAuthenticationFactory saslAuthenticationFactory = SaslAuthenticationFactory.builder()
        .setSecurityDomain(testDomain)
        .setMechanismConfigurationSelector(mechanismInformation -> {
            switch (mechanismInformation.getMechanismName()) {
                case "ANONYMOUS":
                case "PLAIN": {
                    return MechanismConfiguration.EMPTY;
                }
                default: return null;
            }
        })
        .setFactory(SaslFactories.getElytronSaslServerFactory())
        .build();
    AcceptingChannel<StreamConnection> streamServer = networkServerProvider.createServer(configuration.getBindAddress(), OptionMap.EMPTY, saslAuthenticationFactory, null);

    return new ChannelServer(endpoint, streamServer);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:48,代码来源:ChannelServer.java


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