PubSubException.java

  1. /**
  2.  *
  3.  * Copyright 2017 Florian Schmaus
  4.  *
  5.  * Licensed under the Apache License, Version 2.0 (the "License");
  6.  * you may not use this file except in compliance with the License.
  7.  * You may obtain a copy of the License at
  8.  *
  9.  *     http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.jivesoftware.smackx.pubsub;

  18. import org.jivesoftware.smack.SmackException;

  19. import org.jivesoftware.smackx.disco.packet.DiscoverInfo;

  20. import org.jxmpp.jid.BareJid;

  21. public abstract class PubSubException extends SmackException {

  22.     /**
  23.      *
  24.      */
  25.     private static final long serialVersionUID = 1L;

  26.     private final String nodeId;

  27.     protected PubSubException(String nodeId) {
  28.         this.nodeId = nodeId;
  29.     }

  30.     public String getNodeId() {
  31.         return nodeId;
  32.     }

  33.     public static class NotALeafNodeException extends PubSubException {

  34.         /**
  35.          *
  36.          */
  37.         private static final long serialVersionUID = 1L;

  38.         private final BareJid pubSubService;

  39.         NotALeafNodeException(String nodeId, BareJid pubSubService) {
  40.             super(nodeId);
  41.             this.pubSubService = pubSubService;
  42.         }

  43.         public BareJid getPubSubService() {
  44.             return pubSubService;
  45.         }

  46.     }

  47.     public static class NotAPubSubNodeException extends PubSubException {

  48.         /**
  49.          *
  50.          */
  51.         private static final long serialVersionUID = 1L;

  52.         private final DiscoverInfo discoverInfo;

  53.         NotAPubSubNodeException(String nodeId, DiscoverInfo discoverInfo) {
  54.             super(nodeId);
  55.             this.discoverInfo = discoverInfo;
  56.         }

  57.         public DiscoverInfo getDiscoverInfo() {
  58.             return discoverInfo;
  59.         }
  60.     }
  61. }