Commit 2eda27c00b8a73f6901e16c2e573c3155a727aaa

Authored by Nathanael Jourdane
1 parent fa934e09
Exists in master

Start VOResource management implementation.

src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIController.java
... ... @@ -23,8 +23,8 @@ import java.nio.file.Paths;
23 23 import java.util.logging.Level;
24 24 import java.util.logging.Logger;
25 25  
26   -import eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapController;
27   -import eu.omp.irap.vespa.epntapclient.epnTapLib.Queries;
  26 +import eu.omp.irap.vespa.epntapclient.lib.EpnTapController;
  27 +import eu.omp.irap.vespa.epntapclient.lib.Queries;
28 28 import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.CantDisplayVOTableException;
29 29 import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.CantSendQueryException;
30 30  
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapService.java 0 → 100644
... ... @@ -0,0 +1,183 @@
  1 +/*
  2 + * This file is a part of EpnTAPClient.
  3 + * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
  4 + * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
  5 + * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
  6 + *
  7 + * This program is free software: you can
  8 + * redistribute it and/or modify it under the terms of the GNU General Public License as published
  9 + * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
  10 + * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
  11 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12 + * PURPOSE. See the GNU General Public License for more details. You should have received a copy of
  13 + * the GNU General Public License along with this program. If not, see
  14 + * <http://www.gnu.org/licenses/>.
  15 + */
  16 +
  17 +package eu.omp.irap.vespa.epntapclient.lib;
  18 +
  19 +import java.util.Date;
  20 +
  21 +/**
  22 + * @author N. Jourdane
  23 + */
  24 +public class EpnTapService {
  25 +
  26 + public String granuleUid;
  27 +
  28 + public String granuleGid;
  29 +
  30 + public String obsId;
  31 +
  32 + public String dataproductType;
  33 +
  34 + public String targetName;
  35 +
  36 + public String targetClass;
  37 +
  38 + public double timeMin;
  39 +
  40 + public double timeMax;
  41 +
  42 + public double timeSamplingStepMin;
  43 +
  44 + public double timeSamplingStepMax;
  45 +
  46 + public double timeExpMin;
  47 +
  48 + public double timeExpMax;
  49 +
  50 + public double spectralRangeMin;
  51 +
  52 + public double spectralRangeMax;
  53 +
  54 + public double spectralSamplingStepMin;
  55 +
  56 + public double spectralSamplingStepMax;
  57 +
  58 + public double spectralResolutionMin;
  59 +
  60 + public double spectralResolutionMax;
  61 +
  62 + public double c1Min;
  63 +
  64 + public double c1Max;
  65 +
  66 + public double c2Min;
  67 +
  68 + public double c2Max;
  69 +
  70 + public double c3Min;
  71 +
  72 + public double c3Max;
  73 +
  74 + public double c1ResolMin;
  75 +
  76 + public double c1ResolMax;
  77 +
  78 + public double c2ResolMin;
  79 +
  80 + public double c2ResolMax;
  81 +
  82 + public double c3ResolMin;
  83 +
  84 + public double c3ResolMax;
  85 +
  86 + public String spatialFrameType;
  87 +
  88 + public double incidenceMin;
  89 +
  90 + public double incidenceMax;
  91 +
  92 + public double emergenceMin;
  93 +
  94 + public double emergenceMax;
  95 +
  96 + public double phaseMin;
  97 +
  98 + public double phaseMax;
  99 +
  100 + public String instrumentHostName;
  101 +
  102 + public String instrumentName;
  103 +
  104 + public String measurementType;
  105 +
  106 + public int processingLevel;
  107 +
  108 + public Date creationDate;
  109 +
  110 + public Date modificationDate;
  111 +
  112 + public Date releaseDate;
  113 +
  114 + public String serviceTitle;
  115 +
  116 + public String accessUrl;
  117 +
  118 + public String accessFormat;
  119 +
  120 + public int accessEstsize;
  121 +
  122 + public String dataAccessUrl;
  123 +
  124 + public String accessMd5;
  125 +
  126 + public String thumbnailUrl;
  127 +
  128 + public String fileName;
  129 +
  130 + public String species;
  131 +
  132 + public String altTargetName;
  133 +
  134 + public String targetRegion;
  135 +
  136 + public String featureName;
  137 +
  138 + public String bibReference;
  139 +
  140 + public double ra;
  141 +
  142 + public double dec;
  143 +
  144 + public double solarLongitudeMin;
  145 +
  146 + public double solarLongitudeMax;
  147 +
  148 + public double localTimeMin;
  149 +
  150 + public double localTimeMax;
  151 +
  152 + public double targetDistanceMin;
  153 +
  154 + public double targetDistanceMax;
  155 +
  156 + public double targetTimeMin;
  157 +
  158 + public double targetTimeMax;
  159 +
  160 + public String particleSpectralType;
  161 +
  162 + public double particleSpectralRangeMin;
  163 +
  164 + public double particleSpectralRangeMax;
  165 +
  166 + public double particleSpectralSamplingStepMin;
  167 +
  168 + public double particleSpectralSamplingStepMax;
  169 +
  170 + public double particleSpectralResolutionMin;
  171 +
  172 + public double particleSpectralResolutionMax;
  173 +
  174 + public String publisher;
  175 +
  176 + public String spatialCoordinateDescription;
  177 +
  178 + public String spatialOrigin;
  179 +
  180 + public String timeOrigin;
  181 +
  182 + public String timeScale;
  183 +}
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/lib/ServicesManager.java 0 → 100644
... ... @@ -0,0 +1,53 @@
  1 +/*
  2 + * This file is a part of EpnTAPClient.
  3 + * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
  4 + * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
  5 + * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
  6 + *
  7 + * This program is free software: you can
  8 + * redistribute it and/or modify it under the terms of the GNU General Public License as published
  9 + * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
  10 + * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
  11 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12 + * PURPOSE. See the GNU General Public License for more details. You should have received a copy of
  13 + * the GNU General Public License along with this program. If not, see
  14 + * <http://www.gnu.org/licenses/>.
  15 + */
  16 +
  17 +package eu.omp.irap.vespa.epntapclient.lib;
  18 +
  19 +import java.util.logging.Logger;
  20 +
  21 +import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableController;
  22 +import eu.omp.irap.vespa.epntapclient.votable.utils.Consts;
  23 +
  24 +/**
  25 + * @author N. Jourdane
  26 + */
  27 +public class ServicesManager {
  28 +
  29 + /** The logger for the class ServicesManager. */
  30 + private static final Logger logger = Logger.getLogger(ServicesManager.class.getName());
  31 +
  32 +
  33 + public enum ResourceType {
  34 + EPN_TAP, OBSCORE, OBSPM
  35 + };
  36 +
  37 +
  38 + ServicesManager(ResourceType resourceType) {
  39 + if (resourceType == ResourceType.EPN_TAP) {
  40 + VOTableController servicesCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL,
  41 + "ADQL",
  42 + Queries.GET_EPN_TAP_SERVICES);
  43 + } else if (resourceType == ResourceType.OBSCORE) {
  44 + VOTableController servicesCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL,
  45 + "ADQL",
  46 + Queries.GET_TAP_OBSCOR_SERVICES);
  47 + } else if (resourceType == ResourceType.OBSPM) {
  48 + VOTableController servicesCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL,
  49 + "ADQL",
  50 + Queries.GET_VO_RESOURCES);
  51 + }
  52 + }
  53 +}
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceException.java 0 → 100644
... ... @@ -0,0 +1,55 @@
  1 +/*
  2 + * This file is a part of EpnTAPClient.
  3 + * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
  4 + * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
  5 + * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
  6 + *
  7 + * This program is free software: you can
  8 + * redistribute it and/or modify it under the terms of the GNU General Public License as published
  9 + * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
  10 + * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
  11 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12 + * PURPOSE. See the GNU General Public License for more details. You should have received a copy of
  13 + * the GNU General Public License along with this program. If not, see
  14 + * <http://www.gnu.org/licenses/>.
  15 + */
  16 +
  17 +package eu.omp.irap.vespa.epntapclient.lib.resource;
  18 +
  19 +/**
  20 + * @author N. Jourdane
  21 + */
  22 +public class VOResourceException extends Exception {
  23 +
  24 + /**
  25 + * @param message The message describing the exception displayed in the error dialog.
  26 + */
  27 + public VOResourceException(String message) {
  28 + super(message);
  29 + }
  30 +
  31 + /**
  32 + * @param message The message describing the exception displayed in the error dialog.
  33 + * @param e The exception thrown.
  34 + */
  35 + public VOResourceException(String message, Exception e) {
  36 + super(message, e);
  37 + }
  38 +
  39 +
  40 + public static class VOResourceIsNotValidException extends VOResourceException {
  41 +
  42 + /** */
  43 + private static final long serialVersionUID = 1L;
  44 +
  45 +
  46 + /**
  47 + * @param voTablePath The path of the VOTable.
  48 + * @param e The exception thrown.
  49 + */
  50 + public VOResourceIsNotValidException(String voResourcePath, Exception e) {
  51 + super("Can not parse the VOResource because it doesn't match with the VOResource schema."
  52 + + "\n See the VOResource file for more details: " + voResourcePath, e);
  53 + }
  54 + }
  55 +}
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceParser.java 0 → 100644
... ... @@ -0,0 +1,62 @@
  1 +/*
  2 + * This file is a part of EpnTAPClient.
  3 + * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
  4 + * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
  5 + * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
  6 + *
  7 + * This program is free software: you can
  8 + * redistribute it and/or modify it under the terms of the GNU General Public License as published
  9 + * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
  10 + * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
  11 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12 + * PURPOSE. See the GNU General Public License for more details. You should have received a copy of
  13 + * the GNU General Public License along with this program. If not, see
  14 + * <http://www.gnu.org/licenses/>.
  15 + */
  16 +
  17 +package eu.omp.irap.vespa.epntapclient.lib.resource;
  18 +
  19 +import java.io.File;
  20 +import java.util.logging.Logger;
  21 +
  22 +import javax.xml.bind.JAXBContext;
  23 +import javax.xml.bind.JAXBException;
  24 +import javax.xml.bind.Unmarshaller;
  25 +
  26 +import eu.omp.irap.vespa.epntapclient.lib.resource.VOResourceException.VOResourceIsNotValidException;
  27 +import eu.omp.irap.vespa.epntapclient.voresource.model.Resource;
  28 +
  29 +/**
  30 + * @author N. Jourdane
  31 + */
  32 +public class VOResourceParser {
  33 +
  34 + /** The logger for the class VOResourceParser. */
  35 + private static final Logger logger = Logger.getLogger(VOResourceParser.class.getName());
  36 +
  37 + private static final String VORESOURCE_MODEL_PACKAGE = "eu.omp.irap.vespa.epntapclient.voresource.model";
  38 +
  39 + private static final String GET_VORESOURCE_URL = "http://voparis-registry.obspm.fr/vo/ivoa/1/voresources.xml?identifier=";
  40 +
  41 +
  42 + public static Resource parseRemoteVOResource(String identifier) {
  43 + // VOResourceParser.parseVOResource(String voResourcePath);
  44 + return null;
  45 + }
  46 +
  47 + public static Resource parseVOResource(String voResourcePath)
  48 + throws VOResourceIsNotValidException {
  49 + Resource voResource;
  50 + JAXBContext jc;
  51 + try {
  52 + jc = JAXBContext.newInstance(VOResourceParser.VORESOURCE_MODEL_PACKAGE);
  53 + Unmarshaller unmarshaller = jc.createUnmarshaller();
  54 + voResource = (Resource) unmarshaller.unmarshal(new File(voResourcePath));
  55 + } catch (JAXBException e) {
  56 + throw new VOResourceIsNotValidException(voResourcePath, e);
  57 + }
  58 +
  59 + return voResource;
  60 + }
  61 +
  62 +}
... ...