Revision 807

View differences:

org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/exceptions/DiscoveryServiceException.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.catalog.exceptions;
23

  
24
import org.gvsig.tools.exception.BaseException;
25

  
26

  
27
/**
28
 * @author gvSIG Team
29
 * @version $Id$
30
 *
31
 */
32
public class DiscoveryServiceException extends BaseException {
33
    private static final long serialVersionUID = -2033440799086244875L;
34

  
35
    private static final String MESSAGE =
36
        "Error connecting to a catalog service";
37

  
38
    private static final String KEY = "_CatalogException";
39

  
40
    /**
41
     * Constructor to be used in rare cases, usually you must create a new child
42
     * exception class for each case.
43
     * <strong>Don't use this constructor in child classes.</strong>
44
     */
45
    public DiscoveryServiceException() {
46
        super(MESSAGE, KEY, serialVersionUID);
47
    }
48

  
49
    /**
50
     * Constructor to be used in rare cases, usually you must create a new child
51
     * exception class for each case.
52
     * <p>
53
     * <strong>Don't use this constructor in child classes.</strong>
54
     * </p>
55
     * 
56
     * @param cause
57
     *            the original cause of the exception
58
     */
59
    public DiscoveryServiceException(Throwable cause) {
60
        super(MESSAGE, cause, KEY, serialVersionUID);
61
    }
62

  
63
    /**
64
     * @see BaseException#BaseException(String, String, long).
65
     * @param message
66
     *            the default messageFormat to describe the exception
67
     * @param key
68
     *            the key to use to search a localized messageFormnata
69
     * @param code
70
     *            the unique code to identify the exception
71
     */
72
    protected DiscoveryServiceException(String message, String key, long code) {
73
        super(message, key, code);
74
    }
75

  
76
    /**
77
     * @see BaseException#BaseException(String, Throwable, String, long).
78
     * @param message
79
     *            the default messageFormat to describe the exception
80
     * @param cause
81
     *            the original cause of the exception
82
     * @param key
83
     *            the key to use to search a localized messageFormnata
84
     * @param code
85
     *            the unique code to identify the exception
86
     */
87
    protected DiscoveryServiceException(String message, Throwable cause,
88
        String key, long code) {
89
        super(message, cause, key, code);
90
    }
91
}
0 92

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/exceptions/NotSupportedProtocolException.java
1
package org.gvsig.catalog.exceptions;
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
/* CVS MESSAGES:
43
 *
44
 * $Id: NotSupportedProtocolException.java 561 2007-07-27 06:49:30 +0000 (Fri, 27 Jul 2007) jpiera $
45
 * $Log$
46
 * Revision 1.1.2.1  2007/07/10 11:18:04  jorpiell
47
 * Added the registers
48
 *
49
 *
50
 */
51
/**
52
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
53
 */
54
public class NotSupportedProtocolException extends Exception {
55

  
56
	public NotSupportedProtocolException(Throwable cause) {
57
		super(cause);		
58
	}
59
	
60
	/*
61
	 * (non-Javadoc)
62
	 * @see java.lang.Throwable#toString()
63
	 */
64
	public String toString(){
65
		return "errorNotSupportedProtocol";
66
	}
67
}
0 68

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/exceptions/ServerIsNotReadyException.java
1
package org.gvsig.catalog.exceptions;
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
/* CVS MESSAGES:
43
 *
44
 * $Id: ServerIsNotReadyException.java 561 2007-07-27 06:49:30 +0000 (Fri, 27 Jul 2007) jpiera $
45
 * $Log$
46
 * Revision 1.1.2.1  2007/07/10 11:18:04  jorpiell
47
 * Added the registers
48
 *
49
 *
50
 */
51
/**
52
 * This exception indicates that the server is not ready
53
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
54
 */
55
public class ServerIsNotReadyException extends Exception {
56
	private static final long serialVersionUID = 397526568003318327L;
57

  
58
	public ServerIsNotReadyException(Throwable cause) {
59
		super(cause);		
60
	}
61

  
62
	/*
63
	 * (non-Javadoc)
64
	 * @see java.lang.Throwable#toString()
65
	 */
66
	public String toString(){
67
		return "errorServerNotFound";
68
	}
69
}
0 70

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/exceptions/NotSupportedVersionException.java
1
package org.gvsig.catalog.exceptions;
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
/* CVS MESSAGES:
43
 *
44
 * $Id$
45
 * $Log$
46
 *
47
 */
