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: MissingIndicesException.java,v 1.3 2002/11/08 05:06:25 jackknifebarber Exp $
09: */
10:
11: package com.triactive.jdo.store;
12:
13: import java.util.Collection;
14: import java.util.Iterator;
15:
16: /**
17: * A <tt>MissingIndicesException</tt> is thrown if an expected index is not
18: * found in the database during schema validation.
19: *
20: * @author <a href="mailto:mmartin5@austin.rr.com">Mike Martin</a>
21: * @version $Revision: 1.3 $
22: *
23: * @see Table
24: */
25:
26: public class MissingIndicesException extends SchemaValidationException {
27: /**
28: * Constructs a missing index(s) exception.
29: *
30: * @param table The table in which index(s) were missing.
31: * @param stmts The statements that would be used to create the missing indices.
32: */
33:
34: public MissingIndicesException(Table table, Collection stmts) {
35: super ("Required indices missing from " + table + '\n'
36: + listOnePerLine(stmts));
37: }
38:
39: private static String listOnePerLine(Collection stmts) {
40: StringBuffer list = new StringBuffer();
41: Iterator i = stmts.iterator();
42:
43: while (i.hasNext())
44: list.append(i.next()).append('\n');
45:
46: return list.toString();
47: }
48: }
|