Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libRemoteServices / src / org / gvsig / remoteClient / OGCProtocolHandler.java @ 4427

History | View | Annotate | Download (3.83 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.remoteClient;
42

    
43
import java.io.BufferedOutputStream;
44
import java.io.DataOutputStream;
45
import java.io.File;
46
import java.io.FileOutputStream;
47
import java.io.IOException;
48
import java.io.InputStream;
49
import java.net.ConnectException;
50
import java.net.URL;
51
import java.net.UnknownHostException;
52

    
53
public abstract class OGCProtocolHandler {
54
        /**
55
         * procotol handler name
56
         */
57
    protected String name;
58
    /**
59
     * protocol handler version
60
     */
61
    protected String version;
62
    /**
63
     * host of the WMS to connect
64
     */
65
    protected String host;
66
    /**
67
     *  port number of the comunication channel of the WMS to connect
68
     */
69
    protected String port;    
70
    
71
    /**
72
         * @return Returns the host.
73
         */
74
        public String getHost() {
75
                return host;
76
        }
77
        /**
78
         * @param host The host to set.
79
         */
80
        public void setHost(String host) {
81
                this.host = host;
82
        }
83
        /**
84
         * @return Returns the name.
85
         */
86
        public String getName() {
87
                return name;
88
        }
89
        /**
90
         * @param name The name to set.
91
         */
92
        public void setName(String name) {
93
                this.name = name;
94
        }
95
        /**
96
         * @return Returns the port.
97
         */
98
        public String getPort() {
99
                return port;
100
        }
101
        /**
102
         * @param port The port to set.
103
         */
104
        public void setPort(String port) {
105
                this.port = port;
106
        }
107
        /**
108
         * @return Returns the version.
109
         */
110
        public String getVersion() {
111
                return version;
112
        }
113
        /**
114
         * @param version The version to set.
115
         */
116
        public void setVersion(String version) {
117
                this.version = version;
118
        }
119

    
120
//        /**
121
//         * @deprectated 
122
//         * (temporarily)
123
//         */
124
//    protected File downloadFile(URL url, String fileName) throws IOException,ConnectException, UnknownHostException{
125
//        File f = null;
126
//
127
//        try{
128
//            f = TempFileManager.createTempFile(fileName, "tmp");
129
//            System.out.println("downloading '"+url.toString()+"' to: "+f.getAbsolutePath());
130
//             
131
//            f.deleteOnExit();
132
//            
133
//        } catch (IOException io) {
134
//            io.printStackTrace();
135
//        }
136
//        DataOutputStream dos = new DataOutputStream( new BufferedOutputStream(new FileOutputStream(f)));
137
//        byte[] buffer = new byte[1024*256];
138
//        InputStream is = url.openStream();
139
//        long readed = 0;
140
//        for (int i = is.read(buffer); i>0; i = is.read(buffer)){
141
//            dos.write(buffer, 0, i);
142
//            readed += i;
143
//        }
144
//        dos.close();
145
//        /*if (!isNotAnException(f))
146
//            // SI que es una excepci?n
147
//            throw new ServerErrorResponseException();*/
148
//        return f;
149
//    }
150

    
151
    
152
    /**
153
     * parses the data retrieved by the Capabilities XML document
154
     * 
155
     */
156
    public abstract boolean parseCapabilities(File f);
157

    
158
}