Index: WMSProvider.java
===================================================================
--- WMSProvider.java	(revision 4180)
+++ WMSProvider.java	(revision 4181)
@@ -28,6 +28,8 @@
 import java.awt.geom.Rectangle2D;
 import java.io.File;
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Hashtable;
 import java.util.List;
@@ -35,8 +37,10 @@
 
 import javax.swing.ImageIcon;
 
+import org.apache.commons.io.FilenameUtils;
 import org.cresques.cts.ICoordTrans;
 import org.cresques.cts.IProjection;
+
 import org.gvsig.compat.net.ICancellable;
 import org.gvsig.fmap.crs.CRSFactory;
 import org.gvsig.fmap.dal.DALLocator;
@@ -51,6 +55,7 @@
 import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException;
 import org.gvsig.fmap.dal.coverage.exception.InfoByPointException;
 import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException;
+import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException;
 import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException;
 import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
 import org.gvsig.fmap.dal.coverage.exception.QueryException;
@@ -61,6 +66,7 @@
 import org.gvsig.fmap.dal.coverage.store.props.HistogramComputer;
 import org.gvsig.fmap.dal.coverage.store.props.Transparency;
 import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
 import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
 import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
 import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
@@ -83,6 +89,7 @@
 import org.gvsig.remoteclient.utils.Utilities;
 import org.gvsig.remoteclient.wms.WMSStatus;
 import org.gvsig.tools.ToolsLocator;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 /**
@@ -97,7 +104,7 @@
 	private static final Logger         logger                    = LoggerFactory.getLogger(WMSProvider.class);
 	private static final int            FIXED_SIZE               = 800;
 	private Extent                      viewRequest              = null;
-	private static Hashtable<String, WMSConnector>    
+	private static Hashtable<String, WMSConnector>
 	                                    drivers                  = new Hashtable<String, WMSConnector> ();
 	private boolean                     open                     = false;
 	private DataStoreTransparency       fileTransparency         = null;
@@ -110,7 +117,7 @@
 	private File                        fileLayerPixelSize       = null;
 	private File                        lastRequest              = null;
 	private AbstractRasterProvider       lastRequestProvider      = null;
-	
+
 	public static void register() {
 		DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager();
 		if (dataman != null && !dataman.getStoreProviders().contains(NAME)) {
@@ -123,34 +130,62 @@
 		}
 		dataman.registerStoreFactory(NAME, DefaultStoreFactory.class);
 	}
-	
+
 	public WMSProvider() throws NotSupportedExtensionException {
 		super();
 	}
-	
+
 	public void registerTileProviderFormats(Class<RasterProvider> c) {
 
 	}
-	
+
 	/**
 	 * Constructor. Abre el dataset.
 	 * @param proj Proyección
 	 * @param fName Nombre del fichero
+	 * @throws OpenException
 	 * @throws NotSupportedExtensionException
+     * @deprecated use {@link #WMSProvider(URI)}, this constructor will be removed in gvSIG 2.5
 	 */
-	public WMSProvider(String params) throws InitializeException {
-		super(params);
-		if(params instanceof String) {
-			WMSDataParameters p = new WMSDataParametersImpl();
-			p.setURI((String)params);
-			super.init(p, null, ToolsLocator.getDynObjectManager()
-					.createDynObject(
-							MetadataLocator.getMetadataManager().getDefinition(
-									DataStore.METADATA_DEFINITION_NAME)));
-			init(p, null);
-		}
-	}
-	
+    public WMSProvider(String params) throws InitializeException, OpenException {
+        super(params);
+        logger.info("Deprecated use of WMSProvider constructor");
+        if (params instanceof String) {
+            WMSDataParameters p = new WMSDataParametersImpl();
+            try {
+                p.setURI(new URI((String) params));
+            } catch (URISyntaxException e) {
+                throw new OpenException("Can't create URI from" + (String) params, e);
+            }
+            super.init(
+                p,
+                null,
+                ToolsLocator.getDynObjectManager().createDynObject(
+                    MetadataLocator.getMetadataManager().getDefinition(DataStore.METADATA_DEFINITION_NAME)));
+            init(p, null);
+        }
+    }
+
+    /**
+     * Constructor. Abre el dataset.
+     * @param fName Nombre del fichero
+     * @throws OpenException
+     * @throws NotSupportedExtensionException
+     * @deprecated use {@link #WMSProvider(URI)}, this constructor will be removed in gvSIG 2.5
+     */
+    public WMSProvider(URI uri) throws InitializeException {
+        super(uri);
+        logger.info("Deprecated use of ErmapperProvider constructor");
+        WMSDataParameters p = new WMSDataParametersImpl();
+        p.setURI(uri);
+        super.init(
+            p,
+            null,
+            ToolsLocator.getDynObjectManager().createDynObject(
+                MetadataLocator.getMetadataManager().getDefinition(DataStore.METADATA_DEFINITION_NAME)));
+        init(p, null);
+    }
+
 	public WMSProvider(WMSDataParameters params,
 			DataStoreProviderServices storeServices) throws InitializeException {
 		super(params, storeServices, ToolsLocator.getDynObjectManager()
@@ -159,7 +194,7 @@
 								DataStore.METADATA_DEFINITION_NAME)));
 		init(params, storeServices);
 	}
