01: //$HeadURL: svn+ssh://mschneider@svn.wald.intevation.org/deegree/base/trunk/resources/eclipse/svn_classfile_header_template.xml $
02: /*---------------- FILE HEADER ------------------------------------------
03: This file is part of deegree.
04: Copyright (C) 2001-2008 by:
05: Department of Geography, University of Bonn
06: http://www.giub.uni-bonn.de/deegree/
07: lat/lon GmbH
08: http://www.lat-lon.de
09:
10: This library is free software; you can redistribute it and/or
11: modify it under the terms of the GNU Lesser General Public
12: License as published by the Free Software Foundation; either
13: version 2.1 of the License, or (at your option) any later version.
14: This library is distributed in the hope that it will be useful,
15: but WITHOUT ANY WARRANTY; without even the implied warranty of
16: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: Lesser General Public License for more details.
18: You should have received a copy of the GNU Lesser General Public
19: License along with this library; if not, write to the Free Software
20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21: Contact:
22:
23: Andreas Poth
24: lat/lon GmbH
25: Aennchenstr. 19
26: 53177 Bonn
27: Germany
28: E-Mail: poth@lat-lon.de
29:
30: Prof. Dr. Klaus Greve
31: Department of Geography
32: University of Bonn
33: Meckenheimer Allee 166
34: 53115 Bonn
35: Germany
36: E-Mail: greve@giub.uni-bonn.de
37: ---------------------------------------------------------------------------*/
38:
39: package org.deegree.io.datastore.sql;
40:
41: import org.deegree.framework.xml.XMLParsingException;
42: import org.deegree.framework.xml.XMLTools;
43: import org.deegree.io.IODocument;
44: import org.deegree.io.JDBCConnection;
45: import org.deegree.io.datastore.AnnotationDocument;
46: import org.w3c.dom.Element;
47:
48: /**
49: * Handles the annotation parsing for SQL based datastores.
50: *
51: * @author <a href="mailto:schneider@lat-lon.de">Markus Schneider </a>
52: * @author last edited by: $Author:$
53: *
54: * @version $Revision:$, $Date:$
55: */
56: public class SQLAnnotationDocument extends AnnotationDocument {
57:
58: private static final long serialVersionUID = -6663755656885555966L;
59:
60: private Class datastoreClass;
61:
62: /**
63: * Creates a new instance of {@link SQLAnnotationDocument} for the given datastore class.
64: *
65: * @param datastoreClass
66: */
67: public SQLAnnotationDocument(Class datastoreClass) {
68: this .datastoreClass = datastoreClass;
69: }
70:
71: @Override
72: public SQLDatastoreConfiguration parseDatastoreConfiguration()
73: throws XMLParsingException {
74: Element appinfoElement = (Element) XMLTools
75: .getRequiredNode(getRootElement(),
76: "xs:annotation/xs:appinfo", nsContext);
77: IODocument ioDoc = new IODocument((Element) XMLTools
78: .getRequiredNode(appinfoElement,
79: "dgjdbc:JDBCConnection", nsContext));
80: ioDoc.setSystemId(this .getSystemId());
81: JDBCConnection jdbcConnection = ioDoc.parseJDBCConnection();
82: return new SQLDatastoreConfiguration(jdbcConnection,
83: datastoreClass);
84: }
85: }
|