dev@genericjmsra.java.net

Re: Properties with "," in the value

From: Angelo R. Di Filippo <ardf69_at_gmail.com>
Date: Wed, 9 Jul 2008 14:52:43 +0200

Hi Ramesh,
I'm sorry but I haven't seen the 2.0 version; I'll see later.
Regarding the modifications, I did to use it in jonas:

- changed the method parseToProperties as I said
- added all the config-property in ra.xml
- commented the config-property ConnectionFactoryJndiName, ClientId,
ConnectionValidationEnabled in the outbound section of ra.xml (I didn't need
them)
- created a file jonas-ra.xml as the follow

<?xml version="1.0"?>
<jonas-connector xmlns="http://www.objectweb.org/jonas/ns" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.objectweb.org/jonas/ns
http://www.objectweb.org/jonas/ns/jonas-connector_4_4.xsd">
    <rarlink></rarlink>
    <native-lib></native-lib>
    <log-enabled>false</log-enabled>
    <log-topic></log-topic>
    <pool-params>
        <pool-init>1</pool-init>
        <pool-min>0</pool-min>
        <pool-max>-1</pool-max>
        <pool-max-age-minutes>0</pool-max-age-minutes>
        <pstmt-max>10</pstmt-max>
        <pool-max-opentime>0</pool-max-opentime>
        <pool-max-waiters>0</pool-max-waiters>
        <pool-max-waittime>0</pool-max-waittime>
        <pool-sampling-period>30</pool-sampling-period>
    </pool-params>
    <jdbc-conn-params>
        <jdbc-check-level>0</jdbc-check-level>
    </jdbc-conn-params>

    <jonas-config-property>

<jonas-config-property-name>ProviderIntegrationMode</jonas-config-property-name>
        <jonas-config-property-value>javabean</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>ConnectionFactoryClassName</jonas-config-property-name>

<jonas-config-property-value>com.sun.messaging.ConnectionFactory</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>QueueConnectionFactoryClassName</jonas-config-property-name>

<jonas-config-property-value>com.sun.messaging.QueueConnectionFactory</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>TopicConnectionFactoryClassName</jonas-config-property-name>

<jonas-config-property-value>com.sun.messaging.TopicConnectionFactory</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>XAConnectionFactoryClassName</jonas-config-property-name>

<jonas-config-property-value>com.sun.messaging.XAConnectionFactory</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>XAQueueConnectionFactoryClassName</jonas-config-property-name>

<jonas-config-property-value>com.sun.messaging.XAQueueConnectionFactory</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>XATopicConnectionFactoryClassName</jonas-config-property-name>

<jonas-config-property-value>com.sun.messaging.XATopicConnectionFactory</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>UnifiedDestinationClassName</jonas-config-property-name>

<jonas-config-property-value>com.sun.messaging.Destination</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>TopicClassName</jonas-config-property-name>

<jonas-config-property-value>com.sun.messaging.Topic</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>QueueClassName</jonas-config-property-name>

<jonas-config-property-value>com.sun.messaging.Queue</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>
        <jonas-config-property-name>SupportsXA</jonas-config-property-name>
        <jonas-config-property-value>true</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>ConnectionFactoryProperties</jonas-config-property-name>
        <jonas-config-property-value>
            imqAddressList=192.168.0.157,192.168.0.34
            imqAddressListBehavior=PRIORITY
        </jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>JndiProperties</jonas-config-property-name>
        <jonas-config-property-value></jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>

<jonas-config-property-name>CommonSetterMethodName</jonas-config-property-name>

<jonas-config-property-value>setProperty</jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>
        <jonas-config-property-name>UserName</jonas-config-property-name>
        <jonas-config-property-value></jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>
        <jonas-config-property-name>Password</jonas-config-property-name>
        <jonas-config-property-value></jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>
        <jonas-config-property-name>RMPolicy</jonas-config-property-name>
        <jonas-config-property-value></jonas-config-property-value>
    </jonas-config-property>
    <jonas-config-property>
        <jonas-config-property-name>LogLevel</jonas-config-property-name>
        <jonas-config-property-value></jonas-config-property-value>
    </jonas-config-property>

    <jonas-connection-definition>

