Author: jonesde
Date: Thu Mar 25 04:42:26 2010 New Revision: 927271 URL: http://svn.apache.org/viewvc?rev=927271&view=rev Log: Merged multitenant20100310 branch into the trunk Added: ofbiz/trunk/framework/entity/data/ - copied from r927264, ofbiz/branches/multitenant20100310/framework/entity/data/ ofbiz/trunk/framework/entity/data/TenantDemoData.xml - copied unchanged from r927264, ofbiz/branches/multitenant20100310/framework/entity/data/TenantDemoData.xml ofbiz/trunk/framework/entity/entitydef/entitygroup.xml - copied unchanged from r927264, ofbiz/branches/multitenant20100310/framework/entity/entitydef/entitygroup.xml ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperInfo.java - copied unchanged from r927264, ofbiz/branches/multitenant20100310/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperInfo.java Modified: ofbiz/trunk/ (props changed) ofbiz/trunk/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml (props changed) ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy (props changed) ofbiz/trunk/applications/product/script/org/ofbiz/product/test/InventoryTests.xml (props changed) ofbiz/trunk/framework/common/config/CommonUiLabels.xml ofbiz/trunk/framework/common/config/SecurityextUiLabels.xml ofbiz/trunk/framework/common/webcommon/login.ftl ofbiz/trunk/framework/common/widget/HelpScreens.xml (props changed) ofbiz/trunk/framework/entity/config/entityengine.xml ofbiz/trunk/framework/entity/entitydef/entitymodel.xml ofbiz/trunk/framework/entity/ofbiz-component.xml ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DumbFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryInterface.java ofbiz/trunk/framework/entityext/entitydef/entitymodel.xml ofbiz/trunk/framework/entityext/ofbiz-component.xml ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/DelegatorEcaHandler.java ofbiz/trunk/framework/geronimo/src/org/ofbiz/geronimo/GeronimoTransactionFactory.java ofbiz/trunk/framework/security/entitydef/entitymodel.xml ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntityMaint.groovy ofbiz/trunk/specialpurpose/ebaystore/lib/ (props changed) ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy (props changed) ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy (props changed) ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy (props changed) ofbiz/trunk/specialpurpose/ldap/src/org/ofbiz/ldap/LdapLoginWorker.java Propchange: ofbiz/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 25 04:42:26 2010 @@ -1 +1,2 @@ /ofbiz/branches/addbirt:831210-885099,885686-886087 +/ofbiz/branches/multitenant20100310:921280-927264 Propchange: ofbiz/trunk/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 25 04:42:26 2010 @@ -1 +1,2 @@ /ofbiz/branches/addbirt/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml:831210-885099,885686-886087 +/ofbiz/branches/multitenant20100310/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml:921280-927264 Propchange: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 25 04:42:26 2010 @@ -0,0 +1,2 @@ +/incubator/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy:418499-490456 +/ofbiz/branches/multitenant20100310/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy:921280-927264 Propchange: ofbiz/trunk/applications/product/script/org/ofbiz/product/test/InventoryTests.xml ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 25 04:42:26 2010 @@ -1 +1,2 @@ /ofbiz/branches/addbirt/applications/product/script/org/ofbiz/shipment/test/FacilityTests.xml:831210-885099,885686-886087 +/ofbiz/branches/multitenant20100310/applications/product/script/org/ofbiz/product/test/InventoryTests.xml:921280-927264 Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original) +++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Thu Mar 25 04:42:26 2010 @@ -7075,6 +7075,9 @@ <value xml:lang="nl">Belasting</value> <value xml:lang="zh">ç¨</value> </property> + <property key="CommonTenantId"> + <value xml:lang="en">Tenant ID</value> + </property> <property key="CommonTelephoneAbbr"> <value xml:lang="ar">ÙاتÙ</value> <value xml:lang="de">Tel</value> Modified: ofbiz/trunk/framework/common/config/SecurityextUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/SecurityextUiLabels.xml?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/common/config/SecurityextUiLabels.xml (original) +++ ofbiz/trunk/framework/common/config/SecurityextUiLabels.xml Thu Mar 25 04:42:26 2010 @@ -177,7 +177,7 @@ </property> <property key="loginevents.unable_to_login_this_application"> <value xml:lang="de">Anmeldung bei der Anwendung nicht erfolgreich</value> - <value xml:lang="en">unable to login this application</value> + <value xml:lang="en">You cannot login to this application</value> <value xml:lang="es">No puedo conectarse a esta aplicación (faltan permisos)</value> <value xml:lang="fr">Impossible de se connecter à cette application.</value> <value xml:lang="it">L'autenticazione per questa applicazione non è stata completata (permessi non sufficienti).</value> @@ -187,6 +187,9 @@ <value xml:lang="th">à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¸¥à¸à¸à¸à¸´à¸à¹à¸à¹à¸²à¸ªà¸¹à¹à¹à¸à¸£à¹à¸à¸£à¸¡à¸à¸£à¸°à¸¢à¸¸à¸à¸à¹à¸à¸µà¹</value> <value xml:lang="zh">æ æ³ç»å½è¿ä¸ªåºç¨ç¨åº</value> </property> + <property key="loginevents.unable_to_login_tenant"> + <value xml:lang="en">You cannot login to this tenant</value> + </property> <property key="loginevents.user_already_logged_in"> <value xml:lang="de">Dieser User ist bereits eingeloggt.</value> <value xml:lang="en">This user is already logged in.</value> Modified: ofbiz/trunk/framework/common/webcommon/login.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/login.ftl?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/common/webcommon/login.ftl (original) +++ ofbiz/trunk/framework/common/webcommon/login.ftl Thu Mar 25 04:42:26 2010 @@ -42,6 +42,10 @@ under the License. <td><input type="password" name="PASSWORD" value="" size="20"/></td> </tr> <tr> + <td class="label">${uiLabelMap.CommonTenantId}</td> + <td><input type="text" name="tenantId" value="${parameters.tenantId?if_exists}" size="20"/></td> + </tr> + <tr> <td colspan="2" align="center"> <input type="submit" value="${uiLabelMap.CommonLogin}"/> </td> Propchange: ofbiz/trunk/framework/common/widget/HelpScreens.xml ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 25 04:42:26 2010 @@ -1 +1,2 @@ /ofbiz/branches/addbirt/applications/commonext/widget/HelpScreens.xml:831210-885099,885686-886087 +/ofbiz/branches/multitenant20100310/framework/common/widget/HelpScreens.xml:921280-927264 Modified: ofbiz/trunk/framework/entity/config/entityengine.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/config/entityengine.xml (original) +++ ofbiz/trunk/framework/entity/config/entityengine.xml Thu Mar 25 04:42:26 2010 @@ -52,19 +52,19 @@ access. For a detailed description see t <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false"> <group-map group-name="org.ofbiz" datasource-name="localderby"/> <group-map group-name="org.ofbiz.olap" datasource-name="localderbyolap"/> + <group-map group-name="org.ofbiz.tenant" datasource-name="localderbytenant"/> </delegator> <delegator name="default-no-eca" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" entity-eca-enabled="false" distributed-cache-clear-enabled="false"> <group-map group-name="org.ofbiz" datasource-name="localderby"/> <group-map group-name="org.ofbiz.olap" datasource-name="localderbyolap"/> + <group-map group-name="org.ofbiz.tenant" datasource-name="localderbytenant"/> </delegator> <!-- be sure that your default delegator (or the one you use) uses the same datasource for test. You must run "ant run-install" before running "ant run-tests" --> <delegator name="test" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main"> <group-map group-name="org.ofbiz" datasource-name="localderby"/> <group-map group-name="org.ofbiz.olap" datasource-name="localderbyolap"/> - </delegator> - <delegator name="other" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main"> - <group-map group-name="org.ofbiz" datasource-name="localpostgres"/> + <group-map group-name="org.ofbiz.tenant" datasource-name="localderbytenant"/> </delegator> <!-- need to at least define a name for each component to use --> @@ -218,7 +218,31 @@ access. For a detailed description see t time-between-eviction-runs-millis="600000"/> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> --> </datasource> - + <datasource name="localderbytenant" + helper-class="org.ofbiz.entity.datasource.GenericHelperDAO" + schema-name="OFBIZ" + field-type-name="derby" + check-on-start="true" + add-missing-on-start="true" + use-pk-constraint-names="false" + use-indices-unique="false" + alias-view-columns="false"> + <read-data reader-name="seed"/> + <read-data reader-name="seed-initial"/> + <read-data reader-name="demo"/> + <read-data reader-name="ext"/> + <inline-jdbc + jdbc-driver="org.apache.derby.jdbc.EmbeddedDriver" + jdbc-uri="jdbc:derby:ofbiztenant;create=true" + jdbc-username="ofbiz" + jdbc-password="ofbiz" + isolation-level="ReadCommitted" + pool-minsize="2" + pool-maxsize="250" + time-between-eviction-runs-millis="600000"/> + <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> --> + </datasource> + <datasource name="localcloudscape" helper-class="org.ofbiz.entity.datasource.GenericHelperDAO" field-type-name="cloudscape" Modified: ofbiz/trunk/framework/entity/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/entitydef/entitymodel.xml?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/framework/entity/entitydef/entitymodel.xml Thu Mar 25 04:42:26 2010 @@ -35,6 +35,7 @@ under the License. <!-- - org.ofbiz.entity.audit --> <!-- - org.ofbiz.entity.crypto --> <!-- - org.ofbiz.entity.sequence --> + <!-- - org.ofbiz.entity.tenant --> <!-- ========================================================= --> <entity entity-name="EntityAuditLog" package-name="org.ofbiz.entity.audit" title="Entity Audit Log"> @@ -59,4 +60,65 @@ under the License. <field name="seqId" type="numeric"></field> <prim-key field="seqName"/> </entity> + + <!-- ========================================================= --> + <!-- org.ofbiz.entity.tenant --> + <!-- ========================================================= --> + + <entity entity-name="Tenant" package-name="org.ofbiz.entity.tenant"> + <field name="tenantId" type="id-ne"/> + <field name="tenantName" type="name"/> + <field name="disabled" type="indicator"><description>Disabled if 'Y', defaults to 'N' (not disabled).</description></field> + <prim-key field="tenantId"/> + </entity> + <entity entity-name="TenantDataSource" package-name="org.ofbiz.entity.tenant"> + <description> + There should be one record for each tenant and each group-map for the active delegator. + The jdbc fields will override the datasource -> inline-jdbc values for the per-tenant delegator. + </description> + <field name="tenantId" type="id-ne"/> + <field name="entityGroupName" type="name"/> + <field name="jdbcUri" type="long-varchar"/> + <field name="jdbcUsername" type="long-varchar"/> + <field name="jdbcPassword" type="long-varchar"> + <!-- This field should probably be encrypted, but the encrypt=true attribute will not work in this case + because different tenants will have different sets of encryption keys because the EntityKeyStore table is + in the per-tenant database an not in the shared tenant control database, which causes different keys to + be used for those logged in under different tenants, causing decryption errors unless you do all + TenantDataSource maintenance from only one tenant (or the non-tenant master db). + + The problem is that each tenant has their own encryption keys, and that is they way it should be since + having easy access to the encryption keys that other tenants are using would be bad, and not having access + to your own encryption keys would also be bad. Because of that we can't move the EntityKeyStore entity + into the tenant control database. If we encrypt this with the keys from one tenant then no one logged in + with another tenant database will be able to decrypt it, so we can't use the keys in the per-tenant + databases for this. + + Technically we don't have to encrypt the JDBC password, it often isn't encrypted in the configuration + files anyway. But it would be nice to encrypt it to protect other databases anyway, even if they are + probably on the same box and in the same database server instance. + --> + </field> + <prim-key field="tenantId"/> + <prim-key field="entityGroupName"/> + <relation type="one" fk-name="TNTDTSRC_TNT" rel-entity-name="Tenant"> + <key-map field-name="tenantId"/> + </relation> + </entity> + <!-- may be no reason for this entity, user is authenticated inside the tenant and this would only be useful to + get a list of tenants per user + <entity entity-name="TenantUserLogin" package-name="org.ofbiz.entity.tenant"> + <field name="tenantId" type="id-ne"/> + <field name="userLoginId" type="name"/> + <field name="fromDate" type="date-time"/> + <field name="thruDate" type="date-time"/> + <prim-key field="tenantId"/> + <prim-key field="userLoginId"/> + <prim-key field="fromDate"/> + <relation type="one" fk-name="TNTUSRLGN_TNT" rel-entity-name="Tenant"> + <key-map field-name="tenantId"/> + </relation> + <!- - NOTE: there is no FK to the UserLogin entity, which is in a higher-level component, and would normally be in a separate database - -> + </entity> + --> </entitymodel> Modified: ofbiz/trunk/framework/entity/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/ofbiz-component.xml?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/ofbiz-component.xml (original) +++ ofbiz/trunk/framework/entity/ofbiz-component.xml Thu Mar 25 04:42:26 2010 @@ -27,10 +27,14 @@ under the License. <classpath type="jar" location="lib/*"/> <classpath type="jar" location="lib/jdbc/*"/> <classpath type="jar" location="build/lib/*"/> + <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/> - + <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/> + <!-- these are for unit testing --> <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_test.xml"/> + <entity-resource type="data" reader-name="demo" loader="main" location="data/TenantDemoData.xml"/> + <test-suite loader="main" location="testdef/entitytests.xml"/> </ofbiz-component> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java Thu Mar 25 04:42:26 2010 @@ -29,6 +29,7 @@ import javax.xml.parsers.ParserConfigura import org.ofbiz.entity.cache.Cache; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.datasource.GenericHelper; +import org.ofbiz.entity.datasource.GenericHelperInfo; import org.ofbiz.entity.eca.EntityEcaHandler; import org.ofbiz.entity.model.DynamicViewEntity; import org.ofbiz.entity.model.ModelEntity; @@ -504,6 +505,8 @@ public interface Delegator { public Cache getCache(); public String getDelegatorName(); + public String getDelegatorBaseName(); + public String getDelegatorTenantId(); public <T> EntityEcaHandler<T> getEntityEcaHandler(); @@ -599,6 +602,8 @@ public interface Delegator { */ public String getGroupHelperName(String groupName); + public GenericHelperInfo getGroupHelperInfo(String entityGroupName); + /** * Gets the instance of ModelEntity that corresponds to this delegator and * the specified entityName Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Thu Mar 25 04:42:26 2010 @@ -25,7 +25,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; -import java.util.ListIterator; import java.util.Map; import java.util.Set; import java.util.TreeSet; @@ -55,6 +54,7 @@ import org.ofbiz.entity.config.Delegator import org.ofbiz.entity.config.EntityConfigUtil; import org.ofbiz.entity.datasource.GenericHelper; import org.ofbiz.entity.datasource.GenericHelperFactory; +import org.ofbiz.entity.datasource.GenericHelperInfo; import org.ofbiz.entity.eca.EntityEcaHandler; import org.ofbiz.entity.model.DynamicViewEntity; import org.ofbiz.entity.model.ModelEntity; @@ -95,7 +95,11 @@ public class GenericDelegator implements /** This flag is only here for lower level technical testing, it shouldn't be user configurable (or at least I don't think so yet); when true all operations without a transaction will be wrapped in one; seems to be necessary for some (all?) XA aware connection pools, and should improve overall stability and consistency */ public static final boolean alwaysUseTransaction = true; - protected String delegatorName = null; + protected String delegatorBaseName = null; + protected String delegatorFullName = null; + protected String delegatorTenantId = null; + private String originalDelegatorName = null; + protected DelegatorInfo delegatorInfo = null; protected Cache cache = null; @@ -119,8 +123,6 @@ public class GenericDelegator implements private volatile LinkedBlockingDeque<TestOperation> testOperations = null; private enum OperationType {INSERT, UPDATE, DELETE}; - private String originalDelegatorName = null; - /** @deprecated Use Delegator delegator = DelegatorFactory.getDelegator(delegatorName); * @param delegatorName * @return the configured delegator @@ -216,14 +218,25 @@ public class GenericDelegator implements protected GenericDelegator() {} /** Only allow creation through the factory method */ - protected GenericDelegator(String delegatorName) throws GenericEntityException { - //if (Debug.infoOn()) Debug.logInfo("Creating new Delegator with name \"" + delegatorName + "\".", module); + protected GenericDelegator(String delegatorFullName) throws GenericEntityException { + //if (Debug.infoOn()) Debug.logInfo("Creating new Delegator with name \"" + delegatorFullName + "\".", module); + this.setDelegatorNames(delegatorFullName); + + // before continuing, if there is a tenantId use the base delegator to see if it is valid + if (UtilValidate.isNotEmpty(this.delegatorTenantId)) { + Delegator baseDelegator = DelegatorFactory.getDelegator(this.delegatorBaseName); + GenericValue tenant = baseDelegator.findOne("Tenant", true, "tenantId", this.delegatorTenantId); + if (tenant == null) { + throw new GenericEntityException("No Tenant record found for delegator [" + this.delegatorFullName + "] with tenantId [" + this.delegatorTenantId + "]"); + } else if ("Y".equals(tenant.getString("disabled"))) { + throw new GenericEntityException("No Tenant record found for delegator [" + this.delegatorFullName + "] with tenantId [" + this.delegatorTenantId + "]"); + } + } + + this.modelReader = ModelReader.getModelReader(delegatorBaseName); + this.modelGroupReader = ModelGroupReader.getModelGroupReader(delegatorBaseName); - this.delegatorName = delegatorName; - this.modelReader = ModelReader.getModelReader(delegatorName); - this.modelGroupReader = ModelGroupReader.getModelGroupReader(delegatorName); - - cache = new Cache(delegatorName); + cache = new Cache(delegatorFullName); // do the entity model check List<String> warningList = FastList.newInstance(); @@ -237,28 +250,27 @@ public class GenericDelegator implements } // initialize helpers by group - Set<String> groupNames = getModelGroupReader().getGroupNames(delegatorName); - Iterator<String> groups = UtilMisc.toIterator(groupNames); - while (groups != null && groups.hasNext()) { - String groupName = groups.next(); - String helperName = this.getGroupHelperName(groupName); + Set<String> groupNames = getModelGroupReader().getGroupNames(delegatorBaseName); + for (String groupName: groupNames) { + GenericHelperInfo helperInfo = this.getGroupHelperInfo(groupName); + String helperBaseName = helperInfo.getHelperBaseName(); - if (Debug.infoOn()) Debug.logInfo("Delegator \"" + delegatorName + "\" initializing helper \"" + - helperName + "\" for entity group \"" + groupName + "\".", module); + if (Debug.infoOn()) Debug.logInfo("Delegator \"" + delegatorFullName + "\" initializing helper \"" + + helperBaseName + "\" for entity group \"" + groupName + "\".", module); TreeSet<String> helpersDone = new TreeSet<String>(); - if (UtilValidate.isNotEmpty(helperName)) { + if (UtilValidate.isNotEmpty(helperInfo.getHelperFullName())) { // make sure each helper is only loaded once - if (helpersDone.contains(helperName)) { - if (Debug.infoOn()) Debug.logInfo("Helper \"" + helperName + "\" already initialized, not re-initializing.", module); + if (helpersDone.contains(helperInfo.getHelperFullName())) { + if (Debug.infoOn()) Debug.logInfo("Helper \"" + helperInfo.getHelperFullName() + "\" already initialized, not re-initializing.", module); continue; } - helpersDone.add(helperName); + helpersDone.add(helperInfo.getHelperFullName()); // pre-load field type defs, the return value is ignored - ModelFieldTypeReader.getModelFieldTypeReader(helperName); + ModelFieldTypeReader.getModelFieldTypeReader(helperBaseName); // get the helper and if configured, do the datasource check - GenericHelper helper = GenericHelperFactory.getHelper(helperName); + GenericHelper helper = GenericHelperFactory.getHelper(helperInfo); - DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); + DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperBaseName); if (datasourceInfo.checkOnStart) { if (Debug.infoOn()) Debug.logInfo("Doing database check as requested in entityengine.xml with addMissing=" + datasourceInfo.addMissingOnStart, module); try { @@ -272,7 +284,7 @@ public class GenericDelegator implements // NOTE: doing some things before the ECAs and such to make sure it is in place just in case it is used in a service engine startup thing or something - // setup the crypto class + // setup the crypto class; this also after the delegator is in the cache otherwise we get infinite recursion this.crypto = new EntityCrypto(this); //time to do some tricks with manual class loading that resolves circular dependencies, like calling services... @@ -299,7 +311,19 @@ public class GenericDelegator implements Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " does not implement the DistributedCacheClear interface, distributed cache clearing will be disabled", module); } } else { - Debug.logInfo("Distributed Cache Clear System disabled for delegator [" + delegatorName + "]", module); + Debug.logInfo("Distributed Cache Clear System disabled for delegator [" + delegatorFullName + "]", module); + } + } + + protected void setDelegatorNames(String delegatorFullName) { + this.delegatorFullName = delegatorFullName; + + int hashSymbolIndex = delegatorFullName.indexOf('#'); + if (hashSymbolIndex == -1) { + this.delegatorBaseName = delegatorFullName; + } else { + this.delegatorBaseName = delegatorFullName.substring(0, hashSymbolIndex); + this.delegatorTenantId = delegatorFullName.substring(hashSymbolIndex + 1); } } @@ -329,7 +353,7 @@ public class GenericDelegator implements Debug.logWarning(e, "EntityEcaHandler class with name " + entityEcaHandlerClassName + " does not implement the EntityEcaHandler interface, Entity ECA Rules will be disabled", module); } } else { - Debug.logInfo("Entity ECA Handler disabled for delegator [" + delegatorName + "]", module); + Debug.logInfo("Entity ECA Handler disabled for delegator [" + delegatorFullName + "]", module); } } @@ -337,19 +361,33 @@ public class GenericDelegator implements * @see org.ofbiz.entity.Delegator#getDelegatorName() */ public String getDelegatorName() { - return this.delegatorName; + return this.delegatorFullName; + } + + /* (non-Javadoc) + * @see org.ofbiz.entity.Delegator#getDelegatorBaseName() + */ + public String getDelegatorBaseName() { + return this.delegatorBaseName; + } + + /* (non-Javadoc) + * @see org.ofbiz.entity.Delegator#getDelegatorBaseName() + */ + public String getDelegatorTenantId() { + return this.delegatorTenantId; } /* (non-Javadoc) * @see org.ofbiz.entity.Delegator#getOriginalDelegatorName() */ public String getOriginalDelegatorName() { - return this.originalDelegatorName == null ? this.delegatorName : this.originalDelegatorName; + return this.originalDelegatorName == null ? this.delegatorFullName : this.originalDelegatorName; } protected DelegatorInfo getDelegatorInfo() { if (this.delegatorInfo == null) { - this.delegatorInfo = EntityConfigUtil.getDelegatorInfo(this.delegatorName); + this.delegatorInfo = EntityConfigUtil.getDelegatorInfo(this.delegatorBaseName); } return this.delegatorInfo; } @@ -384,7 +422,7 @@ public class GenericDelegator implements * @see org.ofbiz.entity.Delegator#getEntityGroupName(java.lang.String) */ public String getEntityGroupName(String entityName) { - return getModelGroupReader().getEntityGroupName(entityName, getOriginalDelegatorName()); + return getModelGroupReader().getEntityGroupName(entityName, this.delegatorBaseName); } /* (non-Javadoc) @@ -397,7 +435,7 @@ public class GenericDelegator implements // add all entities with no group name to the Set Set<String> allEntityNames = this.getModelReader().getEntityNames(); for (String entityName: allEntityNames) { - if (this.getDelegatorInfo().defaultGroupName.equals(getModelGroupReader().getEntityGroupName(entityName, getDelegatorName()))) { + if (this.getDelegatorInfo().defaultGroupName.equals(getModelGroupReader().getEntityGroupName(entityName, this.delegatorBaseName))) { entityNameSet.add(entityName); } } @@ -437,6 +475,42 @@ public class GenericDelegator implements return this.getDelegatorInfo().groupMap.get(groupName); } + public GenericHelperInfo getGroupHelperInfo(String entityGroupName) { + if (entityGroupName == null) return null; + String helperBaseName = this.getGroupHelperName(entityGroupName); + if (helperBaseName == null) return null; + GenericHelperInfo helperInfo = new GenericHelperInfo(entityGroupName, helperBaseName); + + // to avoid infinite recursion, and to behave right for shared org.ofbiz.tenant entities, do nothing with the tenantId if the entityGroupName=org.ofbiz.tenant + if (UtilValidate.isNotEmpty(this.delegatorTenantId) && !"org.ofbiz.tenant".equals(entityGroupName)) { + helperInfo.setTenantId(this.delegatorTenantId); + + // get the JDBC parameters from the DB for the entityGroupName and tenantId + try { + // NOTE: instead of caching the GenericHelpInfo object do a cached query here and create a new object each time, will avoid issues when the database data changes during run time + // NOTE: always use the base delegator for this to avoid problems when this is being initialized + Delegator baseDelegator = DelegatorFactory.getDelegator(this.delegatorBaseName); + GenericValue tenantDataSource = baseDelegator.findOne("TenantDataSource", true, "tenantId", this.delegatorTenantId, "entityGroupName", entityGroupName); + if (tenantDataSource != null) { + helperInfo.setOverrideJdbcUri(tenantDataSource.getString("jdbcUri")); + helperInfo.setOverrideUsername(tenantDataSource.getString("jdbcUsername")); + helperInfo.setOverridePassword(tenantDataSource.getString("jdbcPassword")); + } else { + // don't log this, happens too many times: if (Debug.warningOn()) Debug.logWarning("Could not find TenantDataSource information for tenantId=[" + this.delegatorTenantId + "] and entityGroupName=[" + entityGroupName + "] in delegator [" + this.delegatorFullName + "]; will be defaulting to settings for the base delegator name [" + this.delegatorBaseName + "]", module); + } + } catch (GenericEntityException e) { + // don't complain about this too much, just log the error if there is one + Debug.logInfo(e, "Error getting TenantDataSource info for tenantId=" + this.delegatorTenantId + ", entityGroupName=" + entityGroupName, module); + } + + } + return helperInfo; + } + + protected GenericHelperInfo getEntityHelperInfo(String entityName) { + return this.getGroupHelperInfo(this.getEntityGroupName(entityName)); + } + /* (non-Javadoc) * @see org.ofbiz.entity.Delegator#getEntityHelperName(java.lang.String) */ @@ -457,10 +531,10 @@ public class GenericDelegator implements * @see org.ofbiz.entity.Delegator#getEntityHelper(java.lang.String) */ public GenericHelper getEntityHelper(String entityName) throws GenericEntityException { - String helperName = getEntityHelperName(entityName); + GenericHelperInfo helperInfo = getEntityHelperInfo(entityName); - if (UtilValidate.isNotEmpty(helperName)) { - return GenericHelperFactory.getHelper(helperName); + if (helperInfo != null) { + return GenericHelperFactory.getHelper(helperInfo); } else { throw new GenericEntityException("There is no datasource (Helper) configured for the entity-group [" + this.getEntityGroupName(entityName) + "]; was trying to find datesource (helper) for entity [" + entityName + "]"); } @@ -713,7 +787,14 @@ public class GenericDelegator implements } catch (GenericEntityException e) { // see if this was caused by an existing record before resetting the sequencer and trying again // NOTE: use the helper directly so ECA rules, etc won't be run - GenericValue existingValue = helper.findByPrimaryKey(value.getPrimaryKey()); + + GenericValue existingValue = null; + try { + existingValue = helper.findByPrimaryKey(value.getPrimaryKey()); + } catch (GenericEntityException e1) { + // ignore this error, if not found it'll probably be a GenericEntityNotFoundException + // it is important to not let this get thrown because it will mask the original exception + } if (existingValue == null) { throw e; } else { @@ -748,7 +829,7 @@ public class GenericDelegator implements return value; } catch (GenericEntityException e) { - String errMsg = "Failure in create operation for entity [" + value.getEntityName() + "]: " + e.toString() + ". Rolling back transaction."; + String errMsg = "Failure in createSetNextSeqId operation for entity [" + value.getEntityName() + "]: " + e.toString() + ". Rolling back transaction."; Debug.logError(e, errMsg, module); try { // only rollback the transaction if we started one... @@ -1666,21 +1747,21 @@ public class GenericDelegator implements // from the delegator level this is complicated because different GenericPK // objects in the list may correspond to different helpers - Map<String, List<GenericPK>> pksPerHelper = FastMap.newInstance(); + Map<String, List<GenericPK>> pksPerGroup = FastMap.newInstance(); for (GenericPK curPK: primaryKeys) { - String helperName = this.getEntityHelperName(curPK.getEntityName()); - List<GenericPK> pks = pksPerHelper.get(helperName); + String groupName = this.getEntityGroupName(curPK.getEntityName()); + List<GenericPK> pks = pksPerGroup.get(groupName); if (pks == null) { pks = FastList.newInstance(); - pksPerHelper.put(helperName, pks); + pksPerGroup.put(groupName, pks); } pks.add(curPK); } - for (Map.Entry<String, List<GenericPK>> curEntry: pksPerHelper.entrySet()) { - String helperName = curEntry.getKey(); - GenericHelper helper = GenericHelperFactory.getHelper(helperName); + for (Map.Entry<String, List<GenericPK>> curEntry: pksPerGroup.entrySet()) { + String groupName = curEntry.getKey(); + GenericHelper helper = GenericHelperFactory.getHelper(this.getGroupHelperInfo(groupName)); List<GenericValue> values = helper.findAllByPrimaryKeys(curEntry.getValue()); results.addAll(values); @@ -1724,7 +1805,7 @@ public class GenericDelegator implements // from the delegator level this is complicated because different GenericPK // objects in the list may correspond to different helpers - Map<String, List<GenericPK>> pksPerHelper = FastMap.newInstance(); + Map<String, List<GenericPK>> pksPerGroup = FastMap.newInstance(); for (GenericPK curPK: primaryKeys) { GenericValue value = this.getFromPrimaryKeyCache(curPK); @@ -1733,20 +1814,20 @@ public class GenericDelegator implements results.add(value); } else { // is not in the cache, so put in a list for a call to the helper - String helperName = this.getEntityHelperName(curPK.getEntityName()); - List<GenericPK> pks = pksPerHelper.get(helperName); + String groupName = this.getEntityGroupName(curPK.getEntityName()); + List<GenericPK> pks = pksPerGroup.get(groupName); if (pks == null) { pks = FastList.newInstance(); - pksPerHelper.put(helperName, pks); + pksPerGroup.put(groupName, pks); } pks.add(curPK); } } - for (Map.Entry<String, List<GenericPK>> curEntry: pksPerHelper.entrySet()) { - String helperName = curEntry.getKey(); - GenericHelper helper = GenericHelperFactory.getHelper(helperName); + for (Map.Entry<String, List<GenericPK>> curEntry: pksPerGroup.entrySet()) { + String groupName = curEntry.getKey(); + GenericHelper helper = GenericHelperFactory.getHelper(this.getGroupHelperInfo(groupName)); List<GenericValue> values = helper.findAllByPrimaryKeys(curEntry.getValue()); this.putAllInPrimaryKeyCache(values); @@ -3136,14 +3217,17 @@ public class GenericDelegator implements /* (non-Javadoc) * @see org.ofbiz.entity.Delegator#cloneDelegator(java.lang.String) */ - public GenericDelegator cloneDelegator(String delegatorName) { + public GenericDelegator cloneDelegator(String delegatorFullName) { // creates an exact clone of the delegator; except for the sequencer // note that this will not be cached and should be used only when // needed to change something for single instance (use). GenericDelegator newDelegator = new GenericDelegator(); newDelegator.modelReader = this.modelReader; newDelegator.modelGroupReader = this.modelGroupReader; - newDelegator.delegatorName = delegatorName; + newDelegator.setDelegatorNames(UtilValidate.isNotEmpty(delegatorFullName) ? delegatorFullName : this.delegatorFullName); + // set the delegatorBaseName to be the same so that configuration settings all work the same as the current + // delegator, allowing the new delegatorFullName to not match a delegator name in the entityengine.xml file + newDelegator.delegatorBaseName = this.delegatorBaseName; newDelegator.delegatorInfo = this.delegatorInfo; newDelegator.cache = this.cache; newDelegator.andCacheFieldSets = this.andCacheFieldSets; @@ -3163,7 +3247,7 @@ public class GenericDelegator implements * @see org.ofbiz.entity.Delegator#cloneDelegator() */ public GenericDelegator cloneDelegator() { - return this.cloneDelegator(this.delegatorName); + return this.cloneDelegator(this.delegatorFullName); } /* (non-Javadoc) Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java Thu Mar 25 04:42:26 2010 @@ -23,12 +23,13 @@ import java.sql.SQLException; import org.w3c.dom.Element; import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.datasource.GenericHelperInfo; /** * ConnectionFactoryInterface */ public interface ConnectionFactoryInterface { - public Connection getConnection(String helperName, Element configElement) throws SQLException, GenericEntityException; + public Connection getConnection(GenericHelperInfo helperInfo, Element configElement) throws SQLException, GenericEntityException; public void closeAll(); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Thu Mar 25 04:42:26 2010 @@ -28,6 +28,7 @@ import org.apache.commons.pool.impl.Gene import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.datasource.GenericHelperInfo; import org.ofbiz.entity.transaction.TransactionFactory; import org.w3c.dom.Element; @@ -48,24 +49,26 @@ public class DBCPConnectionFactory imple public static final String module = DBCPConnectionFactory.class.getName(); protected static Map<String, ManagedDataSource> dsCache = FastMap.newInstance(); - public Connection getConnection(String helperName, Element jdbcElement) throws SQLException, GenericEntityException { - ManagedDataSource mds = dsCache.get(helperName); + public Connection getConnection(GenericHelperInfo helperInfo, Element jdbcElement) throws SQLException, GenericEntityException { + ManagedDataSource mds = dsCache.get(helperInfo.getHelperFullName()); if (mds != null) { - return TransactionFactory.getCursorConnection(helperName, mds.getConnection()); + return TransactionFactory.getCursorConnection(helperInfo, mds.getConnection()); } synchronized (DBCPConnectionFactory.class) { - mds = dsCache.get(helperName); + mds = dsCache.get(helperInfo.getHelperFullName()); if (mds != null) { - return TransactionFactory.getCursorConnection(helperName, mds.getConnection()); + return TransactionFactory.getCursorConnection(helperInfo, mds.getConnection()); } // connection properties TransactionManager txMgr = TransactionFactory.getTransactionManager(); String driverName = jdbcElement.getAttribute("jdbc-driver"); - String dbUri = jdbcElement.getAttribute("jdbc-uri"); - String dbUser = jdbcElement.getAttribute("jdbc-username"); - String dbPass = jdbcElement.getAttribute("jdbc-password"); + + + String jdbcUri = UtilValidate.isNotEmpty(helperInfo.getOverrideJdbcUri()) ? helperInfo.getOverrideJdbcUri() : jdbcElement.getAttribute("jdbc-uri"); + String jdbcUsername = UtilValidate.isNotEmpty(helperInfo.getOverrideUsername()) ? helperInfo.getOverrideUsername() : jdbcElement.getAttribute("jdbc-username"); + String jdbcPassword = UtilValidate.isNotEmpty(helperInfo.getOverridePassword()) ? helperInfo.getOverridePassword() : jdbcElement.getAttribute("jdbc-password"); // pool settings int maxSize, minSize, timeBetweenEvictionRunsMillis; @@ -111,11 +114,11 @@ public class DBCPConnectionFactory imple // connection factory properties Properties cfProps = new Properties(); - cfProps.put("user", dbUser); - cfProps.put("password", dbPass); + cfProps.put("user", jdbcUsername); + cfProps.put("password", jdbcPassword); // create the connection factory - ConnectionFactory cf = new DriverConnectionFactory(jdbcDriver, dbUri, cfProps); + ConnectionFactory cf = new DriverConnectionFactory(jdbcDriver, jdbcUri, cfProps); // wrap it with a LocalXAConnectionFactory XAConnectionFactory xacf = new LocalXAConnectionFactory(txMgr, cf); @@ -156,9 +159,9 @@ public class DBCPConnectionFactory imple mds.setAccessToUnderlyingConnectionAllowed(true); // cache the pool - dsCache.put(helperName, mds); + dsCache.put(helperInfo.getHelperFullName(), mds); - return TransactionFactory.getCursorConnection(helperName, mds.getConnection()); + return TransactionFactory.getCursorConnection(helperInfo, mds.getConnection()); } } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java Thu Mar 25 04:42:26 2010 @@ -30,6 +30,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.datasource.GenericHelperInfo; import org.ofbiz.entity.transaction.TransactionFactory; import org.ofbiz.minerva.pool.jdbc.xa.XAPoolDataSource; import org.ofbiz.minerva.pool.jdbc.xa.wrapper.XADataSourceImpl; @@ -43,28 +44,33 @@ public class MinervaConnectionFactory im public static final String module = MinervaConnectionFactory.class.getName(); protected static Map<String, XAPoolDataSource> dsCache = FastMap.newInstance(); - public Connection getConnection(String helperName, Element jdbcElement) throws SQLException, GenericEntityException { - XAPoolDataSource pds = dsCache.get(helperName); + public Connection getConnection(GenericHelperInfo helperInfo, Element jdbcElement) throws SQLException, GenericEntityException { + XAPoolDataSource pds = dsCache.get(helperInfo.getHelperFullName()); if (pds != null) { - return TransactionFactory.getCursorConnection(helperName, pds.getConnection()); + return TransactionFactory.getCursorConnection(helperInfo, pds.getConnection()); } synchronized (MinervaConnectionFactory.class) { - pds = dsCache.get(helperName); + pds = dsCache.get(helperInfo.getHelperFullName()); if (pds != null) { return pds.getConnection(); } else { pds = new XAPoolDataSource(); - pds.setPoolName(helperName); + pds.setPoolName(helperInfo.getHelperFullName()); } XADataSourceImpl ds = new XADataSourceImpl(); - if (ds == null) + if (ds == null) { throw new GenericEntityException("XADataSource was not created, big problem!"); + } + + String jdbcUri = UtilValidate.isNotEmpty(helperInfo.getOverrideJdbcUri()) ? helperInfo.getOverrideJdbcUri() : jdbcElement.getAttribute("jdbc-uri"); + String jdbcUsername = UtilValidate.isNotEmpty(helperInfo.getOverrideUsername()) ? helperInfo.getOverrideUsername() : jdbcElement.getAttribute("jdbc-username"); + String jdbcPassword = UtilValidate.isNotEmpty(helperInfo.getOverridePassword()) ? helperInfo.getOverridePassword() : jdbcElement.getAttribute("jdbc-password"); ds.setDriver(jdbcElement.getAttribute("jdbc-driver")); - ds.setURL(jdbcElement.getAttribute("jdbc-uri")); + ds.setURL(jdbcUri); String transIso = jdbcElement.getAttribute("isolation-level"); if (UtilValidate.isNotEmpty(transIso)) { @@ -83,8 +89,8 @@ public class MinervaConnectionFactory im // set the datasource in the pool pds.setDataSource(ds); - pds.setJDBCUser(jdbcElement.getAttribute("jdbc-username")); - pds.setJDBCPassword(jdbcElement.getAttribute("jdbc-password")); + pds.setJDBCUser(jdbcUsername); + pds.setJDBCPassword(jdbcPassword); // set the transaction manager in the pool pds.setTransactionManager(TransactionFactory.getTransactionManager()); @@ -110,9 +116,9 @@ public class MinervaConnectionFactory im } // cache the pool - dsCache.put(helperName, pds); + dsCache.put(helperInfo.getHelperFullName(), pds); - return TransactionFactory.getCursorConnection(helperName, pds.getConnection()); + return TransactionFactory.getCursorConnection(helperInfo, pds.getConnection()); } } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Thu Mar 25 04:42:26 2010 @@ -71,24 +71,24 @@ public class GenericDAO { public static final String module = GenericDAO.class.getName(); private static final FastMap<String, GenericDAO> genericDAOs = FastMap.newInstance(); - private final String helperName; + private final GenericHelperInfo helperInfo; private final ModelFieldTypeReader modelFieldTypeReader; private final DatasourceInfo datasourceInfo; - public static GenericDAO getGenericDAO(String helperName) { - GenericDAO newGenericDAO = genericDAOs.get(helperName); + public static GenericDAO getGenericDAO(GenericHelperInfo helperInfo) { + GenericDAO newGenericDAO = genericDAOs.get(helperInfo.getHelperFullName()); if (newGenericDAO == null) { - genericDAOs.putIfAbsent(helperName, new GenericDAO(helperName)); - newGenericDAO = genericDAOs.get(helperName); + genericDAOs.putIfAbsent(helperInfo.getHelperFullName(), new GenericDAO(helperInfo)); + newGenericDAO = genericDAOs.get(helperInfo.getHelperFullName()); } return newGenericDAO; } - public GenericDAO(String helperName) { - this.helperName = helperName; - this.modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName); - this.datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); + public GenericDAO(GenericHelperInfo helperInfo) { + this.helperInfo = helperInfo; + this.modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperInfo.getHelperBaseName()); + this.datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperInfo.getHelperBaseName()); } private void addFieldIfMissing(List<ModelField> fieldsToSave, String fieldName, ModelEntity modelEntity) { @@ -108,7 +108,7 @@ public class GenericDAO { throw new GenericModelException("Could not find ModelEntity record for entityName: " + entity.getEntityName()); } - SQLProcessor sqlP = new SQLProcessor(helperName); + SQLProcessor sqlP = new SQLProcessor(helperInfo); try { return singleInsert(entity, modelEntity, modelEntity.getFieldsUnmodifiable(), sqlP); @@ -209,7 +209,7 @@ public class GenericDAO { } private int customUpdate(GenericEntity entity, ModelEntity modelEntity, List<ModelField> fieldsToSave) throws GenericEntityException { - SQLProcessor sqlP = new SQLProcessor(helperName); + SQLProcessor sqlP = new SQLProcessor(helperInfo); try { return singleUpdate(entity, modelEntity, fieldsToSave, sqlP); } catch (GenericEntityException e) { @@ -285,7 +285,7 @@ public class GenericDAO { } public int updateByCondition(ModelEntity modelEntity, Map<String, ? extends Object> fieldsToSet, EntityCondition condition) throws GenericEntityException { - SQLProcessor sqlP = new SQLProcessor(helperName); + SQLProcessor sqlP = new SQLProcessor(helperInfo); try { return updateByCondition(modelEntity, fieldsToSet, condition, sqlP); @@ -482,7 +482,7 @@ public class GenericDAO { /* ====================================================================== */ public void select(GenericEntity entity) throws GenericEntityException { - SQLProcessor sqlP = new SQLProcessor(helperName); + SQLProcessor sqlP = new SQLProcessor(helperInfo); try { select(entity, sqlP); @@ -582,7 +582,7 @@ public class GenericDAO { sqlBuffer.append(SqlJdbcUtil.makeFromClause(modelEntity, datasourceInfo)); sqlBuffer.append(SqlJdbcUtil.makeWhereClause(modelEntity, modelEntity.getPkFieldsUnmodifiable(), entity, "AND", datasourceInfo.joinStyle)); - SQLProcessor sqlP = new SQLProcessor(helperName); + SQLProcessor sqlP = new SQLProcessor(helperInfo); try { sqlP.prepareStatement(sqlBuffer.toString(), true, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); @@ -728,7 +728,7 @@ public class GenericDAO { // make the final SQL String String sql = sqlBuffer.toString(); - SQLProcessor sqlP = new SQLProcessor(helperName); + SQLProcessor sqlP = new SQLProcessor(helperInfo); sqlP.prepareStatement(sql, findOptions.getSpecifyTypeAndConcur(), findOptions.getResultSetType(), findOptions.getResultSetConcurrency(), findOptions.getFetchSize(), findOptions.getMaxRows()); @@ -856,7 +856,7 @@ public class GenericDAO { public List<GenericValue> selectByMultiRelation(GenericValue value, ModelRelation modelRelationOne, ModelEntity modelEntityOne, ModelRelation modelRelationTwo, ModelEntity modelEntityTwo, List<String> orderBy) throws GenericEntityException { - SQLProcessor sqlP = new SQLProcessor(helperName); + SQLProcessor sqlP = new SQLProcessor(helperInfo); // get the tables names String atable = modelEntityOne.getTableName(datasourceInfo); @@ -1077,7 +1077,7 @@ public class GenericDAO { String sql = sqlBuffer.toString(); if (Debug.verboseOn()) Debug.logVerbose("Count select sql: " + sql, module); - SQLProcessor sqlP = new SQLProcessor(helperName); + SQLProcessor sqlP = new SQLProcessor(helperInfo); sqlP.prepareStatement(sql, findOptions.getSpecifyTypeAndConcur(), findOptions.getResultSetType(), findOptions.getResultSetConcurrency(), findOptions.getFetchSize(), findOptions.getMaxRows()); if (verboseOn) { @@ -1119,7 +1119,7 @@ public class GenericDAO { /* ====================================================================== */ public int delete(GenericEntity entity) throws GenericEntityException { - SQLProcessor sqlP = new SQLProcessor(helperName); + SQLProcessor sqlP = new SQLProcessor(helperInfo); try { return delete(entity, sqlP); @@ -1156,7 +1156,7 @@ public class GenericDAO { } public int deleteByCondition(ModelEntity modelEntity, EntityCondition condition) throws GenericEntityException { - SQLProcessor sqlP = new SQLProcessor(helperName); + SQLProcessor sqlP = new SQLProcessor(helperInfo); try { return deleteByCondition(modelEntity, condition, sqlP); @@ -1194,13 +1194,13 @@ public class GenericDAO { /* ====================================================================== */ public void checkDb(Map<String, ModelEntity> modelEntities, List<String> messages, boolean addMissing) { - DatabaseUtil dbUtil = new DatabaseUtil(this.helperName); + DatabaseUtil dbUtil = new DatabaseUtil(this.helperInfo); dbUtil.checkDb(modelEntities, messages, addMissing); } /** Creates a list of ModelEntity objects based on meta data from the database */ public List<ModelEntity> induceModelFromDb(Collection<String> messages) { - DatabaseUtil dbUtil = new DatabaseUtil(this.helperName); + DatabaseUtil dbUtil = new DatabaseUtil(this.helperInfo); return dbUtil.induceModelFromDb(messages); } } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java Thu Mar 25 04:42:26 2010 @@ -43,15 +43,15 @@ public class GenericHelperDAO implements public static final String module = GenericHelperDAO.class.getName(); protected GenericDAO genericDAO; - protected String helperName; + protected GenericHelperInfo helperInfo; - public GenericHelperDAO(String helperName) { - this.helperName = helperName; - genericDAO = GenericDAO.getGenericDAO(helperName); + public GenericHelperDAO(GenericHelperInfo helperInfo) { + this.helperInfo = helperInfo; + genericDAO = GenericDAO.getGenericDAO(helperInfo); } public String getHelperName() { - return helperName; + return this.helperInfo.getHelperFullName(); } /** Creates a Entity in the form of a GenericValue and write it to the database Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java Thu Mar 25 04:42:26 2010 @@ -37,20 +37,19 @@ public class GenericHelperFactory { // protected static UtilCache helperCache = new UtilCache("entity.GenericHelpers", 0, 0); protected static Map<String, GenericHelper> helperCache = new HashMap<String, GenericHelper>(); - public static GenericHelper getHelper(String helperName) { - GenericHelper helper = helperCache.get(helperName); + public static GenericHelper getHelper(GenericHelperInfo helperInfo) { + GenericHelper helper = helperCache.get(helperInfo.getHelperFullName()); - if (helper == null) // don't want to block here - { + if (helper == null) { // don't want to block here synchronized (GenericHelperFactory.class) { // must check if null again as one of the blocked threads can still enter - helper = helperCache.get(helperName); + helper = helperCache.get(helperInfo.getHelperFullName()); if (helper == null) { try { - DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); + DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperInfo.getHelperBaseName()); if (datasourceInfo == null) { - throw new IllegalStateException("Could not find datasource definition with name " + helperName); + throw new IllegalStateException("Could not find datasource definition with name " + helperInfo.getHelperBaseName()); } String helperClassName = datasourceInfo.helperClass; Class<?> helperClass = null; @@ -65,8 +64,8 @@ public class GenericHelperFactory { } } - Class<?>[] paramTypes = new Class<?>[] {String.class}; - Object[] params = new Object[] {helperName}; + Class<?>[] paramTypes = new Class<?>[] {GenericHelperInfo.class}; + Object[] params = new Object[] {helperInfo}; java.lang.reflect.Constructor<?> helperConstructor = null; @@ -92,7 +91,7 @@ public class GenericHelperFactory { } if (helper != null) - helperCache.put(helperName, helper); + helperCache.put(helperInfo.getHelperFullName(), helper); } catch (SecurityException e) { Debug.logError(e, module); throw new IllegalStateException("Error loading GenericHelper class: " + e.toString()); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java Thu Mar 25 04:42:26 2010 @@ -23,6 +23,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.config.EntityConfigUtil; import org.ofbiz.entity.connection.ConnectionFactoryInterface; +import org.ofbiz.entity.datasource.GenericHelperInfo; import org.ofbiz.entity.transaction.TransactionFactory; import org.w3c.dom.Element; @@ -71,13 +72,23 @@ public class ConnectionFactory { public static Connection getConnection(String helperName) throws SQLException, GenericEntityException { // Debug.logVerbose("Getting a connection", module); - Connection con = TransactionFactory.getConnection(helperName); + Connection con = TransactionFactory.getConnection(new GenericHelperInfo(null, helperName)); if (con == null) { Debug.logError("******* ERROR: No database connection found for helperName \"" + helperName + "\"", module); } return con; } + public static Connection getConnection(GenericHelperInfo helperInfo) throws SQLException, GenericEntityException { + // Debug.logVerbose("Getting a connection", module); + + Connection con = TransactionFactory.getConnection(helperInfo); + if (con == null) { + Debug.logError("******* ERROR: No database connection found for helperName \"" + helperInfo.getHelperFullName() + "\"", module); + } + return con; + } + public static ConnectionFactoryInterface getManagedConnectionFactory() { if (_factory == null) { // don't want to block here synchronized (TransactionFactory.class) { @@ -120,8 +131,8 @@ public class ConnectionFactory { return _factory; } - public static Connection getManagedConnection(String helperName, Element inlineJdbcElement) throws SQLException, GenericEntityException { - return getManagedConnectionFactory().getConnection(helperName, inlineJdbcElement); + public static Connection getManagedConnection(GenericHelperInfo helperInfo, Element inlineJdbcElement) throws SQLException, GenericEntityException { + return getManagedConnectionFactory().getConnection(helperInfo, inlineJdbcElement); } public static void closeAllManagedConnections() { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?rev=927271&r1=927270&r2=927271&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java Thu Mar 25 04:42:26 2010 @@ -45,6 +45,7 @@ import org.ofbiz.base.util.UtilXml; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.config.EntityConfigUtil; +import org.ofbiz.entity.datasource.GenericHelperInfo; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.model.ModelField; import org.ofbiz.entity.model.ModelFieldType; @@ -66,7 +67,7 @@ public class DatabaseUtil { // OFBiz Connections protected ModelFieldTypeReader modelFieldTypeReader = null; protected DatasourceInfo datasourceInfo = null; - protected String helperName = null; + protected GenericHelperInfo helperInfo = null; // Legacy Connections protected String connectionUrl = null; @@ -77,10 +78,10 @@ public class DatabaseUtil { boolean isLegacy = false; // OFBiz DatabaseUtil - public DatabaseUtil(String helperName) { - this.helperName = helperName; - this.modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName); - this.datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); + public DatabaseUtil(GenericHelperInfo helperInfo) { + this.helperInfo = helperInfo; + this.modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperInfo.getHelperBaseName()); + this.datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperInfo.getHelperBaseName()); } // Legacy DatabaseUtil @@ -95,14 +96,14 @@ public class DatabaseUtil { protected Connection getConnection() throws SQLException, GenericEntityException { Connection connection = null; if (!isLegacy) { - connection = ConnectionFactory.getConnection(helperName); + connection = ConnectionFactory.getConnection(helperInfo); } else { connection = ConnectionFactory.getConnection(driverName, connectionUrl, null, userName, password); } if (connection == null) { if (!isLegacy) { - throw new GenericEntityException("No connection available for helper named [" + helperName + "]"); + throw new GenericEntityException("No connection available for helper named [" + helperInfo.getHelperFullName() + "]"); } else { throw new GenericEntityException("No connection avaialble for URL [" + connectionUrl + "]"); } @@ -1709,11 +1710,11 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } @@ -1857,12 +1858,12 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(errMsg, module); if (messages != null) messages.add(errMsg); return; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(errMsg, module); if (messages != null) messages.add(errMsg); return; @@ -1911,11 +1912,11 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } @@ -2016,11 +2017,11 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } @@ -2089,14 +2090,14 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); if (messages != null) { messages.add(errMsg); } return; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); if (messages != null) { messages.add(errMsg); @@ -2146,11 +2147,11 @@ public class DatabaseUtil { connection = getConnection(); } catch (SQLException e) { if (messages != null) - messages.add("Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString()); + messages.add("Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString()); return; } catch (GenericEntityException e) { if (messages != null) - messages.add("Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString()); + messages.add("Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString()); return; } @@ -2321,11 +2322,11 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } @@ -2498,11 +2499,11 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } @@ -2578,9 +2579,9 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - return "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + return "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); } catch (GenericEntityException e) { - return "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + return "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); } // now add constraint clause @@ -2660,11 +2661,11 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } @@ -2764,11 +2765,11 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } @@ -2873,11 +2874,11 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } @@ -2971,11 +2972,11 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } @@ -3092,11 +3093,11 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); return errMsg; } @@ -3172,11 +3173,11 @@ public class DatabaseUtil { try { connection = getConnection(); } catch (SQLException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); messages.add(errMsg); } catch (GenericEntityException e) { - String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperName + "]... Error was: " + e.toString(); + String errMsg = "Unable to establish a connection with the database for helperName [" + this.helperInfo.getHelperFullName() + "]... Error was: " + e.toString(); Debug.logError(e, errMsg, module); messages.add(errMsg); } |
Free forum by Nabble | Edit this page |