48
/**
49
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
50
 */
51
public class NotSupportedVersionException extends Exception{
52
	
53
	public NotSupportedVersionException(Throwable cause) {
54
		super(cause);		
55
	}
56
	
57
	public NotSupportedVersionException() {
58
		super();		
59
	}
60
	
61
	/*
62
	 * (non-Javadoc)
63
	 * @see java.lang.Throwable#toString()
64
	 */
65
	public String toString(){
66
		return "errorNotSupportedVersion";
67
	}
68
}
0 69

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/Iso19139_119Record.java
1
package org.gvsig.catalog.schemas;
2

  
3
import java.net.URI;
4

  
5
import org.gvsig.catalog.metadataxml.XMLNode;
6
import org.gvsig.catalog.metadataxml.XMLTree;
7
import org.gvsig.catalog.querys.Coordinates;
8
/**
9
 * ISO 19139/119 catalog record
10
 * It creates resources(layers) from MD_Distribution and resources(services) from SV_ServiceIdentification
11
 *
12
 * @author jvhigon
13
 *
14
 */
15
public class Iso19139_119Record extends Record{
16

  
17
	public  Iso19139_119Record() {
18

  
19
	 }
20

  
21
	/**
22
	 * Constructor
23
	 * @param node Node with the answer
24
	 * @param serverURI Server URL. Necessary to load the image (just Geonetwork)
25
	 */
26
	    public  Iso19139_119Record(URI uri, XMLNode node) {
27
	        super(uri,node);
28
	        setTitle(node.searchNodeValue(
29
	                "identificationInfo->SV_ServiceIdentification->citation->CI_Citation->title->CharacterString"));
30
	        setAbstract_(node.searchNodeValue("identificationInfo->SV_ServiceIdentification->abstract->gco:CharacterString"));
31
	        setPurpose(node.searchNodeValue("dataIdInfo->idPurp"));
32
	        setKeyWords(node.searchMultipleNodeValue(
33
	                "identificationInfo->SV_ServiceIdentification->descriptiveKeywords->MD_Keywords->keyword->gco:CharacterString"));
34
	        setResources(getResources("distributionInfo->MD_Distribution->transferOptions->MD_DigitalTransferOptions->onLine->CI_OnlineResource",
35
	        		"identificationInfo->SV_ServiceIdentification"));
36
	        setFileID(node.searchNodeValue("mdFileID"));
37
	        setImageURL(node.searchNodeValue("dataIdInfo->graphOver"));
38

  
39
	    }
40

  
41
	/**
42
	 *
43
	 *
44
	 *
45
	 * @return
46
	 * @param label
47
	 */
48
	    private Resource[] getResources(String label_layers, String label_services) {
49
	    	//compute onlineresources
50
	        XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label_layers);
51
	        Coordinates coordinates = null;
52
	        String srs = null;
53

  
54
	        if (nodes == null) {
55
	            return null;
56
	        }
57
	        //size of resources = all onlineresources + one service
58
	        Resource[] resources = new Resource[nodes.length + 1];
59
	        if (nodes.length > 0){
60
	        	srs = XMLTree.searchNodeValue(getNode(),"refSysInfo->MdCoRefSys->refSysID->identCode");
61
	        	coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->westBL"),
62
	        			XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->northBL"),
63
						XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->eastBL"),
64
						XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->southBL"));
65
	        }
66

  
67

  
68
	        for (int i = 0; i < resources.length -1; i++){
69
    	            String linkage=XMLTree.searchNodeValue(nodes[i], "linkage->URL");
70
    	            String protocol=XMLTree.searchNodeValue(nodes[i], "protocol->gco:CharacterString");
71
    	            String name=XMLTree.searchNodeValue(nodes[i], "name->gco:CharacterString");
72
    	            //String description=XMLTree.searchNodeValue(nodes[i], "orDesc");
73
    	            String description=XMLTree.searchNodeValue(nodes[i], "description->gco:CharacterString");
74
    	            String function=XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd","value");
75

  
76
    	            if (linkage==null){
77
    	                linkage="";
78
    	            }
79
	                if (protocol==null){
80
	                   protocol="";
81
	                }
82
	                if (name==null){
83
	                    name="";
84
	                }
85
	                if (description==null){
86
	                    description="";
87
	                }
88
	                if (function==null){
89
	                    function="";
90
	                }
91

  
92
	                resources[i] = new Resource(linkage,
93
	            	    protocol,
94
	                    name,
95
	                    description,
96
	                    function,
97
						srs,
98
	            		coordinates);
99

  
100
	        }
101
	        //compute service
102
	        XMLNode node = XMLTree.searchNode(getNode(), label_services);
103
	        if (node == null){
104
	        	return null;
105
	        }
106
	        String service_name = XMLTree.searchNodeValue(node, "srv:serviceType->gco:LocalName");
107
	        Object operations = XMLTree.searchMultipleNodeValue(node, "srv:containsOperations->srv:SV_OperationMetadata->srv:operationName->gco:CharacterString");
108
	        XMLNode[] operations_nodes= XMLTree.searchMultipleNode(node, "srv:containsOperations->srv:SV_OperationMetadata");
109
	        String capabilities_url="";
110
	        for (int i = 0; i < operations_nodes.length; i++){
111
		        String operation_name= XMLTree.searchNodeValue(operations_nodes[i], "srv:operationName->gco:CharacterString");
112
		        if (operation_name.toUpperCase().equals("GETCAPABILITIES")){
113
		        	capabilities_url=XMLTree.searchNodeValue(operations_nodes[i], "srv:connectPoint->gmd:CI_OnlineResource->gmd:linkage->gmd:URL");
114
		        	break;
115
		        }
116
	        }
117
	        //service_name = XMLTree.searchNode(node, "serviceType->gco:LocalName").getText();
118
	        int last_index = nodes.length;
119
	        resources[last_index] = new Resource(capabilities_url, Resource.WMS_SERVICE, null,null,null,null,null);
120
	        resources[last_index].setType(Resource.WMS_SERVICE);
121
	        return resources;
122
	    }
