diff --git a/CHANGELOG.md b/CHANGELOG.md index ad7b4bb..68de0d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ Find changes for the upcoming release in the project's [changelog.d](https://git + +## 1.17.2 (2024-06-10) + +### Fixed + +- Fixed Capabilities based on standard, mainly Table Access and authentication related + +### Changed + +- Refactor UWSInitAction class a bit, make sure each call in the schema init process is separate ## 1.17.1 (2024-06-10) diff --git a/changelog.d/scriv.ini b/changelog.d/scriv.ini index 592bc12..e452bca 100644 --- a/changelog.d/scriv.ini +++ b/changelog.d/scriv.ini @@ -1,2 +1,3 @@ [scriv] format = md +categories = Backwards-incompatible changes,New features,Bug fixes,Other changes diff --git a/tap/src/main/java/ca/nrc/cadc/uws/impl/UWSInitAction.java b/tap/src/main/java/ca/nrc/cadc/uws/impl/UWSInitAction.java index e2319e9..0380981 100644 --- a/tap/src/main/java/ca/nrc/cadc/uws/impl/UWSInitAction.java +++ b/tap/src/main/java/ca/nrc/cadc/uws/impl/UWSInitAction.java @@ -91,15 +91,12 @@ public UWSInitAction() { @Override public void doInit() { DataSource uws = null; - Connection conn = null; - try { + try { uws = DBUtil.findJNDIDataSource("jdbc/uws"); - conn = uws.getConnection(); - if (!schemaExists(conn, "uws")) { + if (!schemaExists(uws, "uws")) { log.info("uws schema does not exist, creating..."); - createSchema(conn, "uws"); + createSchema(uws, "uws"); log.info("uws schema created"); - // Continue with initialization only if the schema was just created InitDatabaseUWS uwsi = new InitDatabaseUWS(uws, null, "uws"); uwsi.doInit(); @@ -110,6 +107,22 @@ public void doInit() { } } catch (Exception ex) { throw new RuntimeException("INIT FAIL", ex); + } + } + + private boolean schemaExists(DataSource uws, String schemaName) throws SQLException { + Connection conn = null; + try { + conn = uws.getConnection(); + DatabaseMetaData dbMetaData = conn.getMetaData(); + ResultSet rs = dbMetaData.getSchemas(); + while (rs.next()) { + if (schemaName.equalsIgnoreCase(rs.getString("TABLE_SCHEM").trim())) { + return true; + } + } + } catch (Exception ex) { + throw new RuntimeException("Failed to check if schema exists", ex); } finally { if (conn != null) { try { @@ -119,23 +132,25 @@ public void doInit() { } } } - } - - private boolean schemaExists(Connection conn, String schemaName) throws SQLException { - DatabaseMetaData dbMetaData = conn.getMetaData(); - try (ResultSet rs = dbMetaData.getSchemas()) { - while (rs.next()) { - if (schemaName.equalsIgnoreCase(rs.getString("TABLE_SCHEM").trim())) { - return true; - } - } - } return false; } - private void createSchema(Connection conn, String schemaName) throws SQLException { - try (java.sql.Statement stmt = conn.createStatement()) { + private void createSchema(DataSource uws, String schemaName) throws SQLException { + Connection conn = null; + try { + conn = uws.getConnection(); + java.sql.Statement stmt = conn.createStatement(); stmt.execute("CREATE SCHEMA " + schemaName); + } catch (Exception ex) { + throw new RuntimeException("Create Schema failed", ex); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + log.error("Failed to close connection", e); + } + } } } } diff --git a/tap/src/main/webapp/capabilities.xml b/tap/src/main/webapp/capabilities.xml index b37c20b..61b3da3 100644 --- a/tap/src/main/webapp/capabilities.xml +++ b/tap/src/main/webapp/capabilities.xml @@ -1,164 +1,119 @@ + xmlns:vosi="http://www.ivoa.net/xml/VOSICapabilities/v1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:vs="http://www.ivoa.net/xml/VODataService/v1.1"> - http://replace.me.com/tap/capabilities + https://replace.me.com/api/tap/capabilities - http://replace.me.com/tap/availability + https://replace.me.com/api/tap/availability - + - http://replace.me.com/tap/logControl - - - - - - http://replace.me.com/tap/tables - - - http://replace.me.com/tap/auth-tables - - - - http://replace.me.com/tap/tables + https://replace.me.com/api/tap/logControl + - - - https://replace.me.com/tap/tables - + + + - - - - http://replace.me.com/tap/sync - - - http://replace.me.com/tap/auth-sync - - + - http://replace.me.com/tap/sync + https://replace.me.com/api/tap/tables + + + + - - https://replace.me.com/tap/sync - - - - - - - - http://replace.me.com/tap/async - - - http://replace.me.com/tap/auth-async - - + + + - http://replace.me.com/tap/async + https://replace.me.com/api/tap + + + + - - https://replace.me.com/tap/async - - - - - - - - http://replace.me.com/tap - - - https://replace.me.com/tap - - - - - + - ADQL - 2.0 - ADQL-2.0 - - -
POINT
-
- -
CIRCLE
-
- -
BOX
-
- -
POLYGON
-
- -
REGION
-
- -
CONTAINS
-
- -
INTERSECTS
-
- -
AREA
-
- -
CENTROID
-
- -
COORDSYS
-
- -
COORD1
-
- -
COORD2
-
-
+ ADQL + 2.0 + ADQL-2.0 + + +
POINT
+
+ +
CIRCLE
+
+ +
DISTANCE
+
+ +
POLYGON
+
+ +
CONTAINS
+
+ +
BOX
+
+ +
REGION
+
+ +
INTERSECTS
+
+ +
AREA
+
+ +
CENTROID
+
+ +
COORDSYS
+
+ +
COORD1
+
+ +
COORD2
+
+
- - application/x-votable+xml - votable + application/x-votable+xml + votable - - text/xml + text/xml - - text/csv - csv + text/csv + csv - - text/tab-separated-values - tsv + text/tab-separated-values + tsv @@ -166,28 +121,23 @@ - 7200 - 7200 + 604800 + 604800 - - 600 - 600 + 600 + 600 - - + - 1000 - 10000 + 134217728 + 134217728 - - 10000 - 10000 + 10000 + 10000 -
- -
+