You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacopo Cappellato <ja...@hotwaxmedia.com> on 2012/07/20 08:36:18 UTC

Re: svn commit: r1090961 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java

Hi Jacques,

could you please explain why we are using the "entity-default" dispatcher here? Why not using the "default" dispatcher? Is this by design or it was just picked an existing one?

Jacopo

PS: As a side note, using the hardcoded "entity-default" (or "default") name is a bad practice because there is no guarantee that all the setup will have a delegator named "default".

On Apr 11, 2011, at 9:54 AM, jleroux@apache.org wrote:

> Author: jleroux
> Date: Mon Apr 11 07:54:22 2011
> New Revision: 1090961
> 
> URL: http://svn.apache.org/viewvc?rev=1090961&view=rev
> Log:
> Fixes a bug in AbstractJmsListener.java. This was 1st reported by Calum Miller on user ML 3 years ago http://markmail.org/message/hb2r7vbjvekxbris. But as it seems this is no often use nobody noticed since but at least Anand H I who used the same in http://markmail.org/message/yvvm5nepopc7y246. It appeared when you tried to set a jms-service in serviceengine.xml
> 
> Modified:
>    ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java
> 
> Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java?rev=1090961&r1=1090960&r2=1090961&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java (original)
> +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java Mon Apr 11 07:54:22 2011
> @@ -50,7 +50,7 @@ public abstract class AbstractJmsListene
>      * @param dispatcher
>      */
>     protected AbstractJmsListener(ServiceDispatcher serviceDispatcher) {
> -        this.dispatcher = GenericDispatcher.getLocalDispatcher("JMSDispatcher", null, null, this.getClass().getClassLoader(), serviceDispatcher);
> +        this.dispatcher = GenericDispatcher.getLocalDispatcher("entity-default", null, null, this.getClass().getClassLoader(), serviceDispatcher);
>     }
> 
>     /**
> 
> 


Re: svn commit: r1090961 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
On Jul 20, 2012, at 10:09 AM, Jacques Le Roux wrote:

> I must say  I have not clues about it. These both users suggested to replace JMSDispatcher by entity-default and it worked. I did
> not have the time to get further in it at this moment and forgot about it. Maybe entity-default comes from Opentaps? I don't know
> if default would work also. At least JMSDispatcher did not but, I did not digg why.

Ok, I will find a way to fix this but I hope it is clear to everyone that the strategy Jacques is describing to commit code is no more acceptable (at least if we want to maintain the quality of commits at a decent level).

Jacopo


Re: svn commit: r1090961 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java

Posted by Jacques Le Roux <ja...@les7arts.com>.
I must say  I have not clues about it. These both users suggested to replace JMSDispatcher by entity-default and it worked. I did
not have the time to get further in it at this moment and forgot about it. Maybe entity-default comes from Opentaps? I don't know
if default would work also. At least JMSDispatcher did not but, I did not digg why.

I agree that something more robust like
ContainerConfig.Container cfg = ContainerConfig.getContainer(name, org.ofbiz.base.start.Config.getContainerConfig(););
String delegatorName = ContainerConfig.getPropertyValue(cfg, "delegator-name", "default");

should be used.

Config.getContainerConfig() would be added with this patch

Index: start/src/org/ofbiz/base/start/Config.java
===================================================================
--- start/src/org/ofbiz/base/start/Config.java (revision 1353226)
+++ start/src/org/ofbiz/base/start/Config.java (working copy)
@@ -69,6 +69,7 @@
     public String baseLib;
     public String commJar;
     public String containerConfig;
+    public static String staticContainerConfig;
     public String instrumenterClassName;
     public String instrumenterFile;
     public List<String> loaders;
@@ -209,8 +210,6 @@
                     fis = new FileInputStream(propsFile);
                     if (fis != null) {
                         props.load(fis);
-                    } else {
-                        throw new FileNotFoundException();
                     }
                 } catch (FileNotFoundException e2) {
                     // do nothing; we will see empty props below
@@ -338,6 +337,7 @@

         // container configuration
         containerConfig = getOfbizHomeProp(props, "ofbiz.container.config", "framework/base/config/ofbiz-containers.xml");
+        staticContainerConfig = containerConfig;

         // get the admin server info
         String serverHost = getProp(props, "ofbiz.admin.host", "127.0.0.1");
@@ -433,4 +433,8 @@
         }
     }

+    public static synchronized String getContainerConfig() {
+        return staticContainerConfig;
+    }
+
 }

Else you could use
+            String ofbizHome = System.getProperty("ofbiz.home");
+            String configFile = ofbizHome + "/framework/base/config/ofbiz-containers.xml";
but then the configFile will be static. I don't know better ways...

HTH

Jacques

From: "Jacopo Cappellato" <ja...@hotwaxmedia.com>
> Hi Jacques,
>
> could you please explain why we are using the "entity-default" dispatcher here? Why not using the "default" dispatcher? Is this by
> design or it was just picked an existing one?
>
> Jacopo
>
> PS: As a side note, using the hardcoded "entity-default" (or "default") name is a bad practice because there is no guarantee that
> all the setup will have a delegator named "default".
>
> On Apr 11, 2011, at 9:54 AM, jleroux@apache.org wrote:
>
>> Author: jleroux
>> Date: Mon Apr 11 07:54:22 2011
>> New Revision: 1090961
>>
>> URL: http://svn.apache.org/viewvc?rev=1090961&view=rev
>> Log:
>> Fixes a bug in AbstractJmsListener.java. This was 1st reported by Calum Miller on user ML 3 years ago
>> http://markmail.org/message/hb2r7vbjvekxbris. But as it seems this is no often use nobody noticed since but at least Anand H I
>> who used the same in http://markmail.org/message/yvvm5nepopc7y246. It appeared when you tried to set a jms-service in
>> serviceengine.xml
>>
>> Modified:
>>    ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java
>>
>> Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java?rev=1090961&r1=1090960&r2=1090961&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java (original)
>> +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java Mon Apr 11 07:54:22 2011
>> @@ -50,7 +50,7 @@ public abstract class AbstractJmsListene
>>      * @param dispatcher
>>      */
>>     protected AbstractJmsListener(ServiceDispatcher serviceDispatcher) {
>> -        this.dispatcher = GenericDispatcher.getLocalDispatcher("JMSDispatcher", null, null, this.getClass().getClassLoader(),
>> serviceDispatcher);
>> +        this.dispatcher = GenericDispatcher.getLocalDispatcher("entity-default", null, null, this.getClass().getClassLoader(),
>> serviceDispatcher);
>>     }
>>
>>     /**
>>
>>
>
>