From 62382a9307d71bbc50a4b4f272f74bc6b645d37d Mon Sep 17 00:00:00 2001 From: Sonia Zorba Date: Wed, 16 Aug 2017 16:56:10 +0200 Subject: [PATCH] Added connection pooling on core, added ObsCore uytpe and ucd on XML model, added ObsCore optional columns --- TASMAN-core/pom.xml | 16 + .../src/main/java/it/inaf/ia2/tsm/Column.java | 5 + .../main/java/it/inaf/ia2/tsm/TSMUtil.java | 38 -- .../main/java/it/inaf/ia2/tsm/TapSchema.java | 29 +- .../ia2/tsm/datalayer/DataSourceWrapper.java | 42 +- .../it/inaf/ia2/tsm/model/PropertyModel.java | 52 ++ .../it/inaf/ia2/tsm/model/SchemaModels.java | 6 +- .../resources/schema_definition/ivoa-1_1.xml | 528 +++++++++++++++++- .../src/main/resources/sql_type_mapping.xml | 12 + .../java/it/inaf/ia2/tap/tasman/Main.java | 39 +- TASMAN-webapp/pom.xml | 7 + TASMAN-webapp/src/main/webapp/WEB-INF/web.xml | 31 + 12 files changed, 714 insertions(+), 91 deletions(-) diff --git a/TASMAN-core/pom.xml b/TASMAN-core/pom.xml index cec38d2..11b6869 100644 --- a/TASMAN-core/pom.xml +++ b/TASMAN-core/pom.xml @@ -13,15 +13,23 @@ inaf-license-netbeans + + org.apache.tomcat + tomcat-jdbc + 8.5.19 + compile + mysql mysql-connector-java 5.1.37 + runtime org.postgresql postgresql 9.3-1104-jdbc41 + runtime org.slf4j @@ -45,6 +53,14 @@ public + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + false + + \ No newline at end of file diff --git a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/Column.java b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/Column.java index 51b0e17..96cf36c 100644 --- a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/Column.java +++ b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/Column.java @@ -38,6 +38,11 @@ public class Column extends ChildEntity { public final static String ARRAYSIZE_KEY = "arraysize"; public final static String INDEXED_KEY = "indexed"; public final static String PRIMARY_KEY = "primary_key"; + public final static String PRINCIPAL_KEY = "principal"; + public final static String STD_KEY = "std"; + public final static String UTYPE_KEY = "utype"; + public final static String UCD_KEY = "ucd"; + public final static String UNIT_KEY = "unit"; private static final long serialVersionUID = 9175956487892235521L; private static final Logger LOG = LoggerFactory.getLogger(Column.class); diff --git a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/TSMUtil.java b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/TSMUtil.java index abde2e3..fef324e 100644 --- a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/TSMUtil.java +++ b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/TSMUtil.java @@ -22,10 +22,8 @@ */ package it.inaf.ia2.tsm; -import it.inaf.ia2.tsm.datalayer.Credentials; import it.inaf.ia2.tsm.datalayer.DatabaseType; import it.inaf.ia2.tsm.datalayer.DBWrapper; -import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; @@ -33,7 +31,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; import javax.sql.DataSource; -import org.postgresql.ds.PGPoolingDataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,36 +44,6 @@ public class TSMUtil { private static final Logger LOG = LoggerFactory.getLogger(TSMUtil.class); - public static DataSource createDataSource(Credentials credentials) { - - switch (credentials.getDatabaseType()) { - - case MYSQL: - MysqlDataSource myds = new MysqlDataSource(); - - myds.setServerName(credentials.getHostname()); - myds.setPortNumber(credentials.getPort()); - myds.setUser(credentials.getUsername()); - myds.setPassword(credentials.getPassword()); - - return myds; - - case POSTGRES: - PGPoolingDataSource pgds = new PGPoolingDataSource(); - - pgds.setServerName(credentials.getHostname()); - pgds.setPortNumber(credentials.getPort()); - pgds.setUser(credentials.getUsername()); - pgds.setPassword(credentials.getPassword()); - pgds.setDatabaseName(credentials.getDatabase()); - - return pgds; - - default: - throw new UnsupportedOperationException(credentials.getDatabaseType() + " not supported yet."); - } - } - protected static List sortStringsList(List list) { Collections.sort(list, String.CASE_INSENSITIVE_ORDER); return list; @@ -236,11 +203,6 @@ public class TSMUtil { return null; } -// private static void setTSColumnDescription(Table table, String columnName, String description) { -// Column column = table.getChild(columnName); -// column.setDescription(description); -// column.setStd(true); -// } public static String getNaturalLangueName(TapSchemaEntity entity) { if (entity instanceof Schema) { return "schema"; diff --git a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchema.java b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchema.java index e438571..740b28d 100644 --- a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchema.java +++ b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchema.java @@ -56,7 +56,6 @@ public class TapSchema implements EntitiesContainer, Serializable { public static final String KEY_COLUMNS_TABLE = "key_columns"; public static final String DESCRIPTION_KEY = "description"; - public static final String STD_KEY = "std"; private static final long serialVersionUID = 1678083091602571256L; @@ -458,7 +457,7 @@ public class TapSchema implements EntitiesContainer, Serializable { // Adding TAP_SCHEMA into TAP_SCHEMA addEntireSchema(tapSchemaName); - fillColumnDescriptionsAndStd(tapSchemaModel, tapSchemaName); + fillColumnProperties(tapSchemaModel, tapSchemaName); if (obscore) { SchemaModel ivoaSchemaModel = getIvoaSchemaModel(); @@ -680,11 +679,22 @@ public class TapSchema implements EntitiesContainer, Serializable { return visibleKeys; } + private Integer getIntAsBool(Boolean value) { + if (value == null) { + return null; + } + return value ? 1 : 0; + } + /** * Fill descriptions of the TAP_SCHEMA schema entities for a given * SchemaModel (TAP_SCHEMA or ivoa). */ - private void fillColumnDescriptionsAndStd(SchemaModel schemaModel, String schemaName) { + private void fillColumnProperties(SchemaModel schemaModel, String schemaName) { + + // check only on std, but valid also for principal (it depends on TS version) + boolean useIntegerAsBool = getTapSchemaModel().get(COLUMNS_TABLE).get(Column.STD_KEY).getJavaType() == Integer.class; + Schema schema = getChild(schemaName); schema.setValue(DESCRIPTION_KEY, schemaModel.getDescription()); for (TableModel tableModel : schemaModel.getTables().values()) { @@ -693,14 +703,19 @@ public class TapSchema implements EntitiesContainer, Serializable { for (PropertyModel propertyModel : tableModel.getProperties().values()) { Column column = table.getChild(propertyModel.getName()); column.setValue(DESCRIPTION_KEY, propertyModel.getDescription()); - if (propertyModel.isStandard()) { - column.setValue(STD_KEY, 1); - } + column.setValue(Column.UCD_KEY, propertyModel.getUcd()); + column.setValue(Column.UNIT_KEY, propertyModel.getUnit()); + column.setValue(Column.UTYPE_KEY, propertyModel.getUtype()); + + Object compatibleStd = useIntegerAsBool ? getIntAsBool(propertyModel.isStandard()) : propertyModel.isStandard(); + Object compatiblePrincipal = useIntegerAsBool ? getIntAsBool(propertyModel.isPrincipal()) : propertyModel.isPrincipal(); + column.setValue(Column.STD_KEY, compatibleStd); + column.setValue(Column.PRINCIPAL_KEY, compatiblePrincipal); } } } private void fillColumnDescriptionsAndStd(SchemaModel schemaModel) { - fillColumnDescriptionsAndStd(schemaModel, schemaModel.getName()); + fillColumnProperties(schemaModel, schemaModel.getName()); } } diff --git a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/DataSourceWrapper.java b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/DataSourceWrapper.java index 266794a..4f020e0 100644 --- a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/DataSourceWrapper.java +++ b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/DataSourceWrapper.java @@ -22,10 +22,8 @@ */ package it.inaf.ia2.tsm.datalayer; -import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; import java.io.Serializable; import javax.sql.DataSource; -import org.postgresql.ds.PGPoolingDataSource; /** * Serializable wrapper for a DataSource. @@ -48,32 +46,32 @@ public class DataSourceWrapper implements Serializable { public DataSource getDataSource() { if (dataSource == null) { + String driverClassName, url; switch (credentials.getDatabaseType()) { - case MYSQL: - MysqlDataSource myds = new MysqlDataSource(); - - myds.setServerName(credentials.getHostname()); - myds.setPortNumber(credentials.getPort()); - myds.setUser(credentials.getUsername()); - myds.setPassword(credentials.getPassword()); - - return myds; - + driverClassName = "com.mysql.jdbc.Driver"; + url = String.format("jdbc:mysql://%s:%s", credentials.getHostname(), credentials.getPort()); + break; case POSTGRES: - PGPoolingDataSource pgds = new PGPoolingDataSource(); - - pgds.setServerName(credentials.getHostname()); - pgds.setPortNumber(credentials.getPort()); - pgds.setUser(credentials.getUsername()); - pgds.setPassword(credentials.getPassword()); - pgds.setDatabaseName(credentials.getDatabase()); - - return pgds; - + driverClassName = "org.postgresql.Driver"; + url = String.format("jdbc:postgresql://%s:%s/%s", + credentials.getHostname(), credentials.getPort(), credentials.getDatabase()); + break; default: throw new UnsupportedOperationException(credentials.getDatabaseType() + " not supported yet."); } + + org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource(); + ds.setDriverClassName(driverClassName); + ds.setUrl(url); + ds.setUsername(credentials.getUsername()); + ds.setPassword(credentials.getPassword()); + ds.setInitialSize(5); + ds.setMaxActive(10); + ds.setMaxIdle(5); + ds.setMinIdle(2); + + dataSource = ds; } return dataSource; } diff --git a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/PropertyModel.java b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/PropertyModel.java index 557b142..d41f6f7 100644 --- a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/PropertyModel.java +++ b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/PropertyModel.java @@ -40,14 +40,21 @@ public class PropertyModel implements Serializable { private boolean updatable; private boolean nullable; private boolean standard; + private boolean mandatory; private String defaultValueString; private String loaderKey; private String description; + private String ucd; + private String utype; + private String unit; + private boolean principal; public PropertyModel() { // default values updatable = true; nullable = true; + // Currently this is used only for ObsCore + mandatory = true; } @XmlElement(name = "name") @@ -104,6 +111,15 @@ public class PropertyModel implements Serializable { this.standard = standard; } + @XmlElement(name = "mandatory", defaultValue = "true") + public boolean isMandatory() { + return mandatory; + } + + public void setMandatory(boolean mandatory) { + this.mandatory = mandatory; + } + @XmlElement(name = "default-value") public String getDefaultValueString() { return defaultValueString; @@ -131,6 +147,42 @@ public class PropertyModel implements Serializable { this.description = description; } + @XmlElement(name = "ucd") + public String getUcd() { + return ucd; + } + + public void setUcd(String ucd) { + this.ucd = ucd; + } + + @XmlElement(name = "utype") + public String getUtype() { + return utype; + } + + public void setUtype(String utype) { + this.utype = utype; + } + + @XmlElement(name = "unit") + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + @XmlElement(name = "principal", defaultValue = "false") + public boolean isPrincipal() { + return principal; + } + + public void setPrincipal(boolean principal) { + this.principal = principal; + } + @XmlTransient public Object getDefaultValue() { if (defaultValueString == null) { diff --git a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/SchemaModels.java b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/SchemaModels.java index b4c5205..6458b40 100644 --- a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/SchemaModels.java +++ b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/SchemaModels.java @@ -103,7 +103,11 @@ public class SchemaModels { tableModel = new TableModel(tableXmlModel); } for (PropertyModel property : tableXmlModel.getAdd()) { - tableModel.getProperties().put(property.getName(), property); + if (tableModel.getProperties().get(property.getName()) == null) { + // Add property only if it didn't exist in child structure + // this allows to override properties in children + tableModel.getProperties().put(property.getName(), property); + } } model.getTables().put(tableName, tableModel); } diff --git a/TASMAN-core/src/main/resources/schema_definition/ivoa-1_1.xml b/TASMAN-core/src/main/resources/schema_definition/ivoa-1_1.xml index 5d71c1c..6f3e50d 100644 --- a/TASMAN-core/src/main/resources/schema_definition/ivoa-1_1.xml +++ b/TASMAN-core/src/main/resources/schema_definition/ivoa-1_1.xml @@ -31,6 +31,22 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. true Logical data product type (image etc.) true + true + ObsDataset.dataProductType + meta.id + true + + + dataproduct_subtype + VARCHAR + 255 + true + Data product specific type + true + false + ObsDataset.dataProductSubtype + meta.id + true calib_level @@ -39,6 +55,10 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. false Calibration level {0, 1, 2, 3, 4} true + true + ObsDataset.calibLevel + meta.code;obs.calib + true obs_collection @@ -48,6 +68,10 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. false Name of the data collection true + true + DataID.collection + meta.id + true obs_id @@ -55,8 +79,106 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 255 true false - Observation ID + Internal ID given by the ObsTAP service + true + true + DataID.observationID + meta.id + true + + + obs_title + VARCHAR + 255 + true + Brief description of dataset in free format + true + false + DataID.title + meta.title;obs + true + + + obs_creation_date + TIMESTAMP + true + Date when the dataset was created + true + false + DataID.date + time;meta.dataset + true + + + obs_creator_name + VARCHAR + 255 + true + Name of the creator of the data + true + false + DataID.creator + meta.id + true + + + obs_creator_did + VARCHAR + 255 + true + IVOA dataset identifier given by the creator + true + false + DataID.creatorDID + meta.id + false + + + obs_release_date + TIMESTAMP + true + Observation release date (ISO 8601) + true + false + Curation.releaseDate + time.release + true + + + publisher_id + VARCHAR + 255 + true + IVOA-ID for the Publisher + true + false + Curation.publisherID + meta.ref.uri;meta.curation + true + + + bib_reference + VARCHAR + 255 + true + Service bibliographic reference true + false + Curation.reference + meta.bib + false + + + data_rights + VARCHAR + 255 + true + Public/Secure/Proprietary + true + false + Curation.rights + meta.code + false obs_publisher_did @@ -66,6 +188,10 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. false Dataset identifier given by the publisher true + true + Curation.publisherDID + meta.ref.uri;meta.curation + true access_url @@ -74,22 +200,35 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. true URL used to access (download) dataset true + true + Access.reference + meta.ref.url + true access_format VARCHAR 255 true - File content format + Content format of the dataset true + true + Access.format + meta.code.mime + true access_estsize - INTEGER + BIGINT true Estimated size of dataset in kilo bytes true kbyte + true + Access.size + kbyte + phys.size;meta.file + true target_name @@ -98,30 +237,61 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. true Astronomical object observed, if any true + true + Target.name + meta.id;src + true + + + target_class + VARCHAR + 255 + true + Class of the Target object as in SSA + true + false + Target.class + src.class + true s_ra DOUBLE true - Central right ascension, ICRS + Central Spatial Position in ICRS Right ascension true deg + true + Char.SpatialAxis.Coverage.Location.Coord.Position2D.Value2.C1 + deg + pos.eq.ra + true s_dec DOUBLE true - Central declination, ICRS + Central Spatial Position in ICRS Declination true deg + true + Char.SpatialAxis.Coverage.Location.Coord.Position2D.Value2.C2 + deg + pos.eq.dec + true s_fov DOUBLE true - Diameter (bounds) of the covered region + Estimated size of the covered region as the diameter of a containing circle true deg + true + Char.SpatialAxis.Coverage.Bounds.Extent.diameter + deg + phys.angSize;instr.fov + true s_region @@ -130,28 +300,129 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. true Sky region covered by the data product (expressed in ICRS frame) true + true + Char.SpatialAxis.Coverage.Support.Area + pos.outline;obs.field + true s_xel1 - INTEGER + BIGINT true - Number of elements along the first spatial axis + Number of elements along the first coordinate of the spatial axis true + true + Char.SpatialAxis.numBins1 + meta.number + true s_xel2 - INTEGER + BIGINT + true + Number of elements along the second coordinate of the spatial axis + true + true + Char.SpatialAxis.numBins2 + meta.number + true + + + s_ucd + VARCHAR + 255 true - Number of elements along the second spatial axis + UCD for the nature of the spatial axis (pos or u,v data) true + false + Char.SpatialAxis.ucd + meta.ucd + true + + + s_unit + VARCHAR + 255 + true + Unit used for spatial axis + true + false + Char.SpatialAxis.unit + meta.unit + true s_resolution DOUBLE true - Spatial resolution of data as FWHM + Spatial resolution of data as FWHM of PSF + true + true + Char.SpatialAxis.Resolution.refval.value + arcsec + pos.angResolution + true + + + s_resolution_min + DOUBLE + true + Resolution min value on spatial axis (FHWM of PSF) true + false + Char.SpatialAxis.Resolution.Bounds.Limits.LoLimit arcsec + pos.angResolution;stat.min + true + + + s_resolution_max + DOUBLE + true + Resolution max value on spatial axis + true + false + Char.SpatialAxis .Resolution.Bounds.Limits.HiLimit + arcsec + pos.angResolution;stat.max + true + + + s_calib_status + VARCHAR + 255 + true + Type of calibration along the spatial axis + true + false + Char.SpatialAxis.calibrationStatus + meta.code.qual + true + + + s_stat_error + DOUBLE + true + Astrometric precision along the spatial axis + true + arcsec + false + Char.SpatialAxis.Accuracy.StatError.Refval.value + arcsec + stat.error;pos.eq + false + + + s_pixel_scale + DOUBLE + true + Sampling period in world coordinate units along the spatial axis + true + false + Char.SpatialAxis.Sampling.RefVal.SamplingPeriod + arcsec + phys.angSize;instr.pixel + true t_min @@ -160,6 +431,10 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Start time in MJD true d + true + Char.TimeAxis.Coverage.Bounds.Limits.StartTime + time.start;obs.exposure + true t_max @@ -168,6 +443,10 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Stop time in MJD true d + true + Char.TimeAxis.Coverage.Bounds.Limits.StopTime + time.end;obs.exposure + true t_exptime @@ -176,6 +455,10 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Total exposure time true s + true + Char.TimeAxis.Coverage.Support.Extent + time.duration;obs.exposure + true t_resolution @@ -184,13 +467,55 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Temporal resolution FWHM true s + true + Char.TimeAxis.Resolution.Refval.valueResolution.Refval.value + time.resolution + true + + + t_calib_status + VARCHAR + 255 + true + Type of time coordinate calibration + true + false + Char.TimeAxis.calibrationStatus + meta.code.qual + false + + + t_stat_error + DOUBLE + true + Time coord statistical error + true + false + Char.TimeAxis.Accuracy.StatError.Refval.value + s + stat.error;time + false t_xel - INTEGER + BIGINT true Number of elements along the time axis true + true + Char.TimeAxis.numBins + meta.number + true + + + t_refpos + VARCHAR + 255 + true + Time Axis Reference Position as defined in STC REC + true + false + Char.TimeAxis.ReferencePosition em_min @@ -199,6 +524,10 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Start in spectral coordinates true m + true + Char.SpectralAxis.Coverage.Bounds.Limits.LoLimit + em.wl;stat.min + true em_max @@ -207,43 +536,184 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Stop in spectral coordinates true m + true + Char.SpectralAxis.Coverage.Bounds.Limits.HiLimit + em.wl;stat.max + true em_res_power DOUBLE true - Spectral resolving power + Value of the resolving power along the spectral axis. (R) + true + true + Char.SpectralAxis.Resolution.ResolPower.refVal + spect.resolution + true + + + em_res_power_min + DOUBLE + true + Resolving power min value on spectral axis + true + false + Char.SpectralAxis.Resolution.ResolPower.LoLimit + spect.resolution;stat.min + true + + + em_res_power_max + DOUBLE + true + Resolving power max value on spectral axis + true + false + Char.SpectralAxis.Resolution.ResolPower.HiLimit + spect.resolution;stat.max + true + + + em_resolution + DOUBLE + true + Value of Resolution along the spectral axis + true + false + Char.SpectralAxis.Resolution.Refval.value + m + spect.resolution;stat.mean + true + + + em_stat_error + DOUBLE + true + Spectral coord statistical error true + false + Char.SpectralAxis.Accuracy.StatError.Refval.value + m + stat.error;em + false em_xel - INTEGER + BIGINT true Number of elements along the spectral axis true + true + Char.SpectralAxis.numBins + meta.number + + + em_ucd + VARCHAR + 255 + true + Nature of the spectral axis + true + false + Char.SpectralAxis.ucd + meta.ucd + true + + + em_unit + VARCHAR + 255 + true + Units along the spectral axis + true + false + Char.SpectralAxis.unit + meta.unit + true + + + em_calib_status + VARCHAR + 255 + true + Type of spectral coord calibration + true + false + Char.SpectralAxis.calibrationStatus + meta.code.qual + false o_ucd VARCHAR 255 true - UCD of observable (e.g. phot.flux.density, phot.count, etc.) + UCD of the observable axis (e.g. phot.flux.density, phot.count, etc.) true + true + Char.ObservableAxis.ucd + meta.ucd + true + + + o_unit + VARCHAR + 255 + true + Units used for the observable values + true + false + Char.ObservableAxis.unit + meta.unit + true + + + o_calib_status + VARCHAR + 255 + true + Type of calibration for the observable coordinate + true + false + Char.ObservableAxis.calibrationStatus + meta.code.qual + true + + + o_stat_error + DOUBLE + true + Statistical error on the Observable axis + true + false + Char.ObservableAxis.Accuracy.StatError.Refval.value + + stat.error;phot.flux + false pol_states VARCHAR 255 true - List of polarization states or NULL if not applicable + List of polarization states present in the data file or NULL if not applicable true + true + Char.PolarizationAxis.stateList + meta.code;phys.polarization + true pol_xel - INTEGER + BIGINT true - Number of polarization samples + Number of elements along the polarization axis true + true + Char.PolarizationAxis.numBins + meta.number + true facility_name @@ -252,14 +722,34 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. true Name of the facility used for this observation true + true + Provenance.ObsConfig.Facility.name + meta.id;instr.tel + true instrument_name VARCHAR 255 true - Name of the instrument used for this observation + The name of the instrument used for the observation true + true + Provenance.ObsConfig.Instrument.name + meta.id;instr + true + + + proposal_id + VARCHAR + 255 + true + Identifier of proposal to which observation belongs + false + true + Provenance.Proposal.identifier + meta.id; obs.proposal + false
diff --git a/TASMAN-core/src/main/resources/sql_type_mapping.xml b/TASMAN-core/src/main/resources/sql_type_mapping.xml index cb60fd4..4516113 100644 --- a/TASMAN-core/src/main/resources/sql_type_mapping.xml +++ b/TASMAN-core/src/main/resources/sql_type_mapping.xml @@ -71,5 +71,17 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. text java.lang.String + + TIMESTAMP + TIMESTAMP + timestamp + java.lang.String + + + REGION + VARCHAR + character varying + java.lang.String + diff --git a/TASMAN-embedded/src/main/java/it/inaf/ia2/tap/tasman/Main.java b/TASMAN-embedded/src/main/java/it/inaf/ia2/tap/tasman/Main.java index 759ba1e..0e272c7 100644 --- a/TASMAN-embedded/src/main/java/it/inaf/ia2/tap/tasman/Main.java +++ b/TASMAN-embedded/src/main/java/it/inaf/ia2/tap/tasman/Main.java @@ -1,7 +1,11 @@ package it.inaf.ia2.tap.tasman; import java.io.File; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.StdErrLog; import org.eclipse.jetty.webapp.WebAppContext; /** @@ -10,11 +14,29 @@ import org.eclipse.jetty.webapp.WebAppContext; */ public class Main { + private static final int DEFAULT_PORT = 8080; + /** * @param args the command line arguments */ public static void main(String[] args) throws Exception { - Server server = new Server(2500); + + int port = DEFAULT_PORT; + + if (args.length == 1) { + try { + port = Integer.parseInt(args[0]); + } catch (NumberFormatException e) { + System.err.println("First argument must be a port number"); + } + } + + final int serverPort = port; + + // Suppress log verbosity + ((StdErrLog) Log.getRootLogger()).setLevel(StdErrLog.LEVEL_WARN); + + Server server = new Server(serverPort); WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); @@ -22,17 +44,26 @@ public class Main { webapp.setWar(warFile.getAbsolutePath()); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=477705 - //https://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_jetty + // https://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_jetty webapp.prependServerClass("-org.eclipse.jetty.server.handler.ContextHandler"); webapp.prependServerClass("-org.eclipse.jetty.servlet.FilterHolder"); webapp.prependServerClass("-org.eclipse.jetty.servlet.ServletContextHandler"); webapp.prependServerClass("-org.eclipse.jetty.servlet.ServletHolder"); + webapp.addEventListener(new ServletContextListener() { + @Override + public void contextInitialized(ServletContextEvent sce) { + System.out.println("TASMAN initialized. Visit http://localhost:" + serverPort); + } + + @Override + public void contextDestroyed(ServletContextEvent sce) { + } + }); + server.setHandler(webapp); server.start(); - server.dumpStdErr(); - // The use of server.join() the will make the current thread join and // wait until the server is done executing. server.join(); diff --git a/TASMAN-webapp/pom.xml b/TASMAN-webapp/pom.xml index 7c6bdff..a0dbb0f 100644 --- a/TASMAN-webapp/pom.xml +++ b/TASMAN-webapp/pom.xml @@ -111,6 +111,13 @@ it.inaf.ia2.tap tasman-core 1.2.0 + + + + org.apache.tomcat + tomcat-juli + +
ari.ucidy diff --git a/TASMAN-webapp/src/main/webapp/WEB-INF/web.xml b/TASMAN-webapp/src/main/webapp/WEB-INF/web.xml index cb584df..c2eda28 100644 --- a/TASMAN-webapp/src/main/webapp/WEB-INF/web.xml +++ b/TASMAN-webapp/src/main/webapp/WEB-INF/web.xml @@ -97,5 +97,36 @@ com.sun.faces.config.ConfigureListener + + REST + org.glassfish.jersey.servlet.ServletContainer + + jersey.config.server.provider.packages + it.inaf.ia2.tsm.webapp it.inaf.ia2.tsm.webapp.env + + 1 + + + + REST + /rest/* + + + + default + org.eclipse.jetty.servlet.DefaultServlet + + dirAllowed + false + + + welcomeServlets + true + + + redirectWelcome + true + + ${enable.jetty.config.start} --> -- GitLab