X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fcodegen%2Fimpl%2FRuntimeCodeGenerator.xtend;h=6723713645511b6f608eb7ef0d371901f7ad9243;hb=fd8c7a6e7445ca9788c2557caa9da5af8c8a2153;hp=7ebcf02e41fb0ba7e17268aeee1d13f679ff3d31;hpb=ad65bbdb5841a166f37b6cbaa6d5c457c5c77f27;p=controller.git 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 7ebcf02e41..6723713645 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,8 +36,8 @@ 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 { @@ -71,7 +71,7 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co body = ''' { if(«DELEGATE_FIELD» == null) { - throw new java.lang.IllegalStateException("No provider is processing supplied message"); + throw new java.lang.IllegalStateException("No default provider is available"); } return ($r) «DELEGATE_FIELD».«it.name»($$); } @@ -91,12 +91,12 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co return instance; } - override getRouterFor(Class iface) { + override getRouterFor(Class iface,String routerInstanceName) { val metadata = withClassLoader(iface.classLoader) [| val supertype = iface.asCtClass return supertype.rpcMetadata; ] - + val instance = withClassLoaderAndLock(iface.classLoader,lock) [ | val supertype = iface.asCtClass val routerName = iface.routerName; @@ -104,14 +104,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) } @@ -127,7 +127,7 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co instance = «DELEGATE_FIELD»; } if(instance == null) { - throw new java.lang.IllegalStateException("No provider is processing supplied message"); + throw new java.lang.IllegalStateException("No routable provider is processing routed message for " + String.valueOf(identifier)); } return ($r) instance.«it.name»($$); }''' @@ -146,14 +146,14 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co ] ] return targetCls.toClass(iface.classLoader,iface.protectionDomain).newInstance as T - + ]; - return new RpcRouterCodegenInstance(iface, instance, metadata.contexts,metadata.supportedInputs); + 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 +168,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 +232,7 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co finalClass as Class>); } - + @@ -245,7 +245,7 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co val newInvoker = generateListenerInvoker(class1); invokerClasses.put(class1, newInvoker); return newInvoker - + ] } } @@ -294,11 +294,11 @@ package class RpcServiceMetadata { @Property val rpcMethods = new HashMap(); - + @Property val rpcInputs = new HashMap, RpcMetadata>(); - - + + @Property val supportedInputs = new HashSet>(); } @@ -319,7 +319,7 @@ package class RpcMetadata { @Property val boolean routeEncapsulated; - + @Property val CtClass inputType; }