Mercurial > dive4elements > river
view flys-backend/src/main/java/de/intevation/flys/backend/FLYSCredentials.java @ 5388:5ace307430bf
Tinydoc.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 22 Mar 2013 12:32:48 +0100 |
parents | 75c13f65b539 |
children | b582df0c7b00 |
line wrap: on
line source
package de.intevation.flys.backend; import de.intevation.artifacts.common.utils.Config; import de.intevation.flys.model.Annotation; import de.intevation.flys.model.AnnotationType; import de.intevation.flys.model.Attribute; import de.intevation.flys.model.AxisKind; import de.intevation.flys.model.BedHeightEpoch; import de.intevation.flys.model.BedHeightEpochValue; import de.intevation.flys.model.BedHeightSingle; import de.intevation.flys.model.BedHeightSingleValue; import de.intevation.flys.model.BedHeightType; import de.intevation.flys.model.Building; import de.intevation.flys.model.BoundaryKind; import de.intevation.flys.model.CrossSection; import de.intevation.flys.model.CrossSectionLine; import de.intevation.flys.model.CrossSectionPoint; import de.intevation.flys.model.CrossSectionTrack; import de.intevation.flys.model.CrossSectionTrackKind; import de.intevation.flys.model.DGM; import de.intevation.flys.model.Depth; import de.intevation.flys.model.DischargeTable; import de.intevation.flys.model.DischargeTableValue; import de.intevation.flys.model.DischargeZone; import de.intevation.flys.model.Edge; import de.intevation.flys.model.ElevationModel; import de.intevation.flys.model.FedState; import de.intevation.flys.model.Fixpoint; import de.intevation.flys.model.Floodmaps; import de.intevation.flys.model.Floodplain; import de.intevation.flys.model.FloodplainKind; import de.intevation.flys.model.FlowVelocityMeasurement; import de.intevation.flys.model.FlowVelocityMeasurementValue; import de.intevation.flys.model.FlowVelocityModel; import de.intevation.flys.model.FlowVelocityModelValue; import de.intevation.flys.model.Gauge; import de.intevation.flys.model.GaugeLocation; import de.intevation.flys.model.GrainFraction; import de.intevation.flys.model.HWSKind; import de.intevation.flys.model.HWSLine; import de.intevation.flys.model.HWSPoint; import de.intevation.flys.model.HYK; import de.intevation.flys.model.HYKEntry; import de.intevation.flys.model.HYKFlowZone; import de.intevation.flys.model.HYKFlowZoneType; import de.intevation.flys.model.HYKFormation; import de.intevation.flys.model.HydrBoundary; import de.intevation.flys.model.HydrBoundaryPoly; import de.intevation.flys.model.LocationSystem; import de.intevation.flys.model.MainValue; import de.intevation.flys.model.MainValueType; import de.intevation.flys.model.MeasurementStation; import de.intevation.flys.model.MorphologicalWidth; import de.intevation.flys.model.MorphologicalWidthValue; import de.intevation.flys.model.NamedMainValue; import de.intevation.flys.model.Position; import de.intevation.flys.model.Range; import de.intevation.flys.model.River; import de.intevation.flys.model.RiverAxis; import de.intevation.flys.model.RiverAxisKm; import de.intevation.flys.model.SQRelation; import de.intevation.flys.model.SQRelationValue; import de.intevation.flys.model.SectieKind; import de.intevation.flys.model.SobekKind; import de.intevation.flys.model.SedimentDensity; import de.intevation.flys.model.SedimentDensityValue; import de.intevation.flys.model.SedimentYield; import de.intevation.flys.model.SedimentYieldValue; import de.intevation.flys.model.TimeInterval; import de.intevation.flys.model.Unit; import de.intevation.flys.model.Wst; import de.intevation.flys.model.WstColumn; import de.intevation.flys.model.WstColumnQRange; import de.intevation.flys.model.WstColumnValue; import de.intevation.flys.model.WstQRange; public class FLYSCredentials extends Credentials { public static final String XPATH_USER = "/artifact-database/backend-database/user/text()"; public static final String XPATH_PASSWORD = "/artifact-database/backend-database/password/text()"; public static final String XPATH_DIALECT = "/artifact-database/backend-database/dialect/text()"; public static final String XPATH_DRIVER = "/artifact-database/backend-database/driver/text()"; public static final String XPATH_URL = "/artifact-database/backend-database/url/text()"; public static final String XPATH_CONNECTION_INIT_SQLS = "/artifact-database/backend-database/connection-init-sqls/text()"; public static final String DEFAULT_USER = System.getProperty("flys.backend.user", "flys"); public static final String DEFAULT_PASSWORD = System.getProperty("flys.backend.password", "flys"); public static final String DEFAULT_DIALECT = System.getProperty( "flys.backend.dialect", "org.hibernate.dialect.PostgreSQLDialect"); public static final String DEFAULT_DRIVER = System.getProperty( "flys.backend.driver", "org.postgresql.Driver"); public static final String DEFAULT_URL = System.getProperty( "flys.backend.url", "jdbc:postgresql://localhost:5432/flys"); public static final String DEFAULT_CONNECTION_INIT_SQLS = System.getProperty( "flys.backend.connection.init.sqls"); public static final Class [] CLASSES = { Annotation.class, AnnotationType.class, Attribute.class, AxisKind.class, BedHeightEpoch.class, BedHeightEpochValue.class, BedHeightSingle.class, BedHeightSingleValue.class, BedHeightType.class, Building.class, BoundaryKind.class, CrossSection.class, CrossSectionLine.class, CrossSectionPoint.class, CrossSectionTrack.class, CrossSectionTrackKind.class, Depth.class, DGM.class, DischargeTable.class, DischargeTableValue.class, DischargeZone.class, Edge.class, ElevationModel.class, FedState.class, Fixpoint.class, Floodplain.class, FloodplainKind.class, Floodmaps.class, FlowVelocityMeasurement.class, FlowVelocityMeasurementValue.class, FlowVelocityModel.class, FlowVelocityModelValue.class, Gauge.class, GaugeLocation.class, GrainFraction.class, HWSKind.class, HWSLine.class, HWSPoint.class, HydrBoundary.class, HydrBoundaryPoly.class, HYK.class, HYKEntry.class, HYKFormation.class, HYKFlowZoneType.class, HYKFlowZone.class, LocationSystem.class, MainValueType.class, MeasurementStation.class, MorphologicalWidth.class, MorphologicalWidthValue.class, NamedMainValue.class, MainValue.class, Position.class, Range.class, River.class, RiverAxis.class, RiverAxisKm.class, SectieKind.class, SobekKind.class, SedimentDensity.class, SedimentDensityValue.class, SedimentYield.class, SedimentYieldValue.class, SQRelation.class, SQRelationValue.class, TimeInterval.class, Unit.class, WstColumn.class, WstColumnQRange.class, WstColumnValue.class, Wst.class, WstQRange.class }; public FLYSCredentials() { } public FLYSCredentials( String user, String password, String dialect, String driver, String url, String connectionInitSqls ) { super( user, password, dialect, driver, url, connectionInitSqls, CLASSES); } private static Credentials instance; public static synchronized Credentials getInstance() { if (instance == null) { String user = Config.getStringXPath(XPATH_USER, DEFAULT_USER); String password = Config.getStringXPath(XPATH_PASSWORD, DEFAULT_PASSWORD); String dialect = Config.getStringXPath(XPATH_DIALECT, DEFAULT_DIALECT); String driver = Config.getStringXPath(XPATH_DRIVER, DEFAULT_DRIVER); String url = Config.getStringXPath(XPATH_URL, DEFAULT_URL); String connectionInitSqls = Config.getStringXPath( XPATH_CONNECTION_INIT_SQLS, DEFAULT_CONNECTION_INIT_SQLS); instance = new FLYSCredentials( user, password, dialect, driver, url, connectionInitSqls); } return instance; } public static Credentials getDefault() { return new FLYSCredentials( DEFAULT_USER, DEFAULT_PASSWORD, DEFAULT_DIALECT, DEFAULT_DRIVER, DEFAULT_URL, DEFAULT_CONNECTION_INIT_SQLS); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :