Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Increase mdsal's notification queue size, make it configurable."
[controller.git]
/
opendaylight
/
md-sal
/
sal-binding-broker
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
sal
/
binding
/
codegen
/
impl
/
RuntimeCodeGenerator.xtend
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 7ebcf02e41fb0ba7e17268aeee1d13f679ff3d31..6723713645511b6f608eb7ef0d371901f7ad9243 100644
(file)
--- 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.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 {
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) {
body = '''
{
if(«DELEGATE_FIELD» == null) {
- throw new java.lang.IllegalStateException("No
provider is processing supplied messag
e");
+ throw new java.lang.IllegalStateException("No
default provider is availabl
e");
}
return ($r) «DELEGATE_FIELD».«it.name»($$);
}
}
return ($r) «DELEGATE_FIELD».«it.name»($$);
}
@@
-91,12
+91,12
@@
class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co
return instance;
}
return instance;
}
- override <T extends RpcService> getRouterFor(Class<T> iface) {
+ override <T extends RpcService> getRouterFor(Class<T> iface
,String routerInstanceName
) {
val metadata = withClassLoader(iface.classLoader) [|
val supertype = iface.asCtClass
return supertype.rpcMetadata;
]
val metadata = withClassLoader(iface.classLoader) [|
val supertype = iface.asCtClass
return supertype.rpcMetadata;
]
-
+
val instance = <T>withClassLoaderAndLock(iface.classLoader,lock) [ |
val supertype = iface.asCtClass
val routerName = iface.routerName;
val instance = <T>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;
}
if(potentialClass != null) {
return potentialClass.newInstance as T;
}
-
+
val targetCls = createClass(iface.routerName, supertype) [
val targetCls = createClass(iface.routerName, supertype) [
-
-
+
+
field(DELEGATE_FIELD, iface)
//field(REMOTE_INVOKER_FIELD,iface);
implementsType(RpcImplementation.asCtClass)
field(DELEGATE_FIELD, iface)
//field(REMOTE_INVOKER_FIELD,iface);
implementsType(RpcImplementation.asCtClass)
-
+
for (ctx : metadata.contexts) {
field(ctx.routingTableField, Map)
}
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) {
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»($$);
}'''
}
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 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;
}
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) {
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) {
}
private def getRpcMetadata(CtMethod method) {
- val inputClass = method.parameterTypes.get(0);
+ val inputClass = method.parameterTypes.get(0);
return inputClass.rpcMethodMetadata(inputClass,method.name);
}
return inputClass.rpcMethodMetadata(inputClass,method.name);
}
@@
-232,7
+232,7
@@
class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co
finalClass as Class<? extends org.opendaylight.controller.sal.binding.api.NotificationListener<?>>);
}
finalClass as Class<? extends org.opendaylight.controller.sal.binding.api.NotificationListener<?>>);
}
-
+
@@
-245,7
+245,7
@@
class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co
val newInvoker = generateListenerInvoker(class1);
invokerClasses.put(class1, newInvoker);
return newInvoker
val newInvoker = generateListenerInvoker(class1);
invokerClasses.put(class1, newInvoker);
return newInvoker
-
+
]
}
}
]
}
}
@@
-294,11
+294,11
@@
package class RpcServiceMetadata {
@Property
val rpcMethods = new HashMap<String, RpcMetadata>();
@Property
val rpcMethods = new HashMap<String, RpcMetadata>();
-
+
@Property
val rpcInputs = new HashMap<Class<? extends DataContainer>, RpcMetadata>();
@Property
val rpcInputs = new HashMap<Class<? extends DataContainer>, RpcMetadata>();
-
-
+
+
@Property
val supportedInputs = new HashSet<Class<? extends DataContainer>>();
}
@Property
val supportedInputs = new HashSet<Class<? extends DataContainer>>();
}
@@
-319,7
+319,7
@@
package class RpcMetadata {
@Property
val boolean routeEncapsulated;
@Property
val boolean routeEncapsulated;
-
+
@Property
val CtClass inputType;
}
@Property
val CtClass inputType;
}