[validation] Improved/fixed names of tasks and classes
authorAntonio Moreno <antonio.moreno@openbravo.com>
Tue, 30 Mar 2010 18:14:26 +0200
changeset 6918 d6f0fa8b4070
parent 6917 3a18b70881ad
child 6919 0df8fdc4ed4e
[validation] Improved/fixed names of tasks and classes
build.xml
src-core/src/org/openbravo/buildvalidation/BuildValidation.java
src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java
src-core/src/org/openbravo/buildvalidation/Validation.java
src-core/src/org/openbravo/buildvalidation/ValidationHandler.java
src-util/buildvalidation/build.xml
src-util/buildvalidation/src/org/openbravo/buildvalidation/Cbpvendoracct.java
src-util/diagnostic/.classpath
src-util/diagnostic/.project
src-util/diagnostic/.settings/.jsdtscope
src-util/diagnostic/.settings/org.eclipse.jdt.core.prefs
src-util/diagnostic/.settings/org.eclipse.jst.common.project.facet.core.prefs
src-util/diagnostic/.settings/org.eclipse.wst.common.component
src-util/diagnostic/.settings/org.eclipse.wst.common.project.facet.core.xml
src-util/diagnostic/.settings/org.eclipse.wst.jsdt.ui.superType.container
src-util/diagnostic/.settings/org.eclipse.wst.jsdt.ui.superType.name
src-util/diagnostic/WebContent/META-INF/MANIFEST.MF
src-util/diagnostic/WebContent/WEB-INF/web.xml
src-util/diagnostic/build-create.xml
src-util/diagnostic/build.xml
src-util/diagnostic/build/.keep
src-util/diagnostic/check-ob-perms.sh
src-util/diagnostic/config/diagnostics.properties
src-util/diagnostic/config/log4j.properties
src-util/diagnostic/src/Test.java
src-util/diagnostic/src/org/openbravo/check/Check.java
src-util/diagnostic/src/org/openbravo/task/CheckDB.java
src-util/diagnostic/src/org/openbravo/task/CheckEnvironmentVariables.java
src-util/diagnostic/src/org/openbravo/task/CheckJVMVersion.java
src-util/diagnostic/src/org/openbravo/task/CheckMemory.java
src-util/diagnostic/src/org/openbravo/task/CheckTomcatAntExecution.java
src-util/diagnostic/src/org/openbravo/task/CheckTomcatFilePermissions.java
src-util/diagnostic/src/org/openbravo/task/CheckTomcatMemory.java
src-util/diagnostic/src/org/openbravo/task/CheckTomcatVersion.java
src-util/diagnostic/src/org/openbravo/task/CheckX.java
src-util/diagnostic/src/org/openbravo/task/CompareVersion.java
src-util/diagnostic/src/org/openbravo/utils/PropertiesManager.java
src-util/diagnostic/src/org/openbravo/utils/ServerConnection.java
src-util/diagnostic/src/org/openbravo/utils/Version.java
--- a/build.xml	Tue Mar 30 17:34:16 2010 +0200
+++ b/build.xml	Tue Mar 30 18:14:26 2010 +0200
@@ -322,8 +322,8 @@
     <ant dir="${base.src}" target="compile" inheritAll="true" inheritRefs="true" />
   </target>
 
-  <target name="validate" depends="init, core.lib">
-    <ant dir="src-util/buildvalidation" target="validate" inheritAll="true" inheritRefs="true" />
+  <target name="buildvalidation" depends="init, core.lib">
+    <ant dir="src-util/buildvalidation" target="buildvalidation" inheritAll="true" inheritRefs="true" />
   </target>
   
   <target name="compile.buildvalidation" depends="init, core.lib">
@@ -584,14 +584,14 @@
     <antcall target="db.apply.modules.sampledata" />
   </target>
 
-  <target name="update.database" depends="init, core.lib, database.lib, validate">
+  <target name="update.database" depends="init, core.lib, database.lib, buildvalidation">
     <ant dir="${base.db}" target="update.database.java" inheritAll="true" inheritRefs="true" />
     <updatesystemstatus v="RB21"/>
     <antcall target="generate.entities.quick" />
     <antcall target="db.apply.modules" />
   </target>
 
-  <target name="update.database.mod" depends="init, core.lib, database.lib, validate">
+  <target name="update.database.mod" depends="init, core.lib, database.lib, buildvalidation">
     <ant dir="${base.db}" target="update.database.mod.java" inheritAll="true" inheritRefs="true" />
   </target>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-core/src/org/openbravo/buildvalidation/BuildValidation.java	Tue Mar 30 18:14:26 2010 +0200
