geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toby cabot <t...@caboteria.org>
Subject ResourceAdapter.start() not getting called?
Date Sat, 10 Jul 2004 15:26:31 GMT
Hi folks,

I'm trying to get a skeleton JCA 1.5 resource adapter up and running,
and am most of the way there but for one problem: my
javax.resource.spi.ResourceAdapter.start() doesn't get called.
It looks as if my deployment is OK, at least my configuration
parameter setter gets called but then start() doesn't.
Based on my reading of the JCA spec I believe that start() should be
called, by my JCA-fu is weak so I could be wrong.

I fixed a NPE caused by not having any outbound connection factories
or admin objects (see
http://nagoya.apache.org/jira/browse/GERONIMO-262 if you're curious)
and since both are minOccurs=0 in the schema I think they're optional.

So now I'm stuck.  If anyone's got any ideas or pointers of where to
look in the code, I'd appreciate it and will investigate further.  If
anyone wants to whack me with the JCA clue-by-four I can accept that,
too.

Regards,
Toby

My resource adapter rar is trivial, just ra.xml, geronimo-ra.xml and
an implementation of javax.resource.spi.ResourceAdapter.

ra.xml:

<?xml version="1.0" ?>
<connector xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
    version="1.5">
    <description>experimental jca 1.5 resource adapter</description>
    <display-name>testRA</display-name>
    <vendor-name>FIXME</vendor-name>
    <eis-type>test</eis-type>
    <resourceadapter-version>0.0</resourceadapter-version>
    <resourceadapter>
        <resourceadapter-class>skeleton.ra.spread.AdapterImpl</resourceadapter-class>
        <config-property>
            <config-property-name>ConfigParameter</config-property-name>
            <config-property-type>java.lang.String</config-property-type>
            <config-property-value>OldStringValue</config-property-value>
        </config-property>
    </resourceadapter>
</connector>

geronimo-ra.xml:

<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee" version="1.5"
    configId="testRA"
    parentId="org/apache/geronimo/Server">
    <resourceadapter>
        <resourceadapter-instance>
            <resourceadapter-name>testRA</resourceadapter-name>
            <config-property-setting name="ConfigParameter">NewStringValue</config-property-setting>
            <bootstrapcontext-name>geronimo.connector:role=BootstrapContext</bootstrapcontext-name>
        </resourceadapter-instance>
    </resourceadapter>
</connector>

code:

package skeleton.ra.spread;

import javax.resource.spi.BootstrapContext;
import javax.resource.spi.ResourceAdapterInternalException;
import javax.resource.spi.endpoint.MessageEndpointFactory;
import javax.resource.ResourceException;
import javax.transaction.xa.XAResource;
import javax.resource.spi.ActivationSpec;


/**
 * A null resource adapter.
 */
public class AdapterImpl implements javax.resource.spi.ResourceAdapter {

    /**
     * Describe <code>start</code> method here.
     *
     * @param bootstrapContext a <code>BootstrapContext</code> value
     * @exception ResourceAdapterInternalException if an error occurs
     */
    public void start(BootstrapContext bootstrapContext) throws ResourceAdapterInternalException
{
        System.out.println("ra test starting");
    }

    /**
     * Describe <code>stop</code> method here.
     *
     */
    public void stop() {
        System.out.println("ra test stopping");
    }

    /**
     * Describe <code>endpointActivation</code> method here.
     *
     * @param messageEndpointFactory a <code>MessageEndpointFactory</code> value
     * @param activationSpec an <code>ActivationSpec</code> value
     * @exception ResourceException if an error occurs
     */
    public void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec
activationSpec) throws ResourceException {
        System.out.println("ra test endpoint activation");
    }

    /**
     * Describe <code>endpointDeactivation</code> method here.
     *
     * @param messageEndpointFactory a <code>MessageEndpointFactory</code> value
     * @param activationSpec an <code>ActivationSpec</code> value
     */
    public void endpointDeactivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec
activationSpec) {
        System.out.println("ra test endpoint deactivation");
    }

    /**
     * Describe <code>getXAResources</code> method here.
     *
     * @param activationSpecArray an <code>ActivationSpec[]</code> value
     * @return a <code>XAResource[]</code> value
     * @exception ResourceException if an error occurs
     */
    public XAResource[] getXAResources(ActivationSpec[] activationSpecArray) throws ResourceException
{
        System.out.println("ra test get xa resources");
        return null;
    }


    String configParameter;

    /**
     * Get the ConfigParameter value.
     * @return the ConfigParameter value.
     */
    public String getConfigParameter() {
        return configParameter;
    }

    /**
     * Set the ConfigParameter value.
     * @param newConfigParameter The new ConfigParameter value.
     */
    public void setConfigParameter(String newConfigParameter) {
        System.out.println("ra test setting configParameter to " + newConfigParameter);
        new Throwable().printStackTrace();
        this.configParameter = newConfigParameter;
    }

    
}

Mime
View raw message