diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapController.java b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapController.java
new file mode 100644
index 0000000..abc6dbd
--- /dev/null
+++ b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapController.java
@@ -0,0 +1,100 @@
+/*
+ * This file is a part of EpnTAPClient.
+ * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
+ * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
+ * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
+ *
+ * This program is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
+ * version. 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, see
+ * .
+ */
+
+package eu.omp.irap.vespa.epntapclient;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import eu.omp.irap.vespa.epntapclient.service.Queries;
+import eu.omp.irap.vespa.epntapclient.votable.Consts;
+import eu.omp.irap.vespa.epntapclient.votable.VOTableException.CantDisplayVOTableException;
+import eu.omp.irap.vespa.epntapclient.votable.VOTableException.CantSendQueryException;
+import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableController;
+
+/**
+ * The main controller which manage views and controllers.
+ *
+ * @author N. Jourdane
+ */
+public class EpnTapController {
+
+ /** The logger for the class EpnTapController. */
+ private static final Logger logger = Logger.getLogger(EpnTapController.class.getName());
+
+ /** The controller of the VOTable displaying the list of services. */
+ protected VOTableController servicesCtrl;
+
+ /** The controller of the VOTable displaying the list of services. */
+ protected VOTableController resultsCtrl;
+
+ /**
+ * The parameters fields for the request.
+ */
+ protected Map paramValues = new HashMap<>();
+
+
+ /**
+ * Method constructor, which initialize servicesController, resultsController and mainView.
+ */
+ public EpnTapController() {
+ servicesCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL, "ADQL",
+ Queries.GET_EPN_TAP_SERVICES);
+ try {
+ servicesCtrl.readTable();
+ } catch (CantDisplayVOTableException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (CantSendQueryException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ public String sendQuery(String query, String tableServiceURL)
+ throws CantDisplayVOTableException, CantSendQueryException {
+ resultsCtrl = new VOTableController(tableServiceURL, "ADQL", query);
+ resultsCtrl.readTable();
+ return resultsCtrl.getVOTablePath();
+ }
+
+ /**
+ * @return The controller of the VOTable which displays the result of the query.
+ */
+ public VOTableController getResultsController() {
+ return resultsCtrl;
+ }
+
+ /**
+ * @return The controller of the VOTable which displays the list of services.
+ */
+ public VOTableController getServicesController() {
+ return servicesCtrl;
+ }
+
+ public void updateParameter(String paramName, Object paramValue) {
+ paramValues.put(paramName, paramValue);
+ }
+
+ public void removeParameter(String paramName) {
+ paramValues.remove(paramName);
+ }
+
+ public Map getParamValues() {
+ return paramValues;
+ }
+}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapFacade.java b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapFacade.java
new file mode 100644
index 0000000..074cade
--- /dev/null
+++ b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapFacade.java
@@ -0,0 +1,148 @@
+/*
+ * This file is a part of EpnTAPClient.
+ * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
+ * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
+ * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
+ *
+ * This program is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
+ * version. 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, see
+ * .
+ */
+
+package eu.omp.irap.vespa.epntapclient;
+
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import eu.omp.irap.vespa.epntapclient.resource.VOResourceCtrl;
+import eu.omp.irap.vespa.epntapclient.resource.VOResourceException;
+import eu.omp.irap.vespa.epntapclient.service.Service;
+import eu.omp.irap.vespa.epntapclient.voresource.model.Resource;
+
+/**
+ * @author N. Jourdane
+ */
+public class EpnTapFacade implements EpnTapInterface {
+
+ /** The logger for the class EpnTapFacade. */
+ private static final Logger logger = Logger.getLogger(EpnTapFacade.class.getName());
+
+
+ /* @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNVOResources() */
+ @Override
+ public List getEPNVOResources(Service.ServiceType serviceType)
+ throws VOResourceException {
+ return VOResourceCtrl.getVOResources(serviceType);
+ }
+
+ /*
+ * @see
+ * eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNVOResources(java.util.List)
+ */
+ @Override
+ public List getEPNVOResources(Service.ServiceType serviceType,
+ Map keywords)
+ throws VOResourceException {
+ return VOResourceCtrl.getVOResources(serviceType, keywords);
+ }
+
+ /*
+ * @see
+ * eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNVOresource(java.lang.String)
+ */
+ @Override
+ public Resource getEPNVOresource(String ivoid) {
+ return null;
+ // TODO Auto-generated method stub
+
+ }
+
+ /* @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNServices() */
+ @Override
+ public void getEPNServices() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNServices(java.util.List)
+ */
+ @Override
+ public void getEPNServices(List attributes) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNServices(java.util.List,
+ * java.util.List)
+ */
+ @Override
+ public void getEPNServices(List keywords, List attributes) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNService(java.lang.String)
+ */
+ @Override
+ public void getEPNService(String ivoID) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNService(java.lang.String,
+ * java.util.List)
+ */
+ @Override
+ public void getEPNService(String ivoID, List attributes) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNCoreTableName(java.lang.
+ * String)
+ */
+ @Override
+ public void getEPNCoreTableName(String service_ivoid) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getTAPURL(java.lang.String) */
+ @Override
+ public void getTAPURL(String service_ivoid) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#sendADQLQuery(java.lang.String,
+ * java.lang.String)
+ */
+ @Override
+ public void sendADQLQuery(String TAPURL, String ADQLQuery) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#sendQuery(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ @Override
+ public void sendQuery(String TAPURL, String schema_name, String Query) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapInterface.java b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapInterface.java
new file mode 100644
index 0000000..8a629b7
--- /dev/null
+++ b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapInterface.java
@@ -0,0 +1,94 @@
+/*
+ * This file is a part of EpnTAPClient.
+ * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
+ * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
+ * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
+ *
+ * This program is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
+ * version. 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, see
+ * .
+ */
+
+package eu.omp.irap.vespa.epntapclient;
+
+import java.util.List;
+import java.util.Map;
+
+import eu.omp.irap.vespa.epntapclient.resource.VOResourceException;
+import eu.omp.irap.vespa.epntapclient.service.Service;
+import eu.omp.irap.vespa.epntapclient.voresource.model.Resource;
+
+/**
+ * @author N. Jourdane
+ */
+public interface EpnTapInterface {
+
+ /** returns a set of VOResource elements (one per EPN-TAP service) */
+ List getEPNVOResources(Service.ServiceType serviceType)
+ throws VOResourceException;
+
+ /**
+ * Returns a set of VOREsource elements (one per EPN-TAP service corresponding to the keywords).
+ * The way keywords are defined is still to be defined.
+ */
+ List getEPNVOResources(Service.ServiceType serviceType,
+ Map keywords) throws VOResourceException;
+
+ /** returns the VOResource element of the service identified by the ivoID. */
+ Resource getEPNVOresource(String ivoid) throws VOResourceException;
+
+ /**
+ * returns a VOTable containing the list of EPN-TAP services and their attributes (from a
+ * predefined list)
+ */
+ void getEPNServices();
+
+ /**
+ * returns a VOTable containing the list of EPN-TAP services and their attributes (from the list
+ * of attributes)
+ */
+ void getEPNServices(List attributes);
+
+ /**
+ * returns a VOTable containing the list of EPN-TAP services corresponding to the keywords and
+ * their attributes (from the list of attributes)
+ */
+ void getEPNServices(List keywords, List attributes);
+
+ /**
+ * returns a VOTable containing the attributes of the corresponding service (from a predefined
+ * list)
+ */
+ void getEPNService(String ivoID);
+
+ /**
+ * returns a VOTable containing the attributes of the corresponding service (from the list of
+ * attributes)
+ */
+ void getEPNService(String ivoID, List attributes);
+
+ /** returns the name of the EPNCore Table related to a service. */
+ void getEPNCoreTableName(String service_ivoid);
+
+ /** returns the Access URL of an EPN-TAP Service. */
+ void getTAPURL(String service_ivoid);
+
+ /**
+ * returns the list of granules which are compliant with the ADQL Query, in VOTable format .
+ * TAPURL is build from elements taken in VOResource. "ADQLQuery" is created by the Client. It
+ * is a full query containing the name of the EPNCore table, taken in VOResource.
+ */
+ void sendADQLQuery(String TAPURL, String ADQLQuery);
+
+ /**
+ * returns the list of granules which are compliant with the Query, in VOTable format. "Query"
+ * is not an ADQL query. It is taken from a list of predefined queries. This list must be
+ * created.
+ */
+ void sendQuery(String TAPURL, String schema_name, String Query);
+}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/granule/Granule.java b/src/main/java/eu/omp/irap/vespa/epntapclient/granule/Granule.java
new file mode 100644
index 0000000..35ab31c
--- /dev/null
+++ b/src/main/java/eu/omp/irap/vespa/epntapclient/granule/Granule.java
@@ -0,0 +1,183 @@
+/*
+ * This file is a part of EpnTAPClient.
+ * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
+ * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
+ * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
+ *
+ * This program is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
+ * version. 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, see
+ * .
+ */
+
+package eu.omp.irap.vespa.epntapclient.granule;
+
+import java.util.Date;
+
+/**
+ * @author N. Jourdane
+ */
+public class Granule {
+
+ public String granuleUid;
+
+ public String granuleGid;
+
+ public String obsId;
+
+ public String dataproductType;
+
+ public String targetName;
+
+ public String targetClass;
+
+ public double timeMin;
+
+ public double timeMax;
+
+ public double timeSamplingStepMin;
+
+ public double timeSamplingStepMax;
+
+ public double timeExpMin;
+
+ public double timeExpMax;
+
+ public double spectralRangeMin;
+
+ public double spectralRangeMax;
+
+ public double spectralSamplingStepMin;
+
+ public double spectralSamplingStepMax;
+
+ public double spectralResolutionMin;
+
+ public double spectralResolutionMax;
+
+ public double c1Min;
+
+ public double c1Max;
+
+ public double c2Min;
+
+ public double c2Max;
+
+ public double c3Min;
+
+ public double c3Max;
+
+ public double c1ResolMin;
+
+ public double c1ResolMax;
+
+ public double c2ResolMin;
+
+ public double c2ResolMax;
+
+ public double c3ResolMin;
+
+ public double c3ResolMax;
+
+ public String spatialFrameType;
+
+ public double incidenceMin;
+
+ public double incidenceMax;
+
+ public double emergenceMin;
+
+ public double emergenceMax;
+
+ public double phaseMin;
+
+ public double phaseMax;
+
+ public String instrumentHostName;
+
+ public String instrumentName;
+
+ public String measurementType;
+
+ public int processingLevel;
+
+ public Date creationDate;
+
+ public Date modificationDate;
+
+ public Date releaseDate;
+
+ public String serviceTitle;
+
+ public String accessUrl;
+
+ public String accessFormat;
+
+ public int accessEstsize;
+
+ public String dataAccessUrl;
+
+ public String accessMd5;
+
+ public String thumbnailUrl;
+
+ public String fileName;
+
+ public String species;
+
+ public String altTargetName;
+
+ public String targetRegion;
+
+ public String featureName;
+
+ public String bibReference;
+
+ public double ra;
+
+ public double dec;
+
+ public double solarLongitudeMin;
+
+ public double solarLongitudeMax;
+
+ public double localTimeMin;
+
+ public double localTimeMax;
+
+ public double targetDistanceMin;
+
+ public double targetDistanceMax;
+
+ public double targetTimeMin;
+
+ public double targetTimeMax;
+
+ public String particleSpectralType;
+
+ public double particleSpectralRangeMin;
+
+ public double particleSpectralRangeMax;
+
+ public double particleSpectralSamplingStepMin;
+
+ public double particleSpectralSamplingStepMax;
+
+ public double particleSpectralResolutionMin;
+
+ public double particleSpectralResolutionMax;
+
+ public String publisher;
+
+ public String spatialCoordinateDescription;
+
+ public String spatialOrigin;
+
+ public String timeOrigin;
+
+ public String timeScale;
+}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIController.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIController.java
index 8814508..ead04ec 100644
--- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIController.java
+++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIController.java
@@ -23,7 +23,7 @@ import java.nio.file.Paths;
import java.util.logging.Level;
import java.util.logging.Logger;
-import eu.omp.irap.vespa.epntapclient.lib.EpnTapController;
+import eu.omp.irap.vespa.epntapclient.EpnTapController;
import eu.omp.irap.vespa.epntapclient.service.Queries;
import eu.omp.irap.vespa.epntapclient.votable.VOTableException.CantDisplayVOTableException;
import eu.omp.irap.vespa.epntapclient.votable.VOTableException.CantSendQueryException;
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapController.java b/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapController.java
deleted file mode 100644
index d58733e..0000000
--- a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapController.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * This file is a part of EpnTAPClient.
- * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
- * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
- * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
- *
- * This program is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
- * version. 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, see
- * .
- */
-
-package eu.omp.irap.vespa.epntapclient.lib;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import eu.omp.irap.vespa.epntapclient.service.Queries;
-import eu.omp.irap.vespa.epntapclient.votable.Consts;
-import eu.omp.irap.vespa.epntapclient.votable.VOTableException.CantDisplayVOTableException;
-import eu.omp.irap.vespa.epntapclient.votable.VOTableException.CantSendQueryException;
-import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableController;
-
-/**
- * The main controller which manage views and controllers.
- *
- * @author N. Jourdane
- */
-public class EpnTapController {
-
- /** The logger for the class EpnTapController. */
- private static final Logger logger = Logger.getLogger(EpnTapController.class.getName());
-
- /** The controller of the VOTable displaying the list of services. */
- protected VOTableController servicesCtrl;
-
- /** The controller of the VOTable displaying the list of services. */
- protected VOTableController resultsCtrl;
-
- /**
- * The parameters fields for the request.
- */
- protected Map paramValues = new HashMap<>();
-
-
- /**
- * Method constructor, which initialize servicesController, resultsController and mainView.
- */
- public EpnTapController() {
- servicesCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL, "ADQL",
- Queries.GET_EPN_TAP_SERVICES);
- try {
- servicesCtrl.readTable();
- } catch (CantDisplayVOTableException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (CantSendQueryException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- public String sendQuery(String query, String tableServiceURL)
- throws CantDisplayVOTableException, CantSendQueryException {
- resultsCtrl = new VOTableController(tableServiceURL, "ADQL", query);
- resultsCtrl.readTable();
- return resultsCtrl.getVOTablePath();
- }
-
- /**
- * @return The controller of the VOTable which displays the result of the query.
- */
- public VOTableController getResultsController() {
- return resultsCtrl;
- }
-
- /**
- * @return The controller of the VOTable which displays the list of services.
- */
- public VOTableController getServicesController() {
- return servicesCtrl;
- }
-
- public void updateParameter(String paramName, Object paramValue) {
- paramValues.put(paramName, paramValue);
- }
-
- public void removeParameter(String paramName) {
- paramValues.remove(paramName);
- }
-
- public Map getParamValues() {
- return paramValues;
- }
-}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapFacade.java b/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapFacade.java
deleted file mode 100644
index c684f04..0000000
--- a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapFacade.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * This file is a part of EpnTAPClient.
- * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
- * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
- * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
- *
- * This program is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
- * version. 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, see
- * .
- */
-
-package eu.omp.irap.vespa.epntapclient.lib;
-
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import eu.omp.irap.vespa.epntapclient.lib.resource.VOResourceCtrl;
-import eu.omp.irap.vespa.epntapclient.lib.resource.VOResourceException;
-import eu.omp.irap.vespa.epntapclient.service.Service;
-import eu.omp.irap.vespa.epntapclient.voresource.model.Resource;
-
-/**
- * @author N. Jourdane
- */
-public class EpnTapFacade implements EpnTapInterface {
-
- /** The logger for the class EpnTapFacade. */
- private static final Logger logger = Logger.getLogger(EpnTapFacade.class.getName());
-
-
- /* @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNVOResources() */
- @Override
- public List getEPNVOResources(Service.ServiceType serviceType)
- throws VOResourceException {
- return VOResourceCtrl.getVOResources(serviceType);
- }
-
- /*
- * @see
- * eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNVOResources(java.util.List)
- */
- @Override
- public List getEPNVOResources(Service.ServiceType serviceType,
- Map keywords)
- throws VOResourceException {
- return VOResourceCtrl.getVOResources(serviceType, keywords);
- }
-
- /*
- * @see
- * eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNVOresource(java.lang.String)
- */
- @Override
- public Resource getEPNVOresource(String ivoid) {
- return null;
- // TODO Auto-generated method stub
-
- }
-
- /* @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNServices() */
- @Override
- public void getEPNServices() {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNServices(java.util.List)
- */
- @Override
- public void getEPNServices(List attributes) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNServices(java.util.List,
- * java.util.List)
- */
- @Override
- public void getEPNServices(List keywords, List attributes) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNService(java.lang.String)
- */
- @Override
- public void getEPNService(String ivoID) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNService(java.lang.String,
- * java.util.List)
- */
- @Override
- public void getEPNService(String ivoID, List attributes) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getEPNCoreTableName(java.lang.
- * String)
- */
- @Override
- public void getEPNCoreTableName(String service_ivoid) {
- // TODO Auto-generated method stub
-
- }
-
- /* @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#getTAPURL(java.lang.String) */
- @Override
- public void getTAPURL(String service_ivoid) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#sendADQLQuery(java.lang.String,
- * java.lang.String)
- */
- @Override
- public void sendADQLQuery(String TAPURL, String ADQLQuery) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * @see eu.omp.irap.vespa.epntapclient.epnTapLib.EpnTapInterface#sendQuery(java.lang.String,
- * java.lang.String, java.lang.String)
- */
- @Override
- public void sendQuery(String TAPURL, String schema_name, String Query) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapInterface.java b/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapInterface.java
deleted file mode 100644
index 6eedb6a..0000000
--- a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapInterface.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * This file is a part of EpnTAPClient.
- * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
- * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
- * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
- *
- * This program is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
- * version. 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, see
- * .
- */
-
-package eu.omp.irap.vespa.epntapclient.lib;
-
-import java.util.List;
-import java.util.Map;
-
-import eu.omp.irap.vespa.epntapclient.lib.resource.VOResourceException;
-import eu.omp.irap.vespa.epntapclient.service.Service;
-import eu.omp.irap.vespa.epntapclient.voresource.model.Resource;
-
-/**
- * @author N. Jourdane
- */
-public interface EpnTapInterface {
-
- /** returns a set of VOResource elements (one per EPN-TAP service) */
- List getEPNVOResources(Service.ServiceType serviceType)
- throws VOResourceException;
-
- /**
- * Returns a set of VOREsource elements (one per EPN-TAP service corresponding to the keywords).
- * The way keywords are defined is still to be defined.
- */
- List getEPNVOResources(Service.ServiceType serviceType,
- Map keywords) throws VOResourceException;
-
- /** returns the VOResource element of the service identified by the ivoID. */
- Resource getEPNVOresource(String ivoid) throws VOResourceException;
-
- /**
- * returns a VOTable containing the list of EPN-TAP services and their attributes (from a
- * predefined list)
- */
- void getEPNServices();
-
- /**
- * returns a VOTable containing the list of EPN-TAP services and their attributes (from the list
- * of attributes)
- */
- void getEPNServices(List attributes);
-
- /**
- * returns a VOTable containing the list of EPN-TAP services corresponding to the keywords and
- * their attributes (from the list of attributes)
- */
- void getEPNServices(List keywords, List attributes);
-
- /**
- * returns a VOTable containing the attributes of the corresponding service (from a predefined
- * list)
- */
- void getEPNService(String ivoID);
-
- /**
- * returns a VOTable containing the attributes of the corresponding service (from the list of
- * attributes)
- */
- void getEPNService(String ivoID, List attributes);
-
- /** returns the name of the EPNCore Table related to a service. */
- void getEPNCoreTableName(String service_ivoid);
-
- /** returns the Access URL of an EPN-TAP Service. */
- void getTAPURL(String service_ivoid);
-
- /**
- * returns the list of granules which are compliant with the ADQL Query, in VOTable format .
- * TAPURL is build from elements taken in VOResource. "ADQLQuery" is created by the Client. It
- * is a full query containing the name of the EPNCore table, taken in VOResource.
- */
- void sendADQLQuery(String TAPURL, String ADQLQuery);
-
- /**
- * returns the list of granules which are compliant with the Query, in VOTable format. "Query"
- * is not an ADQL query. It is taken from a list of predefined queries. This list must be
- * created.
- */
- void sendQuery(String TAPURL, String schema_name, String Query);
-}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapService.java b/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapService.java
deleted file mode 100644
index a3e2d37..0000000
--- a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/EpnTapService.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * This file is a part of EpnTAPClient.
- * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
- * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
- * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
- *
- * This program is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
- * version. 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, see
- * .
- */
-
-package eu.omp.irap.vespa.epntapclient.lib;
-
-import java.util.Date;
-
-/**
- * @author N. Jourdane
- */
-public class EpnTapService {
-
- public String granuleUid;
-
- public String granuleGid;
-
- public String obsId;
-
- public String dataproductType;
-
- public String targetName;
-
- public String targetClass;
-
- public double timeMin;
-
- public double timeMax;
-
- public double timeSamplingStepMin;
-
- public double timeSamplingStepMax;
-
- public double timeExpMin;
-
- public double timeExpMax;
-
- public double spectralRangeMin;
-
- public double spectralRangeMax;
-
- public double spectralSamplingStepMin;
-
- public double spectralSamplingStepMax;
-
- public double spectralResolutionMin;
-
- public double spectralResolutionMax;
-
- public double c1Min;
-
- public double c1Max;
-
- public double c2Min;
-
- public double c2Max;
-
- public double c3Min;
-
- public double c3Max;
-
- public double c1ResolMin;
-
- public double c1ResolMax;
-
- public double c2ResolMin;
-
- public double c2ResolMax;
-
- public double c3ResolMin;
-
- public double c3ResolMax;
-
- public String spatialFrameType;
-
- public double incidenceMin;
-
- public double incidenceMax;
-
- public double emergenceMin;
-
- public double emergenceMax;
-
- public double phaseMin;
-
- public double phaseMax;
-
- public String instrumentHostName;
-
- public String instrumentName;
-
- public String measurementType;
-
- public int processingLevel;
-
- public Date creationDate;
-
- public Date modificationDate;
-
- public Date releaseDate;
-
- public String serviceTitle;
-
- public String accessUrl;
-
- public String accessFormat;
-
- public int accessEstsize;
-
- public String dataAccessUrl;
-
- public String accessMd5;
-
- public String thumbnailUrl;
-
- public String fileName;
-
- public String species;
-
- public String altTargetName;
-
- public String targetRegion;
-
- public String featureName;
-
- public String bibReference;
-
- public double ra;
-
- public double dec;
-
- public double solarLongitudeMin;
-
- public double solarLongitudeMax;
-
- public double localTimeMin;
-
- public double localTimeMax;
-
- public double targetDistanceMin;
-
- public double targetDistanceMax;
-
- public double targetTimeMin;
-
- public double targetTimeMax;
-
- public String particleSpectralType;
-
- public double particleSpectralRangeMin;
-
- public double particleSpectralRangeMax;
-
- public double particleSpectralSamplingStepMin;
-
- public double particleSpectralSamplingStepMax;
-
- public double particleSpectralResolutionMin;
-
- public double particleSpectralResolutionMax;
-
- public String publisher;
-
- public String spatialCoordinateDescription;
-
- public String spatialOrigin;
-
- public String timeOrigin;
-
- public String timeScale;
-}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/ServicesManager.java b/src/main/java/eu/omp/irap/vespa/epntapclient/lib/ServicesManager.java
deleted file mode 100644
index 19de5dc..0000000
--- a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/ServicesManager.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is a part of EpnTAPClient.
- * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
- * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
- * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
- *
- * This program is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
- * version. 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, see
- * .
- */
-
-package eu.omp.irap.vespa.epntapclient.lib;
-
-import java.util.logging.Logger;
-
-import eu.omp.irap.vespa.epntapclient.service.Queries;
-import eu.omp.irap.vespa.epntapclient.votable.Consts;
-import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableController;
-
-/**
- * @author N. Jourdane
- */
-public class ServicesManager {
-
- /** The logger for the class ServicesManager. */
- private static final Logger logger = Logger.getLogger(ServicesManager.class.getName());
-
-
- public enum ResourceType {
- EPN_TAP, OBSCORE, OBSPM
- };
-
-
- ServicesManager(ResourceType resourceType) {
- if (resourceType == ResourceType.EPN_TAP) {
- VOTableController servicesCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL,
- "ADQL",
- Queries.GET_EPN_TAP_SERVICES);
- } else if (resourceType == ResourceType.OBSCORE) {
- VOTableController servicesCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL,
- "ADQL",
- Queries.GET_TAP_OBSCOR_SERVICES);
- } else if (resourceType == ResourceType.OBSPM) {
- VOTableController servicesCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL,
- "ADQL",
- Queries.GET_VO_RESOURCES);
- }
- }
-}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceCtrl.java
deleted file mode 100644
index 1bfbd9b..0000000
--- a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceCtrl.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * This file is a part of EpnTAPClient.
- * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
- * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
- * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
- *
- * This program is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
- * version. 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, see
- * .
- */
-
-package eu.omp.irap.vespa.epntapclient.lib.resource;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import com.google.gson.stream.JsonReader;
-
-import eu.omp.irap.vespa.epntapclient.lib.resource.VOResourceException.CantGetVOResourceException;
-import eu.omp.irap.vespa.epntapclient.lib.resource.VOResourceException.CantReadVOResourceException;
-import eu.omp.irap.vespa.epntapclient.lib.resource.VOResourceException.VOResourceIsNotValidException;
-import eu.omp.irap.vespa.epntapclient.service.Service.ServiceType;
-import eu.omp.irap.vespa.epntapclient.voresource.model.Resource;
-import eu.omp.irap.vespa.epntapclient.votable.VOTableException.CantSendQueryException;
-import eu.omp.irap.vespa.epntapclient.votable.utils.Network;
-import eu.omp.irap.vespa.epntapclient.votable.utils.StringJoiner;
-
-/**
- * @author N. Jourdane
- */
-public class VOResourceCtrl {
-
- /** The logger for the class VOResourceController. */
- private static final Logger logger = Logger.getLogger(VOResourceCtrl.class.getName());
-
- private static final String VORESOURCE_MODEL_PACKAGE = "eu.omp.irap.vespa.epntapclient.voresource.model";
-
- private static final String GET_VORESOURCE_URL = "http://voparis-registry.obspm.fr/vo/ivoa/1/voresources.xml";
-
- private static final String GET_IVOID_RESOURCES_URL = "http://voparis-registry.obspm.fr/vo/ivoa/1/voresources/search";
-
- private static final int MAX_VORESOURCES = 100;
-
-
- public static List getVOResources(ServiceType type, Map keywords)
- throws VOResourceException {
- return VOResourceCtrl
- .getVOResourcesFromIvoids(VOResourceCtrl.getIvoidResources(type, keywords));
- }
-
- public static List getVOResources(ServiceType type) throws VOResourceException {
- return VOResourceCtrl.getVOResourcesFromIvoids(VOResourceCtrl.getIvoidResources(type));
- }
-
- public static List getIvoidResources(ServiceType type) throws VOResourceException {
- return VOResourceCtrl.getIvoidResources(type, new HashMap());
- }
-
- public static List getIvoidResources(ServiceType type, Map keywords)
- throws VOResourceException {
- List ivoidResources;
-
- keywords.put("datamodel", type.toString());
- // standardid="ivo://ivoa.net/std/TAP" is not necessary
-
- StringJoiner keywordJoiner = new StringJoiner(" ");
- for (Map.Entry keyword : keywords.entrySet()) {
- keywordJoiner.add(keyword.getKey() + ":\"" + keyword.getValue() + "\"");
- }
-
- Map parameters = new HashMap();
- parameters.put("keywords", keywordJoiner.toString());
- parameters.put("max", String.valueOf(VOResourceCtrl.MAX_VORESOURCES));
- try {
- String ivoidResourcesPath = Network.saveQuery(VOResourceCtrl.GET_VORESOURCE_URL,
- parameters);
- ivoidResources = VOResourceCtrl.parseIvoidResources(ivoidResourcesPath);
- } catch (CantSendQueryException e1) {
- throw new CantGetVOResourceException(VOResourceCtrl.GET_VORESOURCE_URL, e1);
- // TODO: pass the entire request.
- }
- return ivoidResources;
- }
-
- public static Resource getVOresource(String identifier) throws VOResourceException {
- Map parameters = new HashMap();
- parameters.put("identifier", identifier);
- String voResourcePath;
- try {
- voResourcePath = Network.saveQuery(VOResourceCtrl.GET_VORESOURCE_URL, parameters);
- } catch (CantSendQueryException e1) {
- throw new CantGetVOResourceException(VOResourceCtrl.GET_VORESOURCE_URL, e1);
- }
-
- Resource voResource;
- JAXBContext jc;
- try {
- jc = JAXBContext.newInstance(VOResourceCtrl.VORESOURCE_MODEL_PACKAGE);
- Unmarshaller unmarshaller = jc.createUnmarshaller();
- voResource = (Resource) unmarshaller.unmarshal(new File(voResourcePath));
- } catch (JAXBException e) {
- throw new VOResourceIsNotValidException(voResourcePath, e);
- }
-
- return voResource;
- }
-
- public static List getVOResourcesFromIvoids(List ivoidResources)
- throws VOResourceException {
- List resources = new ArrayList<>();
- for (String ivoid : ivoidResources) {
- resources.add(VOResourceCtrl.getVOresource(ivoid));
- }
- return resources;
- }
-
- private static List parseIvoidResources(String ivoidResourcesPath)
- throws CantReadVOResourceException {
- JsonReader reader;
- try {
- reader = new JsonReader(new FileReader(ivoidResourcesPath));
- } catch (FileNotFoundException e) {
- throw new CantReadVOResourceException(ivoidResourcesPath, e);
- }
- JsonObject root = new JsonParser().parse(reader).getAsJsonObject();
- JsonArray resources = root.get("resources").getAsJsonArray();
-
- List ivoidResources = new ArrayList<>();
- for (JsonElement e : resources) {
- ivoidResources.add(e.getAsJsonObject().get("identifier").getAsString());
- }
- return ivoidResources;
- }
-}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceException.java b/src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceException.java
deleted file mode 100644
index 201dfd0..0000000
--- a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceException.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * This file is a part of EpnTAPClient.
- * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
- * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
- * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
- *
- * This program is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
- * version. 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, see
- * .
- */
-
-package eu.omp.irap.vespa.epntapclient.lib.resource;
-
-/**
- * @author N. Jourdane
- */
-public abstract class VOResourceException extends Exception {
-
- /** */
- private static final long serialVersionUID = 1L;
-
-
- /**
- * @param message The message describing the exception displayed in the error dialog.
- */
- public VOResourceException(String message) {
- super(message);
- }
-
- /**
- * @param message The message describing the exception displayed in the error dialog.
- * @param e The exception thrown.
- */
- public VOResourceException(String message, Exception e) {
- super(message, e);
- }
-
-
- public static class CantReadVOResourceException extends VOResourceException {
-
- /**
- * @param voTablePath The path of the VOTable.
- * @param e The exception thrown.
- */
- public CantReadVOResourceException(String voResourcePath, Exception e) {
- super("Can not read the VOResource which should be stored in: " + voResourcePath, e);
- }
- }
-
- public static class CantGetVOResourceException extends VOResourceException {
-
- /**
- * @param voTablePath The path of the VOTable.
- * @param e The exception thrown.
- */
- public CantGetVOResourceException(String voResourceRequest, Exception e) {
- super("Can not get the remote VOResource with the request: " + voResourceRequest, e);
- }
- }
-
- public static class VOResourceIsNotValidException extends VOResourceException {
-
- /**
- * @param voTablePath The path of the VOTable.
- * @param e The exception thrown.
- */
- public VOResourceIsNotValidException(String voResourcePath, Exception e) {
- super("Can not parse the VOResource because it doesn't match with the VOResource schema."
- + "\n See the VOResource file for more details: " + voResourcePath, e);
- }
- }
-}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/resource/VOResourceCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/resource/VOResourceCtrl.java
new file mode 100644
index 0000000..cfd649a
--- /dev/null
+++ b/src/main/java/eu/omp/irap/vespa/epntapclient/resource/VOResourceCtrl.java
@@ -0,0 +1,153 @@
+/*
+ * This file is a part of EpnTAPClient.
+ * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
+ * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
+ * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
+ *
+ * This program is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
+ * version. 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, see
+ * .
+ */
+
+package eu.omp.irap.vespa.epntapclient.resource;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.google.gson.stream.JsonReader;
+
+import eu.omp.irap.vespa.epntapclient.resource.VOResourceException.CantGetVOResourceException;
+import eu.omp.irap.vespa.epntapclient.resource.VOResourceException.CantReadVOResourceException;
+import eu.omp.irap.vespa.epntapclient.resource.VOResourceException.VOResourceIsNotValidException;
+import eu.omp.irap.vespa.epntapclient.service.Service.ServiceType;
+import eu.omp.irap.vespa.epntapclient.voresource.model.Resource;
+import eu.omp.irap.vespa.epntapclient.votable.VOTableException.CantSendQueryException;
+import eu.omp.irap.vespa.epntapclient.votable.utils.Network;
+import eu.omp.irap.vespa.epntapclient.votable.utils.StringJoiner;
+
+/**
+ * @author N. Jourdane
+ */
+public class VOResourceCtrl {
+
+ /** The logger for the class VOResourceController. */
+ private static final Logger logger = Logger.getLogger(VOResourceCtrl.class.getName());
+
+ private static final String VORESOURCE_MODEL_PACKAGE = "eu.omp.irap.vespa.epntapclient.voresource.model";
+
+ private static final String GET_VORESOURCE_URL = "http://voparis-registry.obspm.fr/vo/ivoa/1/voresources.xml";
+
+ private static final String GET_IVOID_RESOURCES_URL = "http://voparis-registry.obspm.fr/vo/ivoa/1/voresources/search";
+
+ private static final int MAX_VORESOURCES = 100;
+
+
+ public static List getVOResources(ServiceType type, Map keywords)
+ throws VOResourceException {
+ return VOResourceCtrl
+ .getVOResourcesFromIvoids(VOResourceCtrl.getIvoidResources(type, keywords));
+ }
+
+ public static List getVOResources(ServiceType type) throws VOResourceException {
+ return VOResourceCtrl.getVOResourcesFromIvoids(VOResourceCtrl.getIvoidResources(type));
+ }
+
+ public static List getIvoidResources(ServiceType type) throws VOResourceException {
+ return VOResourceCtrl.getIvoidResources(type, new HashMap());
+ }
+
+ public static List getIvoidResources(ServiceType type, Map keywords)
+ throws VOResourceException {
+ List ivoidResources;
+
+ keywords.put("datamodel", type.toString());
+ // standardid="ivo://ivoa.net/std/TAP" is not necessary
+
+ StringJoiner keywordJoiner = new StringJoiner(" ");
+ for (Map.Entry keyword : keywords.entrySet()) {
+ keywordJoiner.add(keyword.getKey() + ":\"" + keyword.getValue() + "\"");
+ }
+
+ Map parameters = new HashMap();
+ parameters.put("keywords", keywordJoiner.toString());
+ parameters.put("max", String.valueOf(VOResourceCtrl.MAX_VORESOURCES));
+ try {
+ String ivoidResourcesPath = Network.saveQuery(VOResourceCtrl.GET_VORESOURCE_URL,
+ parameters);
+ ivoidResources = VOResourceCtrl.parseIvoidResources(ivoidResourcesPath);
+ } catch (CantSendQueryException e1) {
+ throw new CantGetVOResourceException(VOResourceCtrl.GET_VORESOURCE_URL, e1);
+ // TODO: pass the entire request.
+ }
+ return ivoidResources;
+ }
+
+ public static Resource getVOresource(String identifier) throws VOResourceException {
+ Map parameters = new HashMap();
+ parameters.put("identifier", identifier);
+ String voResourcePath;
+ try {
+ voResourcePath = Network.saveQuery(VOResourceCtrl.GET_VORESOURCE_URL, parameters);
+ } catch (CantSendQueryException e1) {
+ throw new CantGetVOResourceException(VOResourceCtrl.GET_VORESOURCE_URL, e1);
+ }
+
+ Resource voResource;
+ JAXBContext jc;
+ try {
+ jc = JAXBContext.newInstance(VOResourceCtrl.VORESOURCE_MODEL_PACKAGE);
+ Unmarshaller unmarshaller = jc.createUnmarshaller();
+ voResource = (Resource) unmarshaller.unmarshal(new File(voResourcePath));
+ } catch (JAXBException e) {
+ throw new VOResourceIsNotValidException(voResourcePath, e);
+ }
+
+ return voResource;
+ }
+
+ public static List getVOResourcesFromIvoids(List ivoidResources)
+ throws VOResourceException {
+ List resources = new ArrayList<>();
+ for (String ivoid : ivoidResources) {
+ resources.add(VOResourceCtrl.getVOresource(ivoid));
+ }
+ return resources;
+ }
+
+ private static List parseIvoidResources(String ivoidResourcesPath)
+ throws CantReadVOResourceException {
+ JsonReader reader;
+ try {
+ reader = new JsonReader(new FileReader(ivoidResourcesPath));
+ } catch (FileNotFoundException e) {
+ throw new CantReadVOResourceException(ivoidResourcesPath, e);
+ }
+ JsonObject root = new JsonParser().parse(reader).getAsJsonObject();
+ JsonArray resources = root.get("resources").getAsJsonArray();
+
+ List ivoidResources = new ArrayList<>();
+ for (JsonElement e : resources) {
+ ivoidResources.add(e.getAsJsonObject().get("identifier").getAsString());
+ }
+ return ivoidResources;
+ }
+}
diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/resource/VOResourceException.java b/src/main/java/eu/omp/irap/vespa/epntapclient/resource/VOResourceException.java
new file mode 100644
index 0000000..a65e490
--- /dev/null
+++ b/src/main/java/eu/omp/irap/vespa/epntapclient/resource/VOResourceException.java
@@ -0,0 +1,77 @@
+/*
+ * This file is a part of EpnTAPClient.
+ * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
+ * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
+ * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
+ *
+ * This program is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
+ * version. 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, see
+ * .
+ */
+
+package eu.omp.irap.vespa.epntapclient.resource;
+
+/**
+ * @author N. Jourdane
+ */
+public abstract class VOResourceException extends Exception {
+
+ /** */
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * @param message The message describing the exception displayed in the error dialog.
+ */
+ public VOResourceException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param message The message describing the exception displayed in the error dialog.
+ * @param e The exception thrown.
+ */
+ public VOResourceException(String message, Exception e) {
+ super(message, e);
+ }
+
+
+ public static class CantReadVOResourceException extends VOResourceException {
+
+ /**
+ * @param voTablePath The path of the VOTable.
+ * @param e The exception thrown.
+ */
+ public CantReadVOResourceException(String voResourcePath, Exception e) {
+ super("Can not read the VOResource which should be stored in: " + voResourcePath, e);
+ }
+ }
+
+ public static class CantGetVOResourceException extends VOResourceException {
+
+ /**
+ * @param voTablePath The path of the VOTable.
+ * @param e The exception thrown.
+ */
+ public CantGetVOResourceException(String voResourceRequest, Exception e) {
+ super("Can not get the remote VOResource with the request: " + voResourceRequest, e);
+ }
+ }
+
+ public static class VOResourceIsNotValidException extends VOResourceException {
+
+ /**
+ * @param voTablePath The path of the VOTable.
+ * @param e The exception thrown.
+ */
+ public VOResourceIsNotValidException(String voResourcePath, Exception e) {
+ super("Can not parse the VOResource because it doesn't match with the VOResource schema."
+ + "\n See the VOResource file for more details: " + voResourcePath, e);
+ }
+ }
+}
--
libgit2 0.21.2