123

  
124
	/*
125
	 * (non-Javadoc)
126
	 * @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode)
127
	 */
128
	public boolean accept(URI uri, XMLNode node) {
129
		if (node.getName().endsWith("MD_Metadata")){
130
			if (node.searchNode("identificationInfo->SV_ServiceIdentification->citation->CI_Citation->title")!=null){
131
				return true;
132
			}
133
		}
134
		return false;
135
	}
136

  
137
}
0 138

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/DeegreeISO19115Record.java
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 org.gvsig.catalog.schemas;
43
import java.net.URI;
44

  
45
import org.gvsig.catalog.metadataxml.XMLNode;
46
import org.gvsig.catalog.metadataxml.XMLTree;
47

  
48
/**
49
 * This class is used to parse the metadata retreived using
50
 * the CSW deegree server.
51
 * 
52
 * 
53
 * @author Jorge Piera Llodra (piera_jor@gva.es)
54
 */
55
public class DeegreeISO19115Record extends Record {
56

  
57
	public  DeegreeISO19115Record() {        
58

  
59
	}
60
	
61
	/**
62
	 * @param node 
63
	 */
64
	public  DeegreeISO19115Record(URI uri,XMLNode node) {        
65
		super(uri,node);
66

  
67
		setTitle(XMLTree.searchNodeValue(node,
68
				"iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:citation->smXML:CI_Citation->smXML:title->smXML:CharacterString"));
69
		setAbstract_(XMLTree.searchNodeValue(node,
70
		"iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:abstract->smXML:CharacterString"));
71
		setPurpose(XMLTree.searchNodeValue(node,
72
		"iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:purpose->smXML:CharacterString"));
73
		setKeyWords(XMLTree.searchMultipleNodeValue(node,
74
		"iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:descriptiveKeywords->smXML:MD_Keywords->smXML:keyword->smXML:CharacterString"));
75
		setResources(getResources("iso19115:distributionInfo->smXML:MD_Distribution->smXML:distributor->smXML:MD_Distributor->smXML:distributorContact->smXML:CI_ResponsibleParty->smXML:contactInfo->smXML:CI_Contact->smXML:onlineResource->smXML:CI_OnlineResource"));
76
		setImageURL("iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:graphicOverview->smXML:MD_BrowseGraphic->smXML:fileName->smXML:CharacterString");
77
	} 
78

  
79
	/**
80
	 * It parses the online resources
81
	 * 
82
	 * 
83
	 * @return Resource
84
	 * @param label Label that contains the resource root
85
	 */
86
	private Resource[] getResources(String label) {        
87
		XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
88

  
89
		if (nodes == null) {
90
			return null;
91
		}
92
		Resource[] resources = new Resource[nodes.length];
93

  
94
		for (int i = 0; i < resources.length; i++)
95
			resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],"smXML:linkage->smXML:URL"),
