Return-Path: Delivered-To: apmail-lucene-solr-dev-archive@minotaur.apache.org Received: (qmail 92165 invoked from network); 13 Jul 2009 04:22:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jul 2009 04:22:50 -0000 Received: (qmail 27562 invoked by uid 500); 13 Jul 2009 04:22:59 -0000 Delivered-To: apmail-lucene-solr-dev-archive@lucene.apache.org Received: (qmail 27475 invoked by uid 500); 13 Jul 2009 04:22:59 -0000 Mailing-List: contact solr-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-dev@lucene.apache.org Delivered-To: mailing list solr-dev@lucene.apache.org Received: (qmail 27465 invoked by uid 99); 13 Jul 2009 04:22:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2009 04:22:59 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=FS_REPLICA,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of noble.paul@gmail.com designates 209.85.198.236 as permitted sender) Received: from [209.85.198.236] (HELO rv-out-0506.google.com) (209.85.198.236) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2009 04:22:51 +0000 Received: by rv-out-0506.google.com with SMTP id b25so599278rvf.5 for ; Sun, 12 Jul 2009 21:22:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:reply-to:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:content-type:content-transfer-encoding; bh=MvhQF/Tyfu4ghPsvZNsuHInFSNDx83oC2zZHwWP6k4I=; b=rdx7lmn1pH8bxp/p8qAe38kvqWtJ8wanQs63CxklwSuyXqRPyeY0ozK6yGdW5Ioalk p5gCXluf1s943R+mZQF89w44mH+SEJNLEP87kyhGIKG9kpZk07DhuePns0M3tHdumc0j fEFsVd/tclJYYggmRHv3zuAZtHX6TritBHghE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :content-transfer-encoding; b=srih7Zc+ImYGZuTymjzmsWA6cHxRgp2kEgs6YUPPyGHZk8Weu8BPN2msBeNZn0Y/c1 W5Wlgsv37kSJujeqWfcxTdZlrUoNg2Wxp0ocXCZLZKOj+7V/F0QLzgDRWmwrbMP3rxqa bB2QrsDdpw7oYqRSDLbhS215i3obI0U2EmKdc= MIME-Version: 1.0 Sender: noble.paul@gmail.com Reply-To: noble.paul@gmail.com Received: by 10.140.170.12 with SMTP id s12mr2373563rve.278.1247458951076; Sun, 12 Jul 2009 21:22:31 -0700 (PDT) In-Reply-To: <74334911-CE2F-41CB-80C6-8F32C2ECB6CC@ehatchersolutions.com> References: <20090710100430.20C13238887A@eris.apache.org> <74334911-CE2F-41CB-80C6-8F32C2ECB6CC@ehatchersolutions.com> From: =?UTF-8?B?Tm9ibGUgUGF1bCDgtKjgtYvgtKzgtL/gtLPgtY3igI0gIOCkqOCli+CkrOCljeCks+CljQ==?= Date: Mon, 13 Jul 2009 09:52:11 +0530 X-Google-Sender-Auth: 380c66f97a85145a Message-ID: <5e76b0ad0907122122l61d64cdes5d16bd8cea1d34b9@mail.gmail.com> Subject: Re: svn commit: r792861 - in /lucene/solr/trunk/src: java/org/apache/solr/core/RequestHandlers.java java/org/apache/solr/core/SolrCore.java webapp/web/admin/index.jsp webapp/web/admin/replication/header.jsp To: solr-dev@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Sat, Jul 11, 2009 at 7:15 PM, Erik Hatcher w= rote: > Also, may want to use instanceof instead of =3D=3D for class comparison, = in case > subclasses are used. should we do that ? I did it intentionally. The user who makes that call knows the class of the handler. If there is another handler which extends the class he may get that instance which may not be desirable > > =A0 =A0 =A0 =A0Erik > > On Jul 10, 2009, at 3:06 PM, Chris Hostetter wrote: > >> >> Dude .... you've got to at least run "ant test" before you commit ... >> TestWriterPerf can't even compile now. >> >> This breaks anyone that was explicitly passing null to the existing >> getRequestHandler(String) method (like TestWriterPerf) ... but besides >> that it also seems really weird to have a method that takes in a class a= nd >> arbitrarily returns the first instance of that class found -- especially >> since it's iterating over the values in a Map, so if someone has multipl= e >> instances of a handler they could get a different one each time this >> method is called. >> >> making a method that returns *all* the handlers of that type seems like = a >> better general feature for SolrCore/RequestHandlers, and then in this >> specific use case of the replication JSP can be as arbitrary as it wants= . >> >> >> i've got a fix i'll commit as soon as my tests finish... >> >> >> >> : Date: Fri, 10 Jul 2009 10:04:29 -0000 >> : From: noble@apache.org >> : Reply-To: solr-dev@lucene.apache.org >> : To: solr-commits@lucene.apache.org >> : Subject: svn commit: r792861 - in /lucene/solr/trunk/src: >> : =A0 =A0 java/org/apache/solr/core/RequestHandlers.java >> : =A0 =A0 java/org/apache/solr/core/SolrCore.java webapp/web/admin/index= .jsp >> : =A0 =A0 webapp/web/admin/replication/header.jsp >> : >> : Author: noble >> : Date: Fri Jul 10 10:04:29 2009 >> : New Revision: 792861 >> : >> : URL: http://svn.apache.org/viewvc?rev=3D792861&view=3Drev >> : Log: >> : SOLR-1255 An attempt to visit the replication admin page when its not = a >> defined handler should display an approp message >> : >> : Modified: >> : =A0 =A0 lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandler= s.java >> : =A0 =A0 lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java >> : =A0 =A0 lucene/solr/trunk/src/webapp/web/admin/index.jsp >> : =A0 =A0 lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp >> : >> : Modified: >> lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java >> : URL: >> http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/= core/RequestHandlers.java?rev=3D792861&r1=3D792860&r2=3D792861&view=3Ddiff >> : >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> : --- lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.ja= va >> (original) >> : +++ lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.ja= va >> Fri Jul 10 10:04:29 2009 >> : @@ -66,7 +66,7 @@ >> : =A0 =A0public RequestHandlers(SolrCore core) { >> : =A0 =A0 =A0 =A0this.core =3D core; >> : =A0 =A0} >> : - >> : + >> : =A0 =A0/** >> : =A0 =A0 * @return the RequestHandler registered at the given name >> : =A0 =A0 */ >> : @@ -74,6 +74,13 @@ >> : =A0 =A0 =A0return handlers.get(normalize(handlerName)); >> : =A0 =A0} >> : >> : + =A0public SolrRequestHandler get(Class clazz) { >> : + =A0 =A0for (SolrRequestHandler requestHandler : handlers.values()) { >> : + =A0 =A0 =A0if(requestHandler.getClass() =3D=3D clazz) return request= Handler; >> : + =A0 =A0} >> : + =A0 =A0return null; >> : + =A0} >> : + >> : =A0 =A0/** >> : =A0 =A0 * Handlers must be initialized before calling this function. = =A0As >> soon as this is >> : =A0 =A0 * called, the handler can immediately accept requests. >> : >> : Modified: lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.jav= a >> : URL: >> http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/= core/SolrCore.java?rev=3D792861&r1=3D792860&r2=3D792861&view=3Ddiff >> : >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> : --- lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java >> (original) >> : +++ lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java Fri >> Jul 10 10:04:29 2009 >> : @@ -767,6 +767,10 @@ >> : =A0 =A0public SolrRequestHandler getRequestHandler(String handlerName)= { >> : =A0 =A0 =A0return reqHandlers.get(handlerName); >> : =A0 =A0} >> : + >> : + =A0public SolrRequestHandler getRequestHandler(Class clazz) { >> : + =A0 =A0return reqHandlers.get(clazz); >> : + =A0} >> : >> : =A0 =A0/** >> : =A0 =A0 * Returns an unmodifieable Map containing the registered handl= ers >> : >> : Modified: lucene/solr/trunk/src/webapp/web/admin/index.jsp >> : URL: >> http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/inde= x.jsp?rev=3D792861&r1=3D792860&r2=3D792861&view=3Ddiff >> : >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> : --- lucene/solr/trunk/src/webapp/web/admin/index.jsp (original) >> : +++ lucene/solr/trunk/src/webapp/web/admin/index.jsp Fri Jul 10 10:04:= 29 >> 2009 >> : @@ -24,11 +24,12 @@ >> : =A0<%@ page import=3D"java.util.List" %> >> : =A0<%@ page import=3D"java.util.Collection" %> >> : =A0<%@ page import=3D"org.apache.solr.request.SolrRequestHandler"%> >> : +<%@ page import=3D"org.apache.solr.handler.ReplicationHandler" %> >> : >> : =A0<%-- jsp:include page=3D"header.jsp"/ --%> >> : =A0<%-- do a verbatim include so we can use the local vars --%> >> : =A0<%@include file=3D"header.jsp" %> >> : -<%SolrRequestHandler replicationhandler =3D >> core.getRequestHandler("/replication");%> >> : +<%SolrRequestHandler replicationhandler =3D >> core.getRequestHandler(ReplicationHandler.class);%> >> : =A0
>> : =A0 >> : >> : >> : Modified: lucene/solr/trunk/src/webapp/web/admin/replication/header.js= p >> : URL: >> http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/repl= ication/header.jsp?rev=3D792861&r1=3D792860&r2=3D792861&view=3Ddiff >> : >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> : --- lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp >> (original) >> : +++ lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp Fri >> Jul 10 10:04:29 2009 >> : @@ -21,14 +21,14 @@ >> : >> =A0org.apache.solr.request.LocalSolrQueryRequest, >> : >> =A0org.apache.solr.request.SolrQueryResponse, >> : >> =A0org.apache.solr.request.SolrRequestHandler"%> >> : - >> : - >> : - >> : - >> : +<%@ page import=3D"org.apache.solr.handler.ReplicationHandler" %> >> : =A0<% >> : =A0request.setCharacterEncoding("UTF-8"); >> : =A0%> >> : >> : + >> : + >> : + >> : =A0<%@include file=3D"../_info.jsp" %> >> : >> : =A0