svn-gvsig-desktop / tags / v1_0_1_RELEASE / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / schemas / discoverer / DiscovererFormat.java @ 9531
History | View | Annotate | Download (3.88 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.discoverer; |
43 |
import es.gva.cit.catalogClient.metadataXML.XMLNode; |
44 |
import es.gva.cit.catalogClient.schemas.discoverer.Record; |
45 |
import es.gva.cit.catalogClient.schemas.parsers.DeegreeISO19115Parser; |
46 |
import es.gva.cit.catalogClient.schemas.parsers.DublinCoreParser; |
47 |
import es.gva.cit.catalogClient.schemas.parsers.GeonetworkISO19115Parser; |
48 |
import es.gva.cit.catalogClient.schemas.parsers.IdecISO19115Parser; |
49 |
import es.gva.cit.catalogClient.schemas.parsers.IdeeISO19115Parser; |
50 |
import es.gva.cit.catalogClient.schemas.parsers.Iso19139Parser; |
51 |
import es.gva.cit.catalogClient.schemas.parsers.LaitsGmuParser; |
52 |
import es.gva.cit.catalogClient.schemas.parsers.LaitsGmuServicesParser; |
53 |
|
54 |
import com.iver.utiles.swing.jcomboServer.ServerData; |
55 |
import java.net.URL; |
56 |
|
57 |
/**
|
58 |
* This class is used to discover the format of the retrieved records.
|
59 |
*
|
60 |
*
|
61 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
62 |
*/
|
63 |
public class DiscovererFormat { |
64 |
|
65 |
/**
|
66 |
*
|
67 |
*
|
68 |
*/
|
69 |
private String protocol; |
70 |
|
71 |
/**
|
72 |
*
|
73 |
*
|
74 |
*/
|
75 |
private URL url; |
76 |
|
77 |
/**
|
78 |
* Constructor
|
79 |
*
|
80 |
*
|
81 |
* @param protocol Catalog protocol
|
82 |
* @param url Server url
|
83 |
*/
|
84 |
public DiscovererFormat(String protocol, URL url) { |
85 |
this.protocol = protocol;
|
86 |
this.url = url;
|
87 |
} |
88 |
|
89 |
/**
|
90 |
* This method discovers the record format and parses it.
|
91 |
*
|
92 |
*
|
93 |
* @return
|
94 |
* @param node XMLNode
|
95 |
*/
|
96 |
public Record DiscoverAndParse(XMLNode node) {
|
97 |
if (node == null){ |
98 |
return new DublinCoreParser(node); |
99 |
} |
100 |
if ((node.getName().equals("dc:metadata")) || |
101 |
(node.getName().equals("simpledc")) ||
|
102 |
(node.getName().equals("csw:SummaryRecord")) ||
|
103 |
(node.getName().equals("csw:Record"))){
|
104 |
return new DublinCoreParser(node); |
105 |
} |
106 |
|
107 |
if (node.getName().equals("laitscsw:DataGranule")){ |
108 |
return new LaitsGmuParser(node,url); |
109 |
} |
110 |
|
111 |
if (node.getName().equals("rim:Service")){ |
112 |
return new LaitsGmuServicesParser(node,url); |
113 |
} |
114 |
|
115 |
if (node.getName().equals("iso19115:MD_Metadata")){ |
116 |
return new DeegreeISO19115Parser(node); |
117 |
} |
118 |
|
119 |
if (protocol.equals(ServerData.SERVER_SUBTYPE_CATALOG_Z3950)) {
|
120 |
return new GeonetworkISO19115Parser(node,url); |
121 |
} else if (protocol.equals(ServerData.SERVER_SUBTYPE_CATALOG_SRW)) { |
122 |
return new IdeeISO19115Parser(node); |
123 |
} else {
|
124 |
if (node.getName().equals("dc:metadata")){ |
125 |
return new DublinCoreParser(node); |
126 |
}else if (node.getName().equals("DS_DataSet")){ |
127 |
return new Iso19139Parser(node,url); |
128 |
}else{
|
129 |
return new IdecISO19115Parser(node); |
130 |
} |
131 |
} |
132 |
|
133 |
} |
134 |
} |