Statistics
| Revision:

svn-gvsig-desktop / tags / v10_RC2c / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / schemas / parsers / LaitsGmuServicesParser.java @ 8745

History | View | Annotate | Download (4.73 KB)

1
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: LaitsGmuServicesParser.java 8745 2006-11-14 13:14:23Z  $
54
 * $Log$
55
 * Revision 1.1.2.1  2006-11-08 12:57:12  jorpiell
56
 * Se han hecho numerosos cambios para que pueda funcionar el nomenclator de Simon y el cat?logo de GMU
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
62
 */
63
public class LaitsGmuServicesParser extends Record {
64

    
65
        /**
66
         * Constructor
67
         * 
68
         * 
69
         * @param node Node with the answer
70
         * @param serverURL Server URL. Necessary to load the image (just Geonetwork)
71
         */
72
            public  LaitsGmuServicesParser(XMLNode node, URL serverURL) {        
73
                setNode(node);
74
                setTitle(XMLTree.searchNodeValue(node,"name"));
75
                setAbstract_(XMLTree.searchNodeValue(node, "description"));                  
76
                setPurpose(null);
77
                setKeyWords(null);
78
                setResources(getResources(node));
79
                setFileID(null);
80
                setServerURL(serverURL);
81
                //Caution: getImageUrl uses serverURL and FileID!!!
82
                setImage(null);
83
                
84
            } 
85

    
86
        /**
87
         * 
88
         * 
89
         * 
90
         * @return 
91
         * @param label 
92
         */
93
            private Resource[] getResources(XMLNode node) {        
94
                     XMLNode[] slots = XMLTree.searchMultipleNode(node, "rim:Slot");
95
                     if (slots != null){
96
                             Resource[] resources = new Resource[slots.length];
97
                             for (int i=0 ; i<slots.length ; i++){
98
                                     XMLNode slot = slots[i];
99
                                     String resource = null;
100
                                     String serviceType = null;
101
                                     String attType = slot.getAttribute("name");
102
                                     if (attType.equals("connectPointLinkage")){
103
                                             resource = XMLTree.searchNodeValue(slot,"rim:ValueList->rim:Value");
104
                                             setAbstract_(getAbstract_() + "<p>" + resource);
105
                                     }else if(attType.equals("serviceType")){
106
                                             serviceType = XMLTree.searchNodeValue(slot,"rim:ValueList->rim:Value");
107
                                     }
108
                                     resources[i] = new Resource(resource,getProtocol(serviceType),null,null,null,null,null);
109
                             }
110
                             return new Resource[0];
111
                     }else{
112
                             return new Resource[0];
113
                     }
114
              
115
//                for (int i = 0; i < resources.length; i++){
116
//                            resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
117
//                                "URL"),
118
//                            Resource.DOWNLOAD,
119
//                            XMLTree.searchNodeValue(nodes[i], "orName"),
120
//                            XMLTree.searchNodeValue(nodes[i], "URLDescription"),
121
//                            XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
122
//                                "value"),
123
//                                                srs,        
124
//                                    coordinates);
125
//                            if (resources[i].getLinkage() == null){
126
//                                    resources[i].setLinkage("");
127
//                            }
128
//                            
129
//                }
130
//                
131
//                
132
//                return resources;            
133
            }
134

    
135
        private String getProtocol(String serviceType) {
136
                if (serviceType == null){
137
                        return Resource.UNKNOWN;
138
                }
139
                if (serviceType.compareTo("WMS")==0){
140
                        return Resource.WMS;
141
                }else if (serviceType.compareTo("WCS")==0){
142
                        return Resource.WCS;
143
                }else if (serviceType.compareTo("WFS")==0){
144
                        return Resource.WFS;
145
                }else if (serviceType.compareTo("WMS")==0){
146
                        return Resource.WMS;
147
                }else if (serviceType.compareTo("WMS")==0){
148
                        return Resource.WMS;
149
                }else if (serviceType.compareTo("WMS")==0){
150
                        return Resource.WMS;
151
                }
152
                return Resource.UNKNOWN;
153
        } 
154
}
155