After OPENJPA-9, -help option in scripts is not working anymore. This is caused by Configurations.runAgainstAllAnchors returns true if no error is encountered (including no operation) during function execution. Since the check of the -help option is in the command's run method and if no anchor is found, the help check is skipped.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@633921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Albert Lee 2008-03-05 16:38:46 +00:00
parent 126358f0e4
commit b4d72d5843
12 changed files with 5 additions and 35 deletions

View File

@ -189,9 +189,6 @@ public class ClassTableJDBCSeq
*/
public static boolean run(JDBCConfiguration conf, String[] args,
Options opts) throws Exception {
if (opts.containsKey("help") || opts.containsKey("-help"))
return false;
String action = opts.removeProperty("action", "a", null);
Configurations.populateConfiguration(conf, opts);
return run(conf, args, action, null, null);

View File

@ -337,9 +337,6 @@ public class NativeJDBCSeq
public static boolean run(JDBCConfiguration conf, String[] args,
Options opts)
throws Exception {
if (opts.containsKey("help") || opts.containsKey("-help"))
return false;
String action = opts.removeProperty("action", "a", null);
Configurations.populateConfiguration(conf, opts);
return run(conf, args, action);

View File

@ -635,9 +635,6 @@ public class TableJDBCSeq
public static boolean run(JDBCConfiguration conf, String[] args,
Options opts)
throws Exception {
if (opts.containsKey("help") || opts.containsKey("-help"))
return false;
String action = opts.removeProperty("action", "a", null);
Configurations.populateConfiguration(conf, opts);
return run(conf, args, action);

View File

@ -142,9 +142,6 @@ public class ValueTableJDBCSeq
public static boolean run(JDBCConfiguration conf, String[] args,
Options opts)
throws Exception {
if (opts.containsKey("help") || opts.containsKey("-help"))
return false;
String action = opts.removeProperty("action", "a", null);
Configurations.populateConfiguration(conf, opts);
return run(conf, args, action, null, null);

View File

@ -942,9 +942,6 @@ public class MappingTool
public static boolean run(JDBCConfiguration conf, String[] args,
Options opts)
throws IOException, SQLException {
if (opts.containsKey("help") || opts.containsKey("-help"))
return false;
// flags
Flags flags = new Flags();
flags.action = opts.removeProperty("action", "a", flags.action);

View File

@ -1843,9 +1843,6 @@ public class ReverseMappingTool
public static boolean run(JDBCConfiguration conf, String[] args,
Options opts)
throws IOException, SQLException {
if (opts.containsKey("help") || opts.containsKey("-help"))
return false;
// flags
Flags flags = new Flags();
flags.packageName = opts.removeProperty

View File

@ -1357,9 +1357,6 @@ public class SchemaTool {
public static boolean run(JDBCConfiguration conf, String[] args,
Options opts)
throws IOException, SQLException {
if (opts.containsKey("help") || opts.containsKey("-help"))
return false;
Flags flags = new Flags();
flags.dropTables = opts.removeBooleanProperty
("dropTables", "dt", flags.dropTables);

View File

@ -473,9 +473,6 @@ public class TableSchemaFactory
public static boolean run(JDBCConfiguration conf, String[] args,
Options opts)
throws IOException, SQLException {
if (opts.containsKey("help") || opts.containsKey("-help"))
return false;
String action = opts.removeProperty("action", "a", null);
Configurations.populateConfiguration(conf, opts);
return run(conf, action);

View File

@ -1306,9 +1306,6 @@ public class ApplicationIdTool {
public static boolean run(OpenJPAConfiguration conf, String[] args,
Options opts)
throws IOException, ClassNotFoundException {
if (opts.containsKey("help") || opts.containsKey("-help"))
return false;
Flags flags = new Flags();
flags.ignoreErrors = opts.removeBooleanProperty
("ignoreErrors", "i", flags.ignoreErrors);

View File

@ -4365,9 +4365,6 @@ public class PCEnhancer {
public static boolean run(OpenJPAConfiguration conf, String[] args,
Options opts)
throws IOException {
if (opts.containsKey("help") || opts.containsKey("-help"))
return false;
Flags flags = new Flags();
flags.directory = Files.getFile(opts.removeProperty("directory", "d",
null), null);

View File

@ -251,7 +251,8 @@ public class MetaDataTool
throws IOException {
Options opts = new Options();
final String[] arguments = opts.setFromCmdLine(args);
boolean ret = Configurations.runAgainstAllAnchors(opts,
boolean ret = (args.length > 0) &&
Configurations.runAgainstAllAnchors(opts,
new Configurations.Runnable() {
public boolean run(Options opts) throws Exception {
OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
@ -272,10 +273,6 @@ public class MetaDataTool
public static boolean run(OpenJPAConfiguration conf, String[] args,
Options opts)
throws IOException {
if (args.length == 0 || opts.containsKey("help")
|| opts.containsKey("-help"))
return false;
Flags flags = new Flags();
flags.action = opts.removeProperty("action", "a", flags.action);
String fileName = opts.removeProperty("file", "f", null);

View File

@ -673,6 +673,9 @@ public class Configurations {
*/
public static boolean runAgainstAllAnchors(Options opts,
Configurations.Runnable runnable) {
if (opts.containsKey("help") || opts.containsKey("-help")) {
return false;
}
List anchors =
Configurations.getFullyQualifiedAnchorsInPropertiesLocation(opts);