本文整理汇总了Java中org.jivesoftware.smackx.disco.ServiceDiscoveryManager类的典型用法代码示例。如果您正苦于以下问题:Java ServiceDiscoveryManager类的具体用法?Java ServiceDiscoveryManager怎么用?Java ServiceDiscoveryManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceDiscoveryManager类属于org.jivesoftware.smackx.disco包,在下文中一共展示了ServiceDiscoveryManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doInBackground
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
protected EntityViewActivity doInBackground(EntityViewActivity... activity) {
// Get the XMMPConnection from the manager
AbstractXMPPConnection conn = XMPPConnectionManager.getConnection();
// Obtain the ServiceDiscoveryManager associated with my XMPP connection
this.discoManager = ServiceDiscoveryManager.getInstanceFor(conn);
Entity entity = activity[0].myEntity;
try {
if ( entity.getNode() != null && entity.getNode() != "" ) {
activity[0].myLeafInfo = discoManager.discoverInfo( entity.getJid() , entity.getNode() );
} else {
activity[0].myLeafInfo = discoManager.discoverInfo( entity.getJid() );
}
Log.d(LOGTAG, "Got Info!");
} catch (Exception ex) {
Log.w(LOGTAG, "XMPP Disco error " + ex);
errorMessage = ex.toString() ;
}
return activity[0];
}
开发者ID:marevalo,项目名称:FlowsManager,代码行数:22,代码来源:EntityViewActivity.java
示例2: getReservedNickname
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
/**
* Returns the reserved room nickname for the user in the room. A user may have a reserved
* nickname, for example through explicit room registration or database integration. In such
* cases it may be desirable for the user to discover the reserved nickname before attempting
* to enter the room.
*
* @return the reserved room nickname or <tt>null</tt> if none.
* @throws SmackException if there was no response from the server.
*/
public String getReservedNickname() throws SmackException {
try {
DiscoverInfo result =
ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(
room,
"x-roomuser-item");
// Look for an Identity that holds the reserved nickname and return its name
for (DiscoverInfo.Identity identity : result.getIdentities()) {
return identity.getName();
}
}
catch (XMPPException e) {
LOGGER.log(Level.SEVERE, "Error retrieving room nickname", e);
}
// If no Identity was found then the user does not have a reserved room nickname
return null;
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:27,代码来源:MultiUserChat.java
示例3: setServiceEnabled
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
/**
* Enable the Jabber services related to file transfer on the particular
* connection.
*
* @param connection The connection on which to enable or disable the services.
* @param isEnabled True to enable, false to disable.
*/
private static void setServiceEnabled(final XMPPConnection connection,
final boolean isEnabled) {
ServiceDiscoveryManager manager = ServiceDiscoveryManager
.getInstanceFor(connection);
List<String> namespaces = new ArrayList<String>();
namespaces.addAll(Arrays.asList(NAMESPACE));
namespaces.add(DataPacketExtension.NAMESPACE);
if (!IBB_ONLY) {
namespaces.add(Bytestream.NAMESPACE);
}
for (String namespace : namespaces) {
if (isEnabled) {
manager.addFeature(namespace);
} else {
manager.removeFeature(namespace);
}
}
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:28,代码来源:FileTransferNegotiator.java
示例4: isServiceEnabled
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
/**
* Checks to see if all file transfer related services are enabled on the
* connection.
*
* @param connection The connection to check
* @return True if all related services are enabled, false if they are not.
*/
public static boolean isServiceEnabled(final XMPPConnection connection) {
ServiceDiscoveryManager manager = ServiceDiscoveryManager
.getInstanceFor(connection);
List<String> namespaces = new ArrayList<String>();
namespaces.addAll(Arrays.asList(NAMESPACE));
namespaces.add(DataPacketExtension.NAMESPACE);
if (!IBB_ONLY) {
namespaces.add(Bytestream.NAMESPACE);
}
for (String namespace : namespaces) {
if (!manager.includesFeature(namespace)) {
return false;
}
}
return true;
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:26,代码来源:FileTransferNegotiator.java
示例5: VersionManager
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
private VersionManager(final XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(Version.NAMESPACE);
connection.registerIQRequestHandler(new AbstractIqRequestHandler(Version.ELEMENT, Version.NAMESPACE, IQ.Type.get,
Mode.async) {
@Override
public IQ handleIQRequest(IQ iqRequest) {
if (ourVersion == null) {
return IQ.createErrorResponse(iqRequest, new XMPPError(Condition.not_acceptable));
}
return Version.createResultFor(iqRequest, ourVersion);
}
});
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:19,代码来源:VersionManager.java
示例6: setup
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
/**
* Initialize fields used in the tests.
*/
@Before
public void setup() {
// mock connection
connection = mock(XMPPConnection.class);
// create service discovery manager for mocked connection
ServiceDiscoveryManager.getInstanceFor(connection);
// initialize Socks5ByteStreamManager to get the InitiationListener
byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
// get the InitiationListener from Socks5ByteStreamManager
initiationListener = Whitebox.getInternalState(byteStreamManager, InitiationListener.class);
// create a SOCKS5 Bytestream initiation packet
initBytestream = Socks5PacketUtils.createBytestreamInitiation(initiatorJID, targetJID,
sessionID);
initBytestream.addStreamHost(proxyJID, proxyAddress, 7777);
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:25,代码来源:InitiationListenerTest.java
示例7: checkFeatures
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
private void checkFeatures(ServiceDiscoveryManager discoManager, String uri) throws SmackException, XMPPErrorException {
// Get the information of a given XMPP entity
System.out.println("Discover: " + uri);
// This gets the information of the component
DiscoverInfo discoInfo = discoManager.discoverInfo(uri);
// Get the discovered identities of the remote XMPP entity
List<Identity> identities = discoInfo.getIdentities();
// Display the identities of the remote XMPP entity
for(Identity identity : identities) {
System.out.println(identity.getName());
System.out.println(identity.getType());
System.out.println(identity.getCategory());
}
// Check if component supports rest
if(discoInfo.containsFeature(XwadlIQ.NAMESPACE))
System.out.println("XWADL is supported");
else
throw new SmackException("XWADL is not supported");
if(discoInfo.containsFeature(RestIQ.NAMESPACE))
System.out.println("REST is supported");
else
throw new SmackException("REST is not supported");
}
开发者ID:citlab,项目名称:Intercloud,代码行数:25,代码来源:TestClient.java
示例8: discoverItemsByFeature
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
private List<String> discoverItemsByFeature(XmppURI uri, List<String> features) throws XMPPException, IOException, SmackException {
// discover items
ServiceDiscoveryManager discoveryManager = ServiceDiscoveryManager.getInstanceFor(this.connectionManager.getConnection());
DiscoverItems discoverItems = discoveryManager.discoverItems(uri.getDomain());
List<DiscoverItems.Item> items = discoverItems.getItems();
List<String> result = new ArrayList<>();
// discover infos per item and check if specified feature set is supported
for (DiscoverItems.Item item : items) {
DiscoverInfo discoverInfo = discoveryManager.discoverInfo(item.getEntityID());
boolean conatinsAllFeatures = true;
for (String feature : features) {
if (!discoverInfo.containsFeature(feature)) {
conatinsAllFeatures = false;
break;
}
}
if (conatinsAllFeatures) {
result.add(item.getEntityID());
} else if (logger.isDebugEnabled()) {
logger.debug("Entity {} does not support the specified features.", item.getEntityID());
}
}
return result;
}
开发者ID:citlab,项目名称:Intercloud,代码行数:25,代码来源:XmppService.java
示例9: initServiceDiscovery
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
private void initServiceDiscovery() {
debug(TAG, "init service discovery");
// register connection features
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mConnection);
if (!sdm.includesFeature(DISCO_FEATURE))
sdm.addFeature(DISCO_FEATURE);
if (!sdm.includesFeature(DeliveryReceipt.NAMESPACE))
sdm.addFeature(DeliveryReceipt.NAMESPACE);
sdm.addFeature(HttpFileUploadManager.NAMESPACE);
DeliveryReceiptManager.getInstanceFor(mConnection).dontAutoAddDeliveryReceiptRequests();
DeliveryReceiptManager.getInstanceFor(mConnection).setAutoReceiptMode(DeliveryReceiptManager.AutoReceiptMode.disabled);
}
开发者ID:zom,项目名称:Zom-Android,代码行数:17,代码来源:XmppConnection.java
示例10: setPrivacyList
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
private final void setPrivacyList(XMPPConnection connection) throws NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException {
List<PrivacyItem> list = new ArrayList<PrivacyItem>(PRIVACY_LIST.size() + 10);
list.addAll(PRIVACY_LIST);
// Whitelist all JIDs of the own service, e.g. conference.service.com, proxy.service.com
for (Item i : ServiceDiscoveryManager.getInstanceFor(connection)
.discoverItems(connection.getServiceName()).getItems()) {
PrivacyItem allow = new PrivacyItem(Type.jid, i.getEntityID(), true, list.size() + 1);
list.add(allow);
}
// This is an ugly workaround for XMPP servers that apply privacy lists also to stanzas
// originating from themselves. For example http://issues.igniterealtime.org/browse/OF-724
// Because there are such services in the wild and XEP-0016 is not clear on that topic, we
// explicitly have to add a JID rule that allows stanzas from the service
PrivacyItem allowService = new PrivacyItem(Type.jid, connection.getServiceName(), true,
list.size() + 1);
list.add(allowService);
mPrivacyListManager.createPrivacyList(PRIVACY_LIST_NAME, list);
mPrivacyListManager.setDefaultListName(PRIVACY_LIST_NAME);
}
开发者ID:ProjectMAXS,项目名称:maxs,代码行数:24,代码来源:XMPPPrivacyList.java
示例11: perform
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
@Override
public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception {
String entID = sampler.getPropertyAsString(ENTITY_ID);
res.setSamplerData("Entity ID: " + entID);
ServiceDiscoveryManager discoMgr = ServiceDiscoveryManager.getInstanceFor(sampler.getXMPPConnection());
IQ info;
if (Type.valueOf(sampler.getPropertyAsString(TYPE)) == Type.info) {
info = discoMgr.discoverInfo(entID);
} else {
info = discoMgr.discoverItems(entID);
}
res.setResponseData(info.toXML().toString().getBytes());
return res;
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:15,代码来源:ServiceDiscovery.java
示例12: DisplayedManager
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
private DisplayedManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(Displayed.NAMESPACE);
connection.addAsyncStanzaListener(packet -> {
Displayed receipt = Displayed.from((Message) packet);
for (ReceiptReceivedListener listener : receiptReceivedListeners) {
listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet);
}
}, MESSAGES_WITH_DISPLAYED);
}
开发者ID:ukevgen,项目名称:BizareChat,代码行数:12,代码来源:DisplayedManager.java
示例13: ReceivedManager
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
private ReceivedManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(Received.NAMESPACE);
connection.addAsyncStanzaListener(packet -> {
Received receipt = Received.from((Message) packet);
for (ReceiptReceivedListener listener : receiptReceivedListeners) {
listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet);
}
}, MESSAGES_WITH_RECEIVED);
}
开发者ID:ukevgen,项目名称:BizareChat,代码行数:12,代码来源:ReceivedManager.java
示例14: DeliveredReceiptManager
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
private DeliveredReceiptManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(DeliveredReceipt.NAMESPACE);
connection.addAsyncStanzaListener(packet -> {
DeliveredReceipt receipt = DeliveredReceipt.from((Message) packet);
for (ReceiptReceivedListener listener : receiptReceivedListeners) {
listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet);
}
}, MESSAGES_WITH_DELIVERED_RECEIPT);
}
开发者ID:ukevgen,项目名称:BizareChat,代码行数:12,代码来源:DeliveredReceiptManager.java
示例15: ReadReceiptManager
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
private ReadReceiptManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(ReadReceipt.NAMESPACE);
connection.addAsyncStanzaListener(packet -> {
ReadReceipt receipt = ReadReceipt.from((Message) packet);
for (ReceiptReceivedListener listener : receiptReceivedListeners) {
listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet);
}
}, MESSAGES_WITH_READ_RECEIPT);
}
开发者ID:ukevgen,项目名称:BizareChat,代码行数:12,代码来源:ReadReceiptManager.java
示例16: discoverMUCLightItems
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
public DiscoverItems discoverMUCLightItems() {
DiscoverItems discoverItems = null;
try {
discoverItems = ServiceDiscoveryManager.getInstanceFor(mXMPPConnection).discoverItems(JidCreate.from(MUC_LIGHT_SERVICE_NAME));
} catch (Exception e) {
e.printStackTrace();
}
return discoverItems;
}
开发者ID:esl,项目名称:mangosta-android,代码行数:10,代码来源:XMPPSession.java
示例17: doInBackground
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
@Override
protected Boolean doInBackground(ArrayList<Entity>... entityList) {
Entity entity = null ;
Iterator entityIterator = entityList[0].iterator();
// Get the XMMPConnection from the manager
AbstractXMPPConnection conn = XMPPConnectionManager.getConnection();
// Obtain the ServiceDiscoveryManager associated with my XMPP connection
this.discoManager = ServiceDiscoveryManager.getInstanceFor(conn);
while ( entityIterator.hasNext() ) {
if (this.isCancelled()) {
Log.d(LOGTAG , "Cancelling" );
return null;
}
Log.d(LOGTAG , "Loading info for icons" );
entity = (Entity) entityIterator.next();
try {
if ( entity.getNode() != null && entity.getNode() != "" ) {
entityInfo = discoManager.discoverInfo( entity.getJid() , entity.getNode() );
} else {
entityInfo = discoManager.discoverInfo( entity.getJid() );
}
} catch (Exception ex) {
Log.w(LOGTAG, "XMPP Disco error " + ex);
errorMessage = ex.toString() ;
this.publishProgress( false );
continue;
}
entity.setIdentities( entityInfo.getIdentities() );
this.publishProgress( true );
}
return null ;
}
开发者ID:marevalo,项目名称:FlowsManager,代码行数:37,代码来源:CollectionViewActivity.java
示例18: isEmailAvailable
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
/**
* The workgroup service may be configured to send email. This queries the Workgroup Service
* to see if the email service has been configured and is available.
*
* @return true if the email service is available, otherwise return false.
* @throws SmackException
*/
public boolean isEmailAvailable() throws SmackException {
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
try {
String workgroupService = XmppStringUtils.parseDomain(workgroupJID);
DiscoverInfo infoResult = discoManager.discoverInfo(workgroupService);
return infoResult.containsFeature("jive:email:provider");
}
catch (XMPPException e) {
return false;
}
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:20,代码来源:Workgroup.java
示例19: setServiceEnabled
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
/**
* Enables or disables the XHTML support on a given connection.<p>
*
* Before starting to send XHTML messages to a user, check that the user can handle XHTML
* messages. Enable the XHTML support to indicate that this client handles XHTML messages.
*
* @param connection the connection where the service will be enabled or disabled
* @param enabled indicates if the service will be enabled or disabled
*/
public synchronized static void setServiceEnabled(XMPPConnection connection, boolean enabled) {
if (isServiceEnabled(connection) == enabled)
return;
if (enabled) {
ServiceDiscoveryManager.getInstanceFor(connection).addFeature(XHTMLExtension.NAMESPACE);
}
else {
ServiceDiscoveryManager.getInstanceFor(connection).removeFeature(XHTMLExtension.NAMESPACE);
}
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:21,代码来源:XHTMLManager.java
示例20: getJoinedRooms
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入依赖的package包/类
/**
* Returns a List of the rooms where the requested user has joined. The Iterator will contain Strings where each
* String represents a room (e.g. [email protected]).
*
* @param user the user to check. A fully qualified xmpp ID, e.g. [email protected]
* @return a List of the rooms where the requested user has joined.
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
*/
public List<String> getJoinedRooms(String user) throws NoResponseException, XMPPErrorException,
NotConnectedException {
// Send the disco packet to the user
DiscoverItems result = ServiceDiscoveryManager.getInstanceFor(connection()).discoverItems(user, DISCO_NODE);
List<DiscoverItems.Item> items = result.getItems();
List<String> answer = new ArrayList<String>(items.size());
// Collect the entityID for each returned item
for (DiscoverItems.Item item : items) {
answer.add(item.getEntityID());
}
return answer;
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:23,代码来源:MultiUserChatManager.java
注:本文中的org.jivesoftware.smackx.disco.ServiceDiscoveryManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论