Revision 3081

View differences:

trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/protocols/HTTPPostProtocol.java
40 40
*/
41 41
package es.gva.cit.catalogClient.protocols;
42 42

  
43
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44
import es.gva.cit.catalogClient.metadataXML.XMLTree;
45

  
46
import org.apache.commons.httpclient.DefaultMethodRetryHandler;
47
import org.apache.commons.httpclient.HttpClient;
48
import org.apache.commons.httpclient.HttpStatus;
49
import org.apache.commons.httpclient.NameValuePair;
50
import org.apache.commons.httpclient.methods.PostMethod;
51

  
52

  
53 43
import java.io.ByteArrayInputStream;
44
import java.io.IOException;
54 45
import java.io.InputStream;
55

  
46
import java.io.OutputStreamWriter;
47
import java.net.HttpURLConnection;
56 48
import java.net.URL;
57 49

  
50
import es.gva.cit.catalogClient.metadataXML.XMLNode;
51
import es.gva.cit.catalogClient.metadataXML.XMLTree;
52
import es.gva.cit.catalogClient.protocols.IProtocols;
58 53

  
59 54
/**
60
 * Implementa la operacion POST de HTTP. 
55
 * This class implement the protocol used by ADL Gazetteer.
61 56
 * 
62 57
 * @author Jorge Piera Llodra (piera_jor@gva.es)
63 58
 */
64 59
public class HTTPPostProtocol implements IProtocols {
65
    public XMLNode[] doQuery(URL url, Object object, int firstRecord) {
66
        NameValuePair[] parameters = (NameValuePair[]) object;
67 60

  
68
        //String parameters = (String) object;
69
        InputStream is = null;
61
      
62
    public XMLNode[] doQuery(URL url, Object message, int firstRecord) {
63
        String body = (String) message;
70 64
        ByteArrayInputStream output = null;
71

  
72
        // Solo devuleve un nodo
73 65
        XMLNode[] nodes = new XMLNode[1];
74

  
75
        //	Create an instance of HttpClient.
76
        HttpClient client = new HttpClient();
77

  
78
        // 	Create a method instance.
79
        PostMethod method = new PostMethod("http://" + url.getHost() + ":" +
80
                url.getPort() + url.getPath());
81

  
82
        // Provide custom retry handler is necessary
83
        DefaultMethodRetryHandler retryhandler = new DefaultMethodRetryHandler();
84
        retryhandler.setRequestSentRetryEnabled(false);
85
        retryhandler.setRetryCount(3);
86
        method.setMethodRetryHandler(retryhandler);
87

  
88
        method.setQueryString(parameters);
89
        method.setRequestBody(parameters);
90 66
        
91
        System.out.print(method.getQueryString());
92

  
93 67
        try {
94
            // Execute the method
95
            int statusCode = client.executeMethod(method);
68
            HttpURLConnection c = (HttpURLConnection) url.openConnection();
69
       
70
        c.setRequestMethod("POST");
71
        c.setDoOutput(true);
72
        c.setRequestProperty("Content-Type", "text/xml; charset=UTF-8");
96 73

  
97
            //System.out.println("QueryString>>> "+ method.getQueryString());
98
            if (statusCode != HttpStatus.SC_OK) {
99
                System.err.println("Fallo en el m?todo: " +
100
                    method.getStatusLine());
101

  
102
                return null;
74
        // Write the request.
75
        OutputStreamWriter w =
76
            new OutputStreamWriter(c.getOutputStream(), "UTF-8");
77
        w.write(body);
78
            w.flush();
79
            
80
            InputStream is = c.getInputStream();
81
            byte[] buf = new byte[1024];
82
            int len;
83
            String str = "";
84
            while ((len = is.read(buf)) > 0) {
85
                str = str + new String(buf, 0, len);
103 86
            }
104

  
105
            //			 Process the answer
106
            is = method.getResponseBodyAsStream();
107

  
108
            byte[] buffer = new byte[256];
109
            String str = new String("");
110

  
111
            while (true) {
112
                int n = is.read(buffer);
113

  
114
                if (n < 0) {
115
                    break;
116
                }
117

  
118
                str = str + new String(buffer, 0, n);
119
            }
120

  
87
            
121 88
            System.out.println(str);
122

  
123
            is.close();
124 89
            output = new ByteArrayInputStream(str.getBytes());
125
        } catch (Exception e) {
126
            System.err.println("No se encuentra el servidor.");
127

  
90
            
91
        }  catch (IOException e) {
92
            // TODO Auto-generated catch block
128 93
            return null;
129
        } finally {
130
            // Release the connection.
131
            method.releaseConnection();
132
        }
133

  
94
        } 
95
        
134 96
        nodes[0] = XMLTree.XMLToTree(output);
135 97

  
136 98
        return nodes;
99
            
137 100
    }
138

  
139
    public static boolean isProtocolSupported(URL url) {
140
        return true;
141
    }
142 101
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/ui/ShowTreeDialog.java
76 76
        this.setSize(new Dimension(800, 675));
77 77
        this.setTitle("Cliente de Cat?logo");
78 78

  
79
        getContentPane().add(new ShowTreeDialogPanel(node));
79
        ShowTreeDialogPanel panel = new ShowTreeDialogPanel(node);
80
        panel.setParent(this);
81
        getContentPane().add(panel);
80 82

  
83
        
81 84
        this.setVisible(true);
82 85
    }
83 86

  
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/ui/ShowResultsDialog.java
88 88
        this.setSize(new Dimension(625, 425));
89 89
        this.setTitle("Cliente de Cat?logo");
90 90

  
91
        getContentPane().add(new ShowResultsDialogPanel(client, nodes,
92
                currentRecord));
93

  
91
        ShowResultsDialogPanel panel = new ShowResultsDialogPanel(client, nodes,
92
                currentRecord);
93
        panel.setParent(this);
94
        getContentPane().add(panel);
95
       
94 96
        this.setVisible(true);
95 97
    }
