当前位置: 首页>>代码示例>>Java>>正文


Java XMPPException类代码示例

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

	});
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:23,代码来源:Socks5BytestreamsConnectionManager.java

示例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);
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:18,代码来源:SoftwareVersionModule.java

示例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;
	}
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:20,代码来源:SaslModule.java

示例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);
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:17,代码来源:DiscoveryModule.java

示例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;
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:24,代码来源:Stanza.java

示例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;
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:17,代码来源:AdHocCommansModule.java

示例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);
}
 
开发者ID:liule,项目名称:tigase-jaxmpp2,代码行数:18,代码来源:SoftwareVersionModule.java

示例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;
}
 
开发者ID:liule,项目名称:tigase-jaxmpp2,代码行数:24,代码来源:Stanza.java

示例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);
	}
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:8,代码来源:JingleModule.java

示例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);	
	}
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:32,代码来源:StreamManagementModule.java

示例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);
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:10,代码来源:SaslModule.java

示例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);
	}
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:15,代码来源:AbstractIQModule.java

示例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);
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:10,代码来源:RosterModule.java

示例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);
	}
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:12,代码来源:MessageCarbonsModule.java

示例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();
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:12,代码来源:AdHocCommansModule.java


注:本文中的tigase.jaxmpp.core.client.XMPPException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。