Revision 2925

View differences:

trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/ui/SearchDialog.java
56 56
 */
57 57
public class SearchDialog extends JFrame implements WindowListener {
58 58
    private SearchDialogPanel contentPane = null;
59
    private GazetteerClient cliente;
59
    private GazetteerClient client;
60 60

  
61 61
    /**
62 62
     * Crea un nuevo SearchDialog.
63 63
     *
64 64
     * @param cliente DOCUMENT ME!
65 65
     */
66
    public SearchDialog(GazetteerClient cliente) {
66
    public SearchDialog(GazetteerClient client) {
67 67
        super();
68
        this.cliente = cliente;
68
        this.client = client;
69 69
        initialize();
70 70
    }
71 71

  
......
81 81
        //setResizable(false);
82 82
        setName("search");
83 83

  
84
        SearchDialogPanel panel = new SearchDialogPanel();
85
        panel.setCatalogClient(cliente);
84
        SearchDialogPanel panel = new SearchDialogPanel(client);
85
        panel.setCatalogClient(client);
86 86
        getContentPane().add(panel);
87 87
        addWindowListener(this);
88 88
        setVisible(true);
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/ui/SearchDialogPanel.java
79 79
     * This method initializes
80 80
     *
81 81
     */
82
    public SearchDialogPanel() {
82
    public SearchDialogPanel(GazetteerClient client) {
83 83
        super();
84
        this.client = client;
84 85
        initialize();
85 86
    }
86 87

  
......
108 109

  
109 110
    public JPanel getControlsPanel() {
110 111
        if (controlsPanel == null) {
111
            controlsPanel = new SearchPanel();
112
            controlsPanel = new SearchPanel(client.getLnkIGazetteerDriver().getVectorFeatures());
112 113
            controlsPanel.setPreferredSize(new java.awt.Dimension(727, 455));
113 114
            controlsPanel.setLocation(0, 0);
114 115
        }
......
180 181
    }
181 182

  
182 183
    public Query doQuery() {
183
       /*
184
        return new Query(controlsPanel.getTitulo(),
185
            controlsPanel.getConcordancia(), controlsPanel.getResumen(),
186
            controlsPanel.getClave(), controlsPanel.getCategoria(),
187
            controlsPanel.getEscala(), controlsPanel.getProveedor(),
188
            controlsPanel.getFechaDe(), controlsPanel.getFechaA(),
189
            controlsPanel.getCoordenadas(), controlsPanel.getCoordenadasOpcion());
190
            */
191
        return null;
184
       return new Query(controlsPanel.getName(),
185
            controlsPanel.getConcordancia(),
186
            controlsPanel.getTipo(),
187
            controlsPanel.getNPaginas(),
188
            controlsPanel.getCoordenadas(),
189
            controlsPanel.getCoordenadasOpcion());
192 190
    }
193 191

  
194 192
    public void doSearch() {
195
        /*
196
        nodesRecords = client.getLnkIGazetteerDriver().getRecords(cliente.getUrl(),
197
                doQuery(), 1);
193
        nodesRecords = client.getLnkIGazetteerDriver().getFeature(client.getUrl(),
194
                doQuery());
198 195

  
199 196
        if (nodesRecords == null) {
200 197
            JOptionPane.showMessageDialog(this,
201 198
                "Se ha producido un error al hacer el get records", "Error",
202 199
                JOptionPane.ERROR_MESSAGE);
203
        } else if (nodesRecords.length == 1) {
200
        } /*else if (nodesRecords.length == 1) {
204 201
            JOptionPane.showMessageDialog(this,
205 202
                "La b?squeda no ha producido ning?n resultado", "B?squeda",
206 203
                JOptionPane.INFORMATION_MESSAGE);
207
        }
208
        */
204
        }*/
205
        
209 206
    }
210 207

  
211 208
    public void showResults(Node[] nodesRecords) {
212
       // JDialog dialog = new ShowResultsDialog(cliente, nodesRecords, 1);
209
       
210
        // JDialog dialog = new ShowResultsDialog(cliente, nodesRecords, 1);
213 211
    }
214 212
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/ui/SearchPanel.java
41 41
package es.gva.cit.gazetteer.ui;
42 42

  
43 43
import es.gva.cit.catalogClient.querys.Coordinates;
44
import es.gva.cit.gazetteer.querys.Feature;
44 45

  
45 46
import java.awt.GridLayout;
47
import java.util.Vector;
46 48

  
47 49
import javax.swing.BoxLayout;
48 50
import javax.swing.ButtonGroup;
49 51
import javax.swing.JComboBox;
50 52
import javax.swing.JLabel;
53
import javax.swing.JList;
51 54
import javax.swing.JPanel;
52 55
import javax.swing.JRadioButton;
53 56
import javax.swing.JTextField;
54 57

  
55 58

  
59
import javax.swing.JScrollPane;
56 60
/**
57 61
 * @author Jorge Piera Llodra (piera_jor@gva.es)
58 62
 */
59 63
public class SearchPanel extends JPanel {
64
    private String[] resultadosPorPagina = {"10","25","50"};
65
    private Vector features = null;
60 66
    private JTextField nombreText = null;
61 67
    private JPanel panelBotones = null;
62 68
    private JRadioButton exactaButton = null;
......
66 72
    private JLabel nombreLabel = null;
67 73
    private JPanel panelLabNResultados = null;
68 74
    private JLabel nResultadosLabel = null;
69
    private JTextField nPaginasText = null;
75
    private JComboBox nResultadosCombo = null;
70 76
    private JPanel panelAjusteBotones = null;
71 77
    private JPanel jPanel2 = null;
72 78
    private JPanel panelSeparacionDerecha = null;
......
89 95
    private JPanel jPanel6 = null;
90 96
    private JPanel jPanel8 = null;
91 97
    private JPanel panelTextNombre = null;
92
    private JPanel panelNResultadosText = null;
98
    private JPanel panelNResultadosCombo = null;
93 99
    private JPanel panelLabTipo = null;
94
    private JPanel panelTextTipo = null;
100
    private JPanel panelListTipo = null;
95 101
    private JLabel tipoLabel = null;
96
    private JTextField tipoText = null;
102
    private JList tipoList = null;
97 103
    private JComboBox coordenadasCombo = null;
98 104
    private JPanel jPanel4 = null;
99 105
    private JPanel componentesPanel = null;
100 106

  
107
	private JScrollPane jScrollPane = null;
108
	private JScrollPane jScrollPane1 = null;
101 109
    /**
102 110
     * This method initializes
103 111
     *
104 112
     */
105
    public SearchPanel() {
113
    public SearchPanel(Vector features) {
106 114
        super();
115
        this.features = features;
107 116
        initialize();
108 117
    }
109 118

  
......
242 251
    }
243 252

  
244 253
    /**
245
     * This method initializes jTextField
254
     * This method initializes jComboBox
246 255
     *
247
     * @return javax.swing.JTextField
256
     * @return javax.swing.JComboBox
248 257
     */
249
    private JTextField getNPaginasText() {
250
        if (nPaginasText == null) {
251
            nPaginasText = new JTextField();
252
            nPaginasText.setPreferredSize(new java.awt.Dimension(300, 20));
258
    private JComboBox getNResultadosCombo() {
259
        if (nResultadosCombo == null) {
260
            nResultadosCombo = new JComboBox(resultadosPorPagina);
261
            nResultadosCombo.setPreferredSize(new java.awt.Dimension(300, 20));
262
            
253 263
        }
254 264

  
255
        return nPaginasText;
265
        return nResultadosCombo;
256 266
    }
257 267

  
258 268
    /**
......
323 333
            panelSeparacionIzquierda.add(getPanelAjusteBotones(), null);
324 334
            panelSeparacionIzquierda.add(getJPanel2(), null);
325 335
            panelSeparacionIzquierda.add(getPanelLabTipo(), null);
326
            panelSeparacionIzquierda.add(getPanelTextTipo(), null);
336
            panelSeparacionIzquierda.add(getPanelListTipo(), null);
327 337
            panelSeparacionIzquierda.add(getJPanel6(), null);
328 338
            panelSeparacionIzquierda.add(getPanelLabNResultados(), null);
329
            panelSeparacionIzquierda.add(getPanelNResultadosText(), null);
339
            panelSeparacionIzquierda.add(getPanelNResultadosCombo(), null);
330 340
        }
331 341

  
332 342
        return panelSeparacionIzquierda;
......
536 546
     *
537 547
     * @return javax.swing.JPanel
538 548
     */
539
    private JPanel getPanelNResultadosText() {
540
        if (panelNResultadosText == null) {
541
            panelNResultadosText = new JPanel();
542
            panelNResultadosText.add(getNPaginasText(), null);
549
    private JPanel getPanelNResultadosCombo() {
550
        if (panelNResultadosCombo == null) {
551
            panelNResultadosCombo = new JPanel();
552
            panelNResultadosCombo.add(getNResultadosCombo(), null);
543 553
        }
544 554

  
545
        return panelNResultadosText;
555
        return panelNResultadosCombo;
546 556
    }
547 557

  
548 558
    /**
......
570 580
     *
571 581
     * @return javax.swing.JPanel
572 582
     */
573
    private JPanel getPanelTextTipo() {
574
        if (panelTextTipo == null) {
575
            panelTextTipo = new JPanel();
576
            panelTextTipo.add(getTipoText(), null);
583
    private JPanel getPanelListTipo() {
584
        if (panelListTipo == null) {
585
            panelListTipo = new JPanel();
586
            panelListTipo.add(getJScrollPane1(), null);
577 587
        }
578 588

  
579
        return panelTextTipo;
589
        return panelListTipo;
580 590
    }
581 591

  
582 592
    /**
......
584 594
     *
585 595
     * @return javax.swing.JTextField
586 596
     */
587
    private JTextField getTipoText() {
588
        if (tipoText == null) {
589
            tipoText = new JTextField();
590
            tipoText.setPreferredSize(new java.awt.Dimension(300, 20));
597
    private JList getTipoList() {
598
        if (tipoList == null) {
599
            Feature[] f = new Feature[features.size()];
600
            for (int i=0 ; i<features.size() ; i++){
601
                f[i] = (Feature)features.get(i);
602
            }
603
            tipoList = new JList(f);
604
            tipoList.setPreferredSize(new java.awt.Dimension(300,2000));
591 605
        }
592 606

  
593
        return tipoText;
607
        return tipoList;
594 608
    }
595 609

  
596 610
    public String getNombre() {
......
617 631
        return null;
618 632
    }
619 633

  
620
    public String getTipo() {
621
        if (getTipoText().getText().equals("")) {
622
            return null;
623
        }
634
    public Feature getTipo() {
635
        return (Feature) getTipoList().getSelectedValue();
636
        
637
    }   
624 638

  
625
        return getTipoText().getText();
639
    public int getNPaginas() {
640
        String s = (String) getNResultadosCombo().getSelectedItem();
641
        return Integer.valueOf(s).intValue();
626 642
    }
627
 
628
   
629 643

  
630
    public String getNPaginas() {
631
        if (getNPaginasText().getText().equals("")) {
632
            return null;
633
        }
634

  
635
        return getNPaginasText().getText();
636
    }
637

  
638 644
    public Coordinates getCoordenadas() {
639 645
        return new Coordinates(getULXText().getText(), getULYText().getText(),
640 646
            getBRXText().getText(), getBRYText().getText());
......
698 704

  
699 705
        return componentesPanel;
700 706
    }
701
} //  @jve:decl-index=0:visual-constraint="10,10"
707
	/**
708
	 * This method initializes jScrollPane	
709
	 * 	
710
	 * @return javax.swing.JScrollPane	
711
	 */    
712
	private JScrollPane getJScrollPane() {
713
		if (jScrollPane == null) {
714
			jScrollPane = new JScrollPane();
715
		}
716
		return jScrollPane;
717
	}
718
	/**
719
	 * This method initializes jScrollPane1	
720
	 * 	
721
	 * @return javax.swing.JScrollPane	
722
	 */    
723
	private JScrollPane getJScrollPane1() {
724
		if (jScrollPane1 == null) {
725
			jScrollPane1 = new JScrollPane();
726
			jScrollPane1.setViewportView(getTipoList());
727
			jScrollPane1.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
728
		}
729
		return jScrollPane1;
730
	}
731
  } //  @jve:decl-index=0:visual-constraint="10,10"
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/drivers/AsbtractGazetteerServiceDriver.java
42 42

  
43 43
import java.util.Vector;
44 44

  
45
import es.gva.cit.gazetteer.querys.Query;
46

  
47

  
48

  
45 49
/**
46 50
 * This class must be inherited by all the gazetteer drivers. It contains
47 51
 * the common attributes.
......
51 55
public abstract class AsbtractGazetteerServiceDriver implements IGazetteerServiceDriver{
52 56
    private Vector Feature;
53 57
    private String serverAnswerReady = null;
54
    
58
    private Query query = null;
55 59
    /**
56 60
     * @return Returns the serverAnswerReady.
57 61
     */
......
67 71
    /**
68 72
     * @return Returns the feature.
69 73
     */
74
    public Vector getVectorFeatures() {
75
        return Feature;
76
    }
77
    /**
78
     * @param feature The feature to set.
79
     */
80
    public void setVectorFeatures(Vector feature) {
81
        Feature = feature;
82
    }
83
    /**
84
     * @return Returns the feature.
85
     */
70 86
    public Vector getFeature() {
71 87
        return Feature;
72 88
    }
......
76 92
    public void setFeature(Vector feature) {
77 93
        Feature = feature;
78 94
    }
95
    /**
96
     * @return Returns the query.
97
     */
98
    public Query getQuery() {
99
        return query;
100
    }
101
    /**
102
     * @param query The query to set.
103
     */
104
    public void setQuery(Query query) {
105
        this.query = query;
106
    }
79 107
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/drivers/IGazetteerServiceDriver.java
41 41
package es.gva.cit.gazetteer.drivers;
42 42

  
43 43
import java.net.URL;
44
import java.util.Vector;
44 45

  
45 46
import org.w3c.dom.Node;
46 47

  
......
108 109
     */
109 110
    String getServerAnswerReady();
110 111
    
112
    /**
113
     * This function returns a vector with the features retrieved from
114
     * the get Capabilities file
115
     *  
116
     * @return
117
     * A vector
118
     */
119
    Vector getVectorFeatures();
111 120
    
112 121

  
113 122
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/drivers/WFSGazetteerServiceDriver.java
47 47

  
48 48
import es.gva.cit.catalogClient.protocols.HTTPGetProtocol;
49 49
import es.gva.cit.catalogClient.protocols.HTTPPostProtocol;
50
import es.gva.cit.gazetteer.parsers.wfsgCapabilitiesParser;
50
import es.gva.cit.catalogClient.querys.CSWQuery;
51
import es.gva.cit.gazetteer.parsers.wfsg.wfsgCapabilitiesParser;
52
import es.gva.cit.gazetteer.parsers.wfsg.wfsgProtocolsOperations;
51 53
import es.gva.cit.gazetteer.querys.Query;
54
import es.gva.cit.gazetteer.querys.WFSGQuery;
52 55

  
53 56
/**
57
 * Driver for the WFS-Gazetteer protocol
58
 * 
54 59
 * @author Jorge Piera Llodra (piera_jor@gva.es)
55 60
 */
56 61
public class WFSGazetteerServiceDriver extends AsbtractGazetteerServiceDriver{
57

  
62
    private wfsgProtocolsOperations operations = null;
63
    
58 64
    public Node[] getCapabilities(URL url) {
59 65
        Node[] nodes = null;
60 66

  
......
100 106
     
101 107

  
102 108
    
109
     public Node[] getFeature(URL url, Query query) {
110
         Node[] nodes = null;
111
         
112
         for (int i=0 ; i<getOperations().getGetFeature().length; i++){
113
             if (getOperations().getGetFeature()[i].equals("SOAP")){
114
        		 /*
115
                 System.out.println("**************SOAP*************");
116
        		 nodes = new SOAPProtocol().doQuery(url,
117
                        getSOAPMessageRecords(getQuery(), 0), 0);
118
        		 
119
        		 setCommunicationProtocol("SOAP");
120

  
121
                 //We must cut the SOAP Head
122
                 nodes[0] = SOAPMessageParser.cutHead(nodes[0]);
123
        		 break;
124
        		 */
125
        	}
126
    
127
            if (getOperations().getGetFeature()[i].equals("POST")){
128
            	System.out.println("**************POST*************");
129
                nodes = new HTTPPostProtocol().doQuery(url,
130
                        getPOSTgetFeature(this.getQuery()), 0);
131
                
132
                break;
133
            }
134
            if (getOperations().getGetFeature()[i].equals("GET")){/*
135
            	System.out.println("**************GET*************");
136
            	nodes = new HTTPGetProtocol().doQuery(url,
137
                        getMessageRecords(getQuery()), firstRecord);
138
            	
139
            	setCommunicationProtocol("GET");            	
140
                break;
141
                */  
142
            }
143
         }
144
         return null;
145
         
146
     }
147
     
148
     /**
149
      * It creates the XML for the getFeature request
150
      * 
151
      * @return
152
      * Name-value pair with a XML request
153
      */
154
     public NameValuePair[] getPOSTgetFeature(Query query) {
155
         WFSGQuery wfsQuery = new WFSGQuery(query);
156
         
157
         String message = "<wfs-g:GetFeatureRequest " +
158
         	"xmlns:wfs-g=\"http://www.opengis.net/wfs-g\" " +
159
         	"xmlns:ogc=\"http://www.opengis.net/ogc\" " +
160
         	"xmlns:gml=\"http://www.opengis.net/gml\" " +
161
         	"xmlns:wfs=\"http://www.opengis.net/wfs\" " +
162
         	"xmlns:xsi=\"http://www.w3.org/2001/XMLSCHEMA-instance\" " +
163
         	"xsi:schemaLocation=\"http://www.opengis.net/wfs-g ../../gazetteer/0.9/WFS-G_GetFeatureRequest.xsd\" " +
164
         	"version=\"1.0.0\" service=\"WFS\">" +
165
         	wfsQuery.getQuery() + 
166
         	"</wfs-g:GetFeatureRequest>";         	
167
        
168
         System.out.println(message);
169
         
170
         NameValuePair nvp1 = new NameValuePair("body", message);
171

  
172
         return new NameValuePair[] { nvp1 };
173
     }
174
     
175
     
176

  
177
    
103 178
    /* (non-Javadoc)
104 179
     * @see es.gva.cit.gazetteer.drivers.IGazetteerServiceDriver#isProtocolSupported(java.net.URL)
105 180
     */
......
117 192
        return null;
118 193
    }
119 194

  
120
    /* (non-Javadoc)
121
     * @see es.gva.cit.gazetteer.drivers.IGazetteerServiceDriver#getFeature(java.net.URL, es.gva.cit.gazetteer.querys.Query)
122
     */
123
    public Node[] getFeature(URL url, Query query) {
124
        // TODO Auto-generated method stub
125
        return null;
126
    }
127 195

  
128 196
 
129 197
    /* (non-Javadoc)
......
134 202
    }
135 203

  
136 204
    
205
    /**
206
     * @return Returns the operations.
207
     */
208
    public wfsgProtocolsOperations getOperations() {
209
        return operations;
210
    }
211
    /**
212
     * @param operations The operations to set.
213
     */
214
    public void setOperations(wfsgProtocolsOperations operations) {
215
        this.operations = operations;
216
    }
137 217
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/drivers/ADLGazetteerServiceDriver.java
44 44

  
45 45
import org.w3c.dom.Node;
46 46

  
47
import es.gva.cit.gazetteer.parsers.adlCapabilitiesParser;
48
import es.gva.cit.gazetteer.parsers.wfsgCapabilitiesParser;
47
import es.gva.cit.gazetteer.parsers.adl.adlCapabilitiesParser;
48
import es.gva.cit.gazetteer.parsers.wfsg.wfsgCapabilitiesParser;
49 49
import es.gva.cit.gazetteer.querys.Query;
50 50

  
51 51
/**
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/parsers/wfsgCapabilitiesParser.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package es.gva.cit.gazetteer.parsers;
42

  
43
import org.w3c.dom.Node;
44

  
45
import es.gva.cit.catalogClient.metadataXML.XMLTree;
46
import es.gva.cit.gazetteer.drivers.WFSGazetteerServiceDriver;
47

  
48
/**
49
 * This class parses a WFs-G getCapabilities file
50
 * 
51
 * @author Jorge Piera Llodra (piera_jor@gva.es)
52
 */
53
public class wfsgCapabilitiesParser {
54
    WFSGazetteerServiceDriver driver;
55

  
56
    public wfsgCapabilitiesParser(WFSGazetteerServiceDriver driver) {
57
        this.driver = driver;
58
    }
59
    
60
    public boolean parse(Node node){
61
        driver.setServerAnswerReady(XMLTree.searchNodeValue(node,
62
                "Service->Title") + "\n" +
63
                XMLTree.searchNodeValue(node,
64
                "Service->Abstract"));
65
        
66
        System.out.println(XMLTree.searchNodeValue(node,
67
        "Service->Title"));
68
        
69
        return true;
70
    }
71
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/parsers/adlCapabilitiesParser.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package es.gva.cit.gazetteer.parsers;
42

  
43
import org.w3c.dom.Node;
44

  
45
import es.gva.cit.catalogClient.metadataXML.XMLTree;
46
import es.gva.cit.gazetteer.drivers.ADLGazetteerServiceDriver;
47

  
48

  
49
/**
50
 * This Class parses the ADL getCapabilities file
51
 * 
52
 * @author Jorge Piera Llodra (piera_jor@gva.es)
53
 */
54
public class adlCapabilitiesParser {
55

  
56
    ADLGazetteerServiceDriver driver;
57

  
58
    public adlCapabilitiesParser(ADLGazetteerServiceDriver driver) {
59
        this.driver = driver;
60
    }
61
    
62
    public boolean parse(Node node){
63
        driver.setServerAnswerReady(XMLTree.searchNodeValue(node,
64
        "get-capabilities-response->gazetteer-capabilities->description"));
65
    
66

  
67

  
68
return true;
69
    }
70
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/parsers/adl/adlCapabilitiesParser.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package es.gva.cit.gazetteer.parsers.adl;
42

  
43
import org.w3c.dom.Node;
44

  
45
import es.gva.cit.catalogClient.metadataXML.XMLTree;
46
import es.gva.cit.gazetteer.drivers.ADLGazetteerServiceDriver;
47

  
48

  
49
/**
50
 * This Class parses the ADL getCapabilities file
51
 * 
52
 * @author Jorge Piera Llodra (piera_jor@gva.es)
53
 */
54
public class adlCapabilitiesParser {
55

  
56
    ADLGazetteerServiceDriver driver;
57

  
58
    public adlCapabilitiesParser(ADLGazetteerServiceDriver driver) {
59
        this.driver = driver;
60
    }
61
    
62
    public boolean parse(Node node){
63
        driver.setServerAnswerReady(XMLTree.searchNodeValue(node,
64
        "get-capabilities-response->gazetteer-capabilities->description"));
65
    
66

  
67

  
68
return true;
69
    }
70
}
0 71

  
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/parsers/wfsg/wfsgCapabilitiesParser.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package es.gva.cit.gazetteer.parsers.wfsg;
42

  
43
import java.util.Vector;
44

  
45
import org.w3c.dom.Node;
46

  
47
import es.gva.cit.catalogClient.metadataXML.XMLTree;
48
import es.gva.cit.catalogClient.parsers.csw.ProtocolsOperations;
49
import es.gva.cit.catalogClient.querys.Coordinates;
50
import es.gva.cit.gazetteer.drivers.WFSGazetteerServiceDriver;
51
import es.gva.cit.gazetteer.querys.Feature;
52

  
53
/**
54
 * This class parses a WFs-G getCapabilities file
55
 * 
56
 * @author Jorge Piera Llodra (piera_jor@gva.es)
57
 */
58
public class wfsgCapabilitiesParser {
59
    WFSGazetteerServiceDriver driver;
60
    Node rootNode = null;
61

  
62
    
63
  
64
    public wfsgCapabilitiesParser(WFSGazetteerServiceDriver driver) {
65
        this.driver = driver;
66
    }
67
    
68
    public boolean parse(Node node){
69
        setRootNode(node);
70
        
71
        driver.setServerAnswerReady(XMLTree.searchNodeValue(node,
72
                "Service->Title") + "\n" +
73
                XMLTree.searchNodeValue(node,
74
                "Service->Abstract"));
75
            
76
        parseGetCapabilities();
77
        parseDescribeFeatureType();
78
        parseGetFeature();
79
        parseFeatures();
80
             
81
        return true;
82
    }
83
    
84
    /**
85
     * It parses the getCapabilities operation options
86
     *
87
     */
88
    public void parseGetCapabilities() {
89
    	driver.setOperations(new wfsgProtocolsOperations());
90
        driver.getOperations().setGetCapabilities(getOperations("GetCapabilities"));
91
    }
92
    
93
    /**
94
     * It parses the DescribeFeatureType operation options
95
     *
96
     */    
97
    public void parseDescribeFeatureType(){
98
        driver.getOperations().setGetCapabilities(getOperations("DescribeFeatureType"));
99
    }
100
    
101
    /**
102
     * It parses the GetFeature operation options
103
     *
104
     */
105
    public void parseGetFeature(){
106
        driver.getOperations().setGetCapabilities(getOperations("GetFeature"));
107
    }
108
    
109
    /**
110
     * It parses the Feature Types
111
     *
112
     */    
113
    public void parseFeatures(){
114
        Node[] features = XMLTree.searchMultipleNode(getRootNode(),"FeatureTypeList->FeatureType");
115
        Vector v = new Vector();
116
        for (int i=0 ; i<features.length ; i++){
117
            v.add(parseFeature(features[i]));
118
        }
119
        driver.setVectorFeatures(v);
120
        
121
    }
122
    
123
    /**
124
     * It parses a Feature Node.
125
     * @param featureNode
126
     * @return
127
     */
128
    public Feature parseFeature(Node featureNode){
129
        Feature f = new Feature();
130
        f.setName(XMLTree.searchNodeValue(featureNode,"Name"));
131
        f.setTitle(XMLTree.searchNodeValue(featureNode,"Title"));
132
        f.setAbstract(XMLTree.searchNodeValue(featureNode,"Abstract"));
133
        f.setKeywords(XMLTree.searchNodeValue(featureNode,"Keywords"));
134
        f.setSrs(XMLTree.searchNodeValue(featureNode,"SRS"));
135
        f.setCoordinates(new Coordinates(XMLTree.searchNodeAtribute(featureNode,"LatLongBoundingBox","minx"),
136
                XMLTree.searchNodeAtribute(featureNode,"LatLongBoundingBox","miny"),
137
                XMLTree.searchNodeAtribute(featureNode,"LatLongBoundingBox","maxx"),
138
                XMLTree.searchNodeAtribute(featureNode,"LatLongBoundingBox","maxy")));
139
              
140
        return f;
141
    }
142
    /**
143
     * This function parses the protocols of an operation
144
     * @param operation
145
     * Operation to find the supported protocols
146
     * @return
147
     */
148
    
149
    public String[] getOperations(String operation){
150
        Node[] protocols = XMLTree.searchMultipleNode(getRootNode(),"Capability->Request->" + operation + "->DCPType");
151
        String[] sProtocol = new String[protocols.length];
152
               
153
        for (int i=0 ; i<protocols.length ; i++){
154
            if (XMLTree.searchNode(protocols[i],"HTTP->Get") != null){
155
                sProtocol[i] = "GET";
156
            }
157
            if (XMLTree.searchNode(protocols[i],"HTTP->Post") != null){
158
                sProtocol[i] = "POST";
159
            }
160
            
161
        }   
162
       return sProtocol;
163
    }
164
    
165
    /**
166
     * @return Returns the rootNode.
167
     */
168
    public Node getRootNode() {
169
        return rootNode;
170
    }
171
    /**
172
     * @param rootNode The rootNode to set.
173
     */
174
    public void setRootNode(Node rootNode) {
175
        this.rootNode = rootNode;
176
    }
177
}
0 178

  
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/parsers/wfsg/wfsgProtocolsOperations.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package es.gva.cit.gazetteer.parsers.wfsg;
42

  
43
/**
44
 * This class is use like a structure. It saves what protocol is
45
 * supported by each WFS-G operation. Each attribute is an array that
46
 * can contain next values: GET, POST or SOAP
47
 * 
48
 * @author Jorge Piera Llodra (piera_jor@gva.es)
49
 */
50
public class wfsgProtocolsOperations {
51
	private String[] getCapabilities = null;
52
	private String[] describeFeatureType = null;
53
	private String[] getFeature = null;
54
		
55
	
56
    /**
57
     * @return Returns the describeFeatureType.
58
     */
59
    public String[] getDescribeFeatureType() {
60
        return describeFeatureType;
61
    }
62
    /**
63
     * @param describeFeatureType The describeFeatureType to set.
64
     */
65
    public void setDescribeFeatureType(String[] describeFeatureType) {
66
        this.describeFeatureType = describeFeatureType;
67
    }
68
    /**
69
     * @return Returns the getCapabilities.
70
     */
71
    public String[] getGetCapabilities() {
72
        return getCapabilities;
73
    }
74
    /**
75
     * @param getCapabilities The getCapabilities to set.
76
     */
77
    public void setGetCapabilities(String[] getCapabilities) {
78
        this.getCapabilities = getCapabilities;
79
    }
80
    /**
81
     * @return Returns the getFeature.
82
     */
83
    public String[] getGetFeature() {
84
        return getFeature;
85
    }
86
    /**
87
     * @param getFeature The getFeature to set.
88
     */
89
    public void setGetFeature(String[] getFeature) {
90
        this.getFeature = getFeature;
91
    }
92
}
0 93

  
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/querys/Feature.java
40 40
*/
41 41
package es.gva.cit.gazetteer.querys;
42 42

  
43
import es.gva.cit.catalogClient.querys.Coordinates;
44

  
43 45
/**
44 46
 * This class represents a feature
45 47
 * 
......
47 49
 */
48 50
public class Feature {
49 51
    private String name;
52
    private String title;
53
    private String abstract_;
54
    private String keywords;
55
    private String srs;
56
    private Coordinates coordinates;
50 57
    
58
    public Feature(){
59
        
60
    }
61
    
51 62
    public Feature(String name){
52 63
        this.name = name;
53 64
    }
......
64 75
    public void setName(String name) {
65 76
        this.name = name;
66 77
    }
78
    /**
79
     * @return Returns the abstract_.
80
     */
81
    public String getAbstract() {
82
        return abstract_;
83
    }
84
    /**
85
     * @param abstract_ The abstract_ to set.
86
     */
87
    public void setAbstract(String abstract_) {
88
        this.abstract_ = abstract_;
89
    }
90
    /**
91
     * @return Returns the coordinates.
92
     */
93
    public Coordinates getCoordinates() {
94
        return coordinates;
95
    }
96
    /**
97
     * @param coordinates The coordinates to set.
98
     */
99
    public void setCoordinates(Coordinates coordinates) {
100
        this.coordinates = coordinates;
101
    }
102
    /**
103
     * @return Returns the keywords.
104
     */
105
    public String getKeywords() {
106
        return keywords;
107
    }
108
    /**
109
     * @param keywords The keywords to set.
110
     */
111
    public void setKeywords(String keywords) {
112
        this.keywords = keywords;
113
    }
114
    /**
115
     * @return Returns the srs.
116
     */
117
    public String getSrs() {
118
        return srs;
119
    }
120
    /**
121
     * @param srs The srs to set.
122
     */
123
    public void setSrs(String srs) {
124
        this.srs = srs;
125
    }
126
    /**
127
     * @return Returns the title.
128
     */
129
    public String getTitle() {
130
        return title;
131
    }
132
    /**
133
     * @param title The title to set.
134
     */
135
    public void setTitle(String title) {
136
        this.title = title;
137
    }
138
    /**
139
     * To load into a List
140
     */
141
    public String toString(){
142
        return name;
143
    }
67 144
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/querys/WFSGQuery.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package es.gva.cit.gazetteer.querys;
42

  
43
import es.gva.cit.catalogClient.querys.Coordinates;
44

  
45
/**
46
 * @author Jorge Piera Llodra (piera_jor@gva.es)
47
 */
48
public class WFSGQuery extends Query implements IQuery{
49

  
50
    public WFSGQuery(Query query){
51
        super(query.getName(),query.getNameFilter(),query.getFeature(),query.getRecsByPage(),
52
                query.getCoordinates(),query.getCoordinatesFilter());
53
    }
54
    /**
55
     * @param name
56
     * @param nameFilter
57
     * @param feature
58
     * @param recsByPage
59
     * @param coordinates
60
     * @param coordinatesFilter
61
     */
62
    public WFSGQuery(String name, String nameFilter, Feature feature, int recsByPage, Coordinates coordinates, String coordinatesFilter) {
63
        super(name, nameFilter, feature, recsByPage, coordinates, coordinatesFilter);
64
        // TODO Auto-generated constructor stub
65
    }
66

  
67
    /* (non-Javadoc)
68
     * @see es.gva.cit.gazetteer.querys.IQuery#getQuery()
69
     */
70
    public String getQuery() {
71
        // TODO Auto-generated method stub
72
        return null;
73
    }
74

  
75
   
76
}
0 77

  
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/querys/Query.java
40 40
*/
41 41
package es.gva.cit.gazetteer.querys;
42 42

  
43
import es.gva.cit.catalogClient.querys.Coordinates;
44

  
43 45
/**
44 46
 * This class contains all the queryable fields that the user interface
45 47
 * supports.
......
47 49
 * @author Jorge Piera Llodra (piera_jor@gva.es)
48 50
 */
49 51
public class Query {
50

  
52
    private String Name;
53
    private String NameFilter;
54
    private Feature feature;
55
    private int recsByPage;
56
    private Coordinates coordinates;
57
    private String coordinatesFilter;
58
       
51 59
    
60
    /**
61
     * @param name
62
     * @param nameFilter
63
     * @param feature
64
     * @param recsByPage
65
     * @param coordinates
66
     * @param coordinatesFilter
67
     */
68
    public Query(String name, String nameFilter, Feature feature,
69
            int recsByPage, Coordinates coordinates, String coordinatesFilter) {
70
        super();
71
        Name = name;
72
        NameFilter = nameFilter;
73
        this.feature = feature;
74
        this.recsByPage = recsByPage;
75
        this.coordinates = coordinates;
76
        this.coordinatesFilter = coordinatesFilter;
77
    }
78
    /**
79
     * @return Returns the coordinates.
80
     */
81
    public Coordinates getCoordinates() {
82
        return coordinates;
83
    }
84
    /**
85
     * @param coordinates The coordinates to set.
86
     */
87
    public void setCoordinates(Coordinates coordinates) {
88
        this.coordinates = coordinates;
89
    }
90
    /**
91
     * @return Returns the coordinatesFilter.
92
     */
93
    public String getCoordinatesFilter() {
94
        return coordinatesFilter;
95
    }
96
    /**
97
     * @param coordinatesFilter The coordinatesFilter to set.
98
     */
99
    public void setCoordinatesFilter(String coordinatesFilter) {
100
        this.coordinatesFilter = coordinatesFilter;
101
    }
102
    /**
103
     * @return Returns the feature.
104
     */
105
    public Feature getFeature() {
106
        return feature;
107
    }
108
    /**
109
     * @param feature The feature to set.
110
     */
111
    public void setFeature(Feature feature) {
112
        this.feature = feature;
113
    }
114
    /**
115
     * @return Returns the name.
116
     */
117
    public String getName() {
118
        return Name;
119
    }
120
    /**
121
     * @param name The name to set.
122
     */
123
    public void setName(String name) {
124
        Name = name;
125
    }
126
    /**
127
     * @return Returns the nameFilter.
128
     */
129
    public String getNameFilter() {
130
        return NameFilter;
131
    }
132
    /**
133
     * @param nameFilter The nameFilter to set.
134
     */
135
    public void setNameFilter(String nameFilter) {
136
        NameFilter = nameFilter;
137
    }
138
    /**
139
     * @return Returns the recsByPage.
140
     */
141
    public int getRecsByPage() {
142
        return recsByPage;
143
    }
144
    /**
145
     * @param recsByPage The recsByPage to set.
146
     */
147
    public void setRecsByPage(int recsByPage) {
148
        this.recsByPage = recsByPage;
149
    }
52 150
}

Also available in: Unified diff