96
					XMLTree.searchNodeValue(nodes[i],"smXML:protocol->smXML:CharacterString"),
97
					XMLTree.searchNodeValue(nodes[i],"smXML:name->smXML:CharacterString"),
98
					XMLTree.searchNodeValue(nodes[i],"smXML:description->smXML:CharacterString"),
99
					"",
100
					"",	
101
					null);
102
		return resources;
103
	}
104

  
105
	/*
106
	 * (non-Javadoc)
107
	 * @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode)
108
	 */
109
	public boolean accept(URI uri, XMLNode node) {
110
		if (node.getName().equals("iso19115:MD_Metadata")){
111
			return true;
112
		}
113
		return false;
114
	} 
115
}
0 116

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/Record.java
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 org.gvsig.catalog.schemas;
43
import java.awt.image.BufferedImage;
44
import java.net.URI;
45
import java.util.Collection;
46

  
47
import org.gvsig.catalog.metadataxml.XMLNode;
48

  
49
/**
50
 * All classes that implement a tag-parser must to implement this
51
 * class. It only has some fields to show in the application form.
52
 * 
53
 * 
54
 * @author Jorge Piera Llodra (piera_jor@gva.es)
55
 */
56
public abstract class Record {
57
	private XMLNode node;
58
	private String title;
59
	private String abstract_;
60
	private String purpose;
61
	private String[] keyWords;
62
	private BufferedImage image;
63
	private String imageURL;
64
	private String fileID;
65
	private URI uri;
66
	private Collection resources = new java.util.ArrayList();
67

  
68
	public Record(URI uri, XMLNode node){
69
		this.uri = uri;
70
		this.node = node;
71
	}
72
	
73
	public Record(){
74
		
75
	}
76
	
77
	/**
78
	 * Return true is the XML node is from a type that can be
79
	 * parsed
80
	 * @param uri
81
	 * Server uri
82
	 * @param node
83
	 * XML node
84
	 * @return
85
	 * true if the file can be managed or false
86
	 */	
87
	public abstract boolean accept(URI uri, XMLNode node);
88
	
89
	/**
90
	 * @return Returns the fileID.
91
	 */
92
	public String getFileID() {        
93
		return fileID;
94
	} 
95
	
96

  
97
	/**
98
	 * @param fileID The fileID to set.
99
	 */
100
	public void setFileID(String fileID) {        
101
		this.fileID = fileID;
102
	} 
103

  
104
	/**
105
	 * @return Returns the image.
106
	 */
107
	public BufferedImage getImage() {        
108
		return image;
109
	} 
110

  
111
	/**
112
	 * @param image The image to set
113
	 */
114
	public void setImage(BufferedImage image){
115
		this.image = image;
116
	}	
117
	
118
	/**
119
	 * @param image The image address to set.
120
	 */
121
	public void setImageURL(String imageURL) {        
122
		this.imageURL = imageURL;
123
	} 
124

  
125
	/**
126
	 * @return Returns the abstract_.
127
	 */
128
	public String getAbstract_() {        
129
		return abstract_;
130
	} 
131

  
132
	/**
133
	 * @param abstract_ The abstract_ to set.
134
	 */
135
	public void setAbstract_(String abstract_) {        
136
		this.abstract_ = abstract_;
137
	} 
138

  
139
	/**
140
	 * @return Returns the keyWords.
141
	 */
142
	public String[] getKeyWords() {        
143
		return keyWords;
144
	} 
145

  
146
	/**
147
	 * @param keyWords The keyWords to set.
148
	 */
149
	public void setKeyWords(String[] keyWords) {        
150
		this.keyWords = keyWords;
151
	} 
152

  
153
	/**
154
	 * @return Returns the purpose.
155
	 */
156
	public String getPurpose() {        
157
		return purpose;
158
	} 
159

  
160
	/**
161
	 * @param purpose The purpose to set.
162
	 */
163
	public void setPurpose(String purpose) {        
164
		this.purpose = purpose;
165
	} 
166

  
167
	/**
168
	 * @return Returns the title.
169
	 */
170
	public String getTitle() {        
171
		return title;
172
	} 
173

  
174
	/**
175
	 * @param title The title to set.
176
	 */
177
	public void setTitle(String title) {        
178
		this.title = title;
179
	} 
180

  
181
	/**
182
	 * @return Returns the node.
183
	 */
184
	public XMLNode getNode() {        
185
		return node;
186
	} 
187

  
188
	/**
189
	 * @param node The node to set.
190
	 */
191
	public void setNode(XMLNode node) {        
192
		this.node = node;
193
	} 
194

  
195
	/**
196
	 * @return Returns the resources.
197
	 */
198
	public Resource[] getResources() {        
199
		Resource[] aux = new Resource[resources.size()];
200
		for (int i=0 ; i<aux.length ; i++){
201
			aux[i] = (Resource)resources.toArray()[i];
202
		}
203
		return aux;
204
	} 
205

  
206
	/**
207
	 * @param resources The resources to set.
208
	 */
209
	public void setResources(Resource[] resources) {        
210
		this.resources = new java.util.ArrayList();
211
		if (resources == null){
212
			return;
213
		}
214
		for (int i=0 ; i<resources.length ; i++){
215
			this.resources.add(resources[i]);
216
		}        
217
	} 
218

  
219
	/**
220
	 * @return Returns the serverURL.
221
	 */
222
	public URI getURI() {        
223
		return uri;
224
	} 
225

  
226
	/**
227
	 * 
228
	 * 
229
	 * 
230
	 * @param serverURI The serverURL to set.
231
	 */
232
	public void setURI(URI uri) {        
233
		this.uri = uri;
234
	}
235

  
236
	public String getImageURL() {
237
		return imageURL;
238
	} 
239
	
240
}
0 241

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/UnknownRecord.java
1
package org.gvsig.catalog.schemas;
2

  
3
import java.net.URI;
4

  
5
import org.gvsig.catalog.metadataxml.XMLNode;
6

  
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 * For more information, contact:
26
 *
