Revision 37005

View differences:

tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/protocols/HTTPGetProtocol.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.protocols;
43
import java.io.File;
44
import java.net.URL;
45
import java.util.Collection;
46

  
47
import org.apache.commons.httpclient.NameValuePair;
48
import org.gvsig.catalog.metadataxml.XMLTree;
49
import org.gvsig.remoteclient.utils.Utilities;
50

  
51

  
52
/**
53
 * 
54
 * 
55
 * 
56
 * @author Jorge Piera Llodra (piera_jor@gva.es)
57
 */
58
public class HTTPGetProtocol implements IProtocols {
59

  
60
	/**
61
	 * 
62
	 * 
63
	 * 
64
	 * @return 
65
	 * @param url 
66
	 * @param object 
67
	 * @param firstRecord 
68
	 */
69
	public Collection doQuery(URL url, Object object, int firstRecord) {        
70
		NameValuePair[] parameters = (NameValuePair[]) object;
71
		File file = null;
72

  
73
		String sUrl = "http://" + url.getHost() + ":" +
74
		url.getPort() + url.getPath();
75
		sUrl = sUrl + createURLParams(parameters);
76
		
77
		try {	
78
			file = Utilities.downloadFile(new URL(sUrl),
79
					"catalog-", null);
80

  
81
		} catch (Exception e) {
82
			return null;
83
		}
84

  
85
		Collection col = new java.util.ArrayList();
86
		col.add(XMLTree.xmlToTree(file));
87
		return col;
88
	} 
89

  
90
	/**
91
	 * Create and string for a list of params
92
	 * @param params
93
	 * @return
94
	 */
95
	private String createURLParams(NameValuePair[] params){
96
		StringBuffer buffer = new StringBuffer();
97
		for (int i=0 ; i<params.length ; i++){
98
			if (i==0){
99
				buffer.append("?");
100
			}else{
101
				buffer.append("&");
102
			}
103
			buffer.append(params[i].getName());
104
			buffer.append("=");
105
			buffer.append(params[i].getValue());
106
		}
107
		return buffer.toString();
108
	}
109

  
110
}
0 111

  
tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/protocols/Z3950ConnectionFactory.java
1
package org.gvsig.catalog.protocols;
2

  
3
import java.net.URI;
4
import java.util.Hashtable;
5

  
6
import org.jzkit.search.provider.iface.SearchException;
7
import org.jzkit.search.provider.iface.Searchable;
8
import org.jzkit.search.provider.z3950.Z3950ServiceFactory;
9
import org.springframework.context.ApplicationContext;
10
import org.springframework.context.support.FileSystemXmlApplicationContext;
11

  
12
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
13
 *
14
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
15
 *
16
 * This program is free software; you can redistribute it and/or
17
 * modify it under the terms of the GNU General Public License
18
 * as published by the Free Software Foundation; either version 2