96 98

  
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/ui/ShowResultsPanel.java
42 42

  
43 43
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44 44
import es.gva.cit.catalogClient.parsers.AbstractTags;
45
import es.gva.cit.catalogClient.parsers.IndicioTags;
46
import es.gva.cit.catalogClient.parsers.LongTags;
47
import es.gva.cit.catalogClient.parsers.ShortTags;
45
import es.gva.cit.catalogClient.parsers.csw.CswRecordsParser;
46
import es.gva.cit.catalogClient.parsers.srw.SrwRecordsParser;
47
import es.gva.cit.catalogClient.parsers.z3950.Z3959RecordsParser;
48 48

  
49 49

  
50 50
import java.awt.AlphaComposite;
......
314 314

  
315 315
    public void loadTextNewRecord(XMLNode node, String protocol) {
316 316
        if (protocol.equals("Z3950")) {
317
            this.setTags(new ShortTags(node,serverURL));
317
            this.setTags(new Z3959RecordsParser(node,serverURL));
318 318
        } else if (protocol.equals("SRW")) {
319
            this.setTags(new LongTags(node));
319
            this.setTags(new SrwRecordsParser(node));
320 320
        } else {
321
            this.setTags(new IndicioTags(node));
321
            this.setTags(new CswRecordsParser(node));
322 322
        }
323 323

  
324 324
        descriptionArea.setText(this.getHtml());
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/ui/ChooseResourceDialogPanel.java
48 48
import javax.swing.BoxLayout;
49 49
import javax.swing.JButton;
50 50
import javax.swing.JCheckBox;
51
import javax.swing.JFrame;
51 52
import javax.swing.JPanel;
52 53

  
53 54
import es.gva.cit.catalogClient.parsers.Resource;
......
60 61
 * @author Jorge Piera Llodra (piera_jor@gva.es)
61 62
 */
62 63
public class ChooseResourceDialogPanel extends JPanel implements ActionListener {
64
    //It is needed to close the frame
65
    private JFrame parent;
66
    
63 67
    //Panels
64 68
    JPanel ppalPanel = null;
65 69
    ChooseResourcePanel resourcePanel = null;
......
141 145
    }
142 146
    
143 147
    public void closeButtonActionPerformed() {
144
       this.setVisible(false);
148
       parent.setVisible(false);
145 149
    }
146 150

  
151
    /**
152
     * @param parent The parent to set.
153
     */
154
    public void setParent(JFrame parent) {
155
        this.parent = parent;
156
    }
147 157
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/ui/ShowTreeDialogPanel.java
48 48

  
49 49
import javax.swing.BoxLayout;
50 50
import javax.swing.JButton;
51
import javax.swing.JDialog;
51 52
import javax.swing.JPanel;
52 53

  
53 54
import es.gva.cit.catalogClient.metadataXML.XMLNode;
......
57 58
 * @author Jorge Piera Llodra (piera_jor@gva.es)
58 59
 */
59 60
public class ShowTreeDialogPanel extends JPanel implements ActionListener {
61
    //It is needed to close the frame
62
    private JDialog parent;
63
    
60 64
    //Panels
61
    JPanel ppalPanel = null;
62
    ShowTreePanel controlsPanel = null;
63
    JPanel buttonsPanel = null;
65
    private JPanel ppalPanel = null;
66
    private ShowTreePanel controlsPanel = null;
67
    private JPanel buttonsPanel = null;
64 68

  
65 69
    //Buttons
66
    JButton close = null;
70
    protected JButton close = null;
67 71

  
68 72
    //Otros
69
    XMLNode node = null;
70
    boolean nuevo = true;
73
    private XMLNode node = null;
74
    private boolean nuevo = true;
71 75

  
72 76
    public ShowTreeDialogPanel(XMLNode node) {
73 77
        this.node = node;
......
115 119
    }
116 120
    
117 121
    public void closeButtonActionPerformed(){
118
        this.setVisible(false);
122
        parent.setVisible(false);
119 123
    }
120 124

  
121 125
    /* (non-Javadoc)
......
127 131
            closeButtonActionPerformed();
128 132
        }
129 133
    }
134

  
135
    /**
136
     * @param parent The parent to set.
137
     */
138
    public void setParent(JDialog parent) {
139
        this.parent = parent;
140
    }
130 141
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/ui/ShowResultsDialogPanel.java
51 51
import java.awt.event.ActionListener;
52 52

  
53 53
import javax.swing.JButton;
54
import javax.swing.JDialog;
54 55
import javax.swing.JPanel;
55 56

  
56 57

  
......
58 59
 * @author Jorge Piera Llodra (piera_jor@gva.es)
59 60
 */
60 61
public class ShowResultsDialogPanel extends JPanel implements ActionListener {
62
    //It is needed to close the frame
63
    private JDialog parent;
64
    
61 65
    public ShowResultsPanel ppalPanel = null;
62 66
    public XMLNode[] nodes = null;
63 67
    CatalogClient client = null;
64 68
    int currentRecord = 0;
69
    
65 70
    JButton nextButton = null;
66 71
    JButton lastButton = null;
67 72
    JButton descriptionButton = null;
......
227 232
    }
228 233
    
229 234
    public void closeButtonActionPerformed() {
230
        setVisible(false);
235
        parent.setVisible(false);
231 236
    }
237
    /**
238
     * @param parent The parent to set.
239
     */
240
    public void setParent(JDialog parent) {
241
        this.parent = parent;
242
    }
232 243
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/ui/SearchDialogPanel.java
318 318

  
319 319
    public void showResults(XMLNode[] nodesRecords) {
320 320
        JDialog dialog = new ShowResultsDialog(client, nodesRecords, 1);
321
    }
321
     }
322 322

  
323 323
    /* (non-Javadoc)
324 324
     * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/ui/ChooseResourceDialog.java
78 78
        //setResizable(false);
79 79
        setName("chooseResources");
80 80

  
81
        getContentPane().add(new ChooseResourceDialogPanel(resources));
81
        ChooseResourceDialogPanel panel = new ChooseResourceDialogPanel(resources);
82
        panel.setParent(this);
83
        getContentPane().add(panel);
82 84
       
83 85
        setVisible(true);
84 86
    }
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/drivers/SRWCatalogServiceDriver.java
43 43
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44 44
import es.gva.cit.catalogClient.metadataXML.XMLTree;
45 45
import es.gva.cit.catalogClient.metadataXML.XMLTreeNumberOfRecordsAnswer;
46
import es.gva.cit.catalogClient.parsers.srw.SrwCapabilitiesParser;
46 47
import es.gva.cit.catalogClient.protocols.HTTPGetProtocol;
47
import es.gva.cit.catalogClient.protocols.HTTPPostProtocol;
48 48
import es.gva.cit.catalogClient.protocols.SOAPProtocol;
49 49
import es.gva.cit.catalogClient.querys.Query;
50 50
import es.gva.cit.catalogClient.querys.SRWQuery;
......
78 78
            return nodos;
79 79
        }
80 80

  
81
        nodos = new HTTPPostProtocol().doQuery(url, getMessageCapabilities(), 0);
82

  
83
        if (nodos != null) {
84
            setCommunicationProtocol("POST");
85

  
86
            return nodos;
87
        }
88

  
89 81
        nodos = new SOAPProtocol().doQuery(url, getSOAPMessageCapabilities(), 0);
90 82

  
91 83
        if (nodos != null) {
......
108 100
            nodes = new HTTPGetProtocol().doQuery(url,
109 101
                    getMessageRecords(getQuery(), firstRecord), firstRecord);
110 102
        }
111

  
112
        if (getCommunicationProtocol().equals("POST")) {
113
            nodes = new HTTPPostProtocol().doQuery(url,
114
                    getMessageRecords(getQuery(), firstRecord), firstRecord);
115
        }
116

  
117
        if (getCommunicationProtocol().equals("SOAP")) {
103
        
104
        if (getCommunicationProtocol().equals("POST") || 
105
                getCommunicationProtocol().equals("SOAP")){
118 106
            nodes = new SOAPProtocol().doQuery(url,
119 107
                    getMessageRecords(getQuery(), firstRecord), firstRecord);
120 108
        }
......
297 285
     * @see catalogClient.ICatalogServerDriver#setParameters(java.util.Properties)
298 286
     */
299 287
    public boolean setParameters(XMLNode[] nodes) {
300
        if (nodes[0].getName() != null) {
301
            String prefix = new StringTokenizer(nodes[0].getName(), ":").nextToken();
302
            prefix = prefix + ":";
303
            this.setOutputSchema(XMLTree.searchNodeValue(nodes[0],
304
                    prefix + "record->" + prefix + "recordSchema"));
305
            this.setOutputFormat(XMLTree.searchNodeValue(nodes[0],
306
                    prefix + "record->" + prefix + "recordPacking"));
307
            this.setStartPosition("1");
308
            this.setMaxRecords("10");
309
            this.setRecordXPath("");
310
            this.setResultSetTTL("0");
311
            this.setServerAnswerReady("Titulo: " +
312
                XMLTree.searchNodeValue(nodes[0],
313
                    prefix + "record->" + prefix +
314
                    "recordData->explain->databaseInfo->title") +
315
                "\nDescripcion: " +
316
                XMLTree.searchNodeValue(nodes[0],
317
                    prefix + "record->" + prefix +
318
                    "recordData->explain->databaseInfo->description"));
319
        }
320

  
321
        return true;
288
        return new SrwCapabilitiesParser(this).parse(nodes[0]);
322 289
    }
323 290

  
324 291
    /* (non-Javadoc)
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/drivers/CSWCatalogServiceDriver.java
43 43
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44 44
import es.gva.cit.catalogClient.metadataXML.XMLTree;
45 45
import es.gva.cit.catalogClient.metadataXML.XMLTreeNumberOfRecordsAnswer;
46
import es.gva.cit.catalogClient.parsers.csw.ProtocolsOperations;
47
import es.gva.cit.catalogClient.parsers.csw.cswCapabilitiesParser;
46
import es.gva.cit.catalogClient.parsers.csw.CswSupportedProtocolOperations;
47
import es.gva.cit.catalogClient.parsers.csw.CswCapabilitiesParser;
48 48
import es.gva.cit.catalogClient.protocols.HTTPGetProtocol;
49 49
import es.gva.cit.catalogClient.protocols.HTTPPostProtocol;
50 50
import es.gva.cit.catalogClient.protocols.SOAPProtocol;
......
73 73
    private String[] NAMESPACE = null;
74 74
    private String ServerProfile = "ebRIM"; //or ISO
75 75
    private String version = "2.0.0";
76
    private ProtocolsOperations operations = null;
76
    private CswSupportedProtocolOperations operations = null;
77 77

  
78 78
    /*
79 79
     * (non-Javadoc)
......
378 378
     * @return
379 379
     * Name-value pair with a XML request
380 380
     */
381
    public NameValuePair[] getPOSTMessageCapabilities() {
382
        String message = "<csw:GetCapabilities service=\"CSW\" version=\"2.0.0\" " +
381
    public String getPOSTMessageCapabilities() {
382
       return "<csw:GetCapabilities service=\"CSW\" version=\"2.0.0\" " +
383 383
            "xmlns:csw=\"http://www.opengis.net/cat/csw\" " +
384 384
            "xmlns:ogc=\"http://www.opengis.net/ogc\">" +
385 385
            "<AcceptVersions xmlns=\"http://www.opengis.net/ows\">" +
......
387 387
            "<AcceptFormats xmlns=\"http://www.opengis.net/ows\">" +
388 388
            "<OutputFormat>text/xml</OutputFormat>" + "</AcceptFormats>" +
389 389
            "</csw:GetCapabilities>";
390

  
391
        System.out.println(message);
392

  
393
        NameValuePair nvp1 = new NameValuePair("body", message);
394

  
395
        return new NameValuePair[] { nvp1 };
396 390
    }
397 391
    
398 392
    /**
......
401 395
     * @return
402 396
     * Name-value pair with a XML request
403 397
     */
404
    public NameValuePair[] getPOSTDescribeRecords() {
405
        String message = "<csw:DescribeRecord " +
398
    public String getPOSTDescribeRecords() {
399
        return "<csw:DescribeRecord " +
406 400
            "xmlns:csw=\"http://www.opengis.net/cat/csw\" " +
407 401
            "xmlns:ogc=\"http://www.opengis.net/ogc\" " + "service=\"CSW\" " +
408 402
            "version=" + version + " " + "outputFormat=\"test/xml\" " +
409 403
            "schemaLanguage=\"XMLSCHEMA\">" +
410 404
            "<csw:TypeName>csw:record</csw:TypeName>" +
411 405
            "</csw:DescribeRecord>";
412

  
413
        System.out.println(message);
414

  
415
        NameValuePair nvp1 = new NameValuePair("body", message);
416

  
417
        return new NameValuePair[] { nvp1 };
406
       
418 407
    }
419 408

  
420 409
    /**
......
423 412
     * @return
424 413
     * Name-value pair with a XML request
425 414
     */
426
    public NameValuePair[] getPOSTMessageRecords(Query query, int firstRecord) {
415
    public String getPOSTMessageRecords(Query query, int firstRecord) {
427 416
        CSWQuery cswq = new CSWQuery(query);
428 417

  
429
        String message = "<?xml version='1.0' encoding='UTF-8'?>" +
418
        return "<?xml version='1.0' encoding='UTF-8'?>" +
430 419
            "<GetRecords " + "service='CSW' " +
431 420
            "version='2.0.0' " + "xmlns='http://www.opengis.net/cat/csw' " +
432 421
            "xmlns:ogc='http://www.opengis.net/ogc' " +
......
450 439
        cswq.getQuery(this.getServerProfile()) + "</csw:Constraint>" +
451 440
        "</csw:Query>" + "</csw:GetRecords>";
452 441
        */
453
        System.out.println(message);
454

  
455
        NameValuePair nvp1 = new NameValuePair("body", message);
456

  
457
        return new NameValuePair[] { nvp1 };
442
        
458 443
    }
459 444
    
460 445
    /**
......
464 449
     * String with the SOAP message
465 450
     */
466 451
    public String getSOAPMessageCapabilities() {
467
        return SOAPProtocol.setSOAPMessage(getPOSTMessageCapabilities()[0].getValue(),null);
452
        return SOAPProtocol.setSOAPMessage(getPOSTMessageCapabilities(),null);
468 453
    }
469 454

  
470 455
    /**
......
474 459
     * String with the SOAP message
475 460
     */
476 461
    public String getSOAPMessageDescribeRecords() {
477
        return SOAPProtocol.setSOAPMessage(getPOSTDescribeRecords()[0].getValue(),null);
462
        return SOAPProtocol.setSOAPMessage(getPOSTDescribeRecords(),null);
478 463
    }
479 464
    
480 465
    /**
......
485 470
     */
486 471
    public String getSOAPMessageRecords(Query query, int firstRecord) {
487 472
        return SOAPProtocol.setSOAPMessage(getPOSTMessageRecords(query,
488
                firstRecord)[0].getValue(),null);
473
                firstRecord),null);
489 474
    }
490 475

  
491 476
    /*
......
494 479
     * @see catalogClient.ICatalogServerDriver#setParameters(java.util.Properties)
495 480
     */
496 481
    public boolean setParameters(XMLNode[] nodes) {
497
        return new cswCapabilitiesParser(this).parse(nodes[0]);
482
        return new CswCapabilitiesParser(this).parse(nodes[0]);
498 483
    }
499 484
    
500 485
    /**
......
681 666
	/**
682 667
	 * @return Returns the operations.
683 668
	 */
684
	public ProtocolsOperations getOperations() {
669
	public CswSupportedProtocolOperations getOperations() {
685 670
		return operations;
686 671
	}
687 672
	/**
688 673
	 * @param operations The operations to set.
689 674
	 */
690
	public void setOperations(ProtocolsOperations operations) {
675
	public void setOperations(CswSupportedProtocolOperations operations) {
691 676
		this.operations = operations;
692 677
	}
693 678
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/parsers/IndicioTags.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.catalogClient.parsers;
42

  
43
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44
import es.gva.cit.catalogClient.metadataXML.XMLTree;
45

  
46

  
47
/**
48
 * This class parses the Indicio CSW server answer files.
49
 * 
50
 * @author Jorge Piera Llodra (piera_jor@gva.es)
51
 */
52
public class IndicioTags extends AbstractTags {
53
    public IndicioTags(XMLNode node) {
54
        this.setNode(node);
55
        this.setTitle(XMLTree.searchNodeValue(node,
56
                "identificationInfo->MD_DataIdentification->citation->title"));
57
        this.setAbstract_(XMLTree.searchNodeValue(node,
58
                "identificationInfo->MD_DataIdentification->abstract"));
59
        this.setPurpose(XMLTree.searchNodeValue(node,
60
                "identificationInfo->MD_DataIdentification->purpose"));
61
        this.setKeyWords(XMLTree.searchMultipleNodeValue(node,
62
                "identificationInfo->MD_DataIdentification->descriptiveKeywords->keyword"));
63
    }
64
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/parsers/LongTags.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.catalogClient.parsers;
42

  
43
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44
import es.gva.cit.catalogClient.metadataXML.XMLTree;
45

  
46

  
47

  
48
/**
49
 * @author Jorge Piera Llodra (piera_jor@gva.es)
50
 */
51
public class LongTags extends AbstractTags {
52
    public LongTags(XMLNode node) {
53
        setNode(node);
54
        setTitle(XMLTree.searchNodeValue(node,
55
                "recordData->MD_Metadata->identificationInfo->MD_DataIdentification->citation->CI_Citation->title"));
56
        setAbstract_(XMLTree.searchNodeValue(node,
57
                "recordData->MD_Metadata->identificationInfo->MD_DataIdentification->abstract"));
58
        setPurpose(XMLTree.searchNodeValue(node,
59
                "recordData->MD_Metadata->identificationInfo->MD_DataIdentification->purpose"));
60
        setKeyWords(XMLTree.searchMultipleNodeValue(node,
61
                "recordData->MD_Metadata->identificationInfo->MD_DataIdentification->descriptiveKeywords->MD_Keywords->keyword"));
62

  
63
        //this.setResources(getResources(node,""));
64
    }
65

  
66
    public Resource[] getResources(XMLNode node, String label) {
67
        XMLNode[] nodes = XMLTree.searchMultipleNode(node, label);
68

  
69
        if (nodes == null) {
70
            return null;
71
        }
72

  
73
        Resource[] resources = new Resource[nodes.length];
74

  
75
        for (int i = 0; i < resources.length; i++)
76
            resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i], ""),
77
                    XMLTree.searchNodeValue(nodes[i], ""),
78
                    XMLTree.searchNodeValue(nodes[i], ""),
79
                    XMLTree.searchNodeValue(nodes[i], ""),
80
                    XMLTree.searchNodeAtribute(nodes[i], "", ""),
81
					XMLTree.searchNodeValue(nodes[i],""),
82
					null);
83

  
84
        return resources;
85
    }
86
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/parsers/ShortTags.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.catalogClient.parsers;
42

  
43
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44
import es.gva.cit.catalogClient.metadataXML.XMLTree;
45
import es.gva.cit.catalogClient.querys.Coordinates;
46
import java.awt.image.BufferedImage;
47

  
48
import java.io.File;
49
import java.io.IOException;
50

  
51
import java.net.MalformedURLException;
52
import java.net.URL;
53

  
54
import javax.imageio.ImageIO;
55

  
56

  
57

  
58
/**
59
 * @author Jorge Piera Llodra (piera_jor@gva.es)
60
 */
61

  
62
public class ShortTags extends AbstractTags {
63
/**
64
 * Constructor
65
 * @param node
66
 * Node with the answer
67
 * @param serverURL
68
 * Server URL. Necessary to load the image (just Geonetwork)
69
 * 
70
 */
71
    public ShortTags(XMLNode node,URL serverURL) {
72
        setNode(node);
73
        setTitle(XMLTree.searchNodeValue(node,
74
                "dataIdInfo->idCitation->resTitle"));
75
        setAbstract_(XMLTree.searchNodeValue(node, "dataIdInfo->idAbs"));
76
        setPurpose(XMLTree.searchNodeValue(node, "dataIdInfo->idPurp"));
77
        setKeyWords(XMLTree.searchMultipleNodeValue(node,
78
                "dataIdInfo->descKeys->keyword"));
79
        setResources(getResources("distInfo->distTranOps->onLineSrc"));
80
        setFileID(XMLTree.searchNodeValue(node,"mdFileID"));
81
        setServerURL(serverURL);
82
        //Caution: getImageUrl uses serverURL and FileID!!!
83
        setImage(getImageUrl("dataIdInfo->graphOver"));
84
        
85
   }
86

  
87
    private Resource[] getResources(String label) {
88
        XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
89
        Coordinates coordinates = null;
90
        String srs = null;
91
        
92
        if (nodes == null) {
93
            return null;
94
        }
95

  
96
        Resource[] resources = new Resource[nodes.length];
97

  
98
        if (nodes.length > 0){
99
        	srs = XMLTree.searchNodeValue(getNode(),"refSysInfo->MdCoRefSys->refSysID->identCode");
100
        	coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->westBL"),
101
        			XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->northBL"),
102
					XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->eastBL"),
103
					XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->southBL"));
104
        }
105
        	
106
        	
107
        for (int i = 0; i < resources.length; i++)
108
            
109
        	resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
110
                        "linkage"),
111
                    XMLTree.searchNodeValue(nodes[i], "protocol"),
112
                    XMLTree.searchNodeValue(nodes[i], "orName"),
113
                    XMLTree.searchNodeValue(nodes[i], "orDesc"),
114
                    XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
115
                        "value"),
116
					srs,	
117
            		coordinates);
118

  
119
        return resources;
120
    }
121

  
122
    private BufferedImage getImageUrl(String label) {
123
        URL Url;
124
        BufferedImage img;
125
        XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
126

  
127
        if ((nodes == null) || (nodes.length == 0)) {
128
            return null;
129
        }
130

  
131
        //Normal Procedure
132
        String imageURL = XMLTree.searchNodeValue(nodes[0], "bgFileName");
133
     
134
        img = getImage(imageURL);
135
        if (img != null)
136
            return img;
137
                     
138
        //Is it Geonetwork running in port  8080?
139
        String sUrl = getGeonetworkImageUrl(imageURL,"8080");              
140
        img = getImage(sUrl);
141
        if (img != null)
142
            return img;
143
        
144
        //It is Geonetwork running in port 80?
145
        sUrl = getGeonetworkImageUrl(imageURL,"80");   
146
        img = getImage(sUrl);
147
        if (img != null)
148
            return img;
149
        
150
        File fichero = new File("images/IcoRecord.png");
151

  
152
        try {
153
            return ImageIO.read(fichero);
154
        } catch (IOException e2) {
155
            // TODO Auto-generated catch block
156
            System.out.println("No he podido leer la imagen desde el fichero");
157

  
158
            return null;
159
        }
160
    }
161
    
162
    private String getGeonetworkImageUrl(String imageUrl,String port){
163
        return "http://" + getServerURL().getHost() + ":" + port + "/geonetwork/srv/es/resources.getgraphover?" +
164
    	"id=" + getFileID() + "&" +
165
    	"fname=" + imageUrl;
166
    }
167
    
168
    private BufferedImage getImage(String sUrl){
169
        try {
170
            URL Url = new URL(sUrl);
171
        
172
            return ImageIO.read(Url);
173
        } catch (MalformedURLException e) {
174
            // TODO Auto-generated catch block
175
            System.out.println("La URL de la imagen no es correcta: " + sUrl);
176
        } catch (IOException e1) {
177
            // TODO Auto-generated catch block
178
            System.out.println("No he podido leer la imagen desde la URL: " + sUrl);
179
        }
180
        return null;
181
    }
182
}
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/parsers/z3950/Z3959RecordsParser.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.catalogClient.parsers.z3950;
42

  
43
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44
import es.gva.cit.catalogClient.metadataXML.XMLTree;
45
import es.gva.cit.catalogClient.parsers.AbstractTags;
46
import es.gva.cit.catalogClient.parsers.Resource;
47
import es.gva.cit.catalogClient.querys.Coordinates;
48
import java.awt.image.BufferedImage;
49

  
50
import java.io.File;
51
import java.io.IOException;
52

  
53
import java.net.MalformedURLException;
54
import java.net.URL;
55

  
56
import javax.imageio.ImageIO;
57

  
58

  
59

  
60
/**
61
 * @author Jorge Piera Llodra (piera_jor@gva.es)
62
 */
