X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fcodegen%2Fimpl%2FRuntimeCodeGenerator.xtend;h=465a1f7d9dd2d1e5ef33fd088ed076a2597a326b;hp=d9e0983cfa516f07e0285dab813b5b0c1b3aec17;hb=0b0d6f409dc4a7b8ad3d5ef983ec3fb1c4eee7b2;hpb=9212fed678702583f4a555641208cf1c7b45b829 diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend index d9e0983cfa..465a1f7d9d 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend @@ -36,20 +36,18 @@ import java.util.WeakHashMap import org.opendaylight.yangtools.yang.binding.annotations.QName import org.opendaylight.yangtools.yang.binding.DataContainer import org.opendaylight.yangtools.yang.binding.RpcImplementation -import org.opendaylight.controller.sal.binding.codegen.util.JavassistUtils -import org.opendaylight.controller.sal.binding.impl.util.ClassLoaderUtils +import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils +import org.opendaylight.yangtools.sal.binding.generator.util.ClassLoaderUtils import javassist.LoaderClassPath class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator, NotificationInvokerFactory { val CtClass BROKER_NOTIFICATION_LISTENER; - val ClassPool classPool; val extension JavassistUtils utils; val Map, RuntimeGeneratedInvokerPrototype> invokerClasses; new(ClassPool pool) { - classPool = pool; utils = new JavassistUtils(pool); invokerClasses = new WeakHashMap(); BROKER_NOTIFICATION_LISTENER = org.opendaylight.controller.sal.binding.api.NotificationListener.asCtClass; @@ -96,7 +94,7 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co val supertype = iface.asCtClass return supertype.rpcMetadata; ] - + val instance = withClassLoaderAndLock(iface.classLoader,lock) [ | val supertype = iface.asCtClass val routerName = iface.routerName; @@ -104,14 +102,14 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co if(potentialClass != null) { return potentialClass.newInstance as T; } - + val targetCls = createClass(iface.routerName, supertype) [ - - + + field(DELEGATE_FIELD, iface) //field(REMOTE_INVOKER_FIELD,iface); implementsType(RpcImplementation.asCtClass) - + for (ctx : metadata.contexts) { field(ctx.routingTableField, Map) } @@ -146,14 +144,14 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co ] ] return targetCls.toClass(iface.classLoader,iface.protectionDomain).newInstance as T - + ]; return new RpcRouterCodegenInstance(routerInstanceName,iface, instance, metadata.contexts,metadata.supportedInputs); } private def RpcServiceMetadata getRpcMetadata(CtClass iface) { val metadata = new RpcServiceMetadata; - + iface.methods.filter[declaringClass == iface && parameterTypes.size === 1].forEach [ method | val routingPair = method.rpcMetadata; if (routingPair !== null) { @@ -168,7 +166,7 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co } private def getRpcMetadata(CtMethod method) { - val inputClass = method.parameterTypes.get(0); + val inputClass = method.parameterTypes.get(0); return inputClass.rpcMethodMetadata(inputClass,method.name); } @@ -232,7 +230,7 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co finalClass as Class>); } - + @@ -245,7 +243,7 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co val newInvoker = generateListenerInvoker(class1); invokerClasses.put(class1, newInvoker); return newInvoker - + ] } } @@ -294,11 +292,11 @@ package class RpcServiceMetadata { @Property val rpcMethods = new HashMap(); - + @Property val rpcInputs = new HashMap, RpcMetadata>(); - - + + @Property val supportedInputs = new HashSet>(); } @@ -319,7 +317,7 @@ package class RpcMetadata { @Property val boolean routeEncapsulated; - + @Property val CtClass inputType; }