-	
+
 	/**
 	 * Gets the connector from the URL
 	 * @return
@@ -169,7 +204,7 @@
 		WMSDataParameters p = (WMSDataParameters)parameters;
 		URL url = null;
 		try {
-			url = new URL(p.getURI());
+			url =p.getURI().toURL();
 		} catch (Exception e) {
 			throw new RemoteServiceException("Malformed URL",e);
 		}
@@ -179,7 +214,7 @@
 			throw new RemoteServiceException("Error getting the connector",e);
 		}
 	}
-	
+
 	/**
 	 * Crea las referencias al fichero y carga
 	 * las estructuras con la información y los metadatos.
@@ -199,15 +234,15 @@
 			throw new InitializeException(e.getMessage(), e);
 		}
 	}
-	
+
 	/**
-	 * When a WMS provider is opened the information of data type, number of bands and transparency 
+	 * When a WMS provider is opened the information of data type, number of bands and transparency
 	 * is not available. Only after the first time a raster has been downloaded it can be know.
 	 * @param newDataType
 	 * @param buf
 	 * @param bandList
 	 * @return
-	 * @throws RasterDriverException 
+	 * @throws RasterDriverException
 	 */
 	private void loadInitialInfo() throws RasterDriverException {
 		WMSDataParametersImpl p = (WMSDataParametersImpl)parameters;
@@ -233,7 +268,7 @@
 			}
 		}
 		WMSStatus wmsStatus = loadWMSStatus(bBox);
-		
+
 		lastRequest = downloadFile(wmsStatus, ext.getULX(), ext.getULY(), ext.getLRX(), ext.getLRY(), w, h);
 		AbstractRasterProvider driver;
 		try {
@@ -252,7 +287,7 @@
 			throw new RasterDriverException("", e);
 		}
 	}
-	
+
 	public static final WMSConnector getConnectorFromURL(URL url, boolean updating) throws IOException {
 		WMSConnector drv = null;
 		if(!updating) {
@@ -261,15 +296,15 @@
 			if(drivers.get(url.toString()) != null)
 				drivers.remove(url.toString());
 		}
-		
+
 		if (drv == null) {
 			drv = new WMSConnector(url);
 			drivers.put(url.toString(), drv);
 		}
-		
+
 		return drv;
 	}
