/**
 * Copyright 2009-2012 OpenAIRE PROJECT (Bielefeld University)
 * Original author: Marek Imialek <marek.imialek at uni-bielefeld.de>
 *
 * 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.udm.mocks;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.xml.ws.wsaddressing.W3CEndpointReference;

import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;

/**
 * @author <a href="mailto:marek.imialek at uni-bielefeld.de">Marek Imialek</a>
 *
 */

public class ISLookUpServiceMock implements ISLookUpService{

	public static final Map<String, String> repositories = 
		Collections.unmodifiableMap(new HashMap<String, String>() {
			private static final long serialVersionUID = 1L;
			{
				put("DummyRepository-1", "9a842020-b99f-45c1-a74b-a4d4f02baa65_" +
						"TURTdG9yZURTUmVzb3VyY2VzL01EU3RvcmVEU1Jlc291cmNlVHlwZQ==");
			}
		});
	
	@Override
	public Boolean flushCachedResultSets() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getCollection(String profId, String format)
			throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getResourceProfile(String profId) throws ISLookUpException,
			ISLookUpDocumentNotFoundException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getResourceProfileByQuery(String XQuery)
			throws ISLookUpException, ISLookUpDocumentNotFoundException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getResourceQoSParams(String id) throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getResourceTypeSchema(String resourceType)
			throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public W3CEndpointReference listCollections(String format, String idfather,
			String owner) throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public W3CEndpointReference listCommunities() throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<String> listDHNIDs() throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public W3CEndpointReference listMDStores(String metadataformat)
			throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public W3CEndpointReference listResourceProfiles(String resourceKind,
			String format, String resourceType) throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<String> listResourceTypes() throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<String> listServiceIDs(String serviceType)
			throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<String> listServiceTypes() throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<String> quickSearchProfile(String xquery)
			throws ISLookUpException {

		if (xquery.contains("RepositoryServiceResourceType"))
			 return new ArrayList<String>(repositories.keySet());
		
		Iterator<String> iter = repositories.keySet().iterator();
		while (iter.hasNext()) {
			String repoId = iter.next();
			String mdstoreId = repositories.get(repoId);
			if (xquery.contains(repoId))
				 return new ArrayList<String>(
						 Arrays.asList(
							"<DATA_SINK>dnet://MDStoreDS/"+mdstoreId+"?</DATA_SINK>"));
		}
		
		
		
		return null;
	}

	@Override
	public String retrieveCollection(String profId) throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public W3CEndpointReference searchProfile(String xquery)
			throws ISLookUpException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String identify() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void notify(String subscriptionId, String topic, String isId,
			String message) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void start() {
		// TODO Auto-generated method stub
		
	}

}
