Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / schemas / parsers / DeegreeISO19115Parser.java @ 3566

History | View | Annotate | Download (3.87 KB)

1

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

    
48
/**
49
 * This class is used to parse the metadata retreived using
50
 * the CSW deegree server.
51
 * 
52
 * 
53
 * @author Jorge Piera Llodra (piera_jor@gva.es)
54
 */
55
public class DeegreeISO19115Parser extends Record {
56

    
57
/**
58
 * 
59
 * 
60
 * 
61
 * @param node 
62
 */
63
    public  DeegreeISO19115Parser(XMLNode node) {        
64
        setNode(node);
65
        
66
        setTitle(XMLTree.searchNodeValue(node,
67
                "iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:citation->smXML:CI_Citation->smXML:title->smXML:CharacterString"));
68
        setAbstract_(XMLTree.searchNodeValue(node,
69
                "iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:abstract->smXML:CharacterString"));
70
        setPurpose(XMLTree.searchNodeValue(node,
71
                "iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:purpose->smXML:CharacterString"));
72
        setKeyWords(XMLTree.searchMultipleNodeValue(node,
73
                "iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:descriptiveKeywords->smXML:MD_Keywords->smXML:keyword->smXML:CharacterString"));
74
        setResources(getResources("iso19115:distributionInfo->smXML:MD_Distribution->smXML:distributor->smXML:MD_Distributor->smXML:distributorContact->smXML:CI_ResponsibleParty->smXML:contactInfo->smXML:CI_Contact->smXML:onlineResource->smXML:CI_OnlineResource"));
75
        setImage(getImageUrl("iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:graphicOverview->smXML:MD_BrowseGraphic->smXML:fileName->smXML:CharacterString"));
76
    } 
77

    
78
/**
79
 * It parses the online resources
80
 * 
81
 * 
82
 * @return Resource
83
 * @param label Label that contains the resource root
84
 */
85
    private Resource[] getResources(String label) {        
86
        XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
87
                     
88
        if (nodes == null) {
89
            return null;
90
        }
91
        Resource[] resources = new Resource[nodes.length];
92
               
93
        for (int i = 0; i < resources.length; i++)
94
            resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],"smXML:linkage->smXML:URL"),
95
                    XMLTree.searchNodeValue(nodes[i],"smXML:protocol->smXML:CharacterString"),
96
                    XMLTree.searchNodeValue(nodes[i],"smXML:name->smXML:CharacterString"),
97
                    XMLTree.searchNodeValue(nodes[i],"smXML:description->smXML:CharacterString"),
98
                    "",
99
                           "",        
100
                            null);
101
        return resources;
102
    } 
103
 }