63

  
64
public class Z3959RecordsParser extends AbstractTags {
65
/**
66
 * Constructor
67
 * @param node
68
 * Node with the answer
69
 * @param serverURL
70
 * Server URL. Necessary to load the image (just Geonetwork)
71
 * 
72
 */
73
    public Z3959RecordsParser(XMLNode node,URL serverURL) {
74
        setNode(node);
75
        setTitle(XMLTree.searchNodeValue(node,
76
                "dataIdInfo->idCitation->resTitle"));
77
        setAbstract_(XMLTree.searchNodeValue(node, "dataIdInfo->idAbs"));
78
        setPurpose(XMLTree.searchNodeValue(node, "dataIdInfo->idPurp"));
79
        setKeyWords(XMLTree.searchMultipleNodeValue(node,
80
                "dataIdInfo->descKeys->keyword"));
81
        setResources(getResources("distInfo->distTranOps->onLineSrc"));
82
        setFileID(XMLTree.searchNodeValue(node,"mdFileID"));
83
        setServerURL(serverURL);
84
        //Caution: getImageUrl uses serverURL and FileID!!!
85
        setImage(getImageUrl("dataIdInfo->graphOver"));
86
        
87
   }
88

  
89
    private Resource[] getResources(String label) {
90
        XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
91
        Coordinates coordinates = null;
92
        String srs = null;
93
        
94
        if (nodes == null) {
95
            return null;
96
        }
97

  
98
        Resource[] resources = new Resource[nodes.length];
99

  
100
        if (nodes.length > 0){
101
        	srs = XMLTree.searchNodeValue(getNode(),"refSysInfo->MdCoRefSys->refSysID->identCode");
102
        	coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->westBL"),
103
        			XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->northBL"),
104
					XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->eastBL"),
105
					XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->southBL"));
106
        }
107
        	
108
        	
109
        for (int i = 0; i < resources.length; i++)
110
            
111
        	resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
112
                        "linkage"),
113
                    XMLTree.searchNodeValue(nodes[i], "protocol"),
114
                    XMLTree.searchNodeValue(nodes[i], "orName"),
115
                    XMLTree.searchNodeValue(nodes[i], "orDesc"),
116
                    XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
117
                        "value"),
