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

Java EntityImpl类代码示例

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

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



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

示例1: EmbeddedXMPPServer

import org.apache.vysper.xmpp.addressing.EntityImpl; //导入依赖的package包/类
public EmbeddedXMPPServer(int port) throws Exception {

        StorageProviderRegistry providerRegistry = new MemoryStorageProviderRegistry();
        AccountManagement accountManagement = (AccountManagement) providerRegistry.retrieve(AccountManagement.class);

        Entity consumer = EntityImpl.parseUnchecked("[email protected]");
        accountManagement.addUser(consumer, "secret");

        Entity producer = EntityImpl.parseUnchecked("[email protected]");
        accountManagement.addUser(producer, "secret");

        TCPEndpoint endpoint = new TCPEndpoint();
        endpoint.setPort(port);

        InputStream stream = EmbeddedXMPPServer.class.getResourceAsStream("/xmpp/server.jks");

        server = new XMPPServer("apache.camel");
        server.setStorageProviderRegistry(providerRegistry);
        server.addEndpoint(endpoint);
        server.setTLSCertificateInfo(stream, "secret");
        server.setSASLMechanisms(Arrays.asList(new SASLMechanism[]{new Anonymous()}));
    }
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:23,代码来源:EmbeddedXMPPServer.java


示例2: run

import org.apache.vysper.xmpp.addressing.EntityImpl; //导入依赖的package包/类
@Override
public void run(String... args) throws Exception {

    xmppServer = new XMPPServer(domain);
    xmppServer.setStorageProviderRegistry(storageProviderRegistry);

    final TCPEndpoint endpoint = new TCPEndpoint();
    endpoint.setPort(xmppPort);
    xmppServer.addEndpoint(endpoint);

    InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(keystore);
    xmppServer.setTLSCertificateInfo(is, keystorePassword);

    // allow anonymous authentication
    xmppServer.setSASLMechanisms(Arrays.asList(new SASLMechanism[]{new Anonymous()}));

    xmppServer.start();

    // add the multi-user chat module and create a room
    Conference conference = new Conference("Conference");
    conference.createRoom(EntityImpl.parseUnchecked("[email protected]" + domain), "Public Room", RoomType.Public);

    xmppServer.addModule(new MUCModule("conference", conference));
    xmppServer.addModule(new InBandRegistrationModule());
    xmppServer.addModule(new XmppPingModule());
    xmppServer.addModule(new PublishSubscribeModule());
    xmppServer.addModule(new SoftwareVersionModule());

    if (saveMessage) {
        // add MessageHandler
        HandlerDictionary handlerDictionary = new DefaultHandlerDictionary(myMessageHandler);
        ((DefaultServerRuntimeContext) xmppServer.getServerRuntimeContext()).addDictionary(handlerDictionary);
    }

    LOG.info("XMPP Server is running on port {}", xmppPort);
}
 
开发者ID:tumakha,项目名称:xmpp-light,代码行数:37,代码来源:XMPPServerRunner.java


示例3: verifyCredentials

import org.apache.vysper.xmpp.addressing.EntityImpl; //导入依赖的package包/类
@Override
public boolean verifyCredentials(String username, String passwordCleartext, Object credentials) {
    try {
        Entity jid = EntityImpl.parse(username);
        return verifyCredentials(jid, passwordCleartext, credentials);
    } catch (EntityFormatException e) {
        LOG.error("Parse JID failed", e);
    }
    return false;
}
 
开发者ID:tumakha,项目名称:xmpp-light,代码行数:11,代码来源:DbUserManagement.java


示例4: registerAccount

import org.apache.vysper.xmpp.addressing.EntityImpl; //导入依赖的package包/类
public void registerAccount(JID id, String password) throws AccountCreationException
{
    if (!this.users_.contains(id))
    {
        users_.add(id);
        accountManagement_.addUser(EntityImpl.parseUnchecked(id.getId()), password);
    }
}
 
开发者ID:alessandroleite,项目名称:dohko,代码行数:9,代码来源:XmppServer.java


示例5: retrieveRoster

