/**
 * 
 */
package eu.dnetlib.data.information;

import javax.xml.ws.wsaddressing.W3CEndpointReference;

import eu.dnetlib.data.mdstore.IMDStoreService;

/**
 * MdStore data source implementation
 * 
 * @author jochen
 *
 */
public class MDStoreDataSourceImpl implements DataSource {

	private IMDStoreService mdStoreService;
	private String mdId;
	private String from;
	
	/* (non-Javadoc)
	 * @see eu.dnetlib.data.information.DataSource#retrieve()
	 */
	@Override
	public W3CEndpointReference retrieve() throws DataSinkSourceException {
		try{
			return mdStoreService.deliverMDRecords(this.mdId, from, "", "", true);
		}catch(Exception e){
			throw new DataSinkSourceException(e);
		}
	}
	
	public void setMdStore(final IMDStoreService aMdStoreService, final String aMdId, final String aFrom){
		this.mdStoreService = aMdStoreService;
		this.mdId = aMdId;
		this.from = aFrom;
	}

	protected void setMdStoreService(IMDStoreService mdStoreService) {
		this.mdStoreService = mdStoreService;
	}

	protected IMDStoreService getMdStoreService() {
		return mdStoreService;
	}

	public String getMdId() {
		return mdId;
	}

	public void setMdId(String mdId) {
		this.mdId = mdId;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

}
