Statistics
| Revision:

svn-gvsig-desktop / tags / gvSIGv0_6_1RELEASE / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / schemas / discoverer / DiscovererFormat.java @ 5222

History | View | Annotate | Download (3.22 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 com.iver.utiles.swing.jcomboServer.ServerData;
51
import java.net.URL;
52

    
53
/**
54
 * This class is used to discover the format of the retrieved records.
55
 * 
56
 * 
57
 * @author Jorge Piera Llodra (piera_jor@gva.es)
58
 */
59
public class DiscovererFormat {
60

    
61
/**
62
 * 
63
 * 
64
 */
65
    private String protocol;
66

    
67
/**
68
 * 
69
 * 
70
 */
71
    private URL url;
72

    
73
/**
74
 * Constructor
75
 * 
76
 * 
77
 * @param protocol Catalog protocol
78
 * @param url Server url
79
 */
80
    public  DiscovererFormat(String protocol, URL url) {        
81
        this.protocol = protocol;
82
        this.url = url;
83
    } 
84

    
85
/**
86
 * This method discovers the record format and parses it.
87
 * 
88
 * 
89
 * @return 
90
 * @param node XMLNode
91
 */
92
    public Record DiscoverAndParse(XMLNode node) {        
93
       if (node == null){
94
               return new DublinCoreParser(node);
95
       }
96
            if ((node.getName().equals("dc:metadata")) ||
97
                (node.getName().equals("simpledc"))){
98
            return new DublinCoreParser(node);
99
        }
100
        
101
        if (node.getName().equals("iso19115:MD_Metadata")){
102
            return new DeegreeISO19115Parser(node);
103
        }        
104
        
105
        if (protocol.equals(ServerData.SERVER_SUBTYPE_CATALOG_Z3950)) {
106
             return new GeonetworkISO19115Parser(node,url);
107
        } else if (protocol.equals(ServerData.SERVER_SUBTYPE_CATALOG_SRW)) {
108
            return new IdeeISO19115Parser(node);
109
        } else {
110
            if (node.getName().equals("dc:metadata")){
111
                return new DublinCoreParser(node);
112
            }else{
113
                return new IdecISO19115Parser(node);
114
            }
115
        }
116
        
117
    } 
118
 }