27
 *  Generalitat Valenciana
28
 *   Conselleria d'Infraestructures i Transport
29
 *   Av. Blasco Ib??ez, 50
30
 *   46010 VALENCIA
31
 *   SPAIN
32
 *
33
 *      +34 963862235
34
 *   gvsig@gva.es
35
 *      www.gvsig.gva.es
36
 *
37
 *    or
38
 *
39
 *   IVER T.I. S.A
40
 *   Salamanca 50
41
 *   46005 Valencia
42
 *   Spain
43
 *
44
 *   +34 963163400
45
 *   dac@iver.es
46
 */
47
/* CVS MESSAGES:
48
 *
49
 * $Id: UnknownRecord.java 600 2007-09-19 11:30:05 +0000 (Wed, 19 Sep 2007) jpiera $
50
 * $Log$
51
 * Revision 1.1.2.1  2007/07/23 07:14:24  jorpiell
52
 * Catalog refactoring
53
 *
54
 *
55
 */
56
/**
57
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
58
 */
59
public class UnknownRecord extends Record{
60

  
61
	public  UnknownRecord(URI uri, XMLNode node) {        
62
		super(uri,node);
63
		super.setTitle("Unknown record");
64
		super.setAbstract_("It doesn't exist a parser for this record");
65
	}
66
	
67
	/*
68
	 * (non-Javadoc)
69
	 * @see es.gva.cit.catalogClient.schemas.records.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode)
70
	 */
71
	public boolean accept(URI uri, XMLNode node) {
72
		return true;
73
	}
74

  
75
}
0 76

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/GeonetworkISO19115Record.java
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 org.gvsig.catalog.schemas;
43

  
44
import java.net.URI;
45

  
46
import org.gvsig.catalog.metadataxml.XMLNode;
47
import org.gvsig.catalog.metadataxml.XMLTree;
48
import org.gvsig.catalog.querys.Coordinates;
49

  
50
/**
51
 * @author Jorge Piera Llodra (piera_jor@gva.es)
52
 */
