Guest User

Untitled

a guest
Dec 9th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.44 KB | None | 0 0
  1. Index: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java
  2. ===================================================================
  3. --- openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java (revision 1547603)
  4. +++ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java (working copy)
  5. @@ -846,8 +846,7 @@
  6.       *
  7.       * @return a list of {@link File} instances that were written
  8.       */
  9. -    public List recordCode()
  10. -        throws IOException {
  11. +    public List recordCode() throws IOException {
  12.          return recordCode(null);
  13.      }
  14.  
  15. @@ -1755,6 +1754,10 @@
  16.          return tool;
  17.      }
  18.  
  19. +    protected static ReverseMappingTool newInstance(JDBCConfiguration conf) {
  20. +        return new ReverseMappingTool(conf);
  21. +    }
  22. +    
  23.      ////////
  24.      // Main
  25.      ////////
  26. @@ -1994,12 +1997,19 @@
  27.          run(conf, args, flags, loader);
  28.          return true;
  29.      }
  30. -
  31. +    
  32.      /**
  33.       * Run the tool.
  34.       */
  35. -    public static void run(JDBCConfiguration conf, String[] args,
  36. -        Flags flags, ClassLoader loader)
  37. +    public static void run(JDBCConfiguration conf, String[] args, Flags flags, ClassLoader loader) throws IOException,
  38. +        SQLException {
  39. +        run(conf, args, flags, loader, null);
  40. +    }
  41. +
  42. +    /**
  43. +     * Run the tool and write to the optionally provided map
  44. +     */
  45. +    public static void run(JDBCConfiguration conf, String[] args, Flags flags, ClassLoader loader, Map output)
  46.          throws IOException, SQLException {
  47.          // parse the schema to reverse-map
  48.          Log log = conf.getLog(OpenJPAConfiguration.LOG_TOOL);
  49. @@ -2021,7 +2031,7 @@
  50.          }
  51.  
  52.          // flags
  53. -        ReverseMappingTool tool = new ReverseMappingTool(conf);
  54. +        ReverseMappingTool tool = newInstance(conf);
  55.          tool.setSchemaGroup(schema);
  56.          tool.setPackageName(flags.packageName);
  57.          tool.setDirectory(flags.directory);
  58. @@ -2052,7 +2062,12 @@
  59.              tool.buildAnnotations();
  60.          }
  61.          log.info(_loc.get("revtool-write-code"));
  62. -        tool.recordCode();
  63. +        if(output == null){
  64. +            tool.recordCode();
  65. +        } else{
  66. +            tool.recordCode(output);
  67. +        }
  68. +        
  69.          if (!LEVEL_NONE.equals(flags.metaDataLevel)) {
  70.              log.info(_loc.get("revtool-write-metadata"));
  71.              tool.recordMetaData(LEVEL_CLASS.equals(flags.metaDataLevel));
Advertisement
Add Comment
Please, Sign In to add comment