Revision 1979 org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/org.gvsig.raster.wms.io/src/main/java/org/gvsig/raster/wms/io/WMSServerExplorer.java

View differences:

WMSServerExplorer.java
29 29

  
30 30
import java.awt.geom.Rectangle2D;
31 31
import java.io.IOException;
32
import java.io.InputStream;
33
import java.net.InetAddress;
34
import java.net.MalformedURLException;
32 35
import java.net.URL;
36
import java.net.URLConnection;
37
import java.net.UnknownHostException;
33 38
import java.util.ArrayList;
34 39
import java.util.Hashtable;
35 40
import java.util.List;
......
125 130
		return null;
126 131
	}
127 132

  
128
	@SuppressWarnings("unchecked")
129 133
	public List getDataStoreProviderNames() {
130 134
		return null;
131 135
	}
......
139 143
		return parameters;
140 144
	}
141 145

  
142
	@SuppressWarnings("unchecked")
143 146
	public List list() throws DataException {
144 147
		return null;
145 148
	}
146 149

  
147
	@SuppressWarnings("unchecked")
148 150
	public List list(int mode) throws DataException {
149 151
		return null;
150 152
	}
......
187 189
		}
188 190
		
189 191
	}
192
	
193
	/**
194
	 * Checks if the network and host are reachable
195
	 * @param timeout for the host
196
	 * @return true if both are reachable and false if they are not
197
	 */
198
	public boolean isHostReachable(int timeout) {
199
		URL url = null;
200
		try {
201
			url = new URL(parameters.getHost());
202
			URLConnection con = url.openConnection();
203
			if(con == null)
204
				return false;
205
			con.connect();
206
			InputStream stream = con.getInputStream();
207
			if(stream == null)
208
				return false;
209
		} catch (MalformedURLException e) {
210
			return false;
211
		} catch (IOException e) {
212
			return false;
213
		}
214
		
215
		return true;
216
	}
190 217

  
191 218
	/**
219
	 * Checks if the network and host are reachable
220
	 * @return true if both are reachable and false if they are not
221
	 */
222
	public boolean isHostReachable() {
223
		int timeout = 10000;
224
		return isHostReachable(timeout);
225
	}
226

  
227
	/**
192 228
	 * Returns true if this provider is connected to the server
193 229
	 * @return
194 230
	 */
......
267 303
	 * Gets the online resources
268 304
	 * @return
269 305
	 */
270
	@SuppressWarnings("unchecked")
271 306
	public Hashtable getOnlineResources() {
272 307
		if(connector != null) {
273 308
			return connector.getOnlineResources();

Also available in: Unified diff