Re: Like to use Delegator in framework base

2011-04-02 Thread Paul Ray



Jira issue created.
https://issues.apache.org/jira/browse/OFBIZ-4240

Thanks

- PR

Perhaps now is a good time to create a Jira issue. The implementation 
details can be discussed there, POC code can be submitted as patches, etc.


https://cwiki.apache.org/confluence/display/OFBADMIN/OFBiz+Contributors+Best+Practices 



-Adrian


On 4/3/2011 11:55 AM, Paul Ray wrote:



Would be more than happy to contribute if relevant. Thanks for the offer!

Let me summarize again what we are looking to achieve and how I am 
planning to go about doing it.


UtilProperties being in base gets complied and loaded first ahead of 
both entity and service modules. So, as such the service and entity 
classes won't be available there directly. Now the attempt is to have 
a call embedded service call within the 
UtilProperties.getBundle(.) method right after the lines below

Properties newProps = getProperties(resource, candidateLocale);
if (UtilValidate.isNotEmpty(newProps)) {
// The last bundle we found becomes 
the parent of the new bundle


The idea is that by default a set of properties would be loaded from 
the UiLabels.xml  files. However, right after we should be able to 
call a service to override any labels (in newProps) passing the 
newProps as an argument.


So far, so good ?

Next the problem... How to configure a service call? Find the below 
usage in base module

ClassLoader loader = Thread.currentThread().getContextClassLoader();
Iterator cachedClassLoaders = 
ServiceLoader.load(Init.class, loader).iterator();

while (cachedClassLoaders.hasNext()) {
Init cachedClassLoader = cachedClassLoaders.next();
try {
cachedClassLoader.loadClasses(loader);
} catch (Exception e) {
Debug.logError(e, "Could not pre-initialize 
dynamically loaded class: ", module);

}
}


So, can we write a class say UtilTenantProperties under webtools  and 
load that dynamically? This class can then be used to load the 
appropriate delegator to query properties to override and return an 
updated newProps and rest continues as before? The reason thinking of 
webtools is to eventually use the webtools label manager to manage and 
update the override fields into the database.


If this approach looks reasonable, I will give it a shot. I am still 
unclear how the delegator behaves in a multitenant scenario but hoping 
the first iteration can avoid that complexity. Welcome hints and 
suggestions.


-PR



If it's something you intend to contribute to the project, then it 
would be best if the current artifacts are left where they are and 
then come up with some kind of configurable properties loader. 
Something along the lines of using the ServiceLoader class to locate 
classes that implement code to create/update Properties objects. The 
UtilProperties.getProperties(String resource, Locale locale) method 
could then delegate to those classes.


-Adrian


On 4/2/2011 7:20 PM, Paul Ray wrote:



Thanks Adrian. Tried adding org.ofbiz.entity.DelegatorFactory under 
META-INF/services in base but still get the ClassNotFoundException 
for DelegatorFactory. Reckon it is still something to do with the 
classpath.


 As an alternative explored if I could move the UtilProperties 
relevant methods under entity module. Still working on it but wanted 
to check if this is right approach. To be specific looking to move
public static ResourceBundleMapWrapper getResourceBundleMap(String 
resource, Locale locale, Map context)


under a new Utility Class within entity module.

PR


The factory code uses the Java ServiceLoader class, so you will need 
to create a service properties file for it to load. Look in the 
META-INF folder of the entity component.


-Adrian

On 4/1/2011 5:03 PM, Paul Ray wrote:

 Hello Ofbiz user community,

I am trying to avoid file base properties files and uilabels and 
rather load them from Database. Reason, support configuration 
without touching the code and eventually multi-tenant. As part of 
the attempt, trying to load a few properties entries from DB in 
org.ofbiz.base.util.UtilProperties  class. The trouble is delegator 
is not available here. As work around initialized for "default" 
using DelegatorFactory after adding entity module classes in the 
build path. The build goes through , however, at runtime get 
classnotfound exception for Delegator Factory. Not sure if this is a 
classloader issue since adding the entity/lib directly to the 
classpath didn't help either. What am I missing?


Also alternatively is there a better way to query DB (need to be 
multi-tenent aware since eventually all property file entries would 
need to move there) as part of base module?


Thanks
PR








Re: Like to use Delegator in framework base

2011-04-02 Thread Paul Ray
 Further, believe we need one more modification to the approach. Would 
need the identified UtilTenantProperties  class as interface defined in 
base with implementation class under webtools and linked through a 
META-INF services file entry. Will that work?


On second thought this utility may be useful even in a single tenant 
setup and therefore a better nomenclature might be to call it 
UtilPropertiesOverride or something close. Suggestion?


- PR

On 4/3/2011 11:55 AM, Paul Ray wrote:



Would be more than happy to contribute if relevant. Thanks for the offer!

Let me summarize again what we are looking to achieve and how I am 
planning to go about doing it.


UtilProperties being in base gets complied and loaded first ahead of 
both entity and service modules. So, as such the service and entity 
classes won't be available there directly. Now the attempt is to have 
a call embedded service call within the 
UtilProperties.getBundle(.) method right after the lines below

Properties newProps = getProperties(resource, candidateLocale);
if (UtilValidate.isNotEmpty(newProps)) {
// The last bundle we found becomes 
the parent of the new bundle


The idea is that by default a set of properties would be loaded from 
the UiLabels.xml  files. However, right after we should be able to 
call a service to override any labels (in newProps) passing the 
newProps as an argument.


So far, so good ?

Next the problem... How to configure a service call? Find the below 
usage in base module

ClassLoader loader = Thread.currentThread().getContextClassLoader();
Iterator cachedClassLoaders = 
ServiceLoader.load(Init.class, loader).iterator();

while (cachedClassLoaders.hasNext()) {
Init cachedClassLoader = cachedClassLoaders.next();
try {
cachedClassLoader.loadClasses(loader);
} catch (Exception e) {
Debug.logError(e, "Could not pre-initialize 
dynamically loaded class: ", module);

}
}


So, can we write a class say UtilTenantProperties under webtools  and 
load that dynamically? This class can then be used to load the 
appropriate delegator to query properties to override and return an 
updated newProps and rest continues as before? The reason thinking of 
webtools is to eventually use the webtools label manager to manage and 
update the override fields into the database.


If this approach looks reasonable, I will give it a shot. I am still 
unclear how the delegator behaves in a multitenant scenario but hoping 
the first iteration can avoid that complexity. Welcome hints and 
suggestions.


-PR



If it's something you intend to contribute to the project, then it 
would be best if the current artifacts are left where they are and 
then come up with some kind of configurable properties loader. 
Something along the lines of using the ServiceLoader class to locate 
classes that implement code to create/update Properties objects. The 
UtilProperties.getProperties(String resource, Locale locale) method 
could then delegate to those classes.


-Adrian


On 4/2/2011 7:20 PM, Paul Ray wrote:



Thanks Adrian. Tried adding org.ofbiz.entity.DelegatorFactory under 
META-INF/services in base but still get the ClassNotFoundException 
for DelegatorFactory. Reckon it is still something to do with the 
classpath.


 As an alternative explored if I could move the UtilProperties 
relevant methods under entity module. Still working on it but wanted 
to check if this is right approach. To be specific looking to move
public static ResourceBundleMapWrapper getResourceBundleMap(String 
resource, Locale locale, Map context)


under a new Utility Class within entity module.

PR


The factory code uses the Java ServiceLoader class, so you will need 
to create a service properties file for it to load. Look in the 
META-INF folder of the entity component.


-Adrian

On 4/1/2011 5:03 PM, Paul Ray wrote:

 Hello Ofbiz user community,

I am trying to avoid file base properties files and uilabels and 
rather load them from Database. Reason, support configuration 
without touching the code and eventually multi-tenant. As part of 
the attempt, trying to load a few properties entries from DB in 
org.ofbiz.base.util.UtilProperties  class. The trouble is delegator 
is not available here. As work around initialized for "default" 
using DelegatorFactory after adding entity module classes in the 
build path. The build goes through , however, at runtime get 
classnotfound exception for Delegator Factory. Not sure if this is a 
classloader issue since adding the entity/lib directly to the 
classpath didn't help either. What am I missing?


Also alternatively is there a better way to query DB (need to be 
multi-tenent aware since eventually all property file entries would 
need to move there) as part of base module?


Thanks
PR








Re: Like to use Delegator in framework base

2011-04-02 Thread Adrian Crum
Perhaps now is a good time to create a Jira issue. The implementation 
details can be discussed there, POC code can be submitted as patches, etc.


https://cwiki.apache.org/confluence/display/OFBADMIN/OFBiz+Contributors+Best+Practices

-Adrian

On 4/2/2011 11:25 PM, Paul Ray wrote:



Would be more than happy to contribute if relevant. Thanks for the offer!

Let me summarize again what we are looking to achieve and how I am 
planning to go about doing it.


UtilProperties being in base gets complied and loaded first ahead of 
both entity and service modules. So, as such the service and entity 
classes won't be available there directly. Now the attempt is to have 
a call embedded service call within the 
UtilProperties.getBundle(.) method right after the lines below

Properties newProps = getProperties(resource, candidateLocale);
if (UtilValidate.isNotEmpty(newProps)) {
// The last bundle we found becomes 
the parent of the new bundle


The idea is that by default a set of properties would be loaded from 
the UiLabels.xml  files. However, right after we should be able to 
call a service to override any labels (in newProps) passing the 
newProps as an argument.


So far, so good ?

Next the problem... How to configure a service call? Find the below 
usage in base module

ClassLoader loader = Thread.currentThread().getContextClassLoader();
Iterator cachedClassLoaders = 
ServiceLoader.load(Init.class, loader).iterator();

while (cachedClassLoaders.hasNext()) {
Init cachedClassLoader = cachedClassLoaders.next();
try {
cachedClassLoader.loadClasses(loader);
} catch (Exception e) {
Debug.logError(e, "Could not pre-initialize 
dynamically loaded class: ", module);

}
}


So, can we write a class say UtilTenantProperties under webtools  and 
load that dynamically? This class can then be used to load the 
appropriate delegator to query properties to override and return an 
updated newProps and rest continues as before? The reason thinking of 
webtools is to eventually use the webtools label manager to manage and 
update the override fields into the database.


If this approach looks reasonable, I will give it a shot. I am still 
unclear how the delegator behaves in a multitenant scenario but hoping 
the first iteration can avoid that complexity. Welcome hints and 
suggestions.


-PR



If it's something you intend to contribute to the project, then it 
would be best if the current artifacts are left where they are and 
then come up with some kind of configurable properties loader. 
Something along the lines of using the ServiceLoader class to locate 
classes that implement code to create/update Properties objects. The 
UtilProperties.getProperties(String resource, Locale locale) method 
could then delegate to those classes.


-Adrian


On 4/2/2011 7:20 PM, Paul Ray wrote:



Thanks Adrian. Tried adding org.ofbiz.entity.DelegatorFactory under 
META-INF/services in base but still get the ClassNotFoundException 
for DelegatorFactory. Reckon it is still something to do with the 
classpath.


 As an alternative explored if I could move the UtilProperties 
relevant methods under entity module. Still working on it but wanted 
to check if this is right approach. To be specific looking to move
public static ResourceBundleMapWrapper getResourceBundleMap(String 
resource, Locale locale, Map context)


under a new Utility Class within entity module.

PR


The factory code uses the Java ServiceLoader class, so you will need 
to create a service properties file for it to load. Look in the 
META-INF folder of the entity component.


-Adrian

On 4/1/2011 5:03 PM, Paul Ray wrote:

 Hello Ofbiz user community,

I am trying to avoid file base properties files and uilabels and 
rather load them from Database. Reason, support configuration 
without touching the code and eventually multi-tenant. As part of 
the attempt, trying to load a few properties entries from DB in 
org.ofbiz.base.util.UtilProperties  class. The trouble is delegator 
is not available here. As work around initialized for "default" 
using DelegatorFactory after adding entity module classes in the 
build path. The build goes through , however, at runtime get 
classnotfound exception for Delegator Factory. Not sure if this is a 
classloader issue since adding the entity/lib directly to the 
classpath didn't help either. What am I missing?


Also alternatively is there a better way to query DB (need to be 
multi-tenent aware since eventually all property file entries would 
need to move there) as part of base module?


Thanks
PR






Re: Like to use Delegator in framework base

2011-04-02 Thread Paul Ray



Would be more than happy to contribute if relevant. Thanks for the offer!

Let me summarize again what we are looking to achieve and how I am 
planning to go about doing it.


UtilProperties being in base gets complied and loaded first ahead of 
both entity and service modules. So, as such the service and entity 
classes won't be available there directly. Now the attempt is to have a 
call embedded service call within the UtilProperties.getBundle(.) 
method right after the lines below

Properties newProps = getProperties(resource, candidateLocale);
if (UtilValidate.isNotEmpty(newProps)) {
// The last bundle we found becomes the 
parent of the new bundle


The idea is that by default a set of properties would be loaded from the 
UiLabels.xml  files. However, right after we should be able to call a 
service to override any labels (in newProps) passing the newProps as an 
argument.


So far, so good ?

Next the problem... How to configure a service call? Find the below 
usage in base module

ClassLoader loader = Thread.currentThread().getContextClassLoader();
Iterator cachedClassLoaders = 
ServiceLoader.load(Init.class, loader).iterator();

while (cachedClassLoaders.hasNext()) {
Init cachedClassLoader = cachedClassLoaders.next();
try {
cachedClassLoader.loadClasses(loader);
} catch (Exception e) {
Debug.logError(e, "Could not pre-initialize dynamically 
loaded class: ", module);

}
}


So, can we write a class say UtilTenantProperties under webtools  and 
load that dynamically? This class can then be used to load the 
appropriate delegator to query properties to override and return an 
updated newProps and rest continues as before? The reason thinking of 
webtools is to eventually use the webtools label manager to manage and 
update the override fields into the database.


If this approach looks reasonable, I will give it a shot. I am still 
unclear how the delegator behaves in a multitenant scenario but hoping 
the first iteration can avoid that complexity. Welcome hints and 
suggestions.


-PR



If it's something you intend to contribute to the project, then it would 
be best if the current artifacts are left where they are and then come 
up with some kind of configurable properties loader. Something along the 
lines of using the ServiceLoader class to locate classes that implement 
code to create/update Properties objects. The 
UtilProperties.getProperties(String resource, Locale locale) method 
could then delegate to those classes.


-Adrian


On 4/2/2011 7:20 PM, Paul Ray wrote:



Thanks Adrian. Tried adding org.ofbiz.entity.DelegatorFactory under 
META-INF/services in base but still get the ClassNotFoundException for 
DelegatorFactory. Reckon it is still something to do with the classpath.


 As an alternative explored if I could move the UtilProperties 
relevant methods under entity module. Still working on it but wanted 
to check if this is right approach. To be specific looking to move
public static ResourceBundleMapWrapper getResourceBundleMap(String 
resource, Locale locale, Map context)


under a new Utility Class within entity module.

PR


The factory code uses the Java ServiceLoader class, so you will need 
to create a service properties file for it to load. Look in the 
META-INF folder of the entity component.


-Adrian

On 4/1/2011 5:03 PM, Paul Ray wrote:

 Hello Ofbiz user community,

I am trying to avoid file base properties files and uilabels and 
rather load them from Database. Reason, support configuration without 
touching the code and eventually multi-tenant. As part of the 
attempt, trying to load a few properties entries from DB in 
org.ofbiz.base.util.UtilProperties  class. The trouble is delegator 
is not available here. As work around initialized for "default" using 
DelegatorFactory after adding entity module classes in the build 
path. The build goes through , however, at runtime get classnotfound 
exception for Delegator Factory. Not sure if this is a classloader 
issue since adding the entity/lib directly to the classpath didn't 
help either. What am I missing?


Also alternatively is there a better way to query DB (need to be 
multi-tenent aware since eventually all property file entries would 
need to move there) as part of base module?


Thanks
PR






Entities Id as VARCHAR

2011-04-02 Thread Mansour Al Akeel
Hello all,

I am wondering about the reasons behind using VARCHAR for entities Id,
instead of a numeric value with autoincrement. Another thing is the
naming of the primary key. For example, accommodation_class has it's
primary key as "accommodation_class_id". Wouldn't it be easier just to
name it "id"? 






free shipping

2011-04-02 Thread Fadzi Ushewokunze

hi there,

this has been asked numerous times before but i cant find a conclusive answer 
to this.

how do you implement free shipping? i have tried creating a promo but check out 
process still requires shipping information including looking up prices.

generally speaking what is best way to implement free shipping OOTB?

thanks.

fadz
  

Re: Like to use Delegator in framework base

2011-04-02 Thread Adrian Crum
If it's something you intend to contribute to the project, then it would 
be best if the current artifacts are left where they are and then come 
up with some kind of configurable properties loader. Something along the 
lines of using the ServiceLoader class to locate classes that implement 
code to create/update Properties objects. The 
UtilProperties.getProperties(String resource, Locale locale) method 
could then delegate to those classes.


-Adrian

On 4/2/2011 6:50 AM, Paul Ray wrote:



Thanks Adrian. Tried adding org.ofbiz.entity.DelegatorFactory under 
META-INF/services in base but still get the ClassNotFoundException for 
DelegatorFactory. Reckon it is still something to do with the classpath.


 As an alternative explored if I could move the UtilProperties 
relevant methods under entity module. Still working on it but wanted 
to check if this is right approach. To be specific looking to move
public static ResourceBundleMapWrapper getResourceBundleMap(String 
resource, Locale locale, Map context)


under a new Utility Class within entity module.

PR


The factory code uses the Java ServiceLoader class, so you will need 
to create a service properties file for it to load. Look in the 
META-INF folder of the entity component.


-Adrian

On 4/1/2011 5:03 PM, Paul Ray wrote:

 Hello Ofbiz user community,

I am trying to avoid file base properties files and uilabels and 
rather load them from Database. Reason, support configuration without 
touching the code and eventually multi-tenant. As part of the 
attempt, trying to load a few properties entries from DB in 
org.ofbiz.base.util.UtilProperties  class. The trouble is delegator 
is not available here. As work around initialized for "default" using 
DelegatorFactory after adding entity module classes in the build 
path. The build goes through , however, at runtime get classnotfound 
exception for Delegator Factory. Not sure if this is a classloader 
issue since adding the entity/lib directly to the classpath didn't 
help either. What am I missing?


Also alternatively is there a better way to query DB (need to be 
multi-tenent aware since eventually all property file entries would 
need to move there) as part of base module?


Thanks
PR




many webpos instances

2011-04-02 Thread hmalovekar
how i run manay webpos
each one has its own facility and product store

--
View this message in context: 
http://ofbiz.135035.n4.nabble.com/many-webpos-instances-tp3422242p3422242.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: Like to use Delegator in framework base

2011-04-02 Thread Paul Ray



Thanks Adrian. Tried adding org.ofbiz.entity.DelegatorFactory under 
META-INF/services in base but still get the ClassNotFoundException for 
DelegatorFactory. Reckon it is still something to do with the classpath.


 As an alternative explored if I could move the UtilProperties relevant 
methods under entity module. Still working on it but wanted to check if 
this is right approach. To be specific looking to move
public static ResourceBundleMapWrapper getResourceBundleMap(String 
resource, Locale locale, Map context)


under a new Utility Class within entity module.

PR


The factory code uses the Java ServiceLoader class, so you will need to 
create a service properties file for it to load. Look in the META-INF 
folder of the entity component.


-Adrian

On 4/1/2011 5:03 PM, Paul Ray wrote:

 Hello Ofbiz user community,

I am trying to avoid file base properties files and uilabels and 
rather load them from Database. Reason, support configuration without 
touching the code and eventually multi-tenant. As part of the attempt, 
trying to load a few properties entries from DB in 
org.ofbiz.base.util.UtilProperties  class. The trouble is delegator is 
not available here. As work around initialized for "default" using 
DelegatorFactory after adding entity module classes in the build path. 
The build goes through , however, at runtime get classnotfound 
exception for Delegator Factory. Not sure if this is a classloader 
issue since adding the entity/lib directly to the classpath didn't 
help either. What am I missing?


Also alternatively is there a better way to query DB (need to be 
multi-tenent aware since eventually all property file entries would 
need to move there) as part of base module?


Thanks
PR




Re: OrderServices, fulfillDigitalItems with regards to subscription content associations

2011-04-02 Thread Jacques Le Roux

Interesting, we use it also, I did not notice yet, thanks...WIP...
BTW we should make our own page in the wiki...

Jacques

From: "Justin Robinson" 

If I associate content directly with the product I can get my
fulfillment service to run when an order is approved.
But following instructions regarding Subscriptions in OFBiz from the
article at http://www.amicontech.com/blog/subscriptions-in-ofbiz-and-opentaps/
If I associate the content that contains the service to run for
fulfillment with a subscription, via SubscriptionResource and
ProductSubscriptionResource entity associations, it never gets run
because the service method 'fulfillDigitalItems' in
/applications/order/src/org/ofbiz/order/order/OrderServices.java, only
looks for the content related to the product not to the product's
subscription.

I just started on this today so if anyone has had experience with this
& knows I might be missing something, even a little light would be
helpful.
Thanks.

--
Regards,
Justin
Venture-Net Research & Development




Re: what is the purpose of org.ofbiz.base.lang.SourceMonitored?

2011-04-02 Thread Jacques Le Roux

http://markmail.org/message/ii6zubob3wvua2lb

From: "Adrian Crum" 
I believe it is used to trigger email filters for anyone wanting to keep 
an eye on commits that affect a particular piece of code.


-Adrian

On 3/31/2011 12:40 PM, chris snow wrote:

Hi Forum,

What is the purpose of the class org.ofbiz.base.lang.SourceMonitored?

Many thanks,

Chris




Re: building itemized component product listing in the cart view

2011-04-02 Thread Justin Robinson
Thanks for the reply. What I actually want to achieve is using the
configure process to define packages of products at order time. I did
look briefly at marketing packages, but it seems they must be
predefined. I've got virtual products set up now with variants. But
need to be able to configure packages of those variants which are
defined by customer choices at order time. This can be done using a
configurable as a parent product, but once choices are made and the
customer adds to the cart. Only the aggregated price is shown and one
item the config product not it's constituent which would be the
variants under the virtual. The details of those cannot be seen and
don't seem to be in the context of the show cart view. Just wondering
if anyone knew where would be the best place to add this but maybe I
should ask on the dev mailing list?

On 3/31/11, Jacques Le Roux  wrote:
> I'm not quite sure what you want to achieve. By and large it's best to
> follow how things are organized in data files
>
> Jacques
>
> Justin Robinson wrote:
>> I've set up configurable products, with variants in the choices; just
>> like the PIZZA product on demo-stable.ofbiz.apache.org.
>> What I need is an itemized component product listing in the cart view,
>> showing the description and price of each component variant product
>> selected.
>>
>> In the cart view on the demo-stable.ofbiz.apache.org for the PIZZA
>> product it does show the selected Config Option's description, but
>> nothing about the underlying varients.
>> If someone could let me know where the logic for this is located I can
>> build on to it.
>>
>> The solution I came up with might be a really long way round:
>> Add a field to org.ofbiz.order.shoppingcart.ShoppingCart to hold a ref
>> to ProductConfigWrapper, which is set when it's passed into
>> addOrIncreaseItem, during the customer's configuarion of the product.
>> So if I have a ShoppingCart instance I can get the last associated
>> ProductConfigWrapper, then get the configId from it then do a lookup
>> via ProductConfigConfig and ProductConfigProduct entities to get the
>> list of productId's for the configuartion, then I can get product
>> descriptions and component prices from ProductAndPriceView enity using
>> the productId.
>
>


-- 
Regards,
Justin
Venture-Net Research & Development