001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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            public Hits search(SearchContext searchContext, Query query) {
047                    throw new UnsupportedOperationException();
048            }
049    
050            public Hits search(
051                    String searchEngineId, long companyId, Query query, Sort[] sort,
052                    int start, int end) {
053    
054                    throw new UnsupportedOperationException();
055            }
056    
057    }