53
public class GeonetworkISO19115Record extends Record {
54
	
55
	public GeonetworkISO19115Record() {  
56
		
57
	}
58
	
59
	/**
60
	 * Constructor
61
	 * @param node Node with the answer
62
	 * @param serverURL Server URL. Necessary to load the image (just Geonetwork)
63
	 */
64
	public GeonetworkISO19115Record(URI uri,XMLNode node) {        
65
		super(uri,node);
66
		setTitle(XMLTree.searchNodeValue(node,
67
				"dataIdInfo->idCitation->resTitle"));
68
		setAbstract_(XMLTree.searchNodeValue(node, "dataIdInfo->idAbs"));
69
		setPurpose(XMLTree.searchNodeValue(node, "dataIdInfo->idPurp"));
70
		setKeyWords(XMLTree.searchMultipleNodeValue(node,
71
		"dataIdInfo->descKeys->keyword"));
72
		setResources(getResources("distInfo->distTranOps->onLineSrc"));
73
		setFileID(XMLTree.searchNodeValue(node,"mdFileID"));
74
		//Caution: getImageUrl uses serverURL and FileID!!!
75
		XMLNode[] nodes = XMLTree.searchMultipleNode(node,"dataIdInfo->graphOver");
76
		if ((nodes != null) && (nodes.length > 0)){
77
			String imageURL = XMLTree.searchNodeValue(nodes[0], "bgFileName");
78
			if (imageURL != null){
79
				setImageURL(imageURL);
80
			}
81
		}        
82
	} 
83

  
84
	/**
85
	 * @return 
86
	 * @param label 
87
	 */
88
	private Resource[] getResources(String label) {        
89
		XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
90
		Coordinates coordinates = null;
91
		String srs = null;
92

  
93
		if (nodes == null) {
94
			return null;
95
		}
96
		Resource[] resources = new Resource[nodes.length];
97
		if (nodes.length > 0){
98
			srs = XMLTree.searchNodeValue(getNode(),"refSysInfo->MdCoRefSys->refSysID->identCode");
99
			coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->westBL"),
100
					XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->northBL"),
101
					XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->eastBL"),
102
					XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->southBL"));
103
		}
104

  
105
		for (int i = 0; i < resources.length; i++){
106
			resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
107
					"linkage"),
108
					XMLTree.searchNodeValue(nodes[i], "protocol"),
109
					XMLTree.searchNodeValue(nodes[i], "orName"),
110
					XMLTree.searchNodeValue(nodes[i], "orDesc"),
111
					XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
112
					"value"),
113
					srs,	
114
					coordinates);
115
			if (resources[i].getLinkage() == null){
116
				resources[i].setLinkage("");
117
			}
118
		}
119
		return resources;
120
	}
121

  
122
	/*
123
	 * (non-Javadoc)
124
	 * @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode)
125
	 */
126
	public boolean accept(URI uri, XMLNode node) {
127
		if (node.getName().equals("Metadata")){
128
			if (XMLTree.searchNode(node, "mdFileID") != null){
129
				return true;
130
			}
131
		}
132
		return false;
133
	}     
134

  
135

  
136
}
0 137

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/IdecISO19115Record.java
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 org.gvsig.catalog.schemas;
43
import java.net.URI;
44

  
45
import org.gvsig.catalog.metadataxml.XMLNode;
46
import org.gvsig.catalog.metadataxml.XMLTree;
47

  
48
/**
49
 * This class parses the Indicio CSW server answer files.
50
 * 
51
 * 
52
 * @author Jorge Piera Llodra (piera_jor@gva.es)
53
 */
54
public class IdecISO19115Record extends Record {
55

  
56
	public  IdecISO19115Record() {   
57

  
58
	}
59

  
60
	/**
61
	 * @param node 
62
	 */
63
	public  IdecISO19115Record(URI uri,XMLNode node) {        
64
		super(uri,node);
65
		setTitle(XMLTree.searchNodeValue(node,
66
				"identificationInfo->MD_DataIdentification->citation->title"));
67
		setAbstract_(XMLTree.searchNodeValue(node,
68
		"identificationInfo->MD_DataIdentification->abstract"));
69
		setPurpose(XMLTree.searchNodeValue(node,
70
		"identificationInfo->MD_DataIdentification->purpose"));
71
		setKeyWords(XMLTree.searchMultipleNodeValue(node,
72
		"identificationInfo->MD_DataIdentification->descriptiveKeywords->keyword"));
73
		setResources(getResources("distributionInfo->distributor->distributorTransferOptions->onLine"));
74
		//setImage(getImageUrl("identificationInfo->MD_DataIdentification->graphicOverview->fileName"));
75
	} 
76

  
77
	/**
78
	 * It parses the online resources
79
	 * 
80
	 * 
81
	 * @return Resource
82
	 * @param label Label that contains the resource root
83
	 */
84
	private Resource[] getResources(String label) {        
85
		XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
86

  
87
		if (nodes == null) {
88
			return null;
89
		}
90
		Resource[] resources = new Resource[nodes.length];
91

  
92
		for (int i = 0; i < resources.length; i++){
93

  
94
			String sProtocol = XMLTree.searchNodeValue(nodes[i], "protocol");
95
			String sName = XMLTree.searchNodeValue(nodes[i], "orName");
96

  
97
			if (sProtocol == null){
98
				sProtocol =   Resource.WEBSITE;
99
				sName =  "orName";
100
			}
101

  
102
			resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
103
			"linkage"),
104
			sProtocol,
105
			sName,
106
			"orDesc",
107
			"",
108
			"",	
109
			null);
110
		}