118
					srs,	
119
            		coordinates);
120

  
121
        return resources;
122
    }
123

  
124
    private BufferedImage getImageUrl(String label) {
125
        URL Url;
126
        BufferedImage img;
127
        XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
128

  
129
        if ((nodes == null) || (nodes.length == 0)) {
130
            return null;
131
        }
132

  
133
        //Normal Procedure
134
        String imageURL = XMLTree.searchNodeValue(nodes[0], "bgFileName");
135
     
136
        img = getImage(imageURL);
137
        if (img != null)
138
            return img;
139
                     
140
        //Is it Geonetwork running in port  8080?
141
        String sUrl = getGeonetworkImageUrl(imageURL,"8080");              
142
        img = getImage(sUrl);
143
        if (img != null)
144
            return img;
145
        
146
        //It is Geonetwork running in port 80?
147
        sUrl = getGeonetworkImageUrl(imageURL,"80");   
148
        img = getImage(sUrl);
149
        if (img != null)
150
            return img;
151
        
152
        File fichero = new File("images/IcoRecord.png");
153

  
154
        try {
155
            return ImageIO.read(fichero);
156
        } catch (IOException e2) {
157
            // TODO Auto-generated catch block
158
            System.out.println("No he podido leer la imagen desde el fichero");
159

  
160
            return null;
161
        }
162
    }
