001/**
002 *
003 * Copyright 2017 Florian Schmaus
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jivesoftware.smackx.pubsub;
018
019import org.jivesoftware.smack.SmackException;
020
021import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
022
023import org.jxmpp.jid.BareJid;
024
025public abstract class PubSubException extends SmackException {
026
027    /**
028     *
029     */
030    private static final long serialVersionUID = 1L;
031
032    private final String nodeId;
033
034    protected PubSubException(String nodeId) {
035        this.nodeId = nodeId;
036    }
037
038    public String getNodeId() {
039        return nodeId;
040    }
041
042    public static class NotALeafNodeException extends PubSubException {
043
044        /**
045         *
046         */
047        private static final long serialVersionUID = 1L;
048
049        private final BareJid pubSubService;
050
051        NotALeafNodeException(String nodeId, BareJid pubSubService) {
052            super(nodeId);
053            this.pubSubService = pubSubService;
054        }
055
056        public BareJid getPubSubService() {
057            return pubSubService;
058        }
059
060    }
061
062    public static class NotAPubSubNodeException extends PubSubException {
063
064        /**
065         *
066         */
067        private static final long serialVersionUID = 1L;
068
069        private final DiscoverInfo discoverInfo;
070
071        NotAPubSubNodeException(String nodeId, DiscoverInfo discoverInfo) {
072            super(nodeId);
073            this.discoverInfo = discoverInfo;
074        }
075
076        public DiscoverInfo getDiscoverInfo() {
077            return discoverInfo;
078        }
079    }
080}