本文整理汇总了Java中org.jivesoftware.openfire.handler.IQHandler类的典型用法代码示例。如果您正苦于以下问题:Java IQHandler类的具体用法?Java IQHandler怎么用?Java IQHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IQHandler类属于org.jivesoftware.openfire.handler包,在下文中一共展示了IQHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractXepSupport
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
public AbstractXepSupport(XMPPServer server, String namespace,String iqDispatcherNamespace, String iqDispatcherName, boolean muc) {
this.server = server;
this.element2Handlers = Collections
.synchronizedMap(new HashMap<String, IQHandler>());
this.iqDispatcher = new AbstractIQHandler(iqDispatcherName, null, iqDispatcherNamespace) {
public IQ handleIQ(IQ packet) throws UnauthorizedException {
if (!MonitoringPlugin.getInstance().isEnabled()) {
return error(packet,
PacketError.Condition.feature_not_implemented);
}
final IQHandler iqHandler = element2Handlers.get(packet
.getChildElement().getName());
if (iqHandler != null) {
return iqHandler.handleIQ(packet);
} else {
return error(packet,
PacketError.Condition.feature_not_implemented);
}
}
};
this.namespace = namespace;
this.iqHandlers = Collections.emptyList();
this.muc = muc;
}
示例2: start
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
public void start() {
for (IQHandler iqHandler : iqHandlers) {
try {
iqHandler.initialize(server);
iqHandler.start();
} catch (Exception e) {
Log.error("Unable to initialize and start "
+ iqHandler.getClass());
continue;
}
element2Handlers.put(iqHandler.getInfo().getName(), iqHandler);
if (iqHandler instanceof ServerFeaturesProvider) {
for (Iterator<String> i = ((ServerFeaturesProvider) iqHandler)
.getFeatures(); i.hasNext();) {
server.getIQDiscoInfoHandler().addServerFeature(i.next());
}
}
}
server.getIQDiscoInfoHandler().addServerFeature(NAMESPACE_AUTO);
server.getIQRouter().addHandler(iqDispatcher);
}
示例3: stop
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
public void stop() {
IQRouter iqRouter = server.getIQRouter();
IQDiscoInfoHandler iqDiscoInfoHandler = server.getIQDiscoInfoHandler();
for (IQHandler iqHandler : iqHandlers) {
element2Handlers.remove(iqHandler.getInfo().getName());
try {
iqHandler.stop();
iqHandler.destroy();
} catch (Exception e) {
Log.warn("Unable to stop and destroy " + iqHandler.getClass());
}
if (iqHandler instanceof ServerFeaturesProvider) {
for (Iterator<String> i = ((ServerFeaturesProvider) iqHandler)
.getFeatures(); i.hasNext();) {
if (iqDiscoInfoHandler != null) {
iqDiscoInfoHandler.removeServerFeature(i.next());
}
}
}
}
if (iqRouter != null) {
iqRouter.removeHandler(iqDispatcher);
}
}
示例4: addIQHandler
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
@Override
public void addIQHandler(IQHandler iqHandler) {
if (this.iqHandlers == null) {
this.iqHandlers = new HashMap<>();
}
this.iqHandlers.put(iqHandler.getInfo().getNamespace(), iqHandler);
}
示例5: removeIQHandler
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
@Override
public void removeIQHandler(IQHandler iqHandler) {
if (this.iqHandlers != null) {
if (iqHandler == this.iqHandlers.get(iqHandler.getInfo().getNamespace())) {
this.iqHandlers.remove(iqHandler.getInfo().getNamespace());
}
}
}
示例6: getHandler
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
private IQHandler getHandler(String namespace) {
IQHandler handler = namespace2Handlers.get(namespace);
if (handler == null) {
for (IQHandler handlerCandidate : iqHandlers) {
IQHandlerInfo handlerInfo = handlerCandidate.getInfo();
if (handlerInfo != null && namespace.equalsIgnoreCase(handlerInfo.getNamespace())) {
handler = handlerCandidate;
namespace2Handlers.put(namespace, handler);
break;
}
}
}
return handler;
}
示例7: start
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
public void start() {
for (IQHandler iqHandler : iqHandlers) {
try {
iqHandler.initialize(server);
iqHandler.start();
} catch (Exception e) {
Log.error("Unable to initialize and start "
+ iqHandler.getClass());
continue;
}
element2Handlers.put(iqHandler.getInfo().getName(), iqHandler);
if (iqHandler instanceof ServerFeaturesProvider) {
for (Iterator<String> i = ((ServerFeaturesProvider) iqHandler)
.getFeatures(); i.hasNext();) {
server.getIQDiscoInfoHandler().addServerFeature(i.next());
}
}
if (muc) {
MultiUserChatManager manager = server.getMultiUserChatManager();
for (MultiUserChatService mucService : manager.getMultiUserChatServices()) {
mucService.addIQHandler(iqHandler);
mucService.addExtraFeature(namespace);
}
}
}
server.getIQDiscoInfoHandler().addServerFeature(namespace);
server.getIQRouter().addHandler(iqDispatcher);
}
示例8: stop
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
public void stop() {
IQRouter iqRouter = server.getIQRouter();
IQDiscoInfoHandler iqDiscoInfoHandler = server.getIQDiscoInfoHandler();
for (IQHandler iqHandler : iqHandlers) {
element2Handlers.remove(iqHandler.getInfo().getName());
try {
iqHandler.stop();
iqHandler.destroy();
} catch (Exception e) {
Log.warn("Unable to stop and destroy " + iqHandler.getClass());
}
if (iqHandler instanceof ServerFeaturesProvider) {
for (Iterator<String> i = ((ServerFeaturesProvider) iqHandler)
.getFeatures(); i.hasNext();) {
if (iqDiscoInfoHandler != null) {
iqDiscoInfoHandler.removeServerFeature(i.next());
}
}
}
if (muc) {
MultiUserChatManager manager = server.getMultiUserChatManager();
for (MultiUserChatService mucService : manager.getMultiUserChatServices()) {
mucService.removeIQHandler(iqHandler);
mucService.removeExtraFeature(namespace);
}
}
}
if (iqRouter != null) {
iqRouter.removeHandler(iqDispatcher);
}
}
示例9: Xep0136Support
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
public Xep0136Support(XMPPServer server) {
super(server, NAMESPACE_AUTO,IQ_NAMESPACE, "XEP-0136 IQ Dispatcher", false);
iqHandlers = new ArrayList<IQHandler>();
// support for #ns-pref
// iqHandlers.add(new IQPrefHandler());
// support for #ns-manage
iqHandlers.add(new IQListHandler());
iqHandlers.add(new IQRetrieveHandler());
// iqHandlers.add(new IQRemoveHandler());
}
示例10: getIQHandlers
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
/**
* Returns a list with all the modules registered with the server that inherit from IQHandler.
*
* @return a list with all the modules registered with the server that inherit from IQHandler.
*/
public List<IQHandler> getIQHandlers() {
List<IQHandler> answer = new ArrayList<IQHandler>();
for (Module module : modules.values()) {
if (module instanceof IQHandler) {
answer.add((IQHandler) module);
}
}
return answer;
}
示例11: Xep0136Support
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
public Xep0136Support(XMPPServer server) {
this.server = server;
this.element2Handlers = Collections
.synchronizedMap(new HashMap<String, IQHandler>());
this.iqDispatcher = new AbstractIQHandler("XEP-0136 IQ Dispatcher",
null) {
public IQ handleIQ(IQ packet) throws UnauthorizedException {
if (!MonitoringPlugin.getInstance().isEnabled()) {
return error(packet,
PacketError.Condition.feature_not_implemented);
}
final IQHandler iqHandler = element2Handlers.get(packet
.getChildElement().getName());
if (iqHandler != null) {
return iqHandler.handleIQ(packet);
} else {
return error(packet,
PacketError.Condition.feature_not_implemented);
}
}
};
iqHandlers = new ArrayList<IQHandler>();
// support for #ns-pref
// iqHandlers.add(new IQPrefHandler());
// support for #ns-manage
iqHandlers.add(new IQListHandler());
iqHandlers.add(new IQRetrieveHandler());
// iqHandlers.add(new IQRemoveHandler());
}
示例12: addHandler
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
/**
* <p>Adds a new IQHandler to the list of registered handler. The new IQHandler will be
* responsible for handling IQ packet whose namespace matches the namespace of the
* IQHandler.</p>
*
* An IllegalArgumentException may be thrown if the IQHandler to register was already provided
* by the server. The server provides a certain list of IQHandlers when the server is
* started up.
*
* @param handler the IQHandler to add to the list of registered handler.
*/
public void addHandler(IQHandler handler) {
if (iqHandlers.contains(handler)) {
throw new IllegalArgumentException("IQHandler already provided by the server");
}
// Ask the handler to be initialized
handler.initialize(XMPPServer.getInstance());
// Register the handler as the handler of the namespace
namespace2Handlers.put(handler.getInfo().getNamespace(), handler);
}
示例13: removeHandler
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
/**
* <p>Removes an IQHandler from the list of registered handler. The IQHandler to remove was
* responsible for handling IQ packet whose namespace matches the namespace of the
* IQHandler.</p>
*
* An IllegalArgumentException may be thrown if the IQHandler to remove was already provided
* by the server. The server provides a certain list of IQHandlers when the server is
* started up.
*
* @param handler the IQHandler to remove from the list of registered handler.
*/
public void removeHandler(IQHandler handler) {
if (iqHandlers.contains(handler)) {
throw new IllegalArgumentException("Cannot remove an IQHandler provided by the server");
}
// Unregister the handler as the handler of the namespace
namespace2Handlers.remove(handler.getInfo().getNamespace());
}
示例14: addIQHandler
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
/**
* Add a IQHandler to MUC rooms and services. If the IQHandler only supports one or
* other, it should quietly ignore it.
*/
void addIQHandler(IQHandler handler);
示例15: removeIQHandler
import org.jivesoftware.openfire.handler.IQHandler; //导入依赖的package包/类
void removeIQHandler(IQHandler handler);