163
    
164
    private String getGeonetworkImageUrl(String imageUrl,String port){
165
        return "http://" + getServerURL().getHost() + ":" + port + "/geonetwork/srv/es/resources.getgraphover?" +
166
    	"id=" + getFileID() + "&" +
167
    	"fname=" + imageUrl;
168
    }
169
    
170
    private BufferedImage getImage(String sUrl){
171
        try {
172
            URL Url = new URL(sUrl);
173
        
174
            return ImageIO.read(Url);
175
        } catch (MalformedURLException e) {
176
            // TODO Auto-generated catch block
177
            System.out.println("La URL de la imagen no es correcta: " + sUrl);
178
        } catch (IOException e1) {
179
            // TODO Auto-generated catch block
180
            System.out.println("No he podido leer la imagen desde la URL: " + sUrl);
181
        }
182
        return null;
183
    }
184
}
0 185

  
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/parsers/srw/SrwCapabilitiesParser.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.catalogClient.parsers.srw;
42

  
43
import java.util.StringTokenizer;
44

  
45
import es.gva.cit.catalogClient.drivers.SRWCatalogServiceDriver;
46
import es.gva.cit.catalogClient.metadataXML.XMLNode;
47
import es.gva.cit.catalogClient.metadataXML.XMLTree;
48

  
49
/**
50
 * This class is used to parse the SRW capabilities
51
 * @author Jorge Piera Llodra (piera_jor@gva.es)
52
 */
