- public void close() {
- // NOOP Intentionally
- }
-
- public BindingNormalizedNodeCodecRegistry getCodecFactory() {
- return codecRegistry;
- }
-
- // FIXME: This should be probably part of Binding Runtime context
- public ImmutableBiMap<Method, SchemaPath> getRpcMethodToSchemaPath(final Class<? extends RpcService> key) {
- final QNameModule moduleName = BindingReflections.getQNameModule(key);
- final Module module = runtimeContext.getSchemaContext().findModuleByNamespaceAndRevision(moduleName.getNamespace(), moduleName.getRevision());
- final ImmutableBiMap.Builder<Method, SchemaPath> ret = ImmutableBiMap.<Method, SchemaPath>builder();
- try {
- for (final RpcDefinition rpcDef : module.getRpcs()) {
- final Method method = findRpcMethod(key, rpcDef);
- ret.put(method, rpcDef.getPath());
- }
- } catch (final NoSuchMethodException e) {
- throw new IllegalStateException("Rpc defined in model does not have representation in generated class.", e);
- }
- return ret.build();
- }
-
- private Method findRpcMethod(final Class<? extends RpcService> key, final RpcDefinition rpcDef) throws NoSuchMethodException {
- final String methodName = BindingMapping.getMethodName(rpcDef.getQName());
- if(rpcDef.getInput() != null) {
- final Class<?> inputClz = runtimeContext.getClassForSchema(rpcDef.getInput());
- return key.getMethod(methodName, inputClz);
- }
- return key.getMethod(methodName);