You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Justin <fl...@gmail.com> on 2012/02/29 07:28:29 UTC

Component Data Load Multitenancy Infastructure Confusion

I've been testing out this functionality and discovered the reason it
doesn't work for me is:
 if (UtilValidate.isNotEmpty(delegator.getDelegatorTenantId())
in org.ofbiz.entityext.data.EntityDataLoadContainer part of the changes
made with svn commit: r1172989
is always empty.

I got the impression from posts of the dev mail archive about this commit
that the idea here has to load all the seed data in a tenant component
instead of having to use tenant specific reads....is this right.

Does anyone have a clue as to a possible reason for this?
I mean the build target run-install-tenant-component -DtenantIdtcompload01
doesn't pass UtilValidate.isNotEmpty(delegator.getDelegatorTenantId() nor
does
ant run-install-tenant-component-all -DtenantIdtcompload01
-Dcomponent=tenantxcomponent

I've been exploring the code around delegators & group-names I'm a little
confused about what function group names would have in the context of
Multitenancy.

I suppose entityGroupName="org.ofbiz" is this way cause the
TenantDataSource  is part of the main datasource
<group-map group-name="org.ofbiz" datasource-name="localpostgres"/>

<TenantDataSource tenantId="DEMO1" entityGroupName="org.ofbiz"
        jdbcUri="jdbc:postgresql://127.0.0.1/tn1" jdbcUsername="username"
jdbcPassword="password"/>

But then why is
<group-map group-name="org.ofbiz.tenant"
datasource-name="localpostgres_tenant"/> also part of the same delegator
name="default" in the entityengine.xml

I thought the reason for this datasource being defined at all in
entityengine.xml was because it provided a place to set other properties
shared by all the tenant datasources with the TenantDataSource table
providing those properties that vary from tenant to tenant.

So I tried removing the inline-jdbc element from localpostgres_tenant since
it should never be used anyway
then when I run these targets I get
org.ofbiz.entity.GenericDataSourceException: Unable to establish a
connection with the database. Connection was null!


I know perhaps my question isn't clear, it's just after spending several
days looking at all the aspects of the multitenancy functionality these are
the things which don't make sense.
Maybe some who has traveled this road can see the basis of my confusion and
provide some clarity.
If so thanks very much, I can customize it and make it work but I'd rather
be sure I understand it first.

Re: Component Data Load Multitenancy Infastructure Confusion

Posted by Jacques Le Roux <ja...@les7arts.com>.
I have no ideas, I suppose you read https://cwiki.apache.org/confluence/display/OFBIZ/Multitenancy+support

My 2cts

Jacques

From: "Justin" <fl...@gmail.com>
> I've been testing out this functionality and discovered the reason it
> doesn't work for me is:
> if (UtilValidate.isNotEmpty(delegator.getDelegatorTenantId())
> in org.ofbiz.entityext.data.EntityDataLoadContainer part of the changes
> made with svn commit: r1172989
> is always empty.
> 
> I got the impression from posts of the dev mail archive about this commit
> that the idea here has to load all the seed data in a tenant component
> instead of having to use tenant specific reads....is this right.
> 
> Does anyone have a clue as to a possible reason for this?
> I mean the build target run-install-tenant-component -DtenantIdtcompload01
> doesn't pass UtilValidate.isNotEmpty(delegator.getDelegatorTenantId() nor
> does
> ant run-install-tenant-component-all -DtenantIdtcompload01
> -Dcomponent=tenantxcomponent
> 
> I've been exploring the code around delegators & group-names I'm a little
> confused about what function group names would have in the context of
> Multitenancy.
> 
> I suppose entityGroupName="org.ofbiz" is this way cause the
> TenantDataSource  is part of the main datasource
> <group-map group-name="org.ofbiz" datasource-name="localpostgres"/>
> 
> <TenantDataSource tenantId="DEMO1" entityGroupName="org.ofbiz"
>        jdbcUri="jdbc:postgresql://127.0.0.1/tn1" jdbcUsername="username"
> jdbcPassword="password"/>
> 
> But then why is
> <group-map group-name="org.ofbiz.tenant"
> datasource-name="localpostgres_tenant"/> also part of the same delegator
> name="default" in the entityengine.xml
> 
> I thought the reason for this datasource being defined at all in
> entityengine.xml was because it provided a place to set other properties
> shared by all the tenant datasources with the TenantDataSource table
> providing those properties that vary from tenant to tenant.
> 
> So I tried removing the inline-jdbc element from localpostgres_tenant since
> it should never be used anyway
> then when I run these targets I get
> org.ofbiz.entity.GenericDataSourceException: Unable to establish a
> connection with the database. Connection was null!
> 
> 
> I know perhaps my question isn't clear, it's just after spending several
> days looking at all the aspects of the multitenancy functionality these are
> the things which don't make sense.
> Maybe some who has traveled this road can see the basis of my confusion and
> provide some clarity.
> If so thanks very much, I can customize it and make it work but I'd rather
> be sure I understand it first.
>