1 9 package org.webdocwf.dods.access; 10 11 import java.io.PrintStream ; 12 import java.io.PrintWriter ; 13 import org.enhydra.dods.exceptions.DodsBaseException; 14 15 public abstract class AccessException extends DodsBaseException { 16 public User usr = null; 17 public String operation = null; 18 public SecureDO obj = null; 19 public String className = null; 20 public String attrName = null; 21 public String value = null; 22 public String oldValue = null; 23 public String datatype = null; 24 public String cmp_op = null; 25 26 40 public AccessException(String msg, User inUsr, String inOperation, SecureDO inObj, String inClassName, String inAttrName, String inValue, String inOldValue, String inDatatype, String inCmp_op) { 41 super(msg); 42 usr = inUsr; 43 operation = inOperation; 44 obj = inObj; 45 className = inClassName; 46 attrName = inAttrName; 47 value = inValue; 48 oldValue = inOldValue; 49 datatype = inDatatype; 50 cmp_op = inCmp_op; 51 } 52 53 69 public AccessException(String msg, Throwable cause, User inUsr, String inOperation, SecureDO inObj, String inClassName, String inAttrName, String inValue, String inOldValue, String inDatatype, String inCmp_op) { 70 super(msg, cause); 71 usr = inUsr; 72 operation = inOperation; 73 obj = inObj; 74 className = inClassName; 75 attrName = inAttrName; 76 value = inValue; 77 oldValue = inOldValue; 78 datatype = inDatatype; 79 cmp_op = inCmp_op; 80 } 81 82 87 public AccessException(String msg) { 88 super(msg); 89 } 90 91 98 public AccessException(String msg, Throwable cause) { 99 super(msg, cause); 100 } 101 102 105 private void printDetails(PrintWriter out) { 106 if (usr != null) { 107 out.println("User : " + usr.getName()); 108 } 109 if (operation != null) { 110 out.println("Operation : " + operation); 111 } 112 if (obj != null) { 113 out.println("Object OID: " + obj.get_OId()); 114 } 115 if (obj != null) { 116 out.println("Object class: " + obj.getClass().getName()); 117 } 118 if (className != null) { 119 out.println("Class name : " + className); 120 } 121 if (attrName != null) { 122 out.println("Attribute name : " + attrName); 123 } 124 if (value != null) { 125 out.println("Value : " + value); 126 } 127 if (oldValue != null) { 128 out.println("Old value : " + oldValue); 129 } 130 if (datatype != null) { 131 out.println("Datatype : " + datatype); 132 } 133 if (cmp_op != null) { 134 out.println("Comparison operator : " + cmp_op); 135 } 136 } 137 138 141 public void printStackTrace() { 142 super.printStackTrace(); 143 printTrace(); 144 } 145 146 149 public void printStackTrace(PrintStream s) { 150 super.printStackTrace(s); 151 printTrace(s); 152 } 153 154 157 public void printStackTrace(PrintWriter s) { 158 super.printStackTrace(s); 159 printTrace(s); 160 } 161 162 165 protected void printTrace() { 166 PrintWriter pw = new PrintWriter (System.err); 167 168 printDetails(pw); 169 pw.flush(); 170 } 171 172 175 protected void printTrace(PrintStream s) { 176 PrintWriter pw = new PrintWriter (s); 177 178 printDetails(pw); 179 pw.flush(); 180 } 181 182 185 public void printTrace(PrintWriter out) { 186 printDetails(out); 187 out.flush(); 188 } 189 } 190 | Popular Tags |