Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion argus/VERSION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## deployable containers have a semantic and build tag
# semantic version tag: major.minor
# build version tag: timestamp
VER=2.0-BETA-07
VER=2.0-BETA-08
TAGS="${VER} ${VER}-$(date -u +"%Y%m%dT%H%M%S")"
unset VER

Expand Down
2 changes: 2 additions & 0 deletions argus/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dependencies {
runtimeOnly 'org.opencadc:cadc-log:[1.1.0,2.0)'

// force min versions for CVEs
runtimeOnly 'org.apache.commons:commons-configuration2:[2.15.0,)'
runtimeOnly 'org.apache.commons:commons-lang3:[3.18.0,)'
runtimeOnly 'com.nimbusds:nimbus-jose-jwt:[9.37.4,)'
// this breaks CI build on gradle 6 because of library variants
Expand Down Expand Up @@ -92,5 +93,6 @@ configurations {
runtimeOnly.exclude group: 'org.eclipse.jetty'
runtimeOnly.exclude group: 'org.eclipse.jetty'
runtimeOnly.exclude group: 'io.netty'
runtimeOnly.exclude group: 'org.jline'
}

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class InitCaomTapSchemaContent extends InitDatabase {
private static final Logger log = Logger.getLogger(InitCaomTapSchemaContent.class);

public static final String MODEL_NAME = "caom2-schema";
public static final String MODEL_VERSION = "2.5.0-P";
public static final String MODEL_VERSION = "2.5.0-beta-2";

// the SQL is tightly coupled to cadc-tap-schema table names (for TAP-1.1)
static String[] BASE_SQL = new String[] {
Expand All @@ -114,7 +114,9 @@ public class InitCaomTapSchemaContent extends InitDatabase {
public InitCaomTapSchemaContent(DataSource dataSource, String database, String schema, boolean extras) {
// use MODELVERSION/extras so changing extras will cause a recreate
// eg 1.2.13/false <-> 1.2.13/true
super(dataSource, database, schema, MODEL_NAME, MODEL_VERSION + "/" + extras);
//super(dataSource, database, schema, MODEL_NAME, MODEL_VERSION + "/" + extras);
// TODO: currently no extras in 2.5 beta
super(dataSource, database, schema, MODEL_NAME, MODEL_VERSION);
String[] src = BASE_SQL;
if (extras) {
src = BASE_EXTRA_SQL;
Expand Down
113 changes: 58 additions & 55 deletions argus/src/main/resources/sql/caom2.tap_schema_content11.sql

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions argus/src/main/resources/sql/ivoa.tap_schema_content11.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ insert into tap_schema.tables11 (schema_name,table_name,table_type,description,t
insert into tap_schema.columns11
(table_name,column_name,utype,description,ucd,unit,datatype,arraysize,xtype,principal,indexed,std,column_index,column_id) values
( 'ivoa.ObsCore', 'obs_publisher_did', 'obscore:Curation.PublisherDID',
'publisher dataset identifier', 'meta.ref.uri;meta.curation', NULL, 'char', '256*','uri', 1,1,1,1, 'ivoaPublisherID');
'publisher dataset identifier', 'meta.ref.ivoid', NULL, 'char', '256*','uri', 1,1,1,1, 'ivoaPublisherID');

insert into tap_schema.columns11
(table_name,column_name,utype,description,ucd,unit,datatype,arraysize,xtype,principal,indexed,std, column_index) values
( 'ivoa.ObsCore', 'obs_collection', 'obscore:DataID.Collection',
'short name for the data colection', 'meta.id', NULL, 'char','128*',NULL, 1,0,1,2),
'short name for the data colection', 'meta.id', NULL, 'char','128*',NULL, 1,1,1,2),
( 'ivoa.ObsCore', 'facility_name', 'obscore:Provenance.ObsConfig.Facility.name',
'telescope name', 'meta.id;instr.tel', NULL, 'char','128*',NULL, 1,0,1,3),
'telescope name', 'meta.id;instr.tel', NULL, 'char','128*',NULL, 1,1,1,3),
( 'ivoa.ObsCore', 'instrument_name', 'obscore:Provenance.ObsConfig.Instrument.name',
'instrument name', 'meta.id;instr', NULL, 'char','128*',NULL, 1,0,1,4),
'instrument name', 'meta.id;instr', NULL, 'char','128*',NULL, 1,1,1,4),
( 'ivoa.ObsCore', 'target_name', 'obscore:Target.Name',
'name of intended target', 'meta.id;src', NULL, 'char', '32*',NULL, 1,0,1,5),
( 'ivoa.ObsCore', 'obs_id', 'obscore:DataID.observationID',
Expand Down Expand Up @@ -88,9 +88,9 @@ insert into tap_schema.columns11
'region bounded by observation', 'pos.outline;obs.field', NULL, 'char','*','shape', 1,1,1,44),
( 'ivoa.ObsCore', 's_resolution', 'obscore:Char.SpatialAxis.Resolution.refval.value',
'typical spatial resolution', 'pos.angResolution', 'arcsec', 'double',NULL,NULL, 1,0,1,45),
( 'ivoa.ObsCore', 's_resolution_min', '???',
( 'ivoa.ObsCore', 's_resolution_min', 'obscore:Char.SpatialAxis.Resolution.Bounds.Limits.LoLimit',
'smallest spatial resolution', 'pos.angResolution;stat.min', 'arcsec', 'double',NULL,NULL, 1,0,1,46),
( 'ivoa.ObsCore', 's_resolution_max', '???',
( 'ivoa.ObsCore', 's_resolution_max', 'obscore:Char.SpatialAxis.Resolution.Bounds.Limits.HiLimit',
'largest spatial resolution', 'pos.angResolution;stat.max', 'arcsec', 'double',NULL,NULL, 1,0,1,47),
( 'ivoa.ObsCore', 's_xel1', 'obscore:Char.SpatialAxis.numBins1',
'dimensions (number of pixels) along one spatial axis', 'meta.number', NULL, 'long',NULL,NULL, 1,0,1,48),
Expand All @@ -100,13 +100,13 @@ insert into tap_schema.columns11
insert into tap_schema.columns11
(table_name,column_name,utype,description,ucd,unit,datatype,arraysize,xtype,principal,indexed,std, column_index) values
( 'ivoa.ObsCore', 'em_min', 'obscore:Char.SpectralAxis.Coverage.Bounds.Limits.LoLimit',
'start spectral coordinate value', 'em.wl;stat.min', 'm', 'double',NULL,NULL, 1,1,1,50),
'start spectral coordinate value', 'em.wl;stat.min', 'm', 'double',NULL,NULL, 1,0,1,50),
( 'ivoa.ObsCore', 'em_max', 'obscore:Char.SpectralAxis.Coverage.Bounds.Limits.HiLimit',
'stop spectral coordinate value', 'em.wl;stat.max', 'm', 'double',NULL,NULL, 1,1,1,51),
'stop spectral coordinate value', 'em.wl;stat.max', 'm', 'double',NULL,NULL, 1,0,1,51),
( 'ivoa.ObsCore', 'em_res_power', 'obscore:Char.SpectralAxis.Resolution.ResolPower.refval',
'typical spectral resolution', 'spect.resolution', NULL, 'double',NULL,NULL, 1,0,1,52),
( 'ivoa.ObsCore', 'em_resolution', '???',
'typical spectral resolution', 'spect.resolution', NULL, 'double',NULL,NULL, 1,0,1,53),
( 'ivoa.ObsCore', 'em_resolution', 'obscore:Char.SpectralAxis.Resolution.refval.value',
'typical spectral resolution', 'spect.resolution;stat.mean', 'm', 'double',NULL,NULL, 1,0,1,53),
( 'ivoa.ObsCore', 'em_resolution_min', '???',
'minimum spectral resolution', 'spect.resolution;stat.min', NULL, 'double',NULL,NULL, 1,0,1,54),
( 'ivoa.ObsCore', 'em_resolution_max', '???',
Expand All @@ -119,9 +119,9 @@ insert into tap_schema.columns11
insert into tap_schema.columns11
(table_name,column_name,utype,description,ucd,unit,datatype,arraysize,xtype,principal,indexed,std, column_index) values
( 'ivoa.ObsCore', 't_min', 'obscore:Char.TimeAxis.Coverage.Bounds.Limits.StartTime',
'start time of observation (MJD)', 'time.start;obs.exposure', 'd', 'double',NULL,NULL, 1,1,1,60),
'start time of observation (MJD)', 'time.start;obs.exposure', 'd', 'double',NULL,NULL, 1,0,1,60),
( 'ivoa.ObsCore', 't_max', 'obscore:Char.TimeAxis.Coverage.Bounds.Limits.StopTime',
'end time of observation (MJD)', 'time.end;obs.exposure', 'd', 'double',NULL,NULL, 1,1,1,61),
'end time of observation (MJD)', 'time.end;obs.exposure', 'd', 'double',NULL,NULL, 1,0,1,61),
( 'ivoa.ObsCore', 't_exptime', 'obscore:Char.TimeAxis.Coverage.Support.Extent',
'typical exposure time', 'time.duration;obs.exposure', 's', 'double',NULL,NULL, 1,1,1,62),
( 'ivoa.ObsCore', 't_exptime_min', '???',
Expand All @@ -136,7 +136,7 @@ insert into tap_schema.columns11
insert into tap_schema.columns11
(table_name,column_name,utype,description,ucd,unit,datatype,arraysize,xtype,principal,indexed,std, column_index) values
( 'ivoa.ObsCore', 'pol_states', 'obscore:Char.PolarizationAxis.stateList',
'polarization states present in the data', 'meta.code;phys.polarization', NULL, 'char','32*',NULL, 1,0,1,70),
'polarization states present in the data', 'meta.code;phys.polarization', NULL, 'char','32*',NULL, 1,1,1,70),
( 'ivoa.ObsCore', 'pol_xel', 'obscore:Char.PolarizationAxis.numBins',
'dimensions (number of pixels) along the polarization axis', 'meta.number', NULL, 'long',NULL,NULL, 1,0,1,71),
( 'ivoa.ObsCore', 'o_ucd', 'obscore:Char.ObservableAxis.ucd',
Expand All @@ -163,7 +163,7 @@ insert into tap_schema.keys11 (key_id,from_table,target_table,description) value
('ivoa-core-radio', 'ivoa.ObsCore_radio', 'ivoa.ObsCore','standard way to join ivoa.ObsCore and ivoa.ObsCore_radio');

insert into tap_schema.key_columns11 (key_id,from_column,target_column) values
('ivoa-core-radio', 'obs_publisher_id', 'obs_publisher_id');
('ivoa-core-radio', 'obs_publisher_did', 'obs_publisher_did');

-- backwards compatible: fill "size" column with values from arraysize set above
-- where arraysize is a possibly variable-length 1-dimensional value
Expand Down
6 changes: 6 additions & 0 deletions argus/src/main/webapp/capabilities.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
</interface>
</capability>

<capability standardID="ivo://ivoa.net/std/DALI#examples">
<interface xsi:type="vs:ParamHTTP" role="std">
<accessURL use="base">https://replace.me.com/argus/examples</accessURL>
</interface>
</capability>

<!-- TAP-1.1 -->
<capability standardID="ivo://ivoa.net/std/TAP"
xmlns:tr="http://www.ivoa.net/xml/TAPRegExt/v1.0" xsi:type="tr:TableAccess">
Expand Down
102 changes: 102 additions & 0 deletions argus/src/main/webapp/examples/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<!DOCTYPE html>
<html>
<head>
<title>CAOM Query Examples</title>
</head>
<body>
<div vocab="http://www.ivoa.net/rdf/examples#">
<div id="caom-spatial-query" resource="#caom-spatial-query" typeof="example">
<h2 property="name">Standard CAOM Discovery Query with Spatial Constraint</h2>
<p>
standardID: <span property="capability">ivo://ivoa.net/std/TAP</span>
</p>
<!-- Table target configuration -->
<p>
tables:
<span property="table">caom2.Observation</span>
JOIN
<span property="table">caom2.Plane</span>
</p>

<p>parameters:</p>
<div property="generic-parameter" typeof="keyval">
<span property="key">LANG</span> = <span property="value">ADQL</span>
</div>

<div property="generic-parameter" typeof="keyval">
<span property="key">MAXREC</span> = <span property="value">100</span>
</div>

<div property="generic-parameter" typeof="keyval">
<span property="key">QUERY</span> =
<pre property="value">
SELECT p.publisherID, o.telescope_name, o.instrument_name,
p.calibrationLevel, p.dataProductType,
p.position_bounds, p.energy_bounds, p.time_bounds, p.polarization_states
FROM caom2.Observation AS o JOIN caom2.Plane AS p ON o.obsID = p.obsID
WHERE o.intent = 'science' AND INTERSECTS(p.position_bounds, CIRCLE('ICRS', 180.0, 0.0, 0.5)) = 1
</pre>
</div>
<p>
The Plane.publisherID column is the identifier that is needed to call the CAOM DataLink service and initiate
data access; when this column is selected, the service will include a <em>service descriptor</em>
with the necessary information.
</p>
</div>

<div id="caom-artifact-join" resource="#caom-artifact-join" typeof="example">
<h2 property="name">Standard CAOM Query with Primary Artifact</h2>
<p>
standardID: <span property="capability">ivo://ivoa.net/std/TAP</span>
</p>

<!-- Table target configuration -->
<p>
tables:
<span property="table">caom2.Observation</span>
JOIN
<span property="table">caom2.Plane</span>
JOIN
<span property="table">caom2.Artifact</span>
</p>

<p>parameters:</p>
<div property="generic-parameter" typeof="keyval">
<span property="key">LANG</span> = <span property="value">ADQL</span>
</div>

<div property="generic-parameter" typeof="keyval">
<span property="key">MAXREC</span> = <span property="value">100</span>
</div>

<div property="generic-parameter" typeof="keyval">
<span property="key">QUERY</span> =
<pre property="value">
SELECT p.publisherID, o.telescope_name, o.instrument_name,
p.calibrationLevel, p.dataProductType,
p.position_bounds, p.energy_bounds, p.time_bounds, p.polarization_states,
a.uri
FROM caom2.Observation AS o
JOIN caom2.Plane AS p ON o.obsID = p.obsID
JOIN caom2.Artifact AS a ON p.planeID = a.planeID
WHERE o.intent = 'science'
AND a.productType IN ('science', 'this')
AND INTERSECTS(p.position_bounds, CIRCLE('ICRS', 180.0, 0.0, 0.5)) = 1
</pre>
</div>

<p>
The Plane.publisherID column is the identifier that is needed to call the CAOM DataLink service
and initiate data access; when this column is selected, the service will include a
<em>service descriptor</em> with the necessary information.
</p>
<p>
Coming soon: The Artifact.uri column is the identifier that is needed to directly access
the file in the CADC Archive Storage system; when this column is selected, the service will
include a <em>service descriptor</em> with the necessary information.
</p>
</div>

</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public class InitDatabaseTest {
static String schema = "caom2";

static {
Log4jInit.setLevel("ca.nrc.cadc.caom2.version", Level.INFO);
Log4jInit.setLevel("ca.nrc.cadc.db.version", Level.INFO);
Log4jInit.setLevel("org.opencadc.caom2", Level.INFO);
Log4jInit.setLevel("ca.nrc.cadc.db", Level.INFO);
}

private DataSource dataSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void setConfig(Map<String, Object> config) {
}
try {
this.dataSource = DBUtil.findJNDIDataSource(jndiDataSourceName);
log.warn("found: " + jndiDataSourceName);
log.debug("found: " + jndiDataSourceName);
} catch (NamingException ex) {
throw new IllegalArgumentException("cannot find JNDI DataSource: " + jndiDataSourceName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public ResourceIterator<DeletedObservationEvent> query(DataSource ds) {
}

String sql = sb.toString();
log.warn("SQL: " + sb.toString());
log.debug("SQL: " + sb.toString());

Calendar utc = Calendar.getInstance(DateUtil.UTC);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public class ObservationStateIteratorQuery {
private static final Logger log = Logger.getLogger(ObservationStateIteratorQuery.class);

private final SQLGenerator gen;
private final SQLDialect dbDialect;

private final String collection;
private final String namespace;
Expand All @@ -103,6 +104,7 @@ public ObservationStateIteratorQuery(SQLGenerator gen, String collection, String
this.gen = gen;
this.collection = collection;
this.namespace = namespace;
this.dbDialect = gen.getDbDialect();
}

public void setUriBucket(String uriBucket) {
Expand Down Expand Up @@ -156,7 +158,7 @@ public ResourceIterator<ObservationState> query(DataSource ds) {
}

String sql = sb.toString();
log.warn("SQL: " + sb.toString());
log.debug("SQL: " + sb.toString());

Calendar utc = Calendar.getInstance(DateUtil.UTC);
try {
Expand Down Expand Up @@ -200,7 +202,7 @@ private class ObservationStateIterator implements ResourceIterator<ObservationSt
private boolean hasRow;
private int rowNum = 0;

private ObservationStateMapper mapper = new ObservationStateMapper();
private ObservationStateMapper mapper = new ObservationStateMapper(dbDialect);

public ObservationStateIterator(Connection con, ResultSet rs) {
this.con = con;
Expand Down
11 changes: 8 additions & 3 deletions caom2-db/src/main/java/org/opencadc/caom2/db/SQLGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,14 @@
return schema;
}

public SQLDialect getDbDialect() {
return dbDialect;
}


/**
* The default implementation uses the SQL standard CURRENT_TIMESTAMP symbol.
* @return

Check warning on line 438 in caom2-db/src/main/java/org/opencadc/caom2/db/SQLGenerator.java

View workflow job for this annotation

GitHub Actions / build

no description for @return
*/

public String getCurrentTimeSQL() {
Expand Down Expand Up @@ -766,7 +771,7 @@
}

public ObservationState execute(JdbcTemplate jdbc) {
return jdbc.query(this, new ObservationStateExtractor());
return jdbc.query(this, new ObservationStateExtractor(gen.getDbDialect()));
}

@Override
Expand Down Expand Up @@ -2524,11 +2529,11 @@
}

public RowMapper getObservationStateMapper() {
return new ObservationStateMapper();
return new ObservationStateMapper(dbDialect);
}

public ResultSetExtractor<ObservationState> getObservationStateExtractor() {
return new ObservationStateExtractor();
return new ObservationStateExtractor(dbDialect);
}

public ResultSetExtractor getSkeletonExtractor(Class<? extends Skeleton> c) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@

import java.sql.ResultSet;
import java.sql.SQLException;
import org.opencadc.caom2.db.SQLDialect;
import org.opencadc.caom2.util.ObservationState;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;
Expand All @@ -79,14 +80,16 @@
*/
public class ObservationStateExtractor implements ResultSetExtractor<ObservationState> {

public ObservationStateExtractor() {
private ObservationStateMapper mapper;

public ObservationStateExtractor(SQLDialect dbDialect) {
this.mapper = new ObservationStateMapper(dbDialect);
}

@Override
public ObservationState extractData(ResultSet rs) throws SQLException, DataAccessException {
if (rs.next()) {
ObservationStateMapper m = new ObservationStateMapper();
return m.mapRow(rs, 1);
return mapper.mapRow(rs, 1);
}
return null;
}
Expand Down
Loading
Loading