111
		return resources;
112
	}
113

  
114
	/*
115
	 * (non-Javadoc)
116
	 * @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode)
117
	 */
118
	public boolean accept(URI uri, XMLNode node) {
119
		if (node.getName().endsWith("MD_Metadata")){
120
			if (node.searchNode("identificationInfo->MD_DataIdentification->citation->title")!=null){
121
				return true;
122
			}
123
		}
124
		return false;
125
	} 
126
}
0 127

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/Iso19139Record.java
1
package org.gvsig.catalog.schemas;
2

  
3
import java.net.URI;
4

  
5
import org.gvsig.catalog.metadataxml.XMLNode;
6
import org.gvsig.catalog.metadataxml.XMLTree;
7
import org.gvsig.catalog.querys.Coordinates;
8

  
9
public class Iso19139Record extends Record{
10
	 
11
	public  Iso19139Record() {    
12
		 
13
	 }
14
	 
15
	/**
16
	 * Constructor
17
	 * @param node Node with the answer
18
	 * @param serverURI Server URL. Necessary to load the image (just Geonetwork)
19
	 */
20
	    public  Iso19139Record(URI uri, XMLNode node) {        
21
	        super(uri,node);
22
	        setTitle(node.searchNodeValue(
23
	                "identificationInfo->MD_DataIdentification->citation->CI_Citation->title->CharacterString"));
24
	        setAbstract_(node.searchNodeValue("identificationInfo->MD_DataIdentification->abstract->gco:CharacterString"));
25
	        setPurpose(node.searchNodeValue("dataIdInfo->idPurp"));
26
	        setKeyWords(node.searchMultipleNodeValue(
27
	                "identificationInfo->MD_DataIdentification->descriptiveKeywords->MD_Keywords->keyword->gco:CharacterString"));
28
	        setResources(getResources("distributionInfo->MD_Distribution->transferOptions->MD_DigitalTransferOptions->onLine->CI_OnlineResource"));
29
	        setFileID(node.searchNodeValue("mdFileID"));
30
	        setImageURL(node.searchNodeValue("dataIdInfo->graphOver"));
31
	        
32
	    } 
33

  
34
	/**
35
	 * 
36
	 * 
37
	 * 
38
	 * @return 
39
	 * @param label 
40
	 */
41
	    private Resource[] getResources(String label) {        
42
	        XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
43
	        Coordinates coordinates = null;
44
	        String srs = null;
45
	        
46
	        if (nodes == null) {
47
	            return null;
48
	        }
49
	        Resource[] resources = new Resource[nodes.length];
50
	        if (nodes.length > 0){
51
	        	srs = XMLTree.searchNodeValue(getNode(),"refSysInfo->MdCoRefSys->refSysID->identCode");
52
	        	coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->westBL"),
53
	        			XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->northBL"),
54
						XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->eastBL"),
55
						XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->southBL"));
56
	        }
57
	        	
58
	        	
59
	        for (int i = 0; i < resources.length; i++){
60
	            	resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
61
	                        "linkage->URL"),
62
	                    XMLTree.searchNodeValue(nodes[i], "protocol->gco:CharacterString"),
63
	                    XMLTree.searchNodeValue(nodes[i], "name->gco:CharacterString"),
64
	                    XMLTree.searchNodeValue(nodes[i], "orDesc"),
65
	                    XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
66
	                        "value"),
67
						srs,	
68
	            		coordinates);
69
	            	if (resources[i].getLinkage() == null){
70
	            		resources[i].setLinkage("");
71
	            	}
72
	            	
73
	        }
74
	        
75
	        
76
	        return resources;
77
	    }
78

  
79
	/*
80
	 * (non-Javadoc)
81
	 * @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode)
82
	 */