53
public class SrwCapabilitiesParser {
54
    private SRWCatalogServiceDriver driver;
55
    public SrwCapabilitiesParser(SRWCatalogServiceDriver driver){
56
        this.driver = driver;
57
    }
58
    
59
    public boolean parse(XMLNode node) {
60
        if ((node == null) || (node.getName() == null)){
61
            driver.setServerAnswerReady("El servidor no soporta el protocolo " +
62
                    "especificado");
63
            return false;
64
        }
65
        
66
       
67
            String prefix = new StringTokenizer(node.getName(), ":").nextToken();
68
            prefix = prefix + ":";
69
            driver.setOutputSchema(XMLTree.searchNodeValue(node,
70
                    prefix + "record->" + prefix + "recordSchema"));
71
            driver.setOutputFormat(XMLTree.searchNodeValue(node,
72
                    prefix + "record->" + prefix + "recordPacking"));
73
            driver.setStartPosition("1");
74
            driver.setMaxRecords("10");
75
            driver.setRecordXPath("");
76
            driver.setResultSetTTL("0");
77
            driver.setServerAnswerReady("Titulo: " +
78
                XMLTree.searchNodeValue(node,
79
                    prefix + "record->" + prefix +
80
                    "recordData->explain->databaseInfo->title") +
81
                "\nDescripcion: " +
82
                XMLTree.searchNodeValue(node,
83
                    prefix + "record->" + prefix +
84
                    "recordData->explain->databaseInfo->description"));
85
            return true;
86
        
87
    }
88
}
0 89

  
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/parsers/srw/SrwRecordsParser.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.catalogClient.parsers.srw;
42

  
43
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44
import es.gva.cit.catalogClient.metadataXML.XMLTree;
45
import es.gva.cit.catalogClient.parsers.AbstractTags;
46
import es.gva.cit.catalogClient.parsers.Resource;
47

  
48

  
49

  
50
/**
51
 * @author Jorge Piera Llodra (piera_jor@gva.es)
52
 */
