本文整理汇总了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()}));
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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));
}
示例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);
}
}
示例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);
}