001: /*
002: * This file is part of the GeOxygene project source files.
003: *
004: * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for
005: * the development and deployment of geographic (GIS) applications. It is a open source
006: * contribution of the COGIT laboratory at the Institut Géographique National (the French
007: * National Mapping Agency).
008: *
009: * See: http://oxygene-project.sourceforge.net
010: *
011: * Copyright (C) 2005 Institut Géographique National
012: *
013: * This library is free software; you can redistribute it and/or modify it under the terms
014: * of the GNU Lesser General Public License as published by the Free Software Foundation;
015: * either version 2.1 of the License, or any later version.
016: *
017: * This library is distributed in the hope that it will be useful, but WITHOUT ANY
018: * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
019: * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
020: *
021: * You should have received a copy of the GNU Lesser General Public License along with
022: * this library (see file LICENSE if present); if not, write to the Free Software
023: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024: *
025: */
026:
027: package fr.ign.cogit.geoxygene.datatools.castor.conf;
028:
029: /*
030: * This class was automatically generated with
031: * <a href="http://castor.exolab.org">Castor 0.9.2</a>, using an
032: * XML Schema.
033: * Creee a partir du schema jdo-conf.xsd (modifie en jdo-conf.xsd.2001).
034: * Cette classe a ete creee pour recuperer les donnees du fichier "database.xml" (driver, user, etc...)
035: * utiles pour etablir une connection JDBC. Elle est utilisee par la classe GeodatabaseCastorOracle.
036: *
037: * @author Thierry Badard & Arnaud Braun
038: * @version 1.0
039: */
040:
041: import java.util.ArrayList;
042:
043: /** Usage interne. */
044:
045: public class Driver {
046:
047: protected String _url;
048: protected String _className;
049: protected ArrayList _param = new ArrayList();
050:
051: public Driver() {
052: super ();
053: }
054:
055: public String getClassName() {
056: return this ._className;
057: }
058:
059: public String getUrl() {
060: return this ._url;
061: }
062:
063: public void setClassName(String className) {
064: this ._className = className;
065: }
066:
067: public void setUrl(String url) {
068: this ._url = url;
069: }
070:
071: public Param createParam() {
072: return new Param();
073: }
074:
075: public ArrayList getParam() {
076: return _param;
077: }
078:
079: public void addParam(Param param) {
080: _param.add(param);
081: }
082:
083: public String getUserName() throws Exception {
084: for (int i = 0; i < _param.size(); i++) {
085: Param p = (Param) _param.get(i);
086: if (p.getName().compareToIgnoreCase("user") == 0)
087: return p.getValue();
088: }
089: throw new Exception(
090: "Utilisateur non défini dans le fichier database.xml");
091: }
092:
093: public String getPassword() throws Exception {
094: for (int i = 0; i < _param.size(); i++) {
095: Param p = (Param) _param.get(i);
096: if (p.getName().compareToIgnoreCase("password") == 0)
097: return p.getValue();
098: }
099: throw new Exception(
100: "Password non défini dans le fichier database.xml");
101: }
102:
103: }
|