KickJava   Java API By Example, From Geeks To Geeks.

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


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: MissingIndicesException.java,v 1.3 2002/11/08 05:06:25 jackknifebarber Exp $
9  */

10
11 package com.triactive.jdo.store;
12
13 import java.util.Collection JavaDoc;
14 import java.util.Iterator JavaDoc;
15
16
17 /**
18  * A <tt>MissingIndicesException</tt> is thrown if an expected index is not
19  * found in the database during schema validation.
20  *
21  * @author <a HREF="mailto:mmartin5@austin.rr.com">Mike Martin</a>
22  * @version $Revision: 1.3 $
23  *
24  * @see Table
25  */

26
27 public class MissingIndicesException extends SchemaValidationException
28 {
29     /**
30      * Constructs a missing index(s) exception.
31      *
32      * @param table The table in which index(s) were missing.
33      * @param stmts The statements that would be used to create the missing indices.
34      */

35
36     public MissingIndicesException(Table table, Collection JavaDoc stmts)
37     {
38         super("Required indices missing from " + table + '\n' + listOnePerLine(stmts));
39     }
40
41
42     private static String JavaDoc listOnePerLine(Collection JavaDoc stmts)
43     {
44         StringBuffer JavaDoc list = new StringBuffer JavaDoc();
45         Iterator JavaDoc i = stmts.iterator();
46
47         while (i.hasNext())
48             list.append(i.next()).append('\n');
49
50         return list.toString();
51     }
52 }
53
Popular Tags