KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > triactive > jdo > store > SchemaValidationException


1 /*
2  * Copyright 2002 (C) TJDO.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the TJDO License version 1.0.
6  * See the terms of the TJDO License in the documentation provided with this software.
7  *
8  * $Id: SchemaValidationException.java,v 1.4 2003/02/05 18:15:26 jackknifebarber Exp $
9  */

10
11 package com.triactive.jdo.store;
12
13 import java.util.Collection JavaDoc;
14 import java.util.Iterator JavaDoc;
15 import javax.jdo.JDODataStoreException;
16
17
18 /**
19  * A <tt>SchemaValidationException</tt> is thrown if a mismatch is discovered
20  * between what the JDO runtime thinks the schema should look like and what it
21  * actually looks like.
22  *
23  * @author <a HREF="mailto:mmartin5@austin.rr.com">Mike Martin</a>
24  * @version $Revision: 1.4 $
25  *
26  * @see Table
27  */

28
29 public class SchemaValidationException extends JDODataStoreException
30 {
31     /**
32      * Constructs a schema validation exception with the specified detail
33      * message.
34      *
35      * @param msg the detail message
36      */

37
38     public SchemaValidationException(String JavaDoc msg)
39     {
40         super(msg);
41     }
42
43
44     /**
45      * Constructs a schema validation exception with the specified detail
46      * message and nested exception.
47      *
48      * @param msg the detail message
49      * @param nested the nested exception(s).
50      */

51
52     public SchemaValidationException(String JavaDoc msg, Exception JavaDoc nested)
53     {
54         super(msg, nested);
55     }
56
57
58     /**
59      * Converts the given collection of objects to string as a comma-separated
60      * list. If the list is empty the string "&lt;none&gt;" is returned.
61      *
62      * @return A string containing each object in the given collection,
63      * converted toString() and separated by commas.
64      */

65
66     protected static String JavaDoc toString(Collection JavaDoc objs)
67     {
68         if (objs.isEmpty())
69             return "<none>";
70         else
71         {
72             StringBuffer JavaDoc s = new StringBuffer JavaDoc();
73             Iterator JavaDoc i = objs.iterator();
74
75             while (i.hasNext())
76             {
77                 if (s.length() > 0)
78                     s.append(", ");
79
80                 s.append(i.next());
81             }
82
83             return s.toString();
84         }
85     }
86 }
87
Popular Tags