package eu.dnetlib.contract.similarity.mocks;

import java.net.URL;
import java.util.List;

import javax.xml.ws.wsaddressing.W3CEndpointReference;

import org.apache.log4j.Logger;

import eu.dnetlib.data.utility.download.DownloadServiceException;
import eu.dnetlib.data.utility.download.IDownloadService;

/**
 * Download service mock.
 * Returns local path to predefined file.
 * @author mhorst
 *
 */
public class DownloadServiceMock implements IDownloadService {

	protected final Logger log = Logger.getLogger(this.getClass()); 
	
	private final String predefinedLocalLocation;
	
	public DownloadServiceMock() {
		String cpResource = "/eu/dnetlib/contract/similarity/mocks/fulltext_content.txt";
		URL fileURL = DownloadServiceMock.class.getResource(cpResource);
		predefinedLocalLocation = fileURL.getPath();
	}
	
	@Override
	public String downloadURL(String arg0) throws DownloadServiceException {
		log.info("getting predefined local location: " + predefinedLocalLocation + 
				" for parameter: " + arg0);
		return predefinedLocalLocation;
	}

	@Override
	public W3CEndpointReference downloadURLs(List<String> arg0)
			throws DownloadServiceException {
		throw new RuntimeException("Not implemented!");
	}

	@Override
	public W3CEndpointReference downloadURLsFromRS(W3CEndpointReference arg0)
			throws DownloadServiceException {
		throw new RuntimeException("Not implemented!");
	}

	@Override
	public String identify() {
		throw new RuntimeException("Not implemented!");
	}

}