53
public class SrwRecordsParser extends AbstractTags {
54
    public SrwRecordsParser(XMLNode node) {
55
        setNode(node);
56
        setTitle(XMLTree.searchNodeValue(node,
57
                "recordData->MD_Metadata->identificationInfo->MD_DataIdentification->citation->CI_Citation->title"));
58
        setAbstract_(XMLTree.searchNodeValue(node,
59
                "recordData->MD_Metadata->identificationInfo->MD_DataIdentification->abstract"));
60
        setPurpose(XMLTree.searchNodeValue(node,
61
                "recordData->MD_Metadata->identificationInfo->MD_DataIdentification->purpose"));
62
        setKeyWords(XMLTree.searchMultipleNodeValue(node,
63
                "recordData->MD_Metadata->identificationInfo->MD_DataIdentification->descriptiveKeywords->MD_Keywords->keyword"));
64

  
65
        //this.setResources(getResources(node,""));
66
    }
67

  
68
    public Resource[] getResources(XMLNode node, String label) {
69
        XMLNode[] nodes = XMLTree.searchMultipleNode(node, label);
70

  
71
        if (nodes == null) {
72
            return null;
73
        }
74

  
75
        Resource[] resources = new Resource[nodes.length];
76

  
77
        for (int i = 0; i < resources.length; i++)
78
            resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i], ""),
