Skip to content

Commit

Permalink
Merge commit 'refs/pull/1285/head' of github.com:deegree/deegree3 int…
Browse files Browse the repository at this point in the history
…o config_schema_changes
  • Loading branch information
copierrj committed May 13, 2022
2 parents 4e5ffb8 + 6ac21f7 commit b31b51f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/*----------------------------------------------------------------------------
This file is part of deegree, http://deegree.org/
Copyright (C) 2001-2014 by:
Copyright (C) 2001-2022 by:
- Department of Geography, University of Bonn -
and
- lat/lon GmbH -
and
- Occam Labs UG (haftungsbeschränkt) -
and
- grit graphische Informationstechnik Beratungsgesellschaft mbH -
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Expand Down Expand Up @@ -35,6 +37,11 @@
Occam Labs UG (haftungsbeschränkt)
Godesberger Allee 139, 53175 Bonn
Germany
grit graphische Informationstechnik Beratungsgesellschaft mbH
Landwehrstr. 143, 59368 Werne
Germany
http://www.grit.de/
e-mail: info@deegree.org
----------------------------------------------------------------------------*/
Expand All @@ -49,6 +56,7 @@ Occam Labs UG (haftungsbeschränkt)
import javax.sql.DataSource;

import org.deegree.db.ConnectionProvider;
import org.deegree.db.dialect.SqlDialectProvider;
import org.deegree.db.dialect.SqlDialects;
import org.deegree.sqldialect.SQLDialect;
import org.deegree.workspace.ResourceBuilder;
Expand All @@ -60,6 +68,7 @@ Occam Labs UG (haftungsbeschränkt)
* {@link ResourceBuilder} for the {@link DataSourceConnectionProvider}.
*
* @author <a href="mailto:schneider@occamlabs.de">Markus Schneider</a>
* @author <a href="mailto:reichhelm@grit.de">Stephan Reichhelm</a>
*
* @since 3.4
*/
Expand All @@ -85,7 +94,21 @@ public ConnectionProvider build() {
final DataSource ds = initializeDataSourceInstance();
final Method destroyMethod = getDestroyMethod( ds, config.getDataSource().getDestroyMethod() );
final Connection conn = checkConnectivity( ds );
final SQLDialect dialect = SqlDialects.lookupSqlDialect( conn, workspace.getModuleClassLoader() );
final SQLDialect dialect;
if ( config.getDialectProvider() != null ) {
String dialectProviderCls = config.getDialectProvider().getJavaClass();
try {
Class<?> clazz = workspace.getModuleClassLoader().loadClass( dialectProviderCls );
SqlDialectProvider prov = clazz.asSubclass( SqlDialectProvider.class ).newInstance();
dialect = prov.createDialect( conn );
} catch ( Exception ex ) {
final String msg = "Configured SQL dialect provider '" + dialectProviderCls + "' failed to initialize: "
+ ex.getLocalizedMessage();
throw new ResourceException( msg, ex );
}
} else {
dialect = SqlDialects.lookupSqlDialect( conn, workspace.getModuleClassLoader() );
}
close( conn );
return new DataSourceConnectionProvider( metadata, ds, dialect, destroyMethod );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<sequence>
<element name="Argument" minOccurs="0" maxOccurs="unbounded">
<complexType>
<attribute name="javaClass" use="required" />
<attribute name="value" use="required" />
<attribute name="javaClass" use="required" />
<attribute name="value" use="required" />
</complexType>
</element>
</sequence>
Expand All @@ -31,7 +31,12 @@
<element name="Property" minOccurs="0" maxOccurs="unbounded">
<complexType>
<attribute name="name" use="required" />
<attribute name="value" use="required" />
<attribute name="value" use="required" />
</complexType>
</element>
<element name="DialectProvider" minOccurs="0" maxOccurs="1">
<complexType>
<attribute name="javaClass" use="required" />
</complexType>
</element>
</sequence>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ respected.
object

|Property |0..n |Complex |Configuration of javax.sql.DataSource object

|DialectProvider |0..1 |Complex |Configuration of the dialect provider
|===

Technically, the _DataSource_ element defines how the
Expand Down Expand Up @@ -357,6 +359,17 @@ For completeness, here's the list of options of element _Property_:
|value |1..1 |String |Property value
|===

For cases where deegree cannot automatically determine the dialect provider to use or
a special dialect provider has to be used, a manual configuration can be done with
the element _DialectProvider_:

[width="77%",cols="17%,25%,17%,41%",options="header",]
|===
|Option |Cardinality |Value |Description
|javaClass |1..1 |String |Java class of the dialect provider (e.g.
org.deegree.sqldialect.postgis.PostGISDialectProvider)
|===

==== Legacy configuration format

Prior to deegree webservices release 3.4, a simpler (but limited)
Expand Down

0 comments on commit b31b51f

Please sign in to comment.