Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Map<Class<?>, String> runReverseMapping(JDBCConfiguration jconf) {
- String hookId = UUID.randomUUID().toString();
- jconf.setId(hookId);
- //>-cc (customizerClass) is how we get the ReverseMappingTool instance later on
- Options rmOpts = new Options();
- String argString = String.format(... "-cc %s" ..., //
- HookPropertiesReverseCustomizer.class.getName());
- rmOpts.setFromCmdLine(StringUtils.split(argString, " "));
- try {
- ReverseMappingTool.run(jconf, new String[0], rmOpts);
- } catch (Exception e) {
- // e.printStackTrace();
- }
- ReverseMappingTool gotTool = HookPropertiesReverseCustomizer.popTool(hookId);
- ...
- }
- ---------------------------------------------
- public class HookPropertiesReverseCustomizer extends PropertiesReverseCustomizer {
- private static Map<String, ReverseMappingTool> idToTool = new HashMap<>();
- @Override
- public void setTool(ReverseMappingTool tool) {
- super.setTool(tool);
- idToTool.put(tool.getConfiguration().getId(), tool);
- }
- public static ReverseMappingTool popTool(String id) {
- return idToTool.remove(id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment