本文整理汇总了Java中org.jivesoftware.smackx.ServiceDiscoveryManager.removeFeature方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceDiscoveryManager.removeFeature方法的具体用法?Java ServiceDiscoveryManager.removeFeature怎么用?Java ServiceDiscoveryManager.removeFeature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.ServiceDiscoveryManager
的用法示例。
在下文中一共展示了ServiceDiscoveryManager.removeFeature方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setServiceEnabled
import org.jivesoftware.smackx.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.
*/
public static void setServiceEnabled(final Connection connection,
final boolean isEnabled) {
ServiceDiscoveryManager manager = ServiceDiscoveryManager
.getInstanceFor(connection);
List<String> namespaces = new ArrayList<String>();
namespaces.addAll(Arrays.asList(NAMESPACE));
namespaces.add(InBandBytestreamManager.NAMESPACE);
if (!IBB_ONLY) {
namespaces.add(Socks5BytestreamManager.NAMESPACE);
}
for (String namespace : namespaces) {
if (isEnabled) {
if (!manager.includesFeature(namespace)) {
manager.addFeature(namespace);
}
} else {
manager.removeFeature(namespace);
}
}
}
示例2: setServiceEnabled
import org.jivesoftware.smackx.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.
*/
public static void setServiceEnabled(final Connection connection,
final boolean isEnabled) {
ServiceDiscoveryManager manager = ServiceDiscoveryManager
.getInstanceFor(connection);
List<String> namespaces = new ArrayList<String>();
namespaces.addAll(Arrays.asList(NAMESPACE));
namespaces.add(InBandBytestreamManager.NAMESPACE);
if (!IBB_ONLY) {
namespaces.add(Socks5BytestreamManager.NAMESPACE);
}
for (String namespace : namespaces) {
if (isEnabled) {
if (!manager.includesFeature(namespace)) {
manager.addFeature(namespace);
}
} else {
manager.removeFeature(namespace);
}
}
}
示例3: disableService
import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
* Disables the SOCKS5 Bytestream manager by removing the SOCKS5 Bytestream feature from the
* service discovery, disabling the listener for SOCKS5 Bytestream initiation requests and
* resetting its internal state.
* <p>
* To re-enable the SOCKS5 Bytestream feature invoke {@link #getBytestreamManager(Connection)}.
* Using the file transfer API will automatically re-enable the SOCKS5 Bytestream feature.
*/
public synchronized void disableService() {
// remove initiation packet listener
this.connection.removePacketListener(this.initiationListener);
// shutdown threads
this.initiationListener.shutdown();
// clear listeners
this.allRequestListeners.clear();
this.userListeners.clear();
// reset internal state
this.lastWorkingProxy = null;
this.proxyBlacklist.clear();
this.ignoredBytestreamRequests.clear();
// remove manager from static managers map
managers.remove(this.connection);
// shutdown local SOCKS5 proxy if there are no more managers for other connections
if (managers.size() == 0) {
Socks5Proxy.getSocks5Proxy().stop();
}
// remove feature from service discovery
ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(this.connection);
// check if service discovery is not already disposed by connection shutdown
if (serviceDiscoveryManager != null) {
serviceDiscoveryManager.removeFeature(NAMESPACE);
}
}
示例4: disableService
import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
* Disables the SOCKS5 Bytestream manager by removing the SOCKS5 Bytestream feature from the
* service discovery, disabling the listener for SOCKS5 Bytestream initiation requests and
* resetting its internal state, which includes removing this instance from the managers map.
* <p>
* To re-enable the SOCKS5 Bytestream feature invoke {@link #getBytestreamManager(Connection)}.
* Using the file transfer API will automatically re-enable the SOCKS5 Bytestream feature.
*/
public synchronized void disableService() {
// remove initiation packet listener
this.connection.removePacketListener(this.initiationListener);
// shutdown threads
this.initiationListener.shutdown();
// clear listeners
this.allRequestListeners.clear();
this.userListeners.clear();
// reset internal state
this.lastWorkingProxy = null;
this.proxyBlacklist.clear();
this.ignoredBytestreamRequests.clear();
// remove manager from static managers map
managers.remove(this.connection);
// shutdown local SOCKS5 proxy if there are no more managers for other connections
if (managers.size() == 0) {
Socks5Proxy.getSocks5Proxy().stop();
}
// remove feature from service discovery
ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(this.connection);
// check if service discovery is not already disposed by connection shutdown
if (serviceDiscoveryManager != null) {
serviceDiscoveryManager.removeFeature(NAMESPACE);
}
}
示例5: disableService
import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
* Disables the SOCKS5 Bytestream manager by removing the SOCKS5 Bytestream
* feature from the service discovery, disabling the listener for SOCKS5
* Bytestream initiation requests and resetting its internal state.
* <p>
* To re-enable the SOCKS5 Bytestream feature invoke
* {@link #getBytestreamManager(Connection)}. Using the file transfer API
* will automatically re-enable the SOCKS5 Bytestream feature.
*/
public synchronized void disableService() {
// remove initiation packet listener
this.connection.removePacketListener(this.initiationListener);
// shutdown threads
this.initiationListener.shutdown();
// clear listeners
this.allRequestListeners.clear();
this.userListeners.clear();
// reset internal state
this.lastWorkingProxy = null;
this.proxyBlacklist.clear();
this.ignoredBytestreamRequests.clear();
// remove manager from static managers map
managers.remove(this.connection);
// shutdown local SOCKS5 proxy if there are no more managers for other
// connections
if (managers.size() == 0) {
Socks5Proxy.getSocks5Proxy().stop();
}
// remove feature from service discovery
ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager
.getInstanceFor(this.connection);
// check if service discovery is not already disposed by connection
// shutdown
if (serviceDiscoveryManager != null) {
serviceDiscoveryManager.removeFeature(NAMESPACE);
}
}
示例6: removeFeature
import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
* Removes a feature that can be discovered through Disco.
*
* @param namespace the namespace to remove.
*/
public static void removeFeature(String namespace) {
// Obtain the ServiceDiscoveryManager associated with my XMPPConnection
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(getConnection());
// Register that a new feature is supported by this XMPP entity
discoManager.removeFeature(namespace);
}