gvsig-catalog / trunk / appCatalog / src / org / gvsig / catalog / schemas / IdecISO19115Record.java @ 6
History | View | Annotate | Download (3.44 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 org.gvsig.catalog.schemas; |
43 |
import java.net.URI; |
44 |
|
45 |
import org.gvsig.catalog.metadataxml.XMLNode; |
46 |
import org.gvsig.catalog.metadataxml.XMLTree; |
47 |
|
48 |
|
49 |
/**
|
50 |
* This class parses the Indicio CSW server answer files.
|
51 |
*
|
52 |
*
|
53 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
54 |
*/
|
55 |
public class IdecISO19115Record extends Record { |
56 |
|
57 |
public IdecISO19115Record() {
|
58 |
|
59 |
} |
60 |
|
61 |
/**
|
62 |
* @param node
|
63 |
*/
|
64 |
public IdecISO19115Record(URI uri,XMLNode node) { |
65 |
super(uri,node);
|
66 |
setTitle(XMLTree.searchNodeValue(node, |
67 |
"identificationInfo->MD_DataIdentification->citation->title"));
|
68 |
setAbstract_(XMLTree.searchNodeValue(node, |
69 |
"identificationInfo->MD_DataIdentification->abstract"));
|
70 |
setPurpose(XMLTree.searchNodeValue(node, |
71 |
"identificationInfo->MD_DataIdentification->purpose"));
|
72 |
setKeyWords(XMLTree.searchMultipleNodeValue(node, |
73 |
"identificationInfo->MD_DataIdentification->descriptiveKeywords->keyword"));
|
74 |
setResources(getResources("distributionInfo->distributor->distributorTransferOptions->onLine"));
|
75 |
//setImage(getImageUrl("identificationInfo->MD_DataIdentification->graphicOverview->fileName"));
|
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 |
|
95 |
String sProtocol = XMLTree.searchNodeValue(nodes[i], "protocol"); |
96 |
String sName = XMLTree.searchNodeValue(nodes[i], "orName"); |
97 |
|
98 |
if (sProtocol == null){ |
99 |
sProtocol = Resource.WEBSITE; |
100 |
sName = "orName";
|
101 |
} |
102 |
|
103 |
resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
|
104 |
"linkage"),
|
105 |
sProtocol, |
106 |
sName, |
107 |
"orDesc",
|
108 |
"",
|
109 |
"",
|
110 |
null);
|
111 |
} |
112 |
return resources;
|
113 |
} |
114 |
|
115 |
/*
|
116 |
* (non-Javadoc)
|
117 |
* @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode)
|
118 |
*/
|
119 |
public boolean accept(URI uri, XMLNode node) { |
120 |
if (node.getName().endsWith("MD_Metadata")){ |
121 |
if (node.searchNode("identificationInfo->MD_DataIdentification->citation->title")!=null){ |
122 |
return true; |
123 |
} |
124 |
} |
125 |
return false; |
126 |
} |
127 |
} |