From c2ea70f35506fd20ed29ccda3a6e37cd7eb19eef Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sat, 29 Jan 2011 23:35:01 +0000 Subject: [PATCH] A slightly modified patch from Pierre Smits "Enhancement to create new tenants easier" (https://issues.apache.org/jira/browse/OFBIZ-3971) - OFBIZ-3971 This patch enables users to create new tenants via the ANT process. Users can enter: * Tenant ID * Tenant Name * Data to load on creation of the tenant db (e.g.seed, seed-ext, demo) * Database Platform (Derby, MySQL, Oracle, PostgreSQL) remark: You can NOT mix platforms) * IP address of the database (you can add a port if needed) * User-ID for the database * Password for the database Based on the data provided the process will: * Create a new row in the Tenant table * Create a new row in the TenantDataSource table * Create new tables in the new tenant database and fill with initial data (seed, seed-ext, demo) * Create a new admin id for the tenant (based on Tenant ID followed by '-admin') * Set the initial password for the tenant admin id (initial 'ofbiz', must be changed on first login) This patch has been tested against: Derby, MySQL, PostgreSQL. This has not been tested against other db platforms. Prior to running the ANT task the user * has to modify 'general.properties' in framework/common/config to reflect multi tenancy (multitenant=Y) * has to have appropriate db driver(s) in place * has to create the databases first in function of the entityengine.xml datasource-names (not for Derby, applicable for MySQL and PostgreSQL.) git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1065144 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 187 ++++++++++++++++++ framework/entity/config/entityengine.xml | 155 ++++++++++++++- .../templates/AdminNewTenantData-Derby.xml | 8 + .../templates/AdminNewTenantData-MySQL.xml | 8 + .../templates/AdminNewTenantData-Oracle.xml | 8 + .../AdminNewTenantData-PostgreSQL.xml | 8 + 6 files changed, 372 insertions(+), 2 deletions(-) create mode 100644 framework/resources/templates/AdminNewTenantData-Derby.xml create mode 100644 framework/resources/templates/AdminNewTenantData-MySQL.xml create mode 100644 framework/resources/templates/AdminNewTenantData-Oracle.xml create mode 100644 framework/resources/templates/AdminNewTenantData-PostgreSQL.xml diff --git a/build.xml b/build.xml index dd9bb4fe82..ff4fd91eca 100644 --- a/build.xml +++ b/build.xml @@ -419,6 +419,193 @@ under the License. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ------------------------------------ + + tenantName = ${tenantName} + db-Platform = ${db-Platform} + db-IP = ${db-IP} + db-User = ${db-User} + db-Password = ${db-Password} + ------------------------------------ + database for tenant data will be 'ofbiz_${tenantId}' + database for tenant olap data will be 'ofbizolap_${tenantId} + + ------------------------------------ + + + + + ------------------------------------ + + + + + ------------------------------------ + + + + + + + + + + + + + + ------------------------------------ + + + + ------------------------------------ + + + + + + + + + + + + + + + + + + + + diff --git a/framework/entity/config/entityengine.xml b/framework/entity/config/entityengine.xml index 7d00cab2d3..e98bcbbedd 100644 --- a/framework/entity/config/entityengine.xml +++ b/framework/entity/config/entityengine.xml @@ -53,11 +53,23 @@ access. For a detailed description see the core/docs/entityconfig.html file. + + + + @@ -65,6 +77,12 @@ access. For a detailed description see the core/docs/entityconfig.html file. + + @@ -320,6 +338,66 @@ access. For a detailed description see the core/docs/entityconfig.html file. For more look at http://markmail.org/thread/5sivpykv7xkl66px and http://commons.apache.org/dbcp/configuration.html--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + time-between-eviction-runs-millis="600000"/> + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/framework/resources/templates/AdminNewTenantData-MySQL.xml b/framework/resources/templates/AdminNewTenantData-MySQL.xml new file mode 100644 index 0000000000..b3e56344c6 --- /dev/null +++ b/framework/resources/templates/AdminNewTenantData-MySQL.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/framework/resources/templates/AdminNewTenantData-Oracle.xml b/framework/resources/templates/AdminNewTenantData-Oracle.xml new file mode 100644 index 0000000000..2981ecca2c --- /dev/null +++ b/framework/resources/templates/AdminNewTenantData-Oracle.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/framework/resources/templates/AdminNewTenantData-PostgreSQL.xml b/framework/resources/templates/AdminNewTenantData-PostgreSQL.xml new file mode 100644 index 0000000000..ab6e6d0454 --- /dev/null +++ b/framework/resources/templates/AdminNewTenantData-PostgreSQL.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file