19
 * of the License, or (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU General Public License
27
 * along with this program; if not, write to the Free Software
28
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
29
 *
30
 * For more information, contact:
31
 *
32
 *  Generalitat Valenciana
33
 *   Conselleria d'Infraestructures i Transport
34
 *   Av. Blasco Ib??ez, 50
35
 *   46010 VALENCIA
36
 *   SPAIN
37
 *
38
 *      +34 963862235
39
 *   gvsig@gva.es
40
 *      www.gvsig.gva.es
41
 *
42
 *    or
43
 *
44
 *   IVER T.I. S.A
45
 *   Salamanca 50
46
 *   46005 Valencia
47
 *   Spain
48
 *
49
 *   +34 963163400
50
 *   dac@iver.es
51
 */
52
/* CVS MESSAGES:
53
 *
54
 * $Id: Z3950ConnectionFactory.java 568 2007-07-27 07:23:27 +0000 (Fri, 27 Jul 2007) jpiera $
55
 * $Log$
56
 * Revision 1.1.2.2.4.2  2007/07/13 12:00:35  jorpiell
57
 * Add the posibility to add a new panel
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/10/02 08:29:07  jorpiell
66
 * Modificados los cambios del Branch 10 al head
67
 *
68
 * Revision 1.1.2.1  2006/09/20 12:01:07  jorpiell
69
 * Se ha cambiado la versi?n de la jzkit, se ha incorporado la funcionalidad de cargar arcims
70
 *
71
 * Revision 1.1  2006/09/20 11:20:17  jorpiell
72
 * Se ha cambiado la versi?n de la librer?a jzkit de la 1 a la 2.0
73
 *
74
 *
75
 */
76
/**
77
 * This factory creates Z39.50 connections
78
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
79
 */
80
public class Z3950ConnectionFactory {
81
	private static ApplicationContext app_context = null;
82
	private static boolean appContextInitialized = false;
83
	private static Z3950ServiceFactory factory = null;
84
	private static Hashtable connections = new Hashtable();
85
	
86
	public static Z3950Connection getConnection(URI uri){
87
		Z3950Connection connection = (Z3950Connection)connections.get(uri);
88
		if (connection == null){
89
			connection = new Z3950Connection(uri);
90
			connections.put(uri,connection);
91
		}
92
		return connection;
93
	}
94
	
95
	public static Searchable getSearchable(URI uri) throws SearchException{
96
		if (!(appContextInitialized)){
97
			initAppContext(uri);
98
			factory = new Z3950ServiceFactory();		
99
			factory.setApplicationContext(app_context);
100
			factory.setDefaultRecordSyntax("usmarc");
101
			factory.setDefaultElementSetName("F");
102
			factory.getRecordArchetypes().put("Default","usmarc::F");
103
			factory.getRecordArchetypes().put("FullDisplay","usmarc::F");
104
			factory.getRecordArchetypes().put("BriefDisplay","usmarc::B");
105
			factory.getRecordArchetypes().put("Holdings","usmarc::F");
106
		}
107
		factory.setHost(uri.getHost());
108
		factory.setPort(uri.getPort());
109
		Searchable s = factory.newSearchable();
110
		s.setApplicationContext(app_context);	
111
		return s;
112
	}
113

  
114
	/**
115
	 * Initialize the application context
116
	 * @param url 
117
	 */
118
	private static void initAppContext(URI uri){
119
		System.setProperty("javax.xml.parsers.DocumentBuilderFactory","org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
120
		try{
121
			app_context = new FileSystemXmlApplicationContext(new String[]{"config/ApplicationContextAlone.xml"},false);
122
			((FileSystemXmlApplicationContext)app_context).setClassLoader(Z3950ConnectionFactory.class.getClassLoader());
123
			((FileSystemXmlApplicationContext)app_context).refresh();
124
		}catch(Exception e){
125
			e.printStackTrace();
126
			app_context = new FileSystemXmlApplicationContext(new String[]{"gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/config/ApplicationContext.xml"},false);
127
			((FileSystemXmlApplicationContext)app_context).setClassLoader(Z3950ConnectionFactory.class.getClassLoader());
128
			((FileSystemXmlApplicationContext)app_context).refresh();
129
		}			
130
		
131
		if (app_context == null){
132
			throw new RuntimeException("Unable to locate TestApplicationContext.xml definition file");
133
		}
134
		appContextInitialized = true;
135
	}
136
	
137
}
0 138

  
tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/protocols/GetImageFromWeb.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.protocols;
43
import java.awt.image.BufferedImage;
44
import java.io.File;
45
import java.io.IOException;
46
import java.net.MalformedURLException;
47
import java.net.URL;
48

  
49
import javax.imageio.ImageIO;
50

  
51
/**
52
 * This class is used lo load an image from a URL. It saves the image
53
 * in a file
54
 * 
55
 * 
56
 * @author Jorge Piera Llodra (piera_jor@gva.es)
57
 */
58
public class GetImageFromWeb {
59

  
60
/**
61
 * It saves an image in a file
62
 * 
63
 * 
64
 * @return 
65
 * @param sUrl URL that contains the image
66
 * @param sfile File to save the image
67
 */
68
    public boolean getImageUrl(String sUrl, String sfile) {        
69
        URL url;
70
        try {
71
            url = new URL(sUrl);
72
            BufferedImage img = ImageIO.read(url);
73
            
74
            if (img == null)
75
                return false;            
76
            
77
            File outFile = new File(sfile);
78
                                   
79
            //We must to change this value: getCapabalilities request
80
            //has the supported formats
81
            return ImageIO.write(img, "jpeg", outFile);
82
        } catch (MalformedURLException e) {
83
            // TODO Auto-generated catch block
84
            System.out.println("La URL de la imagen no es correcta");
85
        } catch (IOException e1) {
86
            // TODO Auto-generated catch block
87
            System.out.println("No he podido leer la imagen desde la URL");
88
        }
89
        return false;
90
    } 
91
 }
0 92

  
tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/protocols/SOAPProtocol.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.protocols;
43
import java.io.BufferedReader;
44
import java.io.ByteArrayInputStream;
45
import java.io.File;
46
import java.io.FileWriter;
47
import java.io.InputStream;
48
import java.net.URL;
49
import java.util.Collection;
50

  
51
import javax.xml.parsers.DocumentBuilder;
52

  
53
import org.apache.soap.Constants;
54
import org.apache.soap.Envelope;
55
import org.apache.soap.SOAPException;
56
import org.apache.soap.messaging.Message;
57
import org.apache.soap.transport.SOAPTransport;
58
import org.apache.soap.util.xml.XMLParserUtils;
59
import org.gvsig.catalog.metadataxml.XMLTree;
60
import org.w3c.dom.Document;
61
import org.xml.sax.InputSource;
62

  
63

  
64
/**
65
 * 
66
 * 
67
 * 
68
 * @author Jorge Piera Llodra (piera_jor@gva.es)
69
 */
70
public class SOAPProtocol implements IProtocols {
71

  
72
/**
73
 * 
74
 * 
75
 * 
76
 * @return 
77
 * @param url 
78
 * @param object 
79
 * @param firstRecord 
80
 */
81
    public Collection doQuery(URL url, Object object, int firstRecord) {        
82
        String message = (String) object;
83
        File fileAnswer = null;
84
       
85
        //get the envelope to send
86
        try {
87
            InputStream buffer = new ByteArrayInputStream(message.getBytes());
88
            DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
89
            Document doc = xdb.parse(new InputSource(buffer));
90
            if (doc == null) {
91
                throw new SOAPException(Constants.FAULT_CODE_CLIENT,
92
                    "parsing error");
93
            }
94
            Envelope msgEnv = Envelope.unmarshall(doc.getDocumentElement());
95
            // send the message
96
            Message msg = new Message();
97
            msg.send(url, "urn:this-is-the-action-uri", msgEnv);
98
            // receive whatever from the transport and dump it to the screen
99
            SOAPTransport st = msg.getSOAPTransport();
100
            BufferedReader br = st.receive();
101
            String line;
102
            //File to save the answer
103
            fileAnswer = new File("auxiliar");
104
            FileWriter fwAnswer = new FileWriter(fileAnswer);
105
            fwAnswer.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
106
            //Process the answer	    		    
107
            while ((line = br.readLine()) != null) {
108
                System.out.println(line);
109
                fwAnswer.write(line);
110
                fwAnswer.flush();
111
            }
112
            fwAnswer.close();
113
               
114
         
115
        } catch (Exception e) {
116
            return null;
117
        }
118
        Collection col = new java.util.ArrayList();
119
        col.add(XMLTree.xmlToTree(fileAnswer));
120
        return col;
121
    } 
122

  
123
/**
124
 * 
125
 * 
126
 * 
127
 * @return 
128
 * @param url 
129
 */
130
    public static boolean isProtocolSupported(URL url) {        
131
        return true;
132
    } 
133

  
134
/**
135
 * This function returns a SOAP message
136
 * 
137
 * 
138
 * @return 
139
 * @param message the XML message
140
 * @param schemas 
141
 */
142
    public static String setSOAPMessage(String message, String[] schemas) {        
143
        String soap =  "<SOAP:Envelope xmlns:SOAP=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
144
        	"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" ;
145
        if (schemas != null){
146
            for (int i=0 ; i<schemas.length ; i++){
147
                soap = soap + " " + schemas[i];
148
            }
149
        }
150
        soap = soap + ">";
151
        soap = soap + "<SOAP:Body>" + message + "</SOAP:Body>" + "</SOAP:Envelope>";
152
        return soap;
153
        
154
    } 
155
 }
0 156

  
tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/protocols/context/InternalAttrTypes.properties
1
bib-1.1=AccessPoint
2
bib-1.2=Relation
3
bib-1.3=Position
4
bib-1.4=Structure
5
bib-1.5=Truncation
6
bib-1.6=Completeness
7
gils.1=AccessPoint
8
gils.10=SpatialQualifier
0 9

  
tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/protocols/context/a2j.properties
1
# Default OID Configuration file
2
#
3
# $Id: a2j.properties 561 2007-07-27 06:49:30 +0000 (Fri, 27 Jul 2007) jpiera $
4
#
5

  
6
# Attribute Set OID's
7

  
8
# Bib-1 Attribute Set
9
oid.bib-1={1,2,840,10003,3,1}
10

  
11
# Explain Attribute Set
12
oid.exp-1={1,2,840,10003,3,2}
13

  
14
oid.ext-1={1,2,840,10003,3,3}
15

  
16
oid.ccl={1,2,840,10003,3,4}
17

  
18
oid.gils_attrset={1,2,840,10003,3,5}
19

  
20
oid.stas={1,2,840,10003,3,6}
21

  
22
oid.collect1={1,2,840,10003,3,7}
23

  
24
oid.cimi={1,2,840,10003,3,8}
25

  
26
oid.geo={1,2,840,10003,3,9}
27

  
28
oid.zbig={1,2,840,10003,3,10}
29

  
30
oid.util={1,2,840,10003,3,11}
31

  
32
oid.xd1={1,2,840,10003,3,12}
33
name.xd1=Cross Domain Attribute Set
34

  
35
oid.zthes={1,2,840,10003,3,13}
36
name.zthes=Thesaurus Attribute Set
37

  
38
oid.holdings={1,2,840,10003,3,16}
39
name.holdings=Holdings Attribute Set
40

  
41

  
42
# Record Syntax OID's
43

  
44
oid.unimarc={1,2,840,10003,5,1}
45
name.unimarc=UNIMarc Record
46

  
47
oid.usmarc={1,2,840,10003,5,10}
48
name.usmarc=US Marc Record
49

  
50
oid.marc21={1,2,840,10003,5,10}
51
name.marc21=Marc21 Record
52

  
53
oid.ukmarc={1,2,840,10003,5,11}
54
name.ukmark=UK Marc Record
55

  
56
oid.normarc={1,2,840,10003,5,12}
57
name.normarc=NorMarc Record
58

  
59
oid.librismarc={1,2,840,10003,5,13}
60
name.librismarc=LibrisMarc Record
61

  
62
oid.danmarc={1,2,840,10003,5,14}
63

  
64
oid.finmarc={1,2,840,10003,5,15}
65

  
66
oid.canmarc={1,2,840,10003,5,17}
67

  
68
oid.ausmarc={1,2,840,10003,5,20}
69

  
70
oid.ibermarc={1,2,840,10003,5,21}
71
name.ibermarc=IberMarc Record
72

  
73
oid.catmarc={1,2,840,10003,5,22}
74
name.catmarc=CatMarc Record
75

  
76
oid.explain={1,2,840,10003,5,100}
77
name.explain=Explain Record
78
codec.explain=org.jzkit.z3950.gen.v3.RecordSyntax_explain.Explain_Record_codec
79

  
80
oid.sutrs={1,2,840,10003,5,101}
81
name.sutrs=Simple Unstructured Text Record
82
codec.sutrs=org.jzkit.z3950.gen.v3.RecordSyntax_SUTRS.SutrsRecord_codec
83

  
84
oid.opac={1,2,840,10003,5,102}
85
name.opac=Opac Record
86
codec.opac=org.jzkit.z3950.gen.v3.RecordSyntax_opac.OPACRecord_codec
87

  
88
oid.summary={1,2,840,10003,5,103}
89
name.summary=Summary Record
90
codec.summary=org.jzkit.z3950.gen.v3.RecordSyntax_summary.BriefBib_codec
91

  
92
oid.grs-1={1,2,840,10003,5,105}
93
name.grs-1=Generic Record
94
codec.grs-1=org.jzkit.z3950.gen.v3.RecordSyntax_generic.GenericRecord_codec
95

  
96
oid.pdf={1,2,840,10003,5,109,1}
97
name.pdf=PDF Document
98

  
99
oid.postscript={1,2,840,10003,5,109,2}
100
name.postscript=Postscript Document
101

  
102
oid.html={1,2,840,10003,5,109,3}
103
name.html=HTML data
104

  
105
oid.sgml={1,2,840,10003,5,109,9}
106
name.sgml=SGML data
107

  
108
oid.xml={1,2,840,10003,5,109,10}
109
name.xml=XML data
110

  
111
# Diagnostic Set OID's
112

  
113
oid.diag-bib-1={1,2,840,10003,4,1}
114
name.diag-bib-1=Bib1 Diagnostic Set
115

  
116
oid.diag-1={1,2,840,10003,4,2}
117
name.diag-1=Diag1 Diagnostic Set
118
codec.diag-1=org.jzkit.z3950.gen.v3.DiagnosticFormatDiag1.DiagnosticFormat_codec
119

  
120
# Schema OID's
121

  
122
oid.wais_schema={1,2,840,10003,13,1}
123
name.wais_schema=WAIS Record Schema
124

  
125
oid.gils_schema={1,2,840,10003,13,2}
126
name.gils_schema=GILS Record Schema
127

  
128
oid.collections_schema={1,2,840,10003,13,3}
129
name.collections_schema=GILS Record Schema
130

  
131
oid.geo_schema={1,2,840,10003,13,4}
132
name.geo_schema=GEO Record Schema
133

  
134
oid.cimi_schema={1,2,840,10003,13,5}
135
name.cimi_schema=CIMI Record Schema
136

  
137
oid.update_schema={1,2,840,10003,13,6}
138
name.update_schema=CIMI Record Schema
139

  
140
oid.holdings_schema={1,2,840,10003,13,7}
141
name.holdings_schema=Holdings Record Schema
142

  
143
oid.zthes_schema={1,2,840,10003,13,8}
144
name.zthes_schema=Zthes Record Schema
145

  
146
oid.z_charset_neg_3={1,2,840,10003,15,3}
147
name.z_charset_neg_3=Z39.50-Character-Set-Negotiation-3
148
codec.z_charset_neg_3=org.jzkit.z3950.gen.v3.NegotiationRecordDefinition_charSetandLanguageNegotiation_3.CharSetandLanguageNegotiation_codec
149

  
150
oid.charset_ucs2={1,0,10646,1,0,2}
151
name.charset_ucs2=UCS-2
152

  
153
oid.charset_ucs4={1,0,10646,1,0,4}
154
name.charset_ucs4=UCS-4
155

  
156
oid.charset_utf16={1,0,10646,1,0,5}
157
name.charset_utf16=UTF-16
158

  
159
oid.charset_utf8={1,0,10646,1,0,8}
160
name.charset_utf8=UTF-8
161

  
162
oid.es_persistent_result_set={1,2,840,10003,9,1}
163
name.es_persistent_result_set=Persistent Result Set Extended Service
164

  
165
oid.es_persistent_query={1,2,840,10003,9,2}
166
name.es_persistent_query=Persistent Query Extended Service
167

  
168
oid.es_periodic_query_schedule={1,2,840,10003,9,3}
169
name.es_periodic_query_schedule=Periodic Query Schedule Extended Service
170

  
171
oid.es_item_order={1,2,840,10003,9,4}
172
name.es_item_order=Item Order Extended Service
173

  
174
oid.es_database_update={1,2,840,10003,9,5}
175
name.es_database_update=Database Update
176
codec.es_database_update=org.jzkit.z3950.gen.v3.ESFormat_Update0.Update_codec
177

  
178
oid.es_database_update_r1={1,2,840,10003,9,5,1,1}
179
name.es_database_update_r1=Database Update Revision 1
180
codec.es_database_update_r1=org.jzkit.z3950.gen.v3.ESFormat_Update.Update_codec
181

  
182
oid.es_export_specification={1,2,840,10003,9,6}
183
name.es_export_specification=Export Specification
184

  
185
oid.es_export_invocation={1,2,840,10003,9,6}
186
name.es_export_invocation=Export Invocation
187

  
188
# ISO ILL Externals
189
oid.ILL_OCLC_PRISM_Error={1,0,10161,13,1}
190
name.ILL_OCLC_PRISM_Error=OCLC Prism Error Extension
191

  
192
oid.ILL_OCLC_Request={1,0,10161,13,2}
193
name.ILL_OCLC_Request=OCLC Request Extension
194

  
195
oid.ILL_APDU_Delivery_Info={1,0,10161,13,3}
196
name.ILL_APDU_Delivery_Info=ILL APDU Delivery Info
197
# codec.ILL_APDU_Delivery_Info=org.jzkit.OpenRequest.isoill.gen.ILL_APDU_Delivery_Info.APDU_Delivery_Info_codec
198

  
199
oid.ILL_Supplemental_Client_Info={1,0,10161,13,4}
200
name.ILL_Supplemental_Client_Info=ILL Supplemental Client Info
201

  
202
oid.ILL_Forwarded_Additional_Info={1,0,10161,13,5}
203
name.ILL_Forwarded_Additional_Info=ILL Forwarded Additional Info
204

  
205
oid.IPIG_Additional_User_Error_Info={1,0,10161,13,6}
206
name.IPIG_Additional_User_Error_Info=IPIG Additional User Error Information
207

  
208
oid.ILL_Suppliers_Reference={1,0,10161,13,7}
209
name.ILL_Suppliers_Reference=ILL Suppliers Reference
210

  
211
oid.ILL_Internal_Reference_Number={1,0,10161,13,8}
212
name.ILL_Internal_Reference_Number=ILL Internal Reference Number
213

  
214
oid.IPIG_ILL_Request_Extension={1,0,10161,13,9}
215
name.IPIG_ILL_Request_Extension=IPIG ILL Request Extension
0 216

  
tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/protocols/context/InternalToType1Rules.properties
1
DefaultTargetAttrset=bib-1
2
dc.title=bib-1:1:4
3
dc.creator=bib-1:1:4
4
k-int.anywhere=bib-1:1:1016
0 5

  
tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/protocols/HTTPPostProtocol.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.protocols;
43
import java.io.ByteArrayInputStream;
44
import java.io.File;
45
import java.io.FileOutputStream;
46
import java.io.IOException;
47
import java.io.InputStream;
48
import java.io.OutputStreamWriter;
49
import java.net.HttpURLConnection;
50
import java.net.URL;
51
import java.util.Collection;
52

  
53
import org.gvsig.catalog.metadataxml.XMLTree;
54
import org.gvsig.catalog.utils.Strings;
55

  
56

  
57
/**
58
 * This class implement the HTTP Post protocol.
59
 * 
60
 * 
61
 * @author Jorge Piera Llodra (piera_jor@gva.es)
62
 */
63
public class HTTPPostProtocol implements IProtocols {
64

  
65
/**
66
 * @return 
67
 * @param url 
68
 * @param message 
69
 * @param firstRecord 
70
 */
71
    public Collection doQuery(URL url, Object message, int firstRecord) {        
72
        String body = (String) message;
73
        ByteArrayInputStream output = null;
74
            
75
        try {
76
            HttpURLConnection c = (HttpURLConnection) url.openConnection();
77
            
78
         c.setRequestProperty("SOAPAction","post");
79
         c.setRequestMethod("POST");
80
         c.setDoOutput(true);
81
         c.setRequestProperty("Content-Type", "text/xml; charset=UTF-8");
82
                 
83
        // Write the request.
84
        OutputStreamWriter w =
85
            new OutputStreamWriter(c.getOutputStream(), "UTF-8");
86
        
87
        w.write(body);
88
        w.flush();
89
              
90
        InputStream is = c.getInputStream();
91
        byte[] buf = new byte[1024];
92
        int len;
93
        String str = "";
94
        
95
        while ((len = is.read(buf)) > 0) {
96
            str = str + new String(buf, 0, len);
97
        }
98
            
99
        str = Strings.replace(str,
100
				  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
101
		  "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
102
        System.out.println(str);
103
        output = new ByteArrayInputStream(str.getBytes());
104
            
105
        }  catch (IOException e) {
106
            // TODO Auto-generated catch block
107
            //e.printStackTrace();
108
            return null;
109
        } 
110
        
111
        Collection col = new java.util.ArrayList();
112
        col.add(XMLTree.xmlToTree(output));
113
        return col;            
114
    }    
115

  
116
    public void doQuery(URL url, Object message, int firstRecord, String fileName) {        
117
    	String body = (String) message;
118
    	FileOutputStream output = null;
119

  
120
    	try {
121
    		HttpURLConnection c = (HttpURLConnection) url.openConnection();
122

  
123
    		c.setRequestProperty("SOAPAction","post");
124
    		c.setRequestMethod("POST");
125
    		c.setDoOutput(true);
126
    		c.setRequestProperty("Content-Type", "text/xml; charset=UTF-8");
127

  
128
    		// Write the request.
129
    		OutputStreamWriter w =
130
    			new OutputStreamWriter(c.getOutputStream(), "UTF-8");
131

  
132
    		w.write(body);
133
    		w.flush();
134

  
135
    		InputStream is = c.getInputStream();
136
    		byte[] buf = new byte[1024];
137
    		int len;
138
    		String str = "";
139
    		while ((len = is.read(buf)) > 0) {
140
    			str = str + new String(buf, 0, len);
141
    		}
142
	
143
    		System.out.println(str);
144
    		output = new FileOutputStream(new File(fileName));
145
    		output.write(str.getBytes());
146
    		output.flush();
147
    		output.close();
148
    	
149
    		
150
    	}  catch (IOException e) {
151
    		e.printStackTrace();           
152
    	}           
153
             
154
    }    
155
 }
0 156

  
tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/protocols/Z3950Connection.java
1
package org.gvsig.catalog.protocols;
2

  
3
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
4
 *
5
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
6
 *
7
 * This program is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU General Public License
9
 * as published by the Free Software Foundation; either version 2
10
 * of the License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program; if not, write to the Free Software
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
20
 *
21
 * For more information, contact:
22
 *
23
 *  Generalitat Valenciana
24
 *   Conselleria d'Infraestructures i Transport
25
 *   Av. Blasco Ib??ez, 50
26
 *   46010 VALENCIA
27
 *   SPAIN
28
 *
29
 *      +34 963862235
30
 *   gvsig@gva.es
31
 *      www.gvsig.gva.es
32
 *
33
 *    or
34
 *
35
 *   IVER T.I. S.A
36
 *   Salamanca 50
37
 *   46005 Valencia
38
 *   Spain
39
 *
40
 *   +34 963163400
41
 *   dac@iver.es
42
 */
43
/* CVS MESSAGES:
44
 *
45
 * $Id: Z3950Connection.java 561 2007-07-27 06:49:30 +0000 (Fri, 27 Jul 2007) jpiera $
46
 * $Log$
47
 * Revision 1.1.2.6.4.3  2007/07/23 07:14:25  jorpiell
48
 * Catalog refactoring
49
 *
50
 * Revision 1.1.2.6.4.2  2007/07/13 12:00:35  jorpiell
51
 * Add the posibility to add a new panel
52
 *
53
 * Revision 1.1.2.6.4.1  2007/07/10 11:18:04  jorpiell
54
 * Added the registers
55
 *
56
 * Revision 1.1.2.6  2006/11/15 00:08:08  jjdelcerro
57
 * *** empty log message ***
58
 *
59
 * Revision 1.4  2006/11/13 07:52:58  jorpiell
60
 * Se han incluido los cambios que se hicieron para Chile: cambio de la librer?a jzKit, carga de ArcIms y WCS
61
 *
62
 * Revision 1.3  2006/10/02 08:29:07  jorpiell
63
 * Modificados los cambios del Branch 10 al head
64
 *
65
 * Revision 1.1.2.3  2006/10/02 07:13:43  jorpiell
66
 * Comprobada una NullPointerException que generaba una excepci?n
67
 *
68
 * Revision 1.1.2.2  2006/09/25 06:48:38  jorpiell
69
 * A?adida la funcionalidad de mostrar el documento de texto cuando no es un XML
70
 *
71
 * Revision 1.1.2.1  2006/09/20 12:01:07  jorpiell
72
 * Se ha cambiado la versi?n de la jzkit, se ha incorporado la funcionalidad de cargar arcims
73
 *
74
 * Revision 1.1  2006/09/20 11:20:17  jorpiell
75
 * Se ha cambiado la versi?n de la librer?a jzkit de la 1 a la 2.0
76
 *
77
 *
78
 */
79
import java.net.URI;
80
import java.util.StringTokenizer;
81
import java.util.Vector;
82

  
83
import org.gvsig.catalog.drivers.GetRecordsReply;
84
import org.gvsig.catalog.metadataxml.XMLNode;
85
import org.gvsig.catalog.metadataxml.XMLTree;
86
import org.jzkit.a2j.codec.util.OIDRegister;
87
import org.jzkit.search.provider.iface.IRQuery;
88
import org.jzkit.search.provider.iface.SearchException;
89
import org.jzkit.search.provider.iface.Searchable;
90
import org.jzkit.search.util.RecordModel.ExplicitRecordFormatSpecification;
91
import org.jzkit.search.util.RecordModel.InformationFragment;
92
import org.jzkit.search.util.RecordModel.RecordFormatSpecification;
93
import org.jzkit.search.util.RecordModel.SUTRS;
94
import org.jzkit.search.util.RecordModel.XMLRecord;
95
import org.jzkit.search.util.ResultSet.IRResultSet;
96
import org.jzkit.search.util.ResultSet.IRResultSetException;
97
import org.jzkit.search.util.ResultSet.IRResultSetStatus;
98
import org.jzkit.z3950.client.SynchronousOriginBean;
99
import org.jzkit.z3950.gen.v3.Z39_50_APDU_1995.InitializeResponse_type;
100

  
101

  
102
public class Z3950Connection extends SynchronousOriginBean
103
{
104
  public static final char ISO2709_RS = 035;
105
  public static final char ISO2709_FS = 036;
106
  public static final char ISO2709_IDFS = 037;
107
  private static final String PREFIX_QUERY_TYPE = "PREFIX";
108
  private static final String CCL_QUERY_TYPE = "CCL";
109

  
110
  private int auth_type = 0; // 0=none, 1=anonymous, 2=open, 3=idpass
111
  private String principal = null;
112
  private String group = null;
113
  private String credentials = null; 
114
  private InitializeResponse_type resp = null;
115
  private URI uri = null;
116
  private String host = null;
117
  private int port = 0;
118
  private String database = null;
119
  
120
  
121
  public Z3950Connection(URI uri){
122
	  super(new OIDRegister("/a2j.properties"));
123
	  this.uri = uri;
124
	  this.host = uri.getHost();
125
	  this.port = uri.getPort();
126
	  StringTokenizer sti = new StringTokenizer(uri.getPath(), "/");
127
      if (sti.countTokens() == 0) {
128
          this.database = "geo";
129
      } else {
130
          this.database = sti.nextToken();
131
      }
132
  }
133
  
134
  /**
135
   * 
136
   * @param url
137
   * @return
138
   */
139
  public String connect(){
140
	   	if (resp == null){
141
	    	resp = connect(host,port,auth_type,principal,group,credentials);
142
	    }
143
	    StringBuffer string = new StringBuffer();	    
144
	    if (resp == null){
145
	    	return null;
146
	    }
147
	    if (resp.result.booleanValue() == true) {
148
	    	if (resp.referenceId != null) {
149
	    		string.append("Reference ID : " + new String(resp.referenceId) +
150
	    		"\n");
151
	    	}
152
	    	string.append("Implementation ID : " +
153
	    			resp.implementationId + "\n");
154
	    	string.append("Implementation Name : " +
155
	    			resp.implementationName + "\n");
156
	    	string.append("Implementation Version : " +
157
	    			resp.implementationVersion + "\n");
158
	    } else {
159
	    	System.out.println(" Failed to establish association");
160
	    	return null;
161
	    }
162
	    
163
	    return string.toString();
164
  }
165

  
166
  public GetRecordsReply search(GetRecordsReply recordsReply, String sQuery,int firstRecord){
167
	  try{
168
		  IRQuery query = new IRQuery();
169
		  query.collections = new Vector();
170
		  query.collections.add(database);
171
		  query.query = new org.jzkit.search.util.QueryModel.PrefixString.PrefixString(sQuery);
172
		  
173
		  Searchable s = Z3950ConnectionFactory.getSearchable(uri);
174
		  IRResultSet result = s.evaluate(query);
175
		  result.waitForStatus(IRResultSetStatus.COMPLETE|IRResultSetStatus.FAILURE,0);
176
		
177
		  int numOfResults = result.getFragmentCount();
178
		  recordsReply.setNumRecords(numOfResults);
179
				  
180
		  RecordFormatSpecification rfs = new ExplicitRecordFormatSpecification(null,null,"f");
181
		  InformationFragment[] fragment = result.getFragment(firstRecord,10,rfs);
182

  
183
		  for (int i=0 ; i<fragment.length ; i++){
184
			  try {
185
				  String answer = "";				  
186
				  if (fragment[i] instanceof XMLRecord){				  	 
187
					  XMLRecord xml = (XMLRecord)fragment[i];	
188
					  answer = xml.toString();
189
				  }else {
190
					  SUTRS sutr = (SUTRS)fragment[i];
191
					  answer = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
192
					  "<" + XMLNode.ISNOTXML + ">" + 
193
					  sutr.toString() + 
194
					  "</" + XMLNode.ISNOTXML + ">";
195
				  }  				  
196
				  recordsReply.addRecord(uri, XMLTree.xmlToTree(answer));
197
			  } catch (Exception e1) {
198
				  // TODO Auto-generated catch block
199
				  e1.printStackTrace();
200
			  }
201
		  }	
202
	  }catch(SearchException e){
203
		  e.printStackTrace();
204
	  } catch (IRResultSetException e) {
205
		  // TODO Auto-generated catch block
206
		  e.printStackTrace();
207
	  } catch (Exception e) {
208
		  // TODO Auto-generated catch block
209
		  e.printStackTrace();
210
	  }	  
211
      return recordsReply;
212
  } 
213
}
0 214

  
tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/protocols/Z3950Protocol.java
1
package org.gvsig.catalog.protocols;
2

  
3
import java.net.URI;
4
import java.util.StringTokenizer;
5

  
6
import org.gvsig.catalog.drivers.GetRecordsReply;
7
import org.jzkit.search.provider.iface.SearchException;
8
import org.jzkit.search.util.ResultSet.IRResultSetException;
9

  
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: Z3950Protocol.java 561 2007-07-27 06:49:30 +0000 (Fri, 27 Jul 2007) jpiera $
54
 * $Log$
55
 * Revision 1.21.2.2.4.3  2007/07/23 07:14:25  jorpiell
56
 * Catalog refactoring
57
 *
58
 * Revision 1.21.2.2.4.2  2007/07/13 12:00:35  jorpiell
59
 * Add the posibility to add a new panel
60
 *
61
 * Revision 1.21.2.2.4.1  2007/07/10 11:18:04  jorpiell
62
 * Added the registers
63
 *
64
 * Revision 1.21.2.2  2006/11/15 00:08:08  jjdelcerro
65
 * *** empty log message ***
66
 *
67
 * Revision 1.23  2006/10/02 08:29:07  jorpiell
68
 * Modificados los cambios del Branch 10 al head
69
 *
70
 * Revision 1.21.2.1  2006/09/20 12:01:18  jorpiell
71
 * Se ha cambiado la versi?n de la jzkit, se ha incorporado la funcionalidad de cargar arcims
72
 *
73
 * Revision 1.22  2006/09/20 11:20:17  jorpiell
74
 * Se ha cambiado la versi?n de la librer?a jzkit de la 1 a la 2.0
75
 *
76
 *
77
 */
78
/**
79
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
80
 */
81
public class Z3950Protocol {
82

  
83
	/**
84
	   * Makes a query
85
	   * @param url
86
	   * @param object
87
	   * @param firstRecord
88
	   * @return
89
	 * @throws IRResultSetException 
90
	 * @throws SearchException 
91
	   */
92
	  public GetRecordsReply doQuery(GetRecordsReply recordsReply, URI uri, Object object, int firstRecord){    
93
		  Z3950Connection connection = Z3950ConnectionFactory.getConnection(uri);
94
		  return connection.search(recordsReply,(String)object,firstRecord);
95
	 }  
96

  
97
	  
98
	  /**
99
	   * 
100
	   * @param url
101
	   * @return
102
	   */
103
	  public String openConnection(URI uri) {      
104
		  Z3950Connection connection = Z3950ConnectionFactory.getConnection(uri);
105
		  return connection.connect();
106
	  }
107
	  
108
	  /**
109
	   * 
110
	   * @param url
111
	   * @return
112
	   */
113
	  public boolean isProtocolSupported(URI uri) {    
114
	     Z3950Connection connection = Z3950ConnectionFactory.getConnection(uri);
115
	     if (connection.connect() == null){
116
	    	 return false;
117
	     }
118
	     return true;
119
	  }
120

  
121
	  /**
122
	   * Return the database
123
	   * @param url
124
	   * @return
125
	   */
126
	  public static String getDatabase(URI uri) {
127
		  StringTokenizer sti = new StringTokenizer(uri.getPath(), "/");
128
		  if (sti.countTokens() == 0) {
129
			  return "geo";
130
		  } else {
131
			  return sti.nextToken();
132
		  }
133
	  }
134
}
0 135

  
tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/protocols/IProtocols.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.protocols;
43
import java.net.URL;
44
import java.util.Collection;
45
/**
46
 * 
47
 * 
48
 * 
49
 * @author Jorge Piera Llodra (piera_jor@gva.es)
50
 */
51
public interface IProtocols {
52
/**
53
 * 
54
 * 
55
 * 
56
 * @return 
57
 * @param url 
58
 * @param message 
59
 * @param firstRecord 
60
 */
61
    public Collection doQuery(URL url, Object message, int firstRecord);
62
}
63

  
64

  
0 65

  
tags/v2_0_0_Build_2038/applications/appCatalog/src/org/gvsig/catalog/CatalogManager.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

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.catalog;
29

  
30
import java.lang.reflect.InvocationTargetException;
31
import java.net.URI;
32

  
33
import org.gvsig.catalog.drivers.ICatalogServiceDriver;
34
import org.gvsig.catalog.loaders.LayerLoader;
35
import org.gvsig.catalog.metadataxml.XMLNode;
36
import org.gvsig.catalog.schemas.Record;
37
import org.gvsig.catalog.schemas.Resource;
38

  
39
/**
40
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
41
 */
42
public interface CatalogManager {
43
	/**
44
	 * It is used to retrieve a driver that supports a concrete 
45
	 * protocol
46
	 * @param protocol
47
	 * Catalog protocol
48
	 * @return
49
	 * The concrete catalog service driver
50
	 */
51
	public ICatalogServiceDriver getDriver(String protocol);
52
	
53
	/**
54
	 * @return a list with all the catalog drivers
55
	 */
56
	public ICatalogServiceDriver[] getDrivers();
57
	
58
	/**
59
	 * This method is used to register a new catalog driver 
60
	 * that manage a concrete protocol
61
	 * @param driver
62
	 * Catalog driver to register
63
	 */
64
	public void register(String name, Class driver);
65
	
66
	/**
67
	 * Adds a new record
68
	 * @param record
69
	 * New record to add
70
	 */
71
	public void addRecord(Record record);	
72

  
73
	/**
74
	 * Try to identify the XML format and return a record
75
	 * @param uri
76
	 * Server URI (used to retrieve the images)
77
	 * @param node
78
	 * XML node
79
	 * @return
80
	 */
81
	public Record createRecord(URI uri, XMLNode node);
82
	
83
	public void addLayerLoader(String key, Class loader);
84
	
85
	public LayerLoader getLayerLoader(Resource resource) throws IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException;
86
		
87
		
88
}
89

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

Also available in: Unified diff