/**
 * Copyright 2008-2009 DRIVER PROJECT (ICM UW)
 * Original author: Marek Horst
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package eu.dnetlib.data.index;

import java.util.ArrayList;
import java.util.List;

import javax.xml.ws.wsaddressing.W3CEndpointReference;

import eu.dnetlib.common.ws.dataprov.DataProviderException;
import eu.dnetlib.common.ws.dataprov.ResultsResponse;

/**
 * Dummy index service prepared for contracts specification
 * @author mhorst
 *
 */
//@Contract
public class DummyIndexService implements IIndexService {

	
	ResultsResponse dummyResultResponse;
	
	/* (non-Javadoc)
	 * @see eu.dnetlib.data.index.IIndexService#getBrowsingStatistics(java.lang.String, java.lang.String)
	 */
//	@Pre(message="Entry parameters 'query' and 'ixId' cannot be null!")
//	@Post(message="Result cannot be null!")
	public W3CEndpointReference getBrowsingStatistics(String query, String ixId,
			String mdFormatId, String layoutId) throws IndexServiceException {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see eu.dnetlib.data.index.IIndexService#getIndexStatistics(java.lang.String)
	 */
//	@Pre(message="Entry parameter 'ixId' cannot be null!")
//	@Post(message="Result cannot be null!")
	public String getIndexStatistics(String ixId) throws IndexServiceException {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see eu.dnetlib.data.index.IIndexService#getListOfIndices()
	 */
//	@Post(message="Result cannot be null!")
	public String[] getListOfIndices() {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see eu.dnetlib.data.index.IIndexService#getListOfIndicesCSV()
	 */
//	@Post(message="Result cannot be null!")
	public String getListOfIndicesCSV() {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see eu.dnetlib.data.index.IIndexService#identify()
	 */
//	@Post(value="$return != null && $return.length() > 0",
//		message="Result cannot be null or empty!")
	public String identify() {
		// TODO Auto-generated method stub
		return "";
	}

	/* (non-Javadoc)
	 * @see eu.dnetlib.data.index.IIndexService#indexLookup(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
	 */
//	@Pre(value="$args[0]!=null && $args[0].length()>0 && " +
//			"$args[1]!=null && $args[1].length()>0 && " +
//			"$args[2]!=null && $args[2].length()>0 && " +
//			"$args[3]!=null && $args[3].length()>0", 
//		message="Entry parameters cannot be null or empty!")
//	@Post(message="Result cannot be null!")
	public W3CEndpointReference indexLookup(String ixId, String query, String mdFormatId,
			String layoutId) throws IndexServiceException {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see eu.dnetlib.data.index.ws.nh.INotificationHandler#notify(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
	 */
//	@Pre(value="$args[0]!=null && $args[0].length()>0 && " +
//			"$args[1]!=null && $args[1].length()>0 && " +
//			"$args[2]!=null && $args[2].length()>0 && " +
//			"$args[3]!=null && $args[3].length()>0", 
//		message="Entry parameters cannot be null or empty!")
	public boolean notify(String subscrId, String topic, String isId,
			String message) {
		// TODO Auto-generated method stub
		return false;
	}

	/* (non-Javadoc)
	 * @see eu.dnetlib.data.index.ws.dataprov.IDataProvider#getBulkData(java.lang.String, int, int)
	 */
//	@Pre(value="bd_id != null && bd_id.length()>0 && " +
//			"fromPosition > 0 && toPosition > 0 && " +
//			"fromPosition <= toPosition",
//			message="Entry parameter 'bd_id' cannot be null, " +
//			"'fromPosition' and 'toPosition' must be > 0 and " +
//			"'fromPosition' must be less or equal to 'toPosition'!")
//	@Post(message="Result cannot be null!")
	public List<String> getBulkData(String bd_id,
			int fromPosition, int toPosition) throws DataProviderException {
		// TODO Auto-generated method stub
		List<String> list = new ArrayList<String>();
		list.add("someResult");
		return list;
	}

	/* (non-Javadoc)
	 * @see eu.dnetlib.data.index.ws.dataprov.IDataProvider#getNumberOfResults(java.lang.String)
	 */
//	@Pre(value="bd_id != null && bd_id.length()>0",
//			message="'bd_id' cannot be null or empty!")
//	@Post(value="$return != null && $return.total >= 0 &&" +
//			"$return.status != null && $return.status.length() > 0",
//			message="Result cannot be null, " +
//			"total must be non negative value, status cannot be null or empty!")
	public ResultsResponse getNumberOfResults(String bd_id)
			throws DataProviderException {
		// TODO Auto-generated method stub
		return dummyResultResponse;
	}

	/* (non-Javadoc)
	 * @see eu.dnetlib.data.index.ws.dataprov.IDataProvider#getSimpleBulkData(java.lang.String, int, int)
	 */
//	@Pre(value="bd_id != null && bd_id.length()>0 && " +
//			"fromPosition > 0 && toPosition > 0 && " +
//			"fromPosition <= toPosition",
//			message="Entry parameter 'bd_id' cannot be null, " +
//			"'fromPosition' and 'toPosition' must be > 0 and " +
//			"'fromPosition' must be less or equal to 'toPosition'!")
//	@Post(message="Result cannot be null!")
	public String[] getSimpleBulkData(String bd_id, int fromPosition,
			int toPosition) throws DataProviderException {
		// TODO Auto-generated method stub
		return new String[] {"someResult"};
	}

	public ResultsResponse getDummyResultResponse() {
		return dummyResultResponse;
	}

	public void setDummyResultResponse(ResultsResponse dummyResultResponse) {
		this.dummyResultResponse = dummyResultResponse;
	}

}