import org.apache.vysper.xmpp.addressing.EntityImpl; //导入依赖的package包/类
@Override public Roster retrieveRoster(Entity jid) {
    Uid uid = new Uid(jid.toString());
    MutableRoster roster = new MutableRoster();
    
    List<TinyUser> users = loadCacheUsers();
    
    if (null == users || users.size() < 1) {
        return roster;
    }
    
    for (TinyUser u : users) {
        // 忽略当前账户
        if (u.account.equals(uid.getAccount())) {
            continue;
        }
        
        try {
            Entity ujid = EntityImpl.parse(u.account + "@" + uid.getDomain());
            List<RosterGroup> groups = Lists.newArrayList();
            String groupName = u.getGroupName();
            if (null != groupName) {
                groups.add(new RosterGroup(groupName));
            }
            RosterItem rosterItem = new RosterItem(
                    ujid, 
                    u.name, 
                    SubscriptionType.BOTH,   
                    AskSubscriptionType.NOT_SET, 
                    groups);
            roster.addItem(rosterItem);
        } catch (EntityFormatException e) {
            LOG.error("method:retrieveRoster,jid:" + jid + ",errorMsg:" + e.getMessage(), e);
        }
    }
    
    return roster;
}
 
开发者ID:imtopsales,项目名称:vysper-demo,代码行数:38,代码来源:NeteaseQiyeApi.java


示例6: start

import org.apache.vysper.xmpp.addressing.EntityImpl; //导入依赖的package包/类
public void start() throws Exception {
    server.start();

    Conference conference = new Conference("Camel XMPP Test Conference");
    conference.createRoom(EntityImpl.parseUnchecked("[email protected]"), "anon", RoomType.FullyAnonymous);
    conference.createRoom(EntityImpl.parseUnchecked("[email protected]"), "test", RoomType.Public);
    server.addModule(new MUCModule("conference", conference));
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:9,代码来源:EmbeddedXMPPServer.java


示例7: setUp

import org.apache.vysper.xmpp.addressing.EntityImpl; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	domain = UUID.randomUUID().toString().replace("-", "");
	username = UUID.randomUUID().toString().replace("-", "");
	password = UUID.randomUUID().toString().replace("-", "");
	resource = UUID.randomUUID().toString().replace("-", "");
	
       ServerSocket socketServer = new ServerSocket();
       socketServer.bind(null);
       
       port = socketServer.getLocalPort();
       socketServer.close();
       
       StorageProviderRegistry providerRegistry = new MemoryStorageProviderRegistry();

       final Entity adminJID = EntityImpl.parseUnchecked(username + "@" + domain);
       final AccountManagement accountManagement = (AccountManagement) providerRegistry .retrieve(AccountManagement.class);
       
       if (!accountManagement.verifyAccountExists(adminJID)) {
           accountManagement.addUser(adminJID, password);
       }
       
       TCPEndpoint tcpEndpoint = new TCPEndpoint();
       tcpEndpoint.setPort(port);

       try (InputStream certStream = this.getClass().getResourceAsStream("/bogus_mina_tls.cert")) {
		server = new XMPPServer(domain);
        server.addEndpoint(tcpEndpoint);
        server.setStorageProviderRegistry(providerRegistry);
        server.setTLSCertificateInfo(certStream, "boguspw");

        server.start();
        
        server.addModule(new SoftwareVersionModule());
        server.addModule(new EntityTimeModule());
        server.addModule(new XmppPingModule());
        server.addModule(new InBandRegistrationModule());
        server.addModule(new AdhocCommandsModule());
        final ServiceAdministrationModule serviceAdministrationModule = new ServiceAdministrationModule();
        // unless admin user account with a secure password is added, this will be not become effective
        serviceAdministrationModule.setAddAdminJIDs(Arrays.asList(adminJID)); 
        server.addModule(serviceAdministrationModule);
       }
}
 
开发者ID:Kixeye,项目名称:kixmpp,代码行数:45,代码来源:KixmppClientTest.java


示例8: verifyCredentials

import org.apache.vysper.xmpp.addressing.EntityImpl; //导入依赖的package包/类
@Override public boolean verifyCredentials(String username, String passwordCleartext,
        Object credentials) {
    return verifyCredentials(EntityImpl.parseUnchecked(username), passwordCleartext, credentials);  
}
 
开发者ID:imtopsales,项目名称:vysper-demo,代码行数:5,代码来源:UserService.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Row1类代码示例发布时间:2022-05-22
下一篇:
Java SimpleIRIMapper类代码示例发布时间: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