svn-gvsig-desktop / tags / v1_0_2_RELEASE / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / schemas / discoverer / DiscovererFormat.java @ 11432
History | View | Annotate | Download (3.88 KB)
1 | 3566 | jorpiell | |
---|---|---|---|
2 | 3593 | jorpiell | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
3 | 3509 | jorpiell | *
|
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 | 3593 | jorpiell | * Av. Blasco Ib??ez, 50
|
25 | 3509 | jorpiell | * 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 | 3613 | jorpiell | import es.gva.cit.catalogClient.schemas.discoverer.Record; |
45 | 3509 | jorpiell | 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 | 6112 | jorpiell | import es.gva.cit.catalogClient.schemas.parsers.Iso19139Parser; |
51 | 8604 | jorpiell | import es.gva.cit.catalogClient.schemas.parsers.LaitsGmuParser; |
52 | import es.gva.cit.catalogClient.schemas.parsers.LaitsGmuServicesParser; |
||
53 | 6112 | jorpiell | |
54 | 4302 | jorpiell | import com.iver.utiles.swing.jcomboServer.ServerData; |
55 | 3613 | jorpiell | import java.net.URL; |
56 | 3509 | jorpiell | |
57 | /**
|
||
58 | * This class is used to discover the format of the retrieved records.
|
||
59 | 3566 | jorpiell | *
|
60 | *
|
||
61 | 3509 | jorpiell | * @author Jorge Piera Llodra (piera_jor@gva.es)
|
62 | */
|
||
63 | public class DiscovererFormat { |
||
64 | 3566 | jorpiell | |
65 | /**
|
||
66 | *
|
||
67 | *
|
||
68 | */
|
||
69 | 3509 | jorpiell | private String protocol; |
70 | 3566 | jorpiell | |
71 | /**
|
||
72 | *
|
||
73 | *
|
||
74 | */
|
||
75 | 3509 | jorpiell | private URL url; |
76 | 3566 | jorpiell | |
77 | /**
|
||
78 | * Constructor
|
||
79 | *
|
||
80 | *
|
||
81 | * @param protocol Catalog protocol
|
||
82 | * @param url Server url
|
||
83 | */
|
||
84 | public DiscovererFormat(String protocol, URL url) { |
||
85 | 3509 | jorpiell | this.protocol = protocol;
|
86 | this.url = url;
|
||
87 | 3566 | jorpiell | } |
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 | 3751 | jorpiell | if (node == null){ |
98 | return new DublinCoreParser(node); |
||
99 | } |
||
100 | if ((node.getName().equals("dc:metadata")) || |
||
101 | 6079 | jorpiell | (node.getName().equals("simpledc")) ||
|
102 | 6112 | jorpiell | (node.getName().equals("csw:SummaryRecord")) ||
|
103 | (node.getName().equals("csw:Record"))){
|
||
104 | 3509 | jorpiell | return new DublinCoreParser(node); |
105 | } |
||
106 | 8604 | jorpiell | |
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 | 3509 | jorpiell | |
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 | 6112 | jorpiell | }else if (node.getName().equals("DS_DataSet")){ |
127 | return new Iso19139Parser(node,url); |
||
128 | 3509 | jorpiell | }else{
|
129 | return new IdecISO19115Parser(node); |
||
130 | } |
||
131 | } |
||
132 | |||
133 | 3566 | jorpiell | } |
134 | } |