Add injectable LoadingStrategy to RuntimeGeneratedMappingServiceImpl.
[yangtools.git] / code-generator / binding-generator-impl / src / main / java / org / opendaylight / yangtools / sal / binding / generator / impl / RuntimeGeneratedMappingServiceImpl.xtend
index 780c8824d951aecd90732f6ba8076b5a1c465999..c4345ae7b50bab833097d3aefeaaecc1f062d094 100644 (file)
@@ -93,9 +93,19 @@ SchemaLock, AutoCloseable, SchemaContextHolder {
 
     val promisedTypes = HashMultimap.<Type, SettableFuture<Type>>create;
 
+    val GeneratedClassLoadingStrategy classLoadingStrategy;
+
     @Property
     var SchemaContext schemaContext;
 
+    new() {
+        this(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy())
+    }
+
+    new(GeneratedClassLoadingStrategy strat){
+        classLoadingStrategy = strat
+    }
+
     //ServiceRegistration<SchemaServiceListener> listenerRegistration
     override onGlobalContextUpdated(SchemaContext arg0) {
         schemaContext = arg0
@@ -268,7 +278,8 @@ SchemaLock, AutoCloseable, SchemaContextHolder {
 
     public def void init() {
         binding = new TransformerGenerator(pool);
-        registry = new LazyGeneratedCodecRegistry(this)
+        registry = new LazyGeneratedCodecRegistry(this, classLoadingStrategy)
+
         registry.generator = binding
 
         //binding.staticFieldsInitializer = registry
@@ -340,7 +351,7 @@ SchemaLock, AutoCloseable, SchemaContextHolder {
         try {
             val rpcTypeName = module.rpcServiceType;
             if (rpcTypeName.present) {
-                val rpcClass = classLoadingStrategy.loadClass(rpcTypeName.get.fullyQualifiedName);
+                val rpcClass = binding.classLoadingStrategy.loadClass(rpcTypeName.get.fullyQualifiedName);
                 return Optional.of(rpcClass as Class<? extends RpcService>);
             }
         } catch (Exception e) {