lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gsing...@apache.org
Subject svn commit: r803560 - /lucene/solr/trunk/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java
Date Wed, 12 Aug 2009 15:37:13 GMT
Author: gsingers
Date: Wed Aug 12 15:37:13 2009
New Revision: 803560

URL: http://svn.apache.org/viewvc?rev=803560&view=rev
Log:
SOLR-1281: SigUpdateProcFactory now uses SolrResourceLoader

Modified:
    lucene/solr/trunk/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java

Modified: lucene/solr/trunk/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java?rev=803560&r1=803559&r2=803560&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java
(original)
+++ lucene/solr/trunk/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java
Wed Aug 12 15:37:13 2009
@@ -33,6 +33,7 @@
 import org.apache.solr.update.AddUpdateCommand;
 import org.apache.solr.update.CommitUpdateCommand;
 import org.apache.solr.update.DeleteUpdateCommand;
+import org.apache.solr.core.SolrResourceLoader;
 
 public class SignatureUpdateProcessorFactory extends
     UpdateRequestProcessorFactory {
@@ -100,11 +101,13 @@
   }
 
   class SignatureUpdateProcessor extends UpdateRequestProcessor {
+    private final SolrQueryRequest req;
 
     public SignatureUpdateProcessor(SolrQueryRequest req,
         SolrQueryResponse rsp, SignatureUpdateProcessorFactory factory,
         UpdateRequestProcessor next) {
       super(next);
+      this.req = req;
     }
 
     @Override
@@ -118,7 +121,7 @@
           Collections.sort(sigFields);
         }
 
-        Signature sig = (Signature) loadClass(signatureClass);
+        Signature sig = (Signature) req.getCore().getResourceLoader().newInstance(signatureClass);

         sig.init(params);
 
         for (String field : sigFields) {
@@ -166,29 +169,5 @@
     this.enabled = enabled;
   }
 
-  /**
-   * Utility method to dynamically load classes
-   */
-  public static Object loadClass(final String clazz) {
-    Object loadedClass = null;
-    Class handlerClass = null;
-
-    try {
-      handlerClass = Class.forName(clazz);
-    } catch (final NoClassDefFoundError e) {
-      throw new RuntimeException("Cannot find class : " + clazz, e);
-    } catch (final ClassNotFoundException e) {
-      throw new RuntimeException("Cannot find class : " + clazz, e);
-    }
-
-    try {
-      loadedClass = handlerClass.newInstance();
-    } catch (final InstantiationException e) {
-      throw new RuntimeException("Cannot create instance of : " + clazz, e);
-    } catch (final IllegalAccessException e) {
-      throw new RuntimeException("Cannot create instance of : " + clazz, e);
-    }
 
-    return loadedClass;
-  }
 }



Mime
View raw message