本文整理汇总了Java中tigase.jaxmpp.core.client.XMPPException类的典型用法代码示例。如果您正苦于以下问题:Java XMPPException类的具体用法?Java XMPPException怎么用?Java XMPPException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMPPException类属于tigase.jaxmpp.core.client包,在下文中一共展示了XMPPException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: requestStreamHosts
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
protected void requestStreamHosts(final JaxmppCore jaxmpp, final ConnectionSession session, final JID proxyJid)
throws JaxmppException {
Socks5BytestreamsModule socks5Module = jaxmpp.getModule(Socks5BytestreamsModule.class);
socks5Module.requestStreamhosts(proxyJid, new StreamhostsCallback(socks5Module) {
@Override
public void onError(Stanza responseStanza, XMPPException.ErrorCondition error) throws JaxmppException {
sendStreamHosts(jaxmpp, session, null);
}
@Override
public void onStreamhosts(List<Streamhost> hosts) throws JaxmppException {
sendStreamHosts(jaxmpp, session, hosts);
}
@Override
public void onTimeout() throws JaxmppException {
sendStreamHosts(jaxmpp, session, null);
}
});
}
示例2: processGet
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
@Override
protected void processGet(IQ element) throws XMPPException, XMLException, JaxmppException {
Element result = XmlTools.makeResult(element);
Element query = ElementFactory.create("query", null, "jabber:iq:version");
result.addChild(query);
String name = context.getSessionObject().getProperty(NAME_KEY);
String version = context.getSessionObject().getProperty(VERSION_KEY);
String os = context.getSessionObject().getProperty(OS_KEY);
query.addChild(ElementFactory.create("name", name == null ? DEFAULT_NAME_VAL : name, null));
query.addChild(ElementFactory.create("version", version == null ? "0.0.0" : version, null));
if (os != null)
query.addChild(ElementFactory.create("os", os, null));
write(result);
}
示例3: process
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
@Override
public void process(Element element) throws XMPPException, XMLException, JaxmppException {
try {
if ("success".equals(element.getName())) {
context.getSessionObject().setProperty(Scope.stream, Connector.DISABLE_KEEPALIVE_KEY, Boolean.FALSE);
processSuccess(element);
} else if ("failure".equals(element.getName())) {
context.getSessionObject().setProperty(Scope.stream, Connector.DISABLE_KEEPALIVE_KEY, Boolean.FALSE);
processFailure(element);
} else if ("challenge".equals(element.getName())) {
processChallenge(element);
}
} catch (ClientSaslException e) {
SaslAuthFailedHandler.SaslAuthFailedEvent event = new SaslAuthFailedHandler.SaslAuthFailedEvent(
context.getSessionObject(), null);
context.getEventBus().fire(event, this);
throw e;
}
}
示例4: processGet
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
@Override
protected void processGet(IQ element) throws JaxmppException {
final Element q = element.getFirstChild("query");
final String node = q.getAttribute("node");
final NodeDetailsCallback callback = callbacks.get(node);
if (callback == null)
throw new XMPPException(ErrorCondition.item_not_found);
if (INFO_XMLNS.equals(q.getXMLNS())) {
processGetInfo(element, q, node, callback);
} else if (ITEMS_XMLNS.equals(q.getXMLNS())) {
processGetItems(element, q, node, callback);
} else
throw new XMPPException(ErrorCondition.bad_request);
}
示例5: getErrorCondition
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
/**
* Returns {@linkplain ErrorCondition} element.
*
* @return {@linkplain ErrorCondition}. <code>null</code> is element not
* present.
*/
public ErrorCondition getErrorCondition() throws XMLException {
List<Element> es = getChildren("error");
final Element error;
if (es != null && es.size() > 0)
error = es.get(0);
else
error = null;
ErrorCondition errorCondition = null;
if (error != null) {
List<Element> conds = error.getChildrenNS(XMPPException.XMLNS);
if (conds != null && conds.size() > 0) {
errorCondition = ErrorCondition.getByElementName(conds.get(0).getName());
}
}
return errorCondition;
}
示例6: getCommandIdentity
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
protected Identity getCommandIdentity(SessionObject sessionObject, IQ requestStanza, String commandNodeName)
throws JaxmppException {
final AdHocCommand command = this.commands.get(commandNodeName);
if (command == null)
throw new XMPPException(ErrorCondition.item_not_found);
else if (!command.isAllowed(requestStanza.getFrom()))
throw new XMPPException(ErrorCondition.forbidden);
Identity identity = new Identity();
identity.setCategory("automation");
identity.setName(command.getName());
identity.setType("command-node");
return identity;
}
示例7: processGet
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
@Override
protected void processGet(IQ element) throws XMPPException, XMLException, JaxmppException {
Element result = XmlTools.makeResult(element);
Element query = new DefaultElement("query", null, "jabber:iq:version");
result.addChild(query);
String name = sessionObject.getProperty(NAME_KEY);
String version = sessionObject.getProperty(VERSION_KEY);
String os = sessionObject.getProperty(OS_KEY);
query.addChild(new DefaultElement("name", name == null ? DEFAULT_NAME_VAL : name, null));
query.addChild(new DefaultElement("version", version == null ? "0.0.0" : version, null));
if (os != null)
query.addChild(new DefaultElement("os", os, null));
writer.write(result);
}
示例8: getErrorCondition
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
/**
* Returns {@linkplain ErrorCondition} element.
*
* @return {@linkplain ErrorCondition}. <code>null</code> is element not
* present.
*/
public ErrorCondition getErrorCondition() throws XMLException {
List<Element> es = getChildren("error");
final Element error;
if (es != null && es.size() > 0)
error = es.get(0);
else
error = null;
ErrorCondition errorCondition = null;
if (error != null) {
List<Element> conds = error.getChildrenNS(XMPPException.XMLNS);
if (conds != null && conds.size() > 0) {
errorCondition = ErrorCondition.getByElementName(conds.get(0).getName());
}
}
return errorCondition;
}
示例9: process
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
@Override
public void process(Element element) throws XMPPException, XMLException, JaxmppException {
if ("iq".equals(element.getName())) {
IQ iq = (IQ) Stanza.create(element);
processIq(iq);
}
}
示例10: processFailed
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
private void processFailed(Element element) throws JaxmppException {
List<Element> errors = element.getChildrenNS(XMPPException.XMLNS);
context.getSessionObject().setProperty(STREAM_MANAGEMENT_TURNED_ON_KEY, Boolean.FALSE);
context.getSessionObject().setProperty(Scope.stream, SM_ACK_ENABLED_KEY, Boolean.FALSE);
context.getSessionObject().setProperty(STREAM_MANAGEMENT_RESUME_KEY, null);
context.getSessionObject().setProperty(STREAM_MANAGEMENT_RESUMPTION_ID_KEY, null);
XMPPException.ErrorCondition condition = ErrorCondition.unexpected_request;
for (Element element2 : errors) {
ErrorCondition tmp = XMPPException.ErrorCondition.getByElementName(element2.getName());
if (tmp != null) {
condition = tmp;
break;
}
}
StreamManagementFailedEvent event = new StreamManagementFailedEvent(context.getSessionObject(), condition);
context.getEventBus().fire(event);
List<Element> notSentElements = null;
synchronized (this.outgoingQueue) {
notSentElements = new ArrayList<Element>(notSentElements);
outgoingQueue.clear();
}
if (!notSentElements.isEmpty()) {
UnacknowledgedEvent eventNotSentElements = new UnacknowledgedEvent(context.getSessionObject(), notSentElements);
context.getEventBus().fire(eventNotSentElements);
}
}
示例11: processChallenge
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
protected void processChallenge(Element element) throws XMPPException, XMLException, JaxmppException {
SaslMechanism mechanism = context.getSessionObject().getProperty(SASL_MECHANISM);
if (mechanism.isComplete(context.getSessionObject()))
throw new ClientSaslException("Mechanism " + mechanism.name() + " is finished but Server sent challenge.");
String v = element.getValue();
String r = mechanism.evaluateChallenge(v, context.getSessionObject());
Element auth = ElementFactory.create("response", r, "urn:ietf:params:xml:ns:xmpp-sasl");
context.getWriter().write(auth);
}
示例12: process
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
@Override
public void process(IQ stanza) throws JaxmppException {
final StanzaType type = stanza.getType();
if (stanza instanceof IQ && type == StanzaType.set)
processSet(stanza);
else if (stanza instanceof IQ && type == StanzaType.get)
processGet(stanza);
else {
log.log(Level.WARNING, "Unhandled stanza " + stanza.getName() + ", type=" + stanza.getAttribute("type") + ", id="
+ stanza.getAttribute("id"));
throw new XMPPException(ErrorCondition.bad_request);
}
}
示例13: processSet
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
@Override
protected void processSet(final IQ stanza) throws JaxmppException {
final JID bindedJid = context.getSessionObject().getProperty(ResourceBinderModule.BINDED_RESOURCE_JID);
if (stanza.getFrom() != null && !stanza.getFrom().getBareJid().equals(bindedJid.getBareJid()))
throw new XMPPException(ErrorCondition.not_allowed);
Element query = stanza.getQuery();
processRosterQuery(query, false);
}
示例14: process
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
@Override
public void process(Message message) throws JaxmppException {
for (Element carb : message.getChildrenNS(XMLNS_MC)) {
if ("received".equals(carb.getName())) {
processReceivedCarbon(message, carb);
} else if ("sent".equals(carb.getName())) {
processSentCarbon(message, carb);
} else
throw new XMPPException(ErrorCondition.bad_request);
}
}
示例15: getCommandFeatures
import tigase.jaxmpp.core.client.XMPPException; //导入依赖的package包/类
protected String[] getCommandFeatures(SessionObject sessionObject, IQ requestStanza, String commandNodeName)
throws JaxmppException {
final AdHocCommand command = this.commands.get(commandNodeName);
if (command == null)
throw new XMPPException(ErrorCondition.item_not_found);
else if (!command.isAllowed(requestStanza.getFrom()))
throw new XMPPException(ErrorCondition.forbidden);
return command.getFeatures();
}