root / tags / v1_0_2_Build_916 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / schemas / parsers / LaitsGmuServicesParser.java @ 12327
History | View | Annotate | Download (4.73 KB)
1 | 8604 | jorpiell | package es.gva.cit.catalogClient.schemas.parsers; |
---|---|---|---|
2 | |||
3 | import java.net.URL; |
||
4 | |||
5 | import es.gva.cit.catalogClient.metadataXML.XMLNode; |
||
6 | import es.gva.cit.catalogClient.metadataXML.XMLTree; |
||
7 | import es.gva.cit.catalogClient.querys.Coordinates; |
||
8 | import es.gva.cit.catalogClient.schemas.discoverer.Record; |
||
9 | import es.gva.cit.catalogClient.schemas.discoverer.Resource; |
||
10 | |||
11 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
12 | *
|
||
13 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
14 | *
|
||
15 | * This program is free software; you can redistribute it and/or
|
||
16 | * modify it under the terms of the GNU General Public License
|
||
17 | * as published by the Free Software Foundation; either version 2
|
||
18 | * of the License, or (at your option) any later version.
|
||
19 | *
|
||
20 | * This program is distributed in the hope that it will be useful,
|
||
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
23 | * GNU General Public License for more details.
|
||
24 | *
|
||
25 | * You should have received a copy of the GNU General Public License
|
||
26 | * along with this program; if not, write to the Free Software
|
||
27 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
28 | *
|
||
29 | * For more information, contact:
|
||
30 | *
|
||
31 | * Generalitat Valenciana
|
||
32 | * Conselleria d'Infraestructures i Transport
|
||
33 | * Av. Blasco Ib??ez, 50
|
||
34 | * 46010 VALENCIA
|
||
35 | * SPAIN
|
||
36 | *
|
||
37 | * +34 963862235
|
||
38 | * gvsig@gva.es
|
||
39 | * www.gvsig.gva.es
|
||
40 | *
|
||
41 | * or
|
||
42 | *
|
||
43 | * IVER T.I. S.A
|
||
44 | * Salamanca 50
|
||
45 | * 46005 Valencia
|
||
46 | * Spain
|
||
47 | *
|
||
48 | * +34 963163400
|
||
49 | * dac@iver.es
|
||
50 | */
|
||
51 | /* CVS MESSAGES:
|
||
52 | *
|
||
53 | * $Id$
|
||
54 | * $Log$
|
||
55 | 8765 | jjdelcerro | * Revision 1.1.2.2 2006-11-15 00:08:08 jjdelcerro
|
56 | * *** empty log message ***
|
||
57 | *
|
||
58 | * Revision 1.2 2006/11/13 10:01:01 jorpiell
|
||
59 | * Nuevos parsers para el servidor de GMU
|
||
60 | *
|
||
61 | * Revision 1.1.2.1 2006/11/08 12:57:12 jorpiell
|
||
62 | 8604 | jorpiell | * Se han hecho numerosos cambios para que pueda funcionar el nomenclator de Simon y el cat?logo de GMU
|
63 | *
|
||
64 | *
|
||
65 | */
|
||
66 | /**
|
||
67 | * @author Jorge Piera Llodr? (piera_jor@gva.es)
|
||
68 | */
|
||
69 | public class LaitsGmuServicesParser extends Record { |
||
70 | |||
71 | /**
|
||
72 | * Constructor
|
||
73 | *
|
||
74 | *
|
||
75 | * @param node Node with the answer
|
||
76 | * @param serverURL Server URL. Necessary to load the image (just Geonetwork)
|
||
77 | */
|
||
78 | public LaitsGmuServicesParser(XMLNode node, URL serverURL) { |
||
79 | setNode(node); |
||
80 | setTitle(XMLTree.searchNodeValue(node,"name"));
|
||
81 | setAbstract_(XMLTree.searchNodeValue(node, "description"));
|
||
82 | setPurpose(null);
|
||
83 | setKeyWords(null);
|
||
84 | setResources(getResources(node)); |
||
85 | setFileID(null);
|
||
86 | setServerURL(serverURL); |
||
87 | //Caution: getImageUrl uses serverURL and FileID!!!
|
||
88 | setImage(null);
|
||
89 | |||
90 | } |
||
91 | |||
92 | /**
|
||
93 | *
|
||
94 | *
|
||
95 | *
|
||
96 | * @return
|
||
97 | * @param label
|
||
98 | */
|
||
99 | private Resource[] getResources(XMLNode node) { |
||
100 | XMLNode[] slots = XMLTree.searchMultipleNode(node, "rim:Slot"); |
||
101 | if (slots != null){ |
||
102 | 8765 | jjdelcerro | Resource[] resources = new Resource[1]; |
103 | String resource = null; |
||
104 | String serviceType = null; |
||
105 | 8604 | jorpiell | for (int i=0 ; i<slots.length ; i++){ |
106 | XMLNode slot = slots[i]; |
||
107 | String attType = slot.getAttribute("name"); |
||
108 | if (attType.equals("connectPointLinkage")){ |
||
109 | resource = XMLTree.searchNodeValue(slot,"rim:ValueList->rim:Value");
|
||
110 | }else if(attType.equals("serviceType")){ |
||
111 | serviceType = XMLTree.searchNodeValue(slot,"rim:ValueList->rim:Value");
|
||
112 | } |
||
113 | } |
||
114 | 8765 | jjdelcerro | resources[0] = new Resource(resource,getProtocol(serviceType),null,null,null,null,null); |
115 | return resources;
|
||
116 | 8604 | jorpiell | }else{
|
117 | return new Resource[0]; |
||
118 | } |
||
119 | |||
120 | // for (int i = 0; i < resources.length; i++){
|
||
121 | // resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
|
||
122 | // "URL"),
|
||
123 | // Resource.DOWNLOAD,
|
||
124 | // XMLTree.searchNodeValue(nodes[i], "orName"),
|
||
125 | // XMLTree.searchNodeValue(nodes[i], "URLDescription"),
|
||
126 | // XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
|
||
127 | // "value"),
|
||
128 | // srs,
|
||
129 | // coordinates);
|
||
130 | // if (resources[i].getLinkage() == null){
|
||
131 | // resources[i].setLinkage("");
|
||
132 | // }
|
||
133 | //
|
||
134 | // }
|
||
135 | //
|
||
136 | //
|
||
137 | // return resources;
|
||
138 | } |
||
139 | |||
140 | private String getProtocol(String serviceType) { |
||
141 | if (serviceType == null){ |
||
142 | return Resource.UNKNOWN;
|
||
143 | } |
||
144 | if (serviceType.compareTo("WMS")==0){ |
||
145 | return Resource.WMS;
|
||
146 | }else if (serviceType.compareTo("WCS")==0){ |
||
147 | return Resource.WCS;
|
||
148 | }else if (serviceType.compareTo("WFS")==0){ |
||
149 | return Resource.WFS;
|
||
150 | 8765 | jjdelcerro | }else if (serviceType.compareTo("urn:uuid:677F6003-E6E0-4B5C-B930-09B36EF6E0FB")==0){ |
151 | 8604 | jorpiell | return Resource.WMS;
|
152 | } |
||
153 | return Resource.UNKNOWN;
|
||
154 | } |
||
155 | } |