01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package javax.xml.registry;
23:
24: import java.io.ObjectStreamField;
25: import java.io.ObjectInputStream;
26: import java.io.IOException;
27: import java.io.ObjectOutputStream;
28: import javax.xml.registry.infomodel.Key;
29: import javax.xml.namespace.QName;
30:
31: import org.jboss.util.id.SerialVersion;
32:
33: /**
34: * @author Scott.Stark@jboss.org
35: * @version $Revision: 57196 $
36: */
37: public class RegistryException extends JAXRException {
38: /** @since 4.0.2 */
39: static final long serialVersionUID;
40: static final int KEY_IDX = 0;
41: private static final ObjectStreamField[] serialPersistentFields;
42: static {
43: if (SerialVersion.version == SerialVersion.LEGACY) {
44: serialVersionUID = 5830899222180533586L;
45: serialPersistentFields = new ObjectStreamField[] { new ObjectStreamField(
46: "key", QName.class), };
47: } else {
48: serialVersionUID = -2972094643801708304L;
49: serialPersistentFields = new ObjectStreamField[] { new ObjectStreamField(
50: "errorObjectKey", QName.class), };
51: }
52: }
53:
54: private Key key;
55:
56: public RegistryException() {
57: }
58:
59: public RegistryException(String msg) {
60: this (msg, null);
61: }
62:
63: public RegistryException(String msg, Throwable cause) {
64: super (msg, cause);
65: }
66:
67: public RegistryException(Throwable cause) {
68: super (cause);
69: }
70:
71: public Key getErrorObjectKey() throws JAXRException {
72: return key;
73: }
74:
75: public void setErrorObjectKey(Key key) throws JAXRException {
76: this .key = key;
77: }
78:
79: // Private -------------------------------------------------------
80: private void readObject(ObjectInputStream ois)
81: throws ClassNotFoundException, IOException {
82: ObjectInputStream.GetField fields = ois.readFields();
83: String name = serialPersistentFields[KEY_IDX].getName();
84: this .key = (Key) fields.get(name, null);
85: }
86:
87: private void writeObject(ObjectOutputStream oos) throws IOException {
88: ObjectOutputStream.PutField fields = oos.putFields();
89: String name = serialPersistentFields[KEY_IDX].getName();
90: fields.put(name, key);
91: oos.writeFields();
92: }
93: }
|