Package org.jivesoftware.smack.provider

Examples of org.jivesoftware.smack.provider.PacketExtensionProvider


        String name = description.type;
        String namespace = description.namespace;
        // IQ provider?

        PacketExtensionProvider provider = (PacketExtensionProvider) ProviderManager
            .getInstance().getExtensionProvider(name, namespace);

        byte[] data;
        try {

            if (provider == null) {
                /*
                 * We MUST reject. Else the peer will remain in a endless cycle
                 * in BinaryChannel.sendDirect()
                 */
                transferObject.reject();
                return;
            }

            data = transferObject.accept(monitor);

        } catch (SarosCancellationException e) {
            log.error("User canceled. This is unexpected", e);
            return;
        } catch (IOException e) {
            log.error("Could not deserialize incoming "
                + "transfer object or a connection error occurred", e);
            return;
        }
        if (data == null) {
            log.debug("Received empty transferobject. Discarding transferObject:"
                + transferObject.toString() + ")");
            return;
        }

        MXParser parser = new MXParser();
        PacketExtension extension = null;

        try {
            parser.setInput(new ByteArrayInputStream(data), "UTF-8");
            /*
             * We have to skip the empty start tag because Smack expects a
             * parser that already has started parsing.
             */
            parser.next();
            extension = provider.parseExtension(parser);

        } catch (XmlPullParserException e) {
            log.error("Unexpected encoding error:", e);
            return;
        } catch (Exception e) {
View Full Code Here


                if (parser.getName().equals("event")) {
                } else if (parser.getName().equals("items")) {
                    // Figure out the node for this event.
                    String node = parser.getAttributeValue("", "node");
                    // Get the parser for this kind of node, and if found then parse the node.
                    PacketExtensionProvider nodeParser = nodeParsers.get(node);
                    if (nodeParser != null) {
                        pepItem = nodeParser.parseExtension(parser);
                    }
                 }
            } else if (eventType == XmlPullParser.END_TAG) {
                if (parser.getName().equals("event")) {
                    done = true;
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.provider.PacketExtensionProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.