Thanks Marc, this is a good way of looking at it. If you have files know about 
tenants then you're really opening a pandora's box and it's much better to have 
all of the per-tenant settings sourced through the database.

I guess we could have a table in the tenant database that goes along with the 
Tenant entity's table that has information about additional data to load.

However, given the general use patterns for multi-tenant stuff wouldn't you 
want to load the same basic data for each tenant and then let the tenant do the 
rest, including loading any data files they might want (probably through an 
upload or referring to another server)?

-David


On Apr 16, 2010, at 4:15 PM, Marc Morin wrote:

> we've deployed a multi-tenant ofbiz system (our own multi-tenant 
> implementation).  Our case is simpler, since it is truly a single application 
> with multiple customers, each in their own database (delegator).
> 
> When faced with wanting to read different files for different tenants, we've 
> generally, moved to storing the per-tenant information in their database 
> instance.  This keeps management of the per-tenant information separate for 
> the more static "code".
> 
> This has meant, re-factoring the code/screens/forms, etc... putting them in 
> "content" vs files. 
> 
> As for your example of having "seed" data being tenant aware, this appears to 
> expose a new more complex problem of managing the life cycle of the tenant 
> (creating, seeding, terminating, evicting...) that needs to be done to truly 
> make use of any multi-tenant capabilities.
> 
> We're taking the approach of creating "data packages" and allowing tenants to 
> "subscribe" to them.  This then formalizes the management of the "seed" data, 
> it's life cycle, and ultimately, it's storage.
> 
> Now, if you wanted to have a multi-tenant ofbiz, where each tenant has 100% 
> flexibility on configuring their entities, services, screens, eca, .... then 
> I think you'll need to provision a separate app server for each... 
> 
> 
> 
> ----- "BJ Freeman" <[email protected]> wrote:
> 
>> rephrase this.
>> for SAS purposes there will be many files each tenant that are unique
>> to
>> that tenant and to be loaded only into that Tenants DB
>> this requires entry into the ofbiz-component.xml.
>> 
>> A change in the way the readers select files based on delegator is
>> what
>> I am suggesting:
>> 
>> so the command line that has  readers=seed,ext delegator=Tenant1
>> would look for files in the ofbiz-component.xml
>> 
>>    <entity-resource type="data" reader-name="seed-initial"
>> loader="main" delegator="Tentant1"
>> "location="data/tenant1seedinitialData.xml"/>
>> 
>> so added parm of delegator would further define the data selection.
>> if a line did not include the delegator then default would be used.
>> The above suggestion seems to follow the model setup for Multitenancy
>> support.
>> 
>> 
>> ========================
>> 
>> BJ Freeman
>> http://bjfreeman.elance.com
>> Strategic Power Office with Supplier Automation
>> <http://www.businessesnetwork.com/automation/viewforum.php?f=93>
>> Specialtymarket.com <http://www.specialtymarket.com/>
>> 
>> Systems Integrator-- Glad to Assist
>> 
>> Chat  Y! messenger: bjfr33man
>> Linkedin
>> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
>> 
>> 
>> BJ Freeman sent the following on 4/15/2010 8:43 PM:
>>> I am still going through the code trying to figure out how ext for
>>> different tenants can be loaded, that is unique to that tenant.
>>> one example is loading the productstore with the defaults and the
>> theme
>>> that has been created for that tenant.
>>> or how to configure the emails of a productstore for that tenant.
>>> so these get loaded in on that tenants db.
>>> 
>>> =========================
>>> BJ Freeman
>>> http://bjfreeman.elance.com
>>> Strategic Power Office with Supplier Automation
>> <http://www.businessesnetwork.com/automation/viewforum.php?f=93>
>>> Specialtymarket.com <http://www.specialtymarket.com/>
>>> 
>>> Systems Integrator-- Glad to Assist
>>> 
>>> Chat  Y! messenger: bjfr33man
>>> Linkedin
>>> 
>> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
>>> 
>>> 
>>> Adrian Crum sent the following on 4/15/2010 6:00 AM:
>>>> That would be very helpful!
>>>> 
>>>> -Adrian
>>>> 
>>>> --- On Thu, 4/15/10, Scott Gray <[email protected]>
>> wrote:
>>>> 
>>>>> From: Scott Gray <[email protected]>
>>>>> Subject: Re: Multitenancy support
>>>>> To: [email protected]
>>>>> Date: Thursday, April 15, 2010, 3:06 AM
>>>>> If we want non-demo instructions then
>>>>> we'd need to describe how to create some "ext" data with the
>>>>> tenant info and then change the first install command to do
>>>>> a readers=seed,ext.
>>>>> 
>>>>> Regards
>>>>> Scott
>>>>> 
>>>>> On 15/04/2010, at 3:22 AM, Adrian Crum wrote:
>>>>> 
>>>>>> That Wiki page is a work in progress - so there is
>>>>> some information missing. It would be best if you followed
>>>>> the instructions for loading the multi-tenancy demo data,
>>>>> look at how things are set up, and then create your
>>>>> multi-tenant seed data based on the demo data.
>>>>>> The bottom line is, it isn't working because you
>>>>> haven't set up your tenants in the seed data.
>>>>>> -Adrian
>>>>>> 
>>>>>> Mickael BRIDE wrote:
>>>>>>> Hello,
>>>>>>> I followed the documentation on the page
>> https://cwiki.apache.org/confluence/display/OFBIZ/Multitenancy+support
>>>>> to try to get multitenancy in my ofbiz installation.
>>>>>>> But when running the commant :
>>>>>>> java -Xmx512m -XX:MaxPermSize=128m -jar ofbiz.jar
>>>>> -install
>>>>>>> -readers=seed -delegator=default#DEMO1
>>>>>>> I have the error in the end of this mail.
>>>>>>> The same command line run fine with "default"
>>>>> instead of "default#DEMO1". It seems that entries in
>>>>> TenantDemoData.xml are not loaded....?
>>>>>>> I am on the trunk latest version of ofbiz (updated
>>>>> 2 hours ago)
>>>>>>> I am using the default files and conf.
>>>>>>> Any idea of the problem?
>>>>>>> Thanks in advance
>>>>>>> Mickael
>>>>>>> 2010-04-14 16:00:38,256 (main)
>>>>> [DelegatorFactoryImpl.java:35 :ERROR]
>>>>>>> ---- exception report
>>>>>>> 
>>>>> ----------------------------------------------------------
>>>>>>> Error creating delegator
>>>>>>> Exception:
>>>>> org.ofbiz.entity.GenericEntityException
>>>>>>> Message: No Tenant record found for delegator
>>>>> [default#DEMO1] with
>>>>>>> tenantId [DEMO1]
>>>>>>> ---- stack trace
>>>>>>> 
>>>>> ---------------------------------------------------------------
>>>>>>> org.ofbiz.entity.GenericEntityException: No Tenant
>>>>> record found for
>>>>>>> delegator [default#DEMO1] with tenantId [DEMO1]
>>>>>>> 
>>>>> 
>> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:233)
>>>>> 
>> org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:33)
>>>>> 
>> org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:25)
>>>>> 
>> org.ofbiz.base.util.UtilObject.getObjectFromFactory(UtilObject.java:202)
>>>>> 
>> org.ofbiz.entity.DelegatorFactory.getDelegator(DelegatorFactory.java:47)
>>>>> 
>> org.ofbiz.entityext.data.EntityDataLoadContainer.start(EntityDataLoadContainer.java:230)
>>>>> 
>> org.ofbiz.base.container.ContainerLoader.start(ContainerLoader.java:100)
>>>>> org.ofbiz.base.start.Start.startStartLoaders(Start.java:272)
>>>>> org.ofbiz.base.start.Start.startServer(Start.java:322)
>>>>>>> org.ofbiz.base.start.Start.start(Start.java:326)
>>>>>>> org.ofbiz.base.start.Start.main(Start.java:411)
>>>>>>> 
>>>>> 
>> --------------------------------------------------------------------------------
>>>>> 2010-04-14 16:00:38,259 (main)
>>>>> [   DelegatorFactory.java:49 :ERROR]
>>>>>>> ---- exception report
>>>>>>> 
>>>>> ----------------------------------------------------------
>>>>>>> Exception: java.lang.ClassNotFoundException
>>>>>>> Message: java.lang.Class
>>>>>>> ---- stack trace
>>>>>>> 
>>>>> ---------------------------------------------------------------
>>>>>>> java.lang.ClassNotFoundException: java.lang.Class
>>>>>>> 
>>>>> 
>> org.ofbiz.base.util.UtilObject.getObjectFromFactory(UtilObject.java:207)
>>>>> 
>> org.ofbiz.entity.DelegatorFactory.getDelegator(DelegatorFactory.java:47)
>>>>> 
>> org.ofbiz.entityext.data.EntityDataLoadContainer.start(EntityDataLoadContainer.java:230)
>>>>> 
>> org.ofbiz.base.container.ContainerLoader.start(ContainerLoader.java:100)
>>>>> org.ofbiz.base.start.Start.startStartLoaders(Start.java:272)
>>>>> org.ofbiz.base.start.Start.startServer(Start.java:322)
>>>>>>> org.ofbiz.base.start.Start.start(Start.java:326)
>>>>>>> org.ofbiz.base.start.Start.main(Start.java:411)
>>>>>>> 
>>>>> 
>> --------------------------------------------------------------------------------
>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>>>         at
>>>>>>> 
>>>>> 
>> java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:895)
>> 
>>>>>        at
>>>>> 
>> org.ofbiz.entity.DelegatorFactory.getDelegator(DelegatorFactory.java:52)
>>>>>>>         at
>>>>>>> 
>>>>> 
>> org.ofbiz.entityext.data.EntityDataLoadContainer.start(EntityDataLoadContainer.java:230)
>> 
>>>>>        at
>>>>> 
>> org.ofbiz.base.container.ContainerLoader.start(ContainerLoader.java:100)
>>>>>>>         at
>>>>> org.ofbiz.base.start.Start.startStartLoaders(Start.java:272)
>>>>>>>         at
>>>>> org.ofbiz.base.start.Start.startServer(Start.java:322)
>>>>>>>         at
>>>>> org.ofbiz.base.start.Start.start(Start.java:326)
>>>>>>>         at
>>>>> org.ofbiz.base.start.Start.main(Start.java:411)
>>>>> .base.container.ContainerLoader.start(ContainerLoader.java:100)
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 

Reply via email to