79
                    XMLTree.searchNodeValue(nodes[i], ""),
80
                    XMLTree.searchNodeValue(nodes[i], ""),
81
                    XMLTree.searchNodeValue(nodes[i], ""),
82
                    XMLTree.searchNodeAtribute(nodes[i], "", ""),
83
					XMLTree.searchNodeValue(nodes[i],""),
84
					null);
85

  
86
        return resources;
87
    }
88
}
0 89

  
trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/parsers/csw/ProtocolsOperations.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.catalogClient.parsers.csw;
42

  
43
/**
44
 * This class is use like a structure. It saves what protocol is
45
 * supported by each CSW 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 ProtocolsOperations {
51
	private String[] getCapabilities = null;
52
	private String[] describeRecords = null;
53
	private String[] getDomain = null;
54
	private String[] getRecords = null;
55
	private String[] getRecordsById = null;
56
	private String[] Transaction = null;
57
	private String[] Harvest = null;
58
	
59
	/**
60
	 * @return Returns the describeRecords.
61
	 */
62
	public String[] getDescribeRecords() {
63
		return describeRecords;
64
	}
65
	/**
66
	 * @param describeRecords The describeRecords to set.
67
	 */
68
	public void setDescribeRecords(String[] describeRecords) {
69
		this.describeRecords = describeRecords;
70
	}
71
	/**
72
	 * @return Returns the getCapabilities.
73
	 */
74
	public String[] getGetCapabilities() {
75
		return getCapabilities;
76
	}
77
	/**
78
	 * @param getCapabilities The getCapabilities to set.
79
	 */
80
	public void setGetCapabilities(String[] getCapabilities) {
81
		this.getCapabilities = getCapabilities;
82
	}
83
	/**
84
	 * @return Returns the getDomain.
85
	 */
86
	public String[] getGetDomain() {
87
		return getDomain;
88
	}
89
	/**
90
	 * @param getDomain The getDomain to set.
91
	 */
92
	public void setGetDomain(String[] getDomain) {
93
		this.getDomain = getDomain;
94
	}
95
	/**
96
	 * @return Returns the getRecords.
97
	 */
98
	public String[] getGetRecords() {
99
		return getRecords;
100
	}
101
	/**
102
	 * @param getRecords The getRecords to set.
103
	 */
104
	public void setGetRecords(String[] getRecords) {
105
		this.getRecords = getRecords;
106
	}
107
	/**
108
	 * @return Returns the getRecordsById.
109
	 */
110
	public String[] getGetRecordsById() {
111
		return getRecordsById;
112
	}
113
	/**
114
	 * @param getRecordsById The getRecordsById to set.
115
	 */
116
	public void setGetRecordsById(String[] getRecordsById) {
117
		this.getRecordsById = getRecordsById;
118
	}
119
	/**
120
	 * @return Returns the harvest.
121
	 */
122
	public String[] getHarvest() {
123
		return Harvest;
124
	}
125
	/**
126
	 * @param harvest The harvest to set.
127
	 */
128
	public void setHarvest(String[] harvest) {
129
		Harvest = harvest;
130
	}
131
	/**
132
	 * @return Returns the transaction.
133
	 */
134
	public String[] getTransaction() {
135
		return Transaction;
136
	}
137
	/**
138
	 * @param transaction The transaction to set.
139
	 */
140
	public void setTransaction(String[] transaction) {
141
		Transaction = transaction;
142
	}
143
}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff