gvsig-catalog / trunk / appCatalog / src / org / gvsig / catalog / schemas / GeonetworkISO19115Record.java @ 6
History | View | Annotate | Download (4.06 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 |
|
44 |
import java.net.URI; |
45 |
|
46 |
import org.gvsig.catalog.metadataxml.XMLNode; |
47 |
import org.gvsig.catalog.metadataxml.XMLTree; |
48 |
import org.gvsig.catalog.querys.Coordinates; |
49 |
|
50 |
|
51 |
/**
|
52 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
53 |
*/
|
54 |
public class GeonetworkISO19115Record extends Record { |
55 |
|
56 |
public GeonetworkISO19115Record() {
|
57 |
|
58 |
} |
59 |
|
60 |
/**
|
61 |
* Constructor
|
62 |
* @param node Node with the answer
|
63 |
* @param serverURL Server URL. Necessary to load the image (just Geonetwork)
|
64 |
*/
|
65 |
public GeonetworkISO19115Record(URI uri,XMLNode node) { |
66 |
super(uri,node);
|
67 |
setTitle(XMLTree.searchNodeValue(node, |
68 |
"dataIdInfo->idCitation->resTitle"));
|
69 |
setAbstract_(XMLTree.searchNodeValue(node, "dataIdInfo->idAbs"));
|
70 |
setPurpose(XMLTree.searchNodeValue(node, "dataIdInfo->idPurp"));
|
71 |
setKeyWords(XMLTree.searchMultipleNodeValue(node, |
72 |
"dataIdInfo->descKeys->keyword"));
|
73 |
setResources(getResources("distInfo->distTranOps->onLineSrc"));
|
74 |
setFileID(XMLTree.searchNodeValue(node,"mdFileID"));
|
75 |
//Caution: getImageUrl uses serverURL and FileID!!!
|
76 |
XMLNode[] nodes = XMLTree.searchMultipleNode(node,"dataIdInfo->graphOver"); |
77 |
if ((nodes != null) && (nodes.length > 0)){ |
78 |
String imageURL = XMLTree.searchNodeValue(nodes[0], "bgFileName"); |
79 |
if (imageURL != null){ |
80 |
setImageURL(imageURL); |
81 |
} |
82 |
} |
83 |
} |
84 |
|
85 |
/**
|
86 |
* @return
|
87 |
* @param label
|
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 |
Resource[] resources = new Resource[nodes.length]; |
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 |
for (int i = 0; i < resources.length; i++){ |
107 |
resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
|
108 |
"linkage"),
|
109 |
XMLTree.searchNodeValue(nodes[i], "protocol"),
|
110 |
XMLTree.searchNodeValue(nodes[i], "orName"),
|
111 |
XMLTree.searchNodeValue(nodes[i], "orDesc"),
|
112 |
XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
|
113 |
"value"),
|
114 |
srs, |
115 |
coordinates); |
116 |
if (resources[i].getLinkage() == null){ |
117 |
resources[i].setLinkage("");
|
118 |
} |
119 |
} |
120 |
return resources;
|
121 |
} |
122 |
|
123 |
/*
|
124 |
* (non-Javadoc)
|
125 |
* @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode)
|
126 |
*/
|
127 |
public boolean accept(URI uri, XMLNode node) { |
128 |
if (node.getName().equals("Metadata")){ |
129 |
if (XMLTree.searchNode(node, "mdFileID") != null){ |
130 |
return true; |
131 |
} |
132 |
} |
133 |
return false; |
134 |
} |
135 |
|
136 |
|
137 |
} |