From c79283dbfc41b3addf0ae6a75dc7c7b0bf2602ca Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Wed, 11 Apr 2012 20:32:35 +0000 Subject: [PATCH] A patch from Francis ANDRE "unify admin port and key setting: single point of definition in start.properties" https://issues.apache.org/jira/browse/OFBIZ-4793 If someone wants to change the admin password or port, he would have to change currently many files (-- build.xml, various .bat and .sh --). In order to avoid this error-prone pratice, I suggest to centralize the definition of the admin kay and port at 2 single points: the framework/start/src/org/ofbiz/base/start/start.properties and the framework/start/src/org/ofbiz/base/start/jetty.properties jleroux: in config.java I also changed String adminPortStr = getProp(props, "ofbiz.admin.port", "0"); adminKey = getProp(props, "ofbiz.admin.key", "NA"); to String adminPortStr = getProp(props, "ofbiz.admin.port", "10523"); adminKey = getProp(props, "ofbiz.admin.key", "so3du5kasd5dn"); git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1324989 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 12 ------------ .../entity/src/org/ofbiz/entity/GenericEntity.java | 9 +++++++-- .../start/src/org/ofbiz/base/start/jetty.properties | 6 +++--- .../start/src/org/ofbiz/base/start/start.properties | 6 +++--- startofbiz.sh | 7 +------ stopofbiz.sh | 6 +----- tools/startofbiz.sh | 7 +------ tools/stopofbiz.sh | 9 +-------- 8 files changed, 17 insertions(+), 45 deletions(-) diff --git a/build.xml b/build.xml index 22fbde7931..5cde95c89d 100644 --- a/build.xml +++ b/build.xml @@ -24,8 +24,6 @@ under the License. - - @@ -386,8 +384,6 @@ under the License. - - - - - - - - - - diff --git a/framework/entity/src/org/ofbiz/entity/GenericEntity.java b/framework/entity/src/org/ofbiz/entity/GenericEntity.java index bbe2d49189..72154e441a 100644 --- a/framework/entity/src/org/ofbiz/entity/GenericEntity.java +++ b/framework/entity/src/org/ofbiz/entity/GenericEntity.java @@ -461,7 +461,7 @@ public class GenericEntity extends Observable implements Map, Lo } boolean isNullString = false; - if ("null".equals(value) || "[null-field]".equals(value)) { + if ("null".equals(value) || "[null-field]".equals(value)) { // keep [null-field] here but not sure it' used now // count this as a null too, but only for numbers and stuff, not for Strings isNullString = true; } @@ -1079,7 +1079,12 @@ public class GenericEntity extends Observable implements Map, Lo element.setAttribute(name, value); } } else { - element.setAttribute(name, GenericEntity.NULL_FIELD.toString()); + element.setAttribute(name, "null"); + element.setAttribute("xsi:nil", "true"); + // I tried to put the schema in the envelope header (in createAndSendSOAPResponse) + // resEnv.declareNamespace("http://www.w3.org/2001/XMLSchema-instance", null); + // But it gets prefixed and that does not work. So adding in each instance + element.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); } } diff --git a/framework/start/src/org/ofbiz/base/start/jetty.properties b/framework/start/src/org/ofbiz/base/start/jetty.properties index 49ff60a9fb..87f5c66e3b 100644 --- a/framework/start/src/org/ofbiz/base/start/jetty.properties +++ b/framework/start/src/org/ofbiz/base/start/jetty.properties @@ -28,9 +28,9 @@ java.tools.jar.required=true #ofbiz.home= # --- Set these for shutting down when running as background process -#ofbiz.admin.host=127.0.0.1 -#ofbiz.admin.port=10523 -#ofbiz.admin.key=so3du5kasd5dn +ofbiz.admin.host=127.0.0.1 +ofbiz.admin.port=10523 +ofbiz.admin.key=so3du5kasd5dn # --- External Base configuration files (relative to ofbiz.home) #ofbiz.base.config=framework/base/config diff --git a/framework/start/src/org/ofbiz/base/start/start.properties b/framework/start/src/org/ofbiz/base/start/start.properties index 74271a9a30..33ad2af9d1 100644 --- a/framework/start/src/org/ofbiz/base/start/start.properties +++ b/framework/start/src/org/ofbiz/base/start/start.properties @@ -28,9 +28,9 @@ #ofbiz.home= # --- Set these for shutting down when running as background process -#ofbiz.admin.host=127.0.0.1 -#ofbiz.admin.port=10523 -#ofbiz.admin.key=so3du5kasd5dn +ofbiz.admin.host=127.0.0.1 +ofbiz.admin.port=10523 +ofbiz.admin.key=so3du5kasd5dn # --- External Base configuration files (relative to ofbiz.home) #ofbiz.base.config=framework/base/config diff --git a/startofbiz.sh b/startofbiz.sh index cb138c1806..b1b7c40bef 100755 --- a/startofbiz.sh +++ b/startofbiz.sh @@ -18,10 +18,6 @@ # under the License. ##################################################################### -# shutdown settings -ADMIN_PORT=10523 -ADMIN_KEY=so3du5kasd5dn - # console log file OFBIZ_LOG=runtime/logs/console.log @@ -29,7 +25,6 @@ OFBIZ_LOG=runtime/logs/console.log rm -f $OFBIZ_LOG # VM args -ADMIN="-Dofbiz.admin.port=$ADMIN_PORT -Dofbiz.admin.key=$ADMIN_KEY" #DEBUG="-Dsun.rmi.server.exceptionTrace=true" #DEBUG="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8091" #automatic IP address for linux @@ -38,7 +33,7 @@ ADMIN="-Dofbiz.admin.port=$ADMIN_PORT -Dofbiz.admin.key=$ADMIN_KEY" MEMIF="-Xms128M -Xmx512M -XX:MaxPermSize=512m" #JMX="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=33333 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" #MISC="-Duser.language=en" -VMARGS="$MEMIF $MISC $JMX $DEBUG $RMIIF $ADMIN" +VMARGS="$MEMIF $MISC $JMX $DEBUG $RMIIF" # Worldpay Config #VMARGS="-Xbootclasspath/p:applications/accounting/lib/cryptix.jar $VMARGS" diff --git a/stopofbiz.sh b/stopofbiz.sh index 9d03f05457..f746642248 100755 --- a/stopofbiz.sh +++ b/stopofbiz.sh @@ -28,9 +28,5 @@ else JAVA=java fi -# shutdown settings -ADMIN_PORT=10523 -ADMIN_KEY=so3du5kasd5dn - -$JAVA -Dofbiz.admin.port=$ADMIN_PORT -Dofbiz.admin.key=$ADMIN_KEY -jar ofbiz.jar -shutdown +$JAVA -jar ofbiz.jar -shutdown diff --git a/tools/startofbiz.sh b/tools/startofbiz.sh index 055cc1b961..9308733a16 100755 --- a/tools/startofbiz.sh +++ b/tools/startofbiz.sh @@ -18,10 +18,6 @@ # under the License. ##################################################################### -# shutdown settings -ADMIN_PORT=10523 -ADMIN_KEY=so3du5kasd5dn - # set the parent directory as OFBiz Home OFBIZ_HOME="$( cd -P "$( dirname "$0" )" && pwd )"/.. @@ -32,7 +28,6 @@ OFBIZ_LOG=runtime/logs/console.log rm -f $OFBIZ_LOG # VM args -ADMIN="-Dofbiz.admin.port=$ADMIN_PORT -Dofbiz.admin.key=$ADMIN_KEY" #DEBUG="-Dsun.rmi.server.exceptionTrace=true" #DEBUG="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8091" #automatic IP address for linux @@ -41,7 +36,7 @@ ADMIN="-Dofbiz.admin.port=$ADMIN_PORT -Dofbiz.admin.key=$ADMIN_KEY" MEMIF="-Xms128M -Xmx512M -XX:MaxPermSize=512m" #JMX="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=33333 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" #MISC="-Duser.language=en" -VMARGS="$MEMIF $MISC $JMX $DEBUG $RMIIF $ADMIN" +VMARGS="$MEMIF $MISC $JMX $DEBUG $RMIIF" # Worldpay Config #VMARGS="-Xbootclasspath/p:applications/accounting/lib/cryptix.jar $VMARGS" diff --git a/tools/stopofbiz.sh b/tools/stopofbiz.sh index 12a192e8cb..c99969a91f 100755 --- a/tools/stopofbiz.sh +++ b/tools/stopofbiz.sh @@ -17,10 +17,6 @@ # specific language governing permissions and limitations # under the License. ##################################################################### -#### -# ofbiz.admin.key and ofbiz.admin.port must match that which OFBIZ was started with -#### - OFBIZ_HOME="$( cd -P "$( dirname "$0" )" && pwd )"/.. # location of java executable @@ -30,9 +26,6 @@ else JAVA=java fi -# shutdown settings -ADMIN_PORT=10523 -ADMIN_KEY=so3du5kasd5dn -(cd "$OFBIZ_HOME" && $JAVA -Dofbiz.admin.port=$ADMIN_PORT -Dofbiz.admin.key=$ADMIN_KEY -jar ofbiz.jar -shutdown) +(cd "$OFBIZ_HOME" && $JAVA -jar ofbiz.jar -shutdown)