Loading CHANGELOG.md +3 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,9 @@ * **XML configuration format is changed: if you update from previous version you will lost your previous configuration.** * Both new users and custom UCDs can now be added using the GUI. * Added "Rebuild UCD" functionality on the UCD insertion dialog. * Fixed bug on consistency checking when a schema is missing * Added warning in case of possible wrong source credentials selection (this is shown when consistency checking detect only the TAP_SCHEMA itself). * Avoided connection timeout on the webapp when loading big TAP_SCHEMA schemas. ## Version 1.0.4 Loading TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/SchemaSelectionBean.java +71 −27 Original line number Diff line number Diff line Loading @@ -73,6 +73,9 @@ public class SchemaSelectionBean implements Serializable { private String tapSchemaName; private List<String> allSchemas; private List<String> selectedSchemas; private boolean loading; private TapSchema loadedTapSchema; private String loadingError; @PostConstruct public void init() { Loading Loading @@ -146,7 +149,9 @@ public class SchemaSelectionBean implements Serializable { public void setSelectedTAPSchema(String selectedTAPSchema) { this.selectedTAPSchema = selectedTAPSchema; } public void selectedTAPSchemaChanged() { try { loadExposedSchemas(); } catch (SQLException e) { Loading @@ -162,36 +167,56 @@ public class SchemaSelectionBean implements Serializable { this.selectedSchemas = selectedSchemas; } private String loadTapSchema(TapSchema tapSchema) { tapSchemaEditingBean.setTapSchema(tapSchema); public String openLoaded() { if (loadedTapSchema.getConsistencyChecks().isInconsistent()) { consistencyChecksBean.setDbWrapper(dbWrapper); consistencyChecksBean.setTapSchema(loadedTapSchema); return "consistencyChecks.xhtml?faces-redirect=true"; } else { tapSchemaEditingBean.setTapSchema(loadedTapSchema); return "tapSchemaEditing.xhtml?faces-redirect=true"; } } public void edit() { loadedTapSchema = null; loading = true; loadingError = null; public String edit() { new Thread(new Runnable() { @Override public void run() { try { TapSchema tapSchema = TapSchemaFactory.getTapSchema(TapSchemaVersion.TAP_SCHEMA_1_IA2, dbWrapper, selectedTAPSchema, true); if (tapSchema.getConsistencyChecks().isInconsistent()) { consistencyChecksBean.setDbWrapper(dbWrapper); consistencyChecksBean.setTapSchema(tapSchema); return "consistencyChecks.xhtml?faces-redirect=true"; } else { return loadTapSchema(tapSchema); loadedTapSchema = TapSchemaFactory.getTapSchema(TapSchemaVersion.TAP_SCHEMA_1_IA2, dbWrapper, selectedTAPSchema, true); } catch (Throwable e) { loadingError = e.getMessage(); } } catch (SQLException e) { throw new RuntimeException(e); loading = false; } }).start(); } public String create() { public void create() { loadedTapSchema = null; loading = true; loadingError = null; new Thread(new Runnable() { @Override public void run() { try { TapSchema tapSchema = TapSchemaFactory.getTapSchema(TapSchemaVersion.TAP_SCHEMA_1_IA2, dbWrapper, tapSchemaName, false); loadedTapSchema = TapSchemaFactory.getTapSchema(TapSchemaVersion.TAP_SCHEMA_1_IA2, dbWrapper, tapSchemaName, false); for (String schemaName : selectedSchemas) { tapSchema.addChild(schemaName); loadedTapSchema.addChild(schemaName); } return loadTapSchema(tapSchema); } catch (SQLException e) { throw new RuntimeException(e); } catch (Throwable e) { loadingError = e.getMessage(); } loading = false; } }).start(); } public String getTapSchemaName() { Loading Loading @@ -226,4 +251,23 @@ public class SchemaSelectionBean implements Serializable { throw new ValidatorException(new FacesMessage(validatorMessage)); } } /** * This boolean is true when a TapSchema instance is loading. */ public boolean isLoading() { return loading; } /** * This String is not null when an error happens while a TapSchema is * loading. */ public String getLoadingError() { return loadingError; } public TapSchema getLoadedTapSchema() { return loadedTapSchema; } } TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/TapSchemaEditingBean.java +5 −4 Original line number Diff line number Diff line Loading @@ -400,17 +400,18 @@ public class TapSchemaEditingBean implements Serializable { }); } public String reload() { public void reload() { if (schemaSelection.getSelectedRadioOption().equals("edit")) { return schemaSelection.edit(); schemaSelection.edit(); } else { if (tapSchema.exists()) { schemaSelection.setSelectedRadioOption("edit"); schemaSelection.setSelectedTAPSchema(tapSchema.getName()); return schemaSelection.edit(); schemaSelection.selectedTAPSchemaChanged(); schemaSelection.edit(); } else { return schemaSelection.create(); schemaSelection.create(); } } } Loading TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/TapSchemaLoaderResource.java 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * _____________________________________________________________________________ * * INAF - OATS National Institute for Astrophysics - Astronomical Observatory of * Trieste INAF - IA2 Italian Center for Astronomical Archives * _____________________________________________________________________________ * * Copyright (C) 2017 Istituto Nazionale di Astrofisica * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License Version 3 as published by the * Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package it.inaf.ia2.tsm.webapp; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.json.Json; import javax.json.JsonObjectBuilder; /** * REST Web Service * * @author Sonia Zorba {@literal <zorba at oats.inaf.it>} */ @Path("tap_schema") @RequestScoped public class TapSchemaLoaderResource { @Inject private SchemaSelectionBean schemaSelection; @GET @Path("status") public String getStatus() { JsonObjectBuilder job = Json.createObjectBuilder(); job.add("loading", schemaSelection.isLoading()); if (schemaSelection.getLoadingError() != null) { job.add("error", schemaSelection.getLoadingError()); } return job.build().toString(); } } TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/env/ApplicationConfig.java +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ public class ApplicationConfig extends Application { */ private void addRestResourceClasses(Set<Class<?>> resources) { resources.add(it.inaf.ia2.tsm.webapp.CredentialsDialogResource.class); resources.add(it.inaf.ia2.tsm.webapp.TapSchemaLoaderResource.class); resources.add(it.inaf.ia2.tsm.webapp.env.KeepAliveResource.class); } } Loading
CHANGELOG.md +3 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,9 @@ * **XML configuration format is changed: if you update from previous version you will lost your previous configuration.** * Both new users and custom UCDs can now be added using the GUI. * Added "Rebuild UCD" functionality on the UCD insertion dialog. * Fixed bug on consistency checking when a schema is missing * Added warning in case of possible wrong source credentials selection (this is shown when consistency checking detect only the TAP_SCHEMA itself). * Avoided connection timeout on the webapp when loading big TAP_SCHEMA schemas. ## Version 1.0.4 Loading
TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/SchemaSelectionBean.java +71 −27 Original line number Diff line number Diff line Loading @@ -73,6 +73,9 @@ public class SchemaSelectionBean implements Serializable { private String tapSchemaName; private List<String> allSchemas; private List<String> selectedSchemas; private boolean loading; private TapSchema loadedTapSchema; private String loadingError; @PostConstruct public void init() { Loading Loading @@ -146,7 +149,9 @@ public class SchemaSelectionBean implements Serializable { public void setSelectedTAPSchema(String selectedTAPSchema) { this.selectedTAPSchema = selectedTAPSchema; } public void selectedTAPSchemaChanged() { try { loadExposedSchemas(); } catch (SQLException e) { Loading @@ -162,36 +167,56 @@ public class SchemaSelectionBean implements Serializable { this.selectedSchemas = selectedSchemas; } private String loadTapSchema(TapSchema tapSchema) { tapSchemaEditingBean.setTapSchema(tapSchema); public String openLoaded() { if (loadedTapSchema.getConsistencyChecks().isInconsistent()) { consistencyChecksBean.setDbWrapper(dbWrapper); consistencyChecksBean.setTapSchema(loadedTapSchema); return "consistencyChecks.xhtml?faces-redirect=true"; } else { tapSchemaEditingBean.setTapSchema(loadedTapSchema); return "tapSchemaEditing.xhtml?faces-redirect=true"; } } public void edit() { loadedTapSchema = null; loading = true; loadingError = null; public String edit() { new Thread(new Runnable() { @Override public void run() { try { TapSchema tapSchema = TapSchemaFactory.getTapSchema(TapSchemaVersion.TAP_SCHEMA_1_IA2, dbWrapper, selectedTAPSchema, true); if (tapSchema.getConsistencyChecks().isInconsistent()) { consistencyChecksBean.setDbWrapper(dbWrapper); consistencyChecksBean.setTapSchema(tapSchema); return "consistencyChecks.xhtml?faces-redirect=true"; } else { return loadTapSchema(tapSchema); loadedTapSchema = TapSchemaFactory.getTapSchema(TapSchemaVersion.TAP_SCHEMA_1_IA2, dbWrapper, selectedTAPSchema, true); } catch (Throwable e) { loadingError = e.getMessage(); } } catch (SQLException e) { throw new RuntimeException(e); loading = false; } }).start(); } public String create() { public void create() { loadedTapSchema = null; loading = true; loadingError = null; new Thread(new Runnable() { @Override public void run() { try { TapSchema tapSchema = TapSchemaFactory.getTapSchema(TapSchemaVersion.TAP_SCHEMA_1_IA2, dbWrapper, tapSchemaName, false); loadedTapSchema = TapSchemaFactory.getTapSchema(TapSchemaVersion.TAP_SCHEMA_1_IA2, dbWrapper, tapSchemaName, false); for (String schemaName : selectedSchemas) { tapSchema.addChild(schemaName); loadedTapSchema.addChild(schemaName); } return loadTapSchema(tapSchema); } catch (SQLException e) { throw new RuntimeException(e); } catch (Throwable e) { loadingError = e.getMessage(); } loading = false; } }).start(); } public String getTapSchemaName() { Loading Loading @@ -226,4 +251,23 @@ public class SchemaSelectionBean implements Serializable { throw new ValidatorException(new FacesMessage(validatorMessage)); } } /** * This boolean is true when a TapSchema instance is loading. */ public boolean isLoading() { return loading; } /** * This String is not null when an error happens while a TapSchema is * loading. */ public String getLoadingError() { return loadingError; } public TapSchema getLoadedTapSchema() { return loadedTapSchema; } }
TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/TapSchemaEditingBean.java +5 −4 Original line number Diff line number Diff line Loading @@ -400,17 +400,18 @@ public class TapSchemaEditingBean implements Serializable { }); } public String reload() { public void reload() { if (schemaSelection.getSelectedRadioOption().equals("edit")) { return schemaSelection.edit(); schemaSelection.edit(); } else { if (tapSchema.exists()) { schemaSelection.setSelectedRadioOption("edit"); schemaSelection.setSelectedTAPSchema(tapSchema.getName()); return schemaSelection.edit(); schemaSelection.selectedTAPSchemaChanged(); schemaSelection.edit(); } else { return schemaSelection.create(); schemaSelection.create(); } } } Loading
TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/TapSchemaLoaderResource.java 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * _____________________________________________________________________________ * * INAF - OATS National Institute for Astrophysics - Astronomical Observatory of * Trieste INAF - IA2 Italian Center for Astronomical Archives * _____________________________________________________________________________ * * Copyright (C) 2017 Istituto Nazionale di Astrofisica * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License Version 3 as published by the * Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package it.inaf.ia2.tsm.webapp; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.json.Json; import javax.json.JsonObjectBuilder; /** * REST Web Service * * @author Sonia Zorba {@literal <zorba at oats.inaf.it>} */ @Path("tap_schema") @RequestScoped public class TapSchemaLoaderResource { @Inject private SchemaSelectionBean schemaSelection; @GET @Path("status") public String getStatus() { JsonObjectBuilder job = Json.createObjectBuilder(); job.add("loading", schemaSelection.isLoading()); if (schemaSelection.getLoadingError() != null) { job.add("error", schemaSelection.getLoadingError()); } return job.build().toString(); } }
TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/env/ApplicationConfig.java +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ public class ApplicationConfig extends Application { */ private void addRestResourceClasses(Set<Class<?>> resources) { resources.add(it.inaf.ia2.tsm.webapp.CredentialsDialogResource.class); resources.add(it.inaf.ia2.tsm.webapp.TapSchemaLoaderResource.class); resources.add(it.inaf.ia2.tsm.webapp.env.KeepAliveResource.class); } }