@@ -0,0 +1,31 @@
+package org.openbravo.buildvalidation;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.openbravo.database.CPStandAlone;
+import org.openbravo.database.ConnectionProvider;
+
+public abstract class BuildValidation {
+
+  private ConnectionProvider cp = null;
+  private File basedir;
+
+  public abstract ArrayList<String> execute();
+
+  public ConnectionProvider getConnectionProvider() {
+    if (cp == null) {
+      File f = new File("");
+      f = new File(f.getAbsolutePath());
+      File fProp = null;
+      if (new File("../../config/Openbravo.properties").exists())
+        fProp = new File("../../config/Openbravo.properties");
+      else if (new File("../config/Openbravo.properties").exists())
+        fProp = new File("../config/Openbravo.properties");
+      else if (new File("config/Openbravo.properties").exists())
+        fProp = new File("config/Openbravo.properties");
+      cp = new CPStandAlone(fProp.getAbsolutePath());
+    }
+    return cp;
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java	Tue Mar 30 18:14:26 2010 +0200
@@ -0,0 +1,102 @@
+package org.openbravo.buildvalidation;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+public class BuildValidationHandler extends Task {
+
+  private File basedir;
+  private String module;
+
+  @Override
+  public void execute() {
+    String errorMessage = "";
+    List<String> classes = new ArrayList<String>();
+    File modFolders[];
+    if (module != null && !module.equals("%")) {
+      File moduleFolder = new File(basedir, "modules/" + module);
+      modFolders = new File[1];
+      modFolders[0] = moduleFolder;
+    } else {
+      File coreBuildFolder = new File(basedir, "src-util/buildvalidation/build/classes");
+      readClassFiles(classes, coreBuildFolder);
+      File moduleFolder = new File(basedir, "modules");
+      modFolders = moduleFolder.listFiles();
+    }
+    for (File modFolder : modFolders) {
+      if (modFolder.isDirectory()) {
+        File validationFolder = new File(modFolder, "build/classes");
+        if (validationFolder.exists()) {
+          readClassFiles(classes, validationFolder);
+        }
+      }
+    }
+
+    for (String s : classes) {
+      ArrayList<String> errors = new ArrayList<String>();
+      try {
+        Class<?> myClass = Class.forName(s);
+        if (myClass.getGenericSuperclass().equals(
+            Class.forName("org.openbravo.buildvalidation.Validation"))) {
+          Object instance = myClass.newInstance();
+          errors = callExecute(myClass, instance);
+          for (String error : errors) {
+            errorMessage += error + "\n";
+          }
+        }
+      } catch (Exception e) {
+        throw new BuildException("The validation " + s + " couldn't be properly executed");
+      }
+      if (errors.size() > 0) {
+        throw new BuildException(
+            errorMessage
+                + "\nThe validation failed. The system hasn't been modified. Fix the problems described in the validation messages, and then start the build again.");
+      }
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  private ArrayList<String> callExecute(Class<?> myClass, Object instance)
+      throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
+    return (ArrayList<String>) myClass.getMethod("execute", new Class[0]).invoke(instance,
+        new Object[0]);
+  }
+
+  private void readClassFiles(List<String> coreClasses, File file) {
+    if (!file.exists()) {
+      return;
+    }
+    if (file.isDirectory()) {
+      File[] files = file.listFiles();
+      for (File f : files) {
+        readClassFiles(coreClasses, f);
+      }
+    } else {
+      String fileName = file.getAbsolutePath();
+      fileName = fileName.split("build" + File.separatorChar + "classes" + File.separatorChar)[1];
+      coreClasses.add(fileName.replace(".class", "").replace(File.separatorChar, '.'));
+    }
+  }
+
+  public File getBasedir() {
+    return basedir;
+  }
+
+  public void setBasedir(File basedir) {
+    this.basedir = basedir;
+  }
+
+  public String getModule() {
+    return module;
+  }
+
+  public void setModule(String module) {
+    this.module = module;
+  }
+
+}
--- a/src-core/src/org/openbravo/buildvalidation/Validation.java	Tue Mar 30 17:34:16 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-package org.openbravo.buildvalidation;
-
-import java.io.File;
-import java.util.ArrayList;
-
-import org.openbravo.database.CPStandAlone;
-import org.openbravo.database.ConnectionProvider;
-
-public abstract class Validation {
-
-  private ConnectionProvider cp = null;
-  private File basedir;
-
-  public abstract ArrayList<String> execute();
-
-  public ConnectionProvider getConnectionProvider() {
-    if (cp == null) {
-      File f = new File("");
-      f = new File(f.getAbsolutePath());
-      File fProp = null;
-      if (new File("../../config/Openbravo.properties").exists())
-        fProp = new File("../../config/Openbravo.properties");
-      else if (new File("../config/Openbravo.properties").exists())
-        fProp = new File("../config/Openbravo.properties");
-      else if (new File("config/Openbravo.properties").exists())
-        fProp = new File("config/Openbravo.properties");
-      cp = new CPStandAlone(fProp.getAbsolutePath());
-    }
-    return cp;
-  }
-}
\ No newline at end of file
--- a/src-core/src/org/openbravo/buildvalidation/ValidationHandler.java	Tue Mar 30 17:34:16 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-package org.openbravo.buildvalidation;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-public class ValidationHandler extends Task {
-
-  private File basedir;
-  private String module;
-
-  @Override
-  public void execute() {
-    String errorMessage = "";
-    List<String> classes = new ArrayList<String>();
-    File modFolders[];
-    if (module != null && !module.equals("%")) {
-      File moduleFolder = new File(basedir, "modules/" + module);
-      modFolders = new File[1];
-      modFolders[0] = moduleFolder;
-    } else {
-      File coreBuildFolder = new File(basedir, "src-util/buildvalidation/build/classes");
-      readClassFiles(classes, coreBuildFolder);
-      File moduleFolder = new File(basedir, "modules");
-      modFolders = moduleFolder.listFiles();
-    }
-    for (File modFolder : modFolders) {
-      if (modFolder.isDirectory()) {
-        File validationFolder = new File(modFolder, "build/classes");
-        if (validationFolder.exists()) {
-          readClassFiles(classes, validationFolder);
-        }
-      }
-    }
-
-    for (String s : classes) {
-      ArrayList<String> errors = new ArrayList<String>();
-      try {
-        Class<?> myClass = Class.forName(s);
-        if (myClass.getGenericSuperclass().equals(
-            Class.forName("org.openbravo.buildvalidation.Validation"))) {
-          Object instance = myClass.newInstance();
-          errors = callExecute(myClass, instance);
-          for (String error : errors) {
-            errorMessage += error + "\n";
-          }
-        }
-      } catch (Exception e) {
-        throw new BuildException("The validation " + s + " couldn't be properly executed");
-      }
-      if (errors.size() > 0) {
-        throw new BuildException(
-            errorMessage
-                + "\nThe validation failed. The system hasn't been modified. Fix the problems described in the validation messages, and then start the build again.");
-      }
-    }
-  }
-
-  @SuppressWarnings("unchecked")
-  private ArrayList<String> callExecute(Class<?> myClass, Object instance)
-      throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
-    return (ArrayList<String>) myClass.getMethod("execute", new Class[0]).invoke(instance,
-        new Object[0]);
-  }
-
-  private void readClassFiles(List<String> coreClasses, File file) {
-    if (!file.exists()) {
-      return;
-    }
-    if (file.isDirectory()) {
-      File[] files = file.listFiles();
-      for (File f : files) {
-        readClassFiles(coreClasses, f);
-      }
-    } else {
-      String fileName = file.getAbsolutePath();
-      fileName = fileName.split("build" + File.separatorChar + "classes" + File.separatorChar)[1];
-      coreClasses.add(fileName.replace(".class", "").replace(File.separatorChar, '.'));
-    }
-  }
-
-  public File getBasedir() {
-    return basedir;
-  }
-
-  public void setBasedir(File basedir) {
-    this.basedir = basedir;
-  }
-
-  public String getModule() {
-    return module;
-  }
-
-  public void setModule(String module) {
-    this.module = module;
-  }
-
-}
--- a/src-util/buildvalidation/build.xml	Tue Mar 30 17:34:16 2010 +0200
+++ b/src-util/buildvalidation/build.xml	Tue Mar 30 18:14:26 2010 +0200
@@ -100,7 +100,7 @@
   <target name="compile" depends="checkmodule,compileSqlc,javacCore,javacModule">
   </target>
 
-  <target name="validate" >
+  <target name="buildvalidation" >
     <taskdef name="ValidationHandler" classname="org.openbravo.buildvalidation.ValidationHandler" onerror="failall">
       <classpath refid="pre.class.path" />
     </taskdef>
--- a/src-util/buildvalidation/src/org/openbravo/buildvalidation/Cbpvendoracct.java	Tue Mar 30 17:34:16 2010 +0200
+++ b/src-util/buildvalidation/src/org/openbravo/buildvalidation/Cbpvendoracct.java	Tue Mar 30 18:14:26 2010 +0200
@@ -4,7 +4,7 @@
 
 import org.openbravo.database.ConnectionProvider;
 
-public class Cbpvendoracct extends Validation {
+public class Cbpvendoracct extends BuildValidation {
 
   public ArrayList<String> execute() {
     ConnectionProvider cp = getConnectionProvider();