Revision 990 org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSProvider.java

View differences:

WMTSProvider.java
27 27
import java.awt.geom.Rectangle2D;
28 28
import java.io.File;
29 29
import java.io.IOException;
30
import java.net.ConnectException;
30 31
import java.net.MalformedURLException;
31 32
import java.net.URL;
32 33
import java.util.ArrayList;
33
import java.util.Hashtable;
34 34

  
35 35
import org.gvsig.compat.net.ICancellable;
36 36
import org.gvsig.fmap.dal.DALLocator;
......
117 117
	private static final double         MTS_X_GRADO              = 111319.490793274;
118 118
	
119 119
	private Extent                      viewRequest              = null;
120
	private static Hashtable<URL, WMTSConnector>    
121
	                                    drivers                  = new Hashtable<URL, WMTSConnector> ();
120
	private WMTSConnector               connector                = null;
121
	//private static Hashtable<URL, WMTSConnector>    
122
	//                                    drivers                  = new Hashtable<URL, WMTSConnector> ();
122 123
	private boolean                     open                     = false;
123 124
	private File                        lastRequest              = null;
124 125
	private DataStoreTransparency       lastFileTransparency     = null;
......
262 263
	 * @throws RemoteServiceException
263 264
	 */
264 265
	public WMTSConnector getConnector() throws WMTSException {
265
		WMTSDataParameters p = (WMTSDataParameters)parameters;
266
		URL url = null;
267
		try {
268
			url = new URL(p.getURI());
269
		} catch (Exception e) {
270
			throw new WMTSException("Malformed URL",e);
266
		if(connector == null) {
267
			WMTSDataParameters p = (WMTSDataParameters)parameters;
268
			URL url = null;
269
			try {
270
				url = new URL(p.getURI());
271
			} catch (Exception e) {
272
				throw new WMTSException("Malformed URL",e);
273
			}
274
			try {
275
				connector = new WMTSConnector(url);
276
			} catch (ConnectException e) {
277
				throw new WMTSException("Connect exception",e);
278
			} catch (IOException e) {
279
				throw new WMTSException("Connect exception",e);
280
			}
271 281
		}
272
		try {
273
			WMTSConnector con = WMTSProvider.getConnectorFromURL(url);
274
			return con;
275
		} catch (IOException e) {
276
			throw new WMTSException("Error getting the connector",e);
277
		}
282
		return connector;
278 283
	}
279
	
284

  
280 285
	/**
281 286
	 * Crea las referencias al fichero y carga
282 287
	 * las estructuras con la informaci?n y los metadatos.
......
333 338
		return tileMatrixSetLimits.size() <= 0 ? false : true; 
334 339
	}
335 340
	
336
	public static final WMTSConnector getConnectorFromURL(URL url) throws IOException {
341
	/*public static final WMTSConnector getConnectorFromURL(URL url) throws IOException {
337 342
		WMTSConnector drv = (WMTSConnector) drivers.get(url);
338 343
		if (drv == null) {
339 344
			drv = new WMTSConnector(url);
340 345
			drivers.put(url, drv);
341 346
		}
342 347
		return drv;
343
	}
348
	}*/
344 349
	
345 350
	/**
346 351
	 * Obtiene el objeto que contiene que contiene la interpretaci?n de

Also available in: Unified diff