Author: schor
Date: Thu Oct 13 19:53:49 2016
New Revision: 1764775

URL: http://svn.apache.org/viewvc?rev=1764775&view=rev
Log:
[UIMA-5038] consolidation of repeated code snips for doing class loading in 
resources, into single methods.

Modified:
    
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/FlowControllerContainer.java
    
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PrimitiveAnalysisEngine_impl.java
    
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/resource/Resource_ImplBase.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/FlowControllerContainer.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/FlowControllerContainer.java?rev=1764775&r1=1764774&r2=1764775&view=diff
==============================================================================
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/FlowControllerContainer.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/FlowControllerContainer.java
 Thu Oct 13 19:53:49 2016
@@ -309,13 +309,7 @@ public class FlowControllerContainer ext
               new Object[] { aDescriptor.getSourceUrlString() });
     }
     // load FlowController class
-    Class<?> flowControllerClass = null;
-    try {
-      flowControllerClass= loadUserClass(flowControllerClassName);
-    } catch (ClassNotFoundException e) {
-      throw new 
ResourceInitializationException(ResourceInitializationException.CLASS_NOT_FOUND,
-              new Object[] { flowControllerClassName, 
aDescriptor.getSourceUrlString() }, e);
-    }
+    Class<?> flowControllerClass = 
loadUserClassOrThrow(flowControllerClassName, aDescriptor);
 
     Object userObject;
     try {

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PrimitiveAnalysisEngine_impl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PrimitiveAnalysisEngine_impl.java?rev=1764775&r1=1764774&r2=1764775&view=diff
==============================================================================
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PrimitiveAnalysisEngine_impl.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PrimitiveAnalysisEngine_impl.java
 Thu Oct 13 19:53:49 2016
@@ -204,14 +204,7 @@ public class PrimitiveAnalysisEngine_imp
     }
 
     // load annotator class
-    Class<?> annotatorClass = null;
-    try {
-      annotatorClass = loadUserClass(annotatorClassName);
-    } catch (ClassNotFoundException e) {
-      throw new ResourceInitializationException(
-              ResourceInitializationException.ANNOTATOR_CLASS_NOT_FOUND, new 
Object[] {
-                  annotatorClassName, mDescription.getSourceUrlString() }, e);
-    }
+    Class<?> annotatorClass = loadUserClassOrThrow(annotatorClassName, 
mDescription);
 
     // Make sure the specified class can be adapter to an AnalysisComponent.
     if (!(AnalysisComponent.class.isAssignableFrom(annotatorClass))

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/resource/Resource_ImplBase.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/resource/Resource_ImplBase.java?rev=1764775&r1=1764774&r2=1764775&view=diff
==============================================================================
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/resource/Resource_ImplBase.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/resource/Resource_ImplBase.java
 Thu Oct 13 19:53:49 2016
@@ -26,6 +26,7 @@ import org.apache.uima.UIMAFramework;
 import org.apache.uima.UIMA_IllegalStateException;
 import org.apache.uima.UimaContext;
 import org.apache.uima.UimaContextAdmin;
+import org.apache.uima.resource.impl.ResourceManager_impl;
 import org.apache.uima.resource.metadata.ResourceManagerConfiguration;
 import org.apache.uima.resource.metadata.ResourceMetaData;
 import org.apache.uima.util.InvalidXMLException;
@@ -288,10 +289,11 @@ public abstract class Resource_ImplBase
   
   public Class<?> loadUserClass(String name) throws ClassNotFoundException {
     return getResourceManager().loadUserClass(name);
-//    ClassLoader cl = 
getUimaContextAdmin().getResourceManager().getExtensionClassLoader();
-//    if (null == cl) {
-//      cl = this.getClass().getClassLoader();
-//    }
-//    return Class.forName(name, true, cl);
   }
+  
+  public Class<?> loadUserClassOrThrow(String name, ResourceSpecifier 
aSpecifier) 
+      throws ResourceInitializationException {
+    return ResourceManager_impl.loadUserClassOrThrow(name, 
getResourceManager(), aSpecifier);
+  }
+  
 }


Reply via email to