001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.search;
016    
017    import com.liferay.portal.kernel.messaging.proxy.BaseMultiDestinationProxyBean;
018    import com.liferay.portal.kernel.messaging.proxy.ProxyRequest;
019    
020    /**
021     * @author Bruno Farache
022     * @author Tina Tian
023     * @author Raymond Aug??
024     */
025    public class IndexSearcherProxyBean
026            extends BaseMultiDestinationProxyBean implements IndexSearcher {
027    
028            @Override
029            public String getDestinationName(ProxyRequest proxyRequest) {
030                    Object[] arguments = proxyRequest.getArguments();
031    
032                    String searchEngineId = null;
033    
034                    if (arguments[0] instanceof SearchContext) {
035                            SearchContext searchContext = (SearchContext)arguments[0];
036    
037                            searchEngineId = searchContext.getSearchEngineId();
038                    }
039                    else {
040                            searchEngineId = (String)arguments[0];
041                    }
042    
043                    return SearchEngineUtil.getSearchReaderDestinationName(searchEngineId);
044            }
045    
046            @Override
047            public Hits search(SearchContext searchContext, Query query) {
048                    throw new UnsupportedOperationException();
049            }
050    
051            @Override
052            public Hits search(
053                    String searchEngineId, long companyId, Query query, Sort[] sort,
054                    int start, int end) {
055    
056                    throw new UnsupportedOperationException();
057            }
058    
059    }