-	
+
 	/**
 	 * Obtiene el objeto que contiene que contiene la interpretación de
 	 * color por banda
@@ -288,7 +323,7 @@
 		}
 		return super.getColorInterpretation();
 	}
-	
+
 	public AffineTransform getAffineTransform() {
 		WMSDataParameters p = (WMSDataParameters)parameters;
 		if(p.isSizeFixed()) {
@@ -296,10 +331,10 @@
 			double psX = e.width() / (p.getWidth() - 1);
 			double psY = -(e.height() / (p.getHeight() - 1));
 			ownTransformation = new AffineTransform(
-					psX , 
-					0, 
-					0, 
-					psY, 
+					psX ,
+					0,
+					0,
+					psY,
 					e.getULX() - (psX / 2),
 					e.getULY() - (psY / 2));
 		} else {
@@ -307,9 +342,9 @@
 			double psX = bbox.getWidth() / p.getWidth();
 			double psY = -(bbox.getHeight() / p.getHeight());
 			ownTransformation = new AffineTransform(
-					psX, 
-					0, 
-					0, 
+					psX,
+					0,
+					0,
 					psY,
 					bbox.getX(),
 					(bbox.getY()+bbox.getHeight())); // FIXME: check for other CRSs such as 4326
@@ -317,7 +352,7 @@
 		externalTransformation = (AffineTransform) ownTransformation.clone();
 		return ownTransformation;
 	}
-	
+
 	/**
 	 * Calcula el extent en coordenadas del mundo real
 	 * @return Extent
@@ -325,7 +360,7 @@
 	public Extent getExtent() {
 		WMSDataParameters p = (WMSDataParameters)parameters;
 		Vector<?> layerNames = Utilities.createVector(p.getLayerQuery(), ",");
-		
+
 		String[] ln = new String[layerNames.size()];
 		for (int i = 0; i < ln.length; i++) {
 			ln[i] = (String)layerNames.get(i);
@@ -339,7 +374,7 @@
 				if (r == null) {
 					r = getConnector().getLayersExtent(ln, "CRS:84");
 				}
-				
+
 				IProjection reqProj = CRSFactory.getCRS(p.getSRSCode());
 				IProjection latLonProj = CRSFactory.getCRS(latLonID);
 				if ((reqProj != null) && (latLonProj != null)) {
@@ -362,7 +397,7 @@
 	public RasterProvider load() {
 		return this;
 	}
-	
+
 	public boolean isOpen() {
 		return open;
 	}
@@ -370,15 +405,15 @@
 	public void close() {
 		open = false;
 	}
-	
+
 	public Transparency getTransparency() {
 		if(fileTransparency == null)
 			fileTransparency = new DataStoreTransparency(getColorInterpretation());
 		return fileTransparency;
 	}
 
-	public String translateFileName(String fileName) {
-		return fileName;
+	public URI translateURI(URI uri) {
+		return uri;
 	}
 
 	public void setView(Extent e) {
@@ -388,7 +423,7 @@
 	public Extent getView() {
 		return viewRequest;
 	}
-	
+
 	public double getWidth() {
 		WMSDataParameters p = (WMSDataParameters)parameters;
 		return p.getWidth();
@@ -398,7 +433,7 @@
 		WMSDataParameters p = (WMSDataParameters)parameters;
 		return p.getHeight();
 	}
-	
+
 	/**
 	 * Gets WMS parameters
 	 * @return
@@ -411,9 +446,9 @@
 		throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
 		return null;
 	}
-	
+
 	/**
-	 * When the remote layer has fixed size this method downloads the file and return its reference. 
+	 * When the remote layer has fixed size this method downloads the file and return its reference.
 	 * File layer has in the long side FIXED_SIZE pixels and the bounding box is complete. This file could be
 	 * useful to build an histogram or calculate statistics. This represents a sample of data.
 	 * @return
@@ -422,12 +457,12 @@
 	public File getFileLayer() throws RasterDriverException {
 		if(fileLayerPixelSize != null)
 			return fileLayerPixelSize;
-		
+
 		WMSDataParameters p = (WMSDataParameters)parameters;
 		Extent e = getExtent();
 		Rectangle2D bBox = new Rectangle2D.Double(e.getULX(), e.getLRY(), e.width(), e.height());
 		WMSStatus wmsStatus = loadWMSStatus(bBox);
-		
+
 		if(!p.isSizeFixed()) {
 			int w = 0;
 			int h = 0;
@@ -442,7 +477,7 @@
 			wmsStatus.setHeight(h);
 			fileLayerPixelSize = downloadFile(wmsStatus, e.getULX(), e.getULY(), e.getLRX(), e.getLRY(), w, h);
 		} else {
-			fileLayerPixelSize = downloadFile(wmsStatus, e.getULX(), e.getULY(), e.getLRX(), e.getLRY(), 
+			fileLayerPixelSize = downloadFile(wmsStatus, e.getULX(), e.getULY(), e.getLRX(), e.getLRY(),
 					p.getFixedSize().width, p.getFixedSize().height);
 		}
 		return fileLayerPixelSize;
@@ -452,8 +487,8 @@
 	 * Reads a complete block of data and returns an tridimensional array of the right type. This function is useful
 	 * to read a file very fast without setting a view. In a WMS service when the size is fixed then it will read the
 	 * entire image but when the source hasn't pixel size it will read a sample of data. This set of data will have
-	 * the size defined in FIXED_SIZE. 
-	 * 
+	 * the size defined in FIXED_SIZE.
+	 *
 	 * @param pos Posición donde se empieza  a leer
 	 * @param blockHeight Altura máxima del bloque leido
 	 * @return Object que es un array tridimendional del tipo de datos del raster. (Bandas X Filas X Columnas)
@@ -461,7 +496,7 @@
 	 * @throws FileNotOpenException
 	 * @throws RasterDriverException
 	 */
