01: /**
02: * $RCSfile: $
03: * $Revision: $
04: * $Date: $
05: *
06: * Copyright (C) 2006 Jive Software. All rights reserved.
07: * This software is the proprietary information of Jive Software. Use is subject to license terms.
08: */package org.jivesoftware.openfire.filetransfer;
09:
10: import java.io.PrintStream;
11: import java.io.PrintWriter;
12:
13: /**
14: * Thrown by a FileTransferInterceptor when a file transfer is rejected my the Interceptor. The file
15: * transfer is aborted and the participating parties are notified.
16: *
17: * @author Alexander Wenckus
18: */
19: public class FileTransferRejectedException extends Exception {
20:
21: private static final long serialVersionUID = 1L;
22:
23: private Throwable nestedThrowable = null;
24:
25: /**
26: * Text to include in a message that will be sent to the sender of the packet that got
27: * rejected. If no text is specified then no message will be sent to the user.
28: */
29: private String rejectionMessage;
30:
31: public FileTransferRejectedException() {
32: super ();
33: }
34:
35: public FileTransferRejectedException(String msg) {
36: super (msg);
37: }
38:
39: public FileTransferRejectedException(Throwable nestedThrowable) {
40: this .nestedThrowable = nestedThrowable;
41: }
42:
43: public FileTransferRejectedException(String msg,
44: Throwable nestedThrowable) {
45: super (msg);
46: this .nestedThrowable = nestedThrowable;
47: }
48:
49: public void printStackTrace() {
50: super .printStackTrace();
51: if (nestedThrowable != null) {
52: nestedThrowable.printStackTrace();
53: }
54: }
55:
56: public void printStackTrace(PrintStream ps) {
57: super .printStackTrace(ps);
58: if (nestedThrowable != null) {
59: nestedThrowable.printStackTrace(ps);
60: }
61: }
62:
63: public void printStackTrace(PrintWriter pw) {
64: super .printStackTrace(pw);
65: if (nestedThrowable != null) {
66: nestedThrowable.printStackTrace(pw);
67: }
68: }
69:
70: /**
71: * Retuns the text to include in a message that will be sent to the intitiator and target
72: * of the file transfer that got rejected or <tt>null</tt> if none was defined. If no text was
73: * specified then no message will be sent to the parties of the rejected file transfer.
74: *
75: * @return the text to include in a message that will be sent to the parties of the file
76: * transfer that got rejected or <tt>null</tt> if none was defined.
77: */
78: public String getRejectionMessage() {
79: return rejectionMessage;
80: }
81:
82: /**
83: * Sets the text to include in a message that will be sent to the intiator and target of the
84: * file transfer that got rejected or <tt>null</tt> if no message will be sent to the parties
85: * of the rejected file transfer. Bt default, no message will be sent.
86: *
87: * @param rejectionMessage the text to include in the notification message for the rejection.
88: */
89: public void setRejectionMessage(String rejectionMessage) {
90: this.rejectionMessage = rejectionMessage;
91: }
92: }
|