SHOW:
|
|
- or go back to the newest paste.
| 1 | public static Map<Class<?>, String> runReverseMapping(JDBCConfiguration jconf) {
| |
| 2 | String hookId = UUID.randomUUID().toString(); | |
| 3 | ||
| 4 | jconf.setId(hookId); | |
| 5 | ||
| 6 | //>-cc (customizerClass) is how we get the ReverseMappingTool instance later on | |
| 7 | Options rmOpts = new Options(); | |
| 8 | String argString = String.format(... "-cc %s" ..., // | |
| 9 | HookPropertiesReverseCustomizer.class.getName()); | |
| 10 | rmOpts.setFromCmdLine(StringUtils.split(argString, " ")); | |
| 11 | ||
| 12 | try {
| |
| 13 | ReverseMappingTool.run(jconf, new String[0], rmOpts); | |
| 14 | - | } catch (IOException e) {
|
| 14 | + | } catch (Exception e) {
|
| 15 | - | // Can happen if writing files fails or loading customization file fails. |
| 15 | + | |
| 16 | - | // Currently uninterested in either. |
| 16 | + | } |
| 17 | ||
| 18 | - | } catch (SQLException e) {
|
| 18 | + | |
| 19 | - | // SchemaGenerator will be responsible for this |
| 19 | + | |
| 20 | - | // TODO Should we throw an AnzoException here? Probably |
| 20 | + | |
| 21 | - | e.printStackTrace(); |
| 21 | + | |
| 22 | - | } |
| 22 | + | |
| 23 | ||
| 24 | public class HookPropertiesReverseCustomizer extends PropertiesReverseCustomizer {
| |
| 25 | private static Map<String, ReverseMappingTool> idToTool = new HashMap<>(); | |
| 26 | ||
| 27 | @Override | |
| 28 | public void setTool(ReverseMappingTool tool) {
| |
| 29 | super.setTool(tool); | |
| 30 | idToTool.put(tool.getConfiguration().getId(), tool); | |
| 31 | } | |
| 32 | ||
| 33 | public static ReverseMappingTool popTool(String id) {
| |
| 34 | return idToTool.remove(id); | |
| 35 | } | |
| 36 | } |