Fixed issue 10492. When upgrading Openbravo Core, new dbsm should be used instead of the old one.
authorAntonio Moreno <antonio.moreno@openbravo.com>
Fri, 04 Sep 2009 13:24:13 +0200
changeset 4870 20e3a339d7df
parent 4869 4019c5011d70
child 4871 d8e8ce19b459
Fixed issue 10492. When upgrading Openbravo Core, new dbsm should be used instead of the old one.
build.xml
src-core/src/org/openbravo/utils/OBLogAppender.java
src-db/database/build.xml
src-db/database/lib/dbsourcemanager.jar
--- a/build.xml	Fri Sep 04 11:16:28 2009 +0200
+++ b/build.xml	Fri Sep 04 13:24:13 2009 +0200
@@ -539,7 +539,7 @@
   <target name="update.database" depends="init,code.rev">
     <antcall target="database.lib" />
     <antcall target="core.lib" />
-    <ant dir="${base.db}" target="update.database" inheritAll="true" inheritRefs="true" />
+    <ant dir="${base.db}" target="update.database.java" inheritAll="true" inheritRefs="true" />
     <antcall target="generate.entities.quick" />
     <antcall target="db.apply.modules" />
   </target>
--- a/src-core/src/org/openbravo/utils/OBLogAppender.java	Fri Sep 04 11:16:28 2009 +0200
+++ b/src-core/src/org/openbravo/utils/OBLogAppender.java	Fri Sep 04 13:24:13 2009 +0200
@@ -23,6 +23,7 @@
 import java.io.OutputStream;
 
 import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.Level;
 import org.apache.log4j.Priority;
 import org.apache.log4j.spi.LoggingEvent;
 import org.apache.tools.ant.Project;
@@ -38,6 +39,7 @@
 
   private static final ThreadLocal<OutputStream> outputStreamHolder = new ThreadLocal<OutputStream>();
   private static final ThreadLocal<Project> projectHolder = new ThreadLocal<Project>();
+  private static final ThreadLocal<Level> levelHolder = new ThreadLocal<Level>();
 
   /**
    * @return the ant project held in the threadlocal.
@@ -46,6 +48,10 @@
     return projectHolder.get();
   }
 
+  public static void setLevel(Level level) {
+    levelHolder.set(level);
+  }
+
   /**
    * Sets an ant project in the project threadlocal. Logging events are send to the logger of the
    * project to.
@@ -93,12 +99,14 @@
       }
 
       if (outputStreamHolder.get() != null) {
-        if (getLayout() != null) {
-          outputStreamHolder.get().write(getLayout().format(event).getBytes());
-        } else {
-          outputStreamHolder.get().write((event.getMessage().toString() + "\n").getBytes());
+        if (event.getLevel().isGreaterOrEqual(levelHolder.get())) {
+          if (getLayout() != null) {
+            outputStreamHolder.get().write(getLayout().format(event).getBytes());
+          } else {
+            outputStreamHolder.get().write((event.getMessage().toString() + "\n").getBytes());
+          }
+          outputStreamHolder.get().flush();
         }
-        outputStreamHolder.get().flush();
       }
     } catch (final IOException e) {
       // TODO: replace with OBException to log this exception
--- a/src-db/database/build.xml	Fri Sep 04 11:16:28 2009 +0200
+++ b/src-db/database/build.xml	Fri Sep 04 13:24:13 2009 +0200
@@ -147,7 +147,7 @@
       </sql>
     </target>
   
-  
+
   <target name="update.database">
     <antcall target="fix.date.${bbdd.rdbms}" />
     <alterdatabasedataall driver="${bbdd.driver}" url="${bbdd.owner.url}" user="${bbdd.user}" password="${bbdd.password}" excludeobjects="com.openbravo.db.OpenbravoExcludeFilter" model="model" filter="com.openbravo.db.OpenbravoMetadataFilter" input="sourcedata" object="${bbdd.object}" failonerror="false" verbosity="${bbdd.verbosity}" basedir="${base.modules}/" dirFilter="*/src-db/database/model" datadir="${base.modules}/" dataFilter="*/src-db/database/sourcedata" userId="0" propertiesFile="${base.config}/Openbravo.properties" force="${force}" onlyIfModified="${onlyIfModified}"/>
@@ -155,6 +155,33 @@
     <antcall target="update.dbupdate.timestamp" />
   </target>
 
+  <target name="update.database.java">
+    <antcall target="fix.date.${bbdd.rdbms}" />
+    <java classname="org.openbravo.ddlutils.task.AlterDatabaseJava" fork="true" spawn="true">
+      <arg value="${bbdd.driver}"/>
+      <arg value="${bbdd.owner.url}"/>
+      <arg value="${bbdd.user}"/>
+      <arg value="${bbdd.password}"/>
+      <arg value="com.openbravo.db.OpenbravoExcludeFilter"/>
+      <arg value="model"/>
+      <arg value="com.openbravo.db.OpenbravoMetadataFilter"/>
+      <arg value="sourcedata"/>
+      <arg value="${bbdd.object}"/>
+      <arg value="false"/>
+      <arg value="${bbdd.verbosity}"/>
+      <arg value="${base.modules}/"/>
+      <arg value="*/src-db/database/model"/>
+      <arg value="${base.modules}/"/>
+      <arg value="*/src-db/database/sourcedata"/>
+      <arg value="0"/>
+      <arg value="${base.config}/Openbravo.properties"/>
+      <arg value="${force}"/>
+      <classpath refid="runtime-classpath" />
+    </java>
+    <antcall target="database.postupdate.${bbdd.rdbms}" />
+    <antcall target="update.dbupdate.timestamp" />
+  </target>
+
   <target name="update.database.mod">
     <alterdatabasedatamod driver="${bbdd.driver}" url="${bbdd.owner.url}" user="${bbdd.user}" password="${bbdd.password}" excludeobjects="com.openbravo.db.OpenbravoExcludeFilter" model="model" filter="com.openbravo.db.OpenbravoMetadataFilter" input="sourcedata" object="${bbdd.object}" failonerror="false" verbosity="DEBUG" basedir="${base.modules}/" baseConfig="${base.config}" dirFilter="*/src-db/database/model" datadir="${base.modules}/" dataFilter="*/src-db/database/sourcedata" module="${module}" userId="0" propertiesFile="${base.config}/Openbravo.properties" force="${force}" />
     <antcall target="database.postupdate.${bbdd.rdbms}" />
Binary file src-db/database/lib/dbsourcemanager.jar has changed