-	public Object readBlock(int pos, int blockHeight, double scale) 
+	public Object readBlock(int pos, int blockHeight, double scale)
 	throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException {
 		File lastFile = getFileLayer();
 		BandList bandList = new BandListImpl();
@@ -482,7 +517,7 @@
 			throw new RasterDriverException("Error building GdalDriver", exc);
 		}
 	}
-	
+
 	public double getLastRequestHeight() throws RasterDriverException {
 		if(lastRequestProvider == null) {
 			try {
@@ -495,7 +530,7 @@
 		}
 		return lastRequestProvider.getHeight();
 	}
-	
+
 	public double getLastRequestWidth() throws RasterDriverException {
 		if(lastRequestProvider == null) {
 			try {
@@ -508,11 +543,11 @@
 		}
 		return lastRequestProvider.getWidth();
 	}
-	
+
 	public File getLastRequest() {
 		return lastRequest;
 	}
-	
+
 	public Buffer getBufferLastRequest() throws ProcessInterruptedException, RasterDriverException {
 		try {
 			lastRequestProvider = openLastRequest();
@@ -525,7 +560,7 @@
 			throw new RasterDriverException("Error building GdalDriver", e);
 		}
 	}
-	
+
 	/**
 	 * Opens the last request downloaded
 	 * @return
@@ -546,7 +581,7 @@
 		throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
 		return null;
 	}
-	
+
 	/**
 	 * Gets the georeferencing file name form a raster file
 	 * @param file
@@ -554,15 +589,15 @@
 	 * @return
 	 * a georeferencing file
 	 */
-	private String getWorldFile(String file){		
+	private String getWorldFile(String file){
 		String worldFile = file;
 		int index = file.lastIndexOf(".");
-		if (index > 0){			
+		if (index > 0){
 			worldFile = file.substring(0, index) + getExtensionWorldFile();
 		}
 		return worldFile;
 	}
-	
+
 	/**
 	 * Obtiene la extensión del fichero de georreferenciación
 	 * @return String con la extensión del fichero de georreferenciación dependiendo
@@ -576,7 +611,7 @@
 		}
 		return extWorldFile;
 	}
-	
+
 	public WMSStatus loadWMSStatus(Rectangle2D bBox) {
 		WMSDataParameters p = (WMSDataParameters)parameters;
 		WMSStatus wmsStatus = new WMSStatus();
@@ -585,7 +620,7 @@
 		wmsStatus.setFormat(p.getFormat());
 		wmsStatus.setInfoFormat(p.getInfoFormat());
 		List<RemoteWMSStyle> listStyles = p.getStyles();
-		Vector<?> v = listStyles != null ? new Vector<RemoteWMSStyle>(listStyles) : null; 
+		Vector<?> v = listStyles != null ? new Vector<RemoteWMSStyle>(listStyles) : null;
 		wmsStatus.setStyles(v);
 		wmsStatus.setDimensions(p.getDimensions());
 		wmsStatus.setTransparency(p.isWmsTransparent());
@@ -602,7 +637,7 @@
 			wmsStatus.setProjected(proj.isProjected());
 		return wmsStatus;
 	}
-	
+
 	/**
 	 * This function downloads the file and creates the georeferencing file
 	 * @param wmsStatus
@@ -622,10 +657,10 @@
 		} catch (RemoteServiceException e) {
 			throw new RasterDriverException(e.getMessage(), e);
 		}
-		
+
 		if(lastRequest == null)
 			return null;
-		
+
 		String nameWorldFile = getWorldFile(lastRequest.getPath());
 		try {
 			if(p.isSizeFixed()) {
@@ -640,27 +675,27 @@
 
 		return lastRequest;
 	}
-	
+
 	@Override
-	public void loadBuffer(SpiRasterQuery q) 
+	public void loadBuffer(SpiRasterQuery q)
 			throws ProcessInterruptedException, RasterDriverException {
 		Extent bbox = q.getRequestBoundingBox();
 		lastWidthRequest = q.getBufWidth();
 		lastHeightRequest = q.getBufHeight();
 		WMSStatus wmsStatus = loadWMSStatus(bbox.toRectangle2D());
-		
-		lastRequest = downloadFile(wmsStatus, 
-				bbox.getULX(), 
-				bbox.getULY(), 
-				bbox.getLRX(), 
-				bbox.getLRY(), 
-				q.getBufWidth(), 
+
+		lastRequest = downloadFile(wmsStatus,
+				bbox.getULX(),
+				bbox.getULY(),
+				bbox.getLRX(),
+				bbox.getLRY(),
+				q.getBufWidth(),
 				q.getBufHeight());
-		
+
 		if (lastRequest == null) {
 			return;
 		}
-		
+
 		Buffer b = null;
 		try {
 			b = getDownloadedRaster(lastRequest);
@@ -673,13 +708,13 @@
 		}
 		q.setBufferResult(b);
 	}
-	
+
 	private Buffer getDownloadedRaster(File f) throws ProcessInterruptedException, QueryException, ProviderNotRegisteredException, InitializeException {
 		AbstractRasterProvider provider = DefaultProviderServices.loadProvider(new File(f.getPath()));
 		setColorTable(provider.getColorTable());
 		return getDownloadedRaster(provider);
 	}
-	
+
 	private Buffer getDownloadedRaster(AbstractRasterProvider provider) throws ProcessInterruptedException, QueryException, ProviderNotRegisteredException, InitializeException {
 		DefaultRasterStore store = new DefaultRasterStore();
 		store.setProvider(provider);
@@ -690,15 +725,15 @@
 			q.setDrawableBands(getColorInterpretation().buildRenderBands());
 		if(store.getBandCount() > 3)
 			q.forceARGBRequest();
-		else 
+		else
 			q.forceRGBRequest();
-		
+
 		Buffer buf = store.query(q);
 
 		store.close();
 		return buf;
 	}
-	
+
 	/**
 	 * Assigns the list of bands RGB and read a window of data
 	 * @param rasterBuf
@@ -712,7 +747,7 @@
 	 * @throws RasterDriverException
 	 * @throws ProcessInterruptedException
 	 */
-	/*public Buffer getBuffer(Buffer rasterBuf, BandList bandList, File lastFile, 
+	/*public Buffer getBuffer(Buffer rasterBuf, BandList bandList, File lastFile,
 			double ulx, double uly, double lrx, double lry) throws RasterDriverException, ProcessInterruptedException {
 		try {
 			//El nombre de fichero que ha puesto en el bandList es el del servidor y no el del fichero en disco
@@ -720,20 +755,20 @@
 			for (int i = 0; i < bandList.getBandCount(); i++) {
 				bandList.getBand(i).setFileName(lastFile.getPath());
 			}
-			
+
 			AbstractRasterProvider driver = DefaultProviderServices.loadProvider(new File(lastFile.getPath()));
 			setColorTable(driver.getColorTable());
-			
+
 			DefaultRasterQuery q = (DefaultRasterQuery)RasterLocator.getManager().createQuery();
 			q.setAreaOfInterest(new ExtentImpl(ulx, uly, lrx, lry));
 			q.setBandList(bandList);
 			q.setBuffer(rasterBuf);
 			Buffer buf = driver.getDataSet(q);
-			
+
 			for (int i = 0; i < bandList.getBandCount(); i++) {
 				bandList.getBand(i).setFileName(serverName);
 			}
-			
+
 			return buf;
 		} catch (ProviderNotRegisteredException e) {
 			throw new RasterDriverException("Error building GdalDriver", e);
@@ -741,8 +776,8 @@
 			throw new RasterDriverException("Error building GdalDriver", e);
 		}
 	}*/
-	
-	/*public void getWindow(Extent ex, int bufWidth, int bufHeight, 
+
+	/*public void getWindow(Extent ex, int bufWidth, int bufHeight,
 			BandList bandList, TileListener listener, TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
 
 		Buffer raster = DefaultRasterManager.getInstance().createBuffer(getDataType()[0], bufWidth, bufHeight, 3, true);
@@ -766,35 +801,35 @@
 		listener.endReading();
 	}*/
 
-	/*public Buffer getWindow(Extent ex, BandList bandList, Buffer rasterBuf, TaskStatus status) 
+	/*public Buffer getWindow(Extent ex, BandList bandList, Buffer rasterBuf, TaskStatus status)
 		throws ProcessInterruptedException, RasterDriverException {
 		Rectangle2D bBox = ex.toRectangle2D();
 		lastWidthRequest = rasterBuf.getWidth();
 		lastHeightRequest = rasterBuf.getHeight();
 		WMSStatus wmsStatus = loadWMSStatus(bBox);
-		
+
 		lastRequest = downloadFile(wmsStatus, ex.getULX(), ex.getULY(), ex.getLRX(), ex.getLRY(), rasterBuf.getWidth(), rasterBuf.getHeight());
-		
+
 		if (lastRequest == null) {
 			return rasterBuf;
 		}
-		
+
 		try {
 			//El nombre de fichero que ha puesto en el bandList es el del servidor y no el del fichero en disco
 			String serverName = bandList.getBand(0).getFileName();
 			for (int i = 0; i < bandList.getBandCount(); i++) {
 				bandList.getBand(i).setFileName(lastRequest.getPath());
 			}
-			
+
 			AbstractRasterProvider driver = DefaultProviderServices.loadProvider(new File(lastRequest.getPath()));
 			setColorTable(driver.getColorTable());
-			
+
 			DefaultRasterQuery q = (DefaultRasterQuery)RasterLocator.getManager().createQuery();
 			q.setAreaOfInterest(ex);
 			q.setBandList(bandList);
 			q.setBuffer(rasterBuf);
 			Buffer buf = driver.getDataSet(q);
-			
+
 			for (int i = 0; i < bandList.getBandCount(); i++) {
 				bandList.getBand(i).setFileName(serverName);
 			}
@@ -807,41 +842,41 @@
 		}
 	}*/
 
-	/*public Buffer getWindow(double ulx, double uly, double w, double h, 
+	/*public Buffer getWindow(double ulx, double uly, double w, double h,
 			BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
 		Rectangle2D bBox = new Rectangle2D.Double(ulx, uly, w, h);
 		lastWidthRequest = rasterBuf.getWidth();
 		lastHeightRequest = rasterBuf.getHeight();
 		WMSStatus wmsStatus = loadWMSStatus(bBox);
-		
+
 		lastRequest = downloadFile(wmsStatus, ulx, uly, ulx + w, uly - h, rasterBuf.getWidth(), rasterBuf.getHeight());
-		
+
 		if (lastRequest == null) {
 			return rasterBuf;
 		}
-		
+
 		try {
 			//El nombre de fichero que ha puesto en el bandList es el del servidor y no el del fichero en disco
 			String serverName = bandList.getBand(0).getFileName();
 			for (int i = 0; i < bandList.getBandCount(); i++) {
 				bandList.getBand(i).setFileName(lastRequest.getPath());
 			}
-			
+
 			AbstractRasterProvider driver = DefaultProviderServices.loadProvider(new File(lastRequest.getPath()));
 			setColorTable(driver.getColorTable());
-			
+
 			DefaultRasterQuery q = (DefaultRasterQuery)RasterLocator.getManager().createQuery();
 			q.setAreaOfInterest(ulx, uly, w, h);
 			q.setBandList(bandList);
 			q.setBuffer(rasterBuf);
 			q.setAdjustToExtent(adjustToExtent);
-			
+
 			Buffer buf = driver.getDataSet(q);
-			
+
 			for (int i = 0; i < bandList.getBandCount(); i++) {
 				bandList.getBand(i).setFileName(serverName);
 			}
-			
+
 			return buf;
 		} catch (ProviderNotRegisteredException e) {
 			throw new RasterDriverException("Error building GdalDriver", e);
@@ -850,28 +885,28 @@
 		}
 	}*/
 
-	/*public Buffer getWindow(Extent extent, int bufWidth, int bufHeight, 
+	/*public Buffer getWindow(Extent extent, int bufWidth, int bufHeight,
 			BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
 		Rectangle2D bBox = extent.toRectangle2D();//new Rectangle2D.Double(ulx, lry, Math.abs(lrx - ulx), Math.abs(lry - uly));
 		lastWidthRequest = rasterBuf.getWidth();
 		lastHeightRequest = rasterBuf.getHeight();
 		WMSStatus wmsStatus = loadWMSStatus(bBox);
 		lastRequest = downloadFile(wmsStatus, extent.getULX(), extent.getULY(), extent.getLRX(), extent.getLRY(), rasterBuf.getWidth(), rasterBuf.getHeight());
-		
+
 		if (lastRequest == null) {
 			return rasterBuf;
 		}
-		
+
 		try {
 			//El nombre de fichero que ha puesto en el bandList es el del servidor y no el del fichero en disco
 			String serverName = bandList.getBand(0).getFileName();
 			for (int i = 0; i < bandList.getBandCount(); i++) {
 				bandList.getBand(i).setFileName(lastRequest.getPath());
 			}
-			
+
 			AbstractRasterProvider driver = DefaultProviderServices.loadProvider(new File(lastRequest.getPath()));
 			setColorTable(driver.getColorTable());
-			
+
 			DefaultRasterQuery q = (DefaultRasterQuery)RasterLocator.getManager().createQuery();
 			q.setAreaOfInterest(extent, bufWidth, bufHeight);
 			q.setBandList(bandList);
@@ -882,7 +917,7 @@
 			for (int i = 0; i < bandList.getBandCount(); i++) {
 				bandList.getBand(i).setFileName(serverName);
 			}
-			
+
 			return buf;
 		} catch (ProviderNotRegisteredException e) {
 			throw new RasterDriverException("Error building GdalDriver", e);
@@ -891,7 +926,7 @@
 		}
 	}*/
 
-//	public Buffer getWindow(int x, int y, 
+//	public Buffer getWindow(int x, int y,
 //			BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException {
 //		int w = rasterBuf.getWidth();
 //		int h = rasterBuf.getHeight();
@@ -901,9 +936,9 @@
 //		lastHeightRequest = rasterBuf.getHeight();
 //		Rectangle2D bBox = new Rectangle2D.Double(p1.getX(), p1.getY(), Math.abs(p1.getX() - p1.getX()), Math.abs(p1.getY() - p2.getY()));
 //		WMSStatus wmsStatus = loadWMSStatus(bBox);
-//		
+//
 //		lastRequest = downloadFile(wmsStatus, p1.getX(), p1.getY(), p2.getX(), p2.getY(), rasterBuf.getWidth(), rasterBuf.getHeight());
-//		
+//
 //		if (lastRequest == null) {
 //			return rasterBuf;
 //		}
@@ -915,14 +950,14 @@
 //			for (int i = 0; i < bandList.getBandCount(); i++) {
 //				bandList.getBand(i).setFileName(lastRequest.getPath());
 //			}
-//			
+//
 //			driver = DefaultProviderServices.loadProvider(new File(lastRequest.getPath()));
 //			Buffer buf = driver.getWindow(0, 0, w, h, bandList, rasterBuf);
 //
 //			for (int i = 0; i < bandList.getBandCount(); i++) {
 //				bandList.getBand(i).setFileName(serverName);
 //			}
-//			
+//
 //			return buf;
 //		} catch (ProviderNotRegisteredException e) {
 //			throw new RasterDriverException("Error building GdalDriver", e);
@@ -931,7 +966,7 @@
 //		}
 //	}
 
-	/*public Buffer getWindow(int x, int y, int w, int h, 
+	/*public Buffer getWindow(int x, int y, int w, int h,
 			BandList bandList, Buffer rasterBuf, TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
 		Point2D p1 = rasterToWorld(new Point2D.Double(x, y));
 		Point2D p2 = rasterToWorld(new Point2D.Double(x + w, y + h));
@@ -939,9 +974,9 @@
 		lastHeightRequest = rasterBuf.getHeight();
 		Rectangle2D bBox = new Rectangle2D.Double(p1.getX(), p1.getY(), Math.abs(p1.getX() - p1.getX()), Math.abs(p1.getY() - p2.getY()));
 		WMSStatus wmsStatus = loadWMSStatus(bBox);
-		
+
 		lastRequest = downloadFile(wmsStatus, p1.getX(), p1.getY(), p2.getX(), p2.getY(), rasterBuf.getWidth(), rasterBuf.getHeight());
-		
+
 		if (lastRequest == null) {
 			return rasterBuf;
 		}
@@ -953,10 +988,10 @@
 			for (int i = 0; i < bandList.getBandCount(); i++) {
 				bandList.getBand(i).setFileName(lastRequest.getPath());
 			}
-			
+
 			driver = DefaultProviderServices.loadProvider(new File(lastRequest.getPath()));
 			setColorTable(driver.getColorTable());
-			
+
 			DefaultRasterQuery q = (DefaultRasterQuery)RasterLocator.getManager().createQuery();
 			q.setAreaOfInterest(0, 0, w, h);
 			q.setBandList(bandList);
@@ -966,7 +1001,7 @@
 			for (int i = 0; i < bandList.getBandCount(); i++) {
 				bandList.getBand(i).setFileName(serverName);
 			}
-			
+
 			return buf;
 		} catch (ProviderNotRegisteredException e) {
 			throw new RasterDriverException("Error building GdalDriver", e);
@@ -996,7 +1031,7 @@
 	}
 
 	public void setAffineTransform(AffineTransform t){
-		
+
 	}
 
 	public int getOverviewCount(int band) throws BandAccessException, RasterDriverException {
@@ -1022,15 +1057,15 @@
 	public String getProviderName() {
 		return NAME;
 	}
-        
+
 	public String getName() {
 		return this.getParameters().getName();
 	}
-        
+
 	public String getFullName() {
-		return this.uri;
+		return getURI().getPath();
 	}
-	
+
 	/**
 	 * Convierte un punto desde coordenadas pixel a coordenadas del mundo.
 	 * @param pt Punto a transformar
@@ -1056,12 +1091,12 @@
 		}
 		return p;
 	}
-	
+
 	public void setStatus(RasterProvider provider) {
 		if(provider instanceof WMSProvider) {
 		}
 	}
-	
+
 	/**
 	 * ASigna el parámetro de inicialización del driver.
 	 */
@@ -1070,9 +1105,9 @@
 			this.uri = ((WMSDataParameters)param).getURI();
 		this.param = param;
 	}
-        
-        
-	
+
+
+
 	public String getInfoByPoint(int x, int y, Extent bbox, int w, int h, ICancellable cancellable) throws InfoByPointException {
 		WMSDataParameters p = (WMSDataParameters)parameters;
 		WMSStatus wmsStatus = new WMSStatus();
@@ -1097,7 +1132,7 @@
 			throw new InfoByPointException("Error in getFeatureInfo", e);
 		}
 	}
-	
+
 	/**
 	 * Gets the suffix of the downloaded image
 	 * @return
@@ -1110,10 +1145,10 @@
 		}
 		if (format.indexOf("png") >= 0){
 	        return "png";
-		}	
+		}
 	    if (format.indexOf("xml") >= 0){
 	        return "xml";
-	    }	
+	    }
 	    if (format.indexOf("gif") >= 0){
 	        return "gif";
 	    }
@@ -1125,11 +1160,11 @@
 	    }
 	    if (format.indexOf("jpg") >= 0
 	        || format.indexOf("jpeg") >= 0){
-	        return "jpg";			 
+	        return "jpg";
 	    }
 		return "xml";
 	}
-	
+
 	public TileServer getTileServer() {
 		if(tileServer == null) {
 			DefaultRasterStore store = new DefaultRasterStore();
@@ -1138,7 +1173,7 @@
 		}
 		return tileServer;
 	}
-	
+
 	public boolean isRasterEnclosed() {
 		WMSDataParameters p = (WMSDataParameters)parameters;
 		if(p.isSizeFixed()) {
@@ -1146,16 +1181,32 @@
 		}
 		return true;
 	}
-	
-	public String getRMFFile() {
+
+	public File getRMFFile() {
 		if(lastRequest != null)
-			return fileUtil.getNameWithoutExtension(lastRequest.getAbsolutePath()) + ".rmf";
+		    return new File(FilenameUtils.removeExtension(lastRequest.getAbsolutePath()) + ".rmf");
 		return null;
 	}
-	
+
 	public HistogramComputer getHistogramComputer() {
 		if (histogram == null)
 			histogram = new RemoteStoreHistogram(this);
 		return histogram;
 	}
+
+    /* (non-Javadoc)
+     * @see org.gvsig.raster.impl.provider.RasterProvider#addFile(java.io.File)
+     */
+    @Override
+    public void addFile(File file) throws InvalidSourceException {
+        //do nothing
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.raster.impl.provider.RasterProvider#removeFile(java.io.File)
+     */
+    @Override
+    public void removeFile(File file) {
+        //do nothing
+    }
 }
\ No newline at end of file