<description>com.sun.genericra.outbound.ManagedQueueConnectionFactory</description>
        <jndi-name>jms/QCF</jndi-name>
    </jonas-connection-definition>
    <jonas-connection-definition>

<description>com.sun.genericra.outbound.ManagedTopicConnectionFactory</description>
        <jndi-name>jms/TCF</jndi-name>
    </jonas-connection-definition>
    <jonas-connection-definition>

<description>com.sun.genericra.outbound.ManagedJMSConnectionFactory</description>
        <jndi-name>jms/CF</jndi-name>
    </jonas-connection-definition>
    <jonas-activationspec>
        <description>javax.jms.MessageListener</description>
        <jndi-name>jca/openmq</jndi-name>
    </jonas-activationspec>
    <jonas-adminobject>
        <description>com.sun.genericra.outbound.QueueProxy</description>
        <jndi-name>jms/Q1</jndi-name>
        <jonas-config-property>

<jonas-config-property-name>DestinationJndiName</jonas-config-property-name>
            <jonas-config-property-value></jonas-config-property-value>
        </jonas-config-property>
        <jonas-config-property>

<jonas-config-property-name>DestinationProperties</jonas-config-property-name>
            <jonas-config-property-value></jonas-config-property-value>
        </jonas-config-property>
    </jonas-adminobject>
    <jonas-adminobject>
        <description>com.sun.genericra.outbound.TopicProxy</description>
        <jndi-name>jms/T1</jndi-name>
        <jonas-config-property>

<jonas-config-property-name>DestinationJndiName</jonas-config-property-name>
            <jonas-config-property-value></jonas-config-property-value>
        </jonas-config-property>
        <jonas-config-property>

<jonas-config-property-name>DestinationProperties</jonas-config-property-name>
            <jonas-config-property-value></jonas-config-property-value>
        </jonas-config-property>
    </jonas-adminobject>
</jonas-connector>

and put it in META-INF directory of the rar. Note that I used only the
connection factory and not the activation spec or the adminobject objects.
- added to com.sun.genericra.GenericJMSRAProperties the following method

    public void setSupportsXA(Boolean supportsXA) {
        if (supportsXA != null) {
            setSupportsXA(supportsXA.booleanValue());
        }
    }

The last point was necessary since jonas doesn't consider equivalent the
setter in the basic datatype and the settere in the object datatype. I
signaled the problem in the jonas mailing list but at the moment I haven't
received a reply.

Ciao Angelo

---------- Messaggio inoltrato ----------
From: Ramesh Parthasarathy <Ramesh.Parthasarathy_at_Sun.COM>
To: dev_at_genericjmsra.dev.java.net
Date: Wed, 09 Jul 2008 11:37:29 +0000
Subject: Re: Properties with "," in the value
Hi Angelo,
       Thanks for the contribution. Did you get a chance to look at the
ObjectBuilder implementation in Generic ra 2.0, it uses a CustomTokenizer
which could solve the problem you have described.
Also, if you have a write up that describes the steps involved in
integrating jonas and Open MQ, please send it us, we will post it in the
generic jms ra site.

Thanks
-Ramesh

Angelo R. Di Filippo wrote:
Hi,
I'm using genericjmsra.rar (1.7.0) with jonas application server and,
excluded some modifications to the code to work, the JCA seems to work. I
found a problem with the ConnectionFactoryProperties tag/property; I decided
to use open mq in clustering but the config

imqAddressList=192.168.0.157,192.168.0.34,imqAddressListBehavior=RANDOM

for ConnectionFactoryProperties doesn't work since the "," is the server
separator and the property delimitator. I think it should be better to
change the method parseToProperties of com.sun.genericra.util.ObjectBu
>
> ilder in
>
> protected Hashtable parseToProperties(String prop)
> throws ResourceException {
> _logger.log(Level.FINE,
> "parseToProperties:" + prop + " delimited:" + delimiter +
> " seperator:" + separator);
>
> Properties result = new Properties();
> try {
> result.load(new
> ByteArrayInputStream(prop.getBytes("ISO-8859-1")));
> } catch (Exception e) {
> }
> return result;
> }
>
> so the properties are in a java real properties format.
> I appreciate comments.
>
> Ciao Angelo