83
	public boolean accept(URI uri, XMLNode node) {
84
		if (node.getName().endsWith("MD_Metadata")){
85
			if (node.searchNode("identificationInfo->MD_DataIdentification->citation->CI_Citation->title")!=null){
86
				return true;
87
			}
88
		}
89
		return false;
90
	}     
91
	  
92
}
0 93

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.148/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/LaitsGmuISO19115Record.java
1
package org.gvsig.catalog.schemas;
2

  
3
import java.net.URI;
4

  
5
import org.gvsig.catalog.metadataxml.XMLNode;
6
import org.gvsig.catalog.metadataxml.XMLTree;
7
import org.gvsig.catalog.querys.Coordinates;
8

  
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id: LaitsGmuRecord.java 561 2007-07-27 06:49:30Z jpiera $
52
 * $Log$
53
 * Revision 1.1.2.1  2007/07/23 07:14:24  jorpiell
54
 * Catalog refactoring
55
 *
56
 * Revision 1.1.2.2.4.2  2007/07/11 13:01:51  jorpiell
57
 * Catalog UI updated
58
 *
59
 * Revision 1.1.2.2.4.1  2007/07/10 11:18:04  jorpiell
60
 * Added the registers
61
 *
62
 * Revision 1.1.2.2  2006/11/15 00:08:08  jjdelcerro
63
 * *** empty log message ***
64
 *
65
 * Revision 1.2  2006/11/13 10:01:01  jorpiell
66
 * Nuevos parsers para el servidor de GMU
67
 *
68
 * Revision 1.1.2.1  2006/11/08 12:57:12  jorpiell
69
 * Se han hecho numerosos cambios para que pueda funcionar el nomenclator de Simon y el cat?logo de GMU
70
 *
71
 *
72
 */
73
/**
74
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
75
 */
76
public class LaitsGmuISO19115Record extends Record {	
77

  
78
	public  LaitsGmuISO19115Record() {        
79

  
80
	}
81

  
82
	/**
83
	 * Constructor
84
	 * 
85
	 * 
86
	 * @param node Node with the answer
87
	 * @param serverURL Server URL. Necessary to load the image (just Geonetwork)
88
	 */
89
	public  LaitsGmuISO19115Record(URI uri, XMLNode node) {        
90
		super(uri,node);
91
		setTitle(XMLTree.searchNodeValue(node,"granuleShortName"));
92
		setAbstract_(XMLTree.searchNodeValue(node, "description"));
93
		setPurpose(null);
94
		setKeyWords(null);
95
		setResources(getResources("OnlineAccessURLs->OnlineAccessURL"));
96
		setFileID(null);	       
97
		//Caution: getImageUrl uses serverURL and FileID!!!
98
		setImage(null);
99

  
100
	} 
101

  
102
	/**
103
	 * 
104
	 * 
105
	 * 
106
	 * @return 
107
	 * @param label 
108
	 */
109
	private Resource[] getResources(String label) {        
110
		XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
111
		Coordinates coordinates = null;
112
		String srs = null;
113

  
114
		if (nodes == null) {
115
			return null;
116
		}
117
		Resource[] resources = new Resource[nodes.length];
118
		if (nodes.length > 0){
119
			srs = XMLTree.searchNodeValue(getNode(),"ogc:BBOX->referenceSystemNameCode");
120
			coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"ogc:BBOX->westBoundingCoordinate"),
121
					XMLTree.searchNodeValue(getNode(),"ogc:BBOX->northBoundingCoordinate"),
122
					XMLTree.searchNodeValue(getNode(),"ogc:BBOX->eastBoundingCoordinate"),
123
					XMLTree.searchNodeValue(getNode(),"ogc:BBOX->southBoundingCoordinate"));
124
		}
125

  
126

  
127
		for (int i = 0; i < resources.length; i++){
128
			resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
129
					"URL"),
130
					Resource.DOWNLOAD,
131
					XMLTree.searchNodeValue(nodes[i], "orName"),
132
					XMLTree.searchNodeValue(nodes[i], "URLDescription"),
133
					XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
134
					"value"),
135
					srs,	
136
					coordinates);
137
			if (resources[i].getLinkage() == null){
138
				resources[i].setLinkage("");
139
			}
140

  
141
		}
142
		return resources;
143
	}
144

  
145
	/*
146
	 * (non-Javadoc)
147
	 * @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode)
148
	 */
149
	public boolean accept(URI uri, XMLNode node) {
150
		return false;
151
	}     
152

  
153

  
154
}
0 155

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff