01: /*
02: * Copyright 2002 (C) TJDO.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the TJDO License version 1.0.
06: * See the terms of the TJDO License in the documentation provided with this software.
07: *
08: * $Id: SchemaValidationException.java,v 1.4 2003/02/05 18:15:26 jackknifebarber Exp $
09: */
10:
11: package com.triactive.jdo.store;
12:
13: import java.util.Collection;
14: import java.util.Iterator;
15: import javax.jdo.JDODataStoreException;
16:
17: /**
18: * A <tt>SchemaValidationException</tt> is thrown if a mismatch is discovered
19: * between what the JDO runtime thinks the schema should look like and what it
20: * actually looks like.
21: *
22: * @author <a href="mailto:mmartin5@austin.rr.com">Mike Martin</a>
23: * @version $Revision: 1.4 $
24: *
25: * @see Table
26: */
27:
28: public class SchemaValidationException extends JDODataStoreException {
29: /**
30: * Constructs a schema validation exception with the specified detail
31: * message.
32: *
33: * @param msg the detail message
34: */
35:
36: public SchemaValidationException(String msg) {
37: super (msg);
38: }
39:
40: /**
41: * Constructs a schema validation exception with the specified detail
42: * message and nested exception.
43: *
44: * @param msg the detail message
45: * @param nested the nested exception(s).
46: */
47:
48: public SchemaValidationException(String msg, Exception nested) {
49: super (msg, nested);
50: }
51:
52: /**
53: * Converts the given collection of objects to string as a comma-separated
54: * list. If the list is empty the string "<none>" is returned.
55: *
56: * @return A string containing each object in the given collection,
57: * converted toString() and separated by commas.
58: */
59:
60: protected static String toString(Collection objs) {
61: if (objs.isEmpty())
62: return "<none>";
63: else {
64: StringBuffer s = new StringBuffer();
65: Iterator i = objs.iterator();
66:
67: while (i.hasNext()) {
68: if (s.length() > 0)
69: s.append(", ");
70:
71: s.append(i.next());
72: }
73:
74: return s.toString();
75: }
76: }
77: }
|