KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > core > persist > db > DatabaseSchemaClassFactory


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: DatabaseSchemaClassFactory.java,v 1.7 2007/01/07 06:14:18 bastafidli Exp $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program 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
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21
22 package org.opensubsystems.core.persist.db;
23
24 import org.opensubsystems.core.error.OSSDynamicClassException;
25 import org.opensubsystems.core.error.OSSException;
26
27 /**
28  * Class factory responsible for instantiation of database schemas. Based on the
29  * schema interface or default implementation and currently active database
30  * instantiate correct database schema which should be used for this database.
31  *
32  * @version $Id: DatabaseSchemaClassFactory.java,v 1.7 2007/01/07 06:14:18 bastafidli Exp $
33  * @author Miro Halas
34  * @code.reviewer Miro Halas
35  * @code.reviewed 1.5 2004/12/18 06:18:21 bastafidli
36  */

37 class DatabaseSchemaClassFactory extends DatabaseDependentClassFactory
38 {
39    /**
40     * {@inheritDoc}
41     */

42    protected void verifyInstance(
43       Object JavaDoc objInstance
44    ) throws OSSException
45    {
46       // Make sure that the instantiated class is of type DatabaseSchema
47
if ((objInstance != null) && (!(objInstance instanceof DatabaseSchema)))
48       {
49          throw new OSSDynamicClassException("Instantiated class " +
50                                             " doesn't implements DatabaseSchema" +
51                                             " interface and is of type " +
52                                             objInstance.getClass().getName());
53                       
54       }
55    }
56 }
57
Popular Tags