diff options
Diffstat (limited to 'vpp-api/java/jvpp/gen/jvppgen/callback_gen.py')
-rw-r--r-- | vpp-api/java/jvpp/gen/jvppgen/callback_gen.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py b/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py index eadf3b5c50d..68f70126a04 100644 --- a/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py +++ b/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py @@ -22,10 +22,10 @@ from util import remove_suffix callback_suffix = "Callback" callback_template = Template(""" -package $base_package.$callback_package; +package $plugin_package.$callback_package; /** - * <p>Represents callback for vpe.api message. + * <p>Represents callback for plugin's api file message. * <br>It was generated by callback_gen.py based on $inputfile preparsed data: * <pre> $docs @@ -39,19 +39,19 @@ public interface $cls_name extends $base_package.$callback_package.$callback_typ """) global_callback_template = Template(""" -package $base_package.$callback_package; +package $plugin_package.$callback_package; /** * <p>Global aggregated callback interface. * <br>It was generated by callback_gen.py based on $inputfile - * <br>(python representation of vpe.api generated by vppapigen). + * <br>(python representation of api file generated by vppapigen). */ -public interface JVppGlobalCallback extends $callbacks { +public interface JVpp${plugin_name}GlobalCallback extends $base_package.$callback_package.ControlPingCallback, $callbacks { } """) -def generate_callbacks(func_list, base_package, callback_package, dto_package, inputfile): +def generate_callbacks(func_list, base_package, plugin_package, plugin_name, callback_package, dto_package, inputfile): """ Generates callback interfaces """ print "Generating Callback interfaces" @@ -61,10 +61,10 @@ def generate_callbacks(func_list, base_package, callback_package, dto_package, i callbacks = [] for func in func_list: - if util.is_ignored(func['name']): - continue - camel_case_name_with_suffix = util.underscore_to_camelcase_upper(func['name']) + + if util.is_ignored(func['name']) or util.is_control_ping(camel_case_name_with_suffix): + continue if not util.is_reply(camel_case_name_with_suffix) and not util.is_notification(func['name']): continue @@ -76,11 +76,11 @@ def generate_callbacks(func_list, base_package, callback_package, dto_package, i camel_case_name = camel_case_name_with_suffix callback_type = "JVppNotificationCallback" - callbacks.append("{0}.{1}.{2}".format(base_package, callback_package, camel_case_name + callback_suffix)) + callbacks.append("{0}.{1}.{2}".format(plugin_package, callback_package, camel_case_name + callback_suffix)) callback_path = os.path.join(callback_package, camel_case_name + callback_suffix + ".java") callback_file = open(callback_path, 'w') - reply_type = "%s.%s.%s" % (base_package, dto_package, camel_case_name_with_suffix) + reply_type = "%s.%s.%s" % (plugin_package, dto_package, camel_case_name_with_suffix) method = "void on{0}({1} reply);".format(camel_case_name_with_suffix, reply_type) callback_file.write( callback_template.substitute(inputfile=inputfile, @@ -88,15 +88,18 @@ def generate_callbacks(func_list, base_package, callback_package, dto_package, i cls_name=camel_case_name + callback_suffix, callback_method=method, base_package=base_package, + plugin_package=plugin_package, callback_package=callback_package, callback_type=callback_type)) callback_file.flush() callback_file.close() - callback_file = open(os.path.join(callback_package, "JVppGlobalCallback.java"), 'w') + callback_file = open(os.path.join(callback_package, "JVpp%sGlobalCallback.java" % plugin_name), 'w') callback_file.write(global_callback_template.substitute(inputfile=inputfile, callbacks=", ".join(callbacks), base_package=base_package, + plugin_package=plugin_package, + plugin_name=plugin_name, callback_package=callback_package)) callback_file.flush() callback_file.close() |