1 package test;2 3 import java.util.logging.Logger ;4 5 import javax.resource.spi.ResourceAdapter ;6 import javax.resource.spi.ResourceAdapterInternalException ;7 import javax.resource.spi.BootstrapContext ;8 9 import com.caucho.jca.AbstractResourceAdapter;10 11 /**12 * Implements a resource which is a plain-old bean.13 *14 * The resource is configured in the resin.conf (or web.xml) using15 * bean-style configuration and saved in JNDI.16 *17 * <pre>18 * <resource name="test/basic"19 * type="test.TestResource">20 * <init>21 * <value>sample configuration</value>22 * </init>23 * </resource>24 * </pre>25 *26 * <p>Applications will use JNDI to retrieve the resource:</p>27 *28 * <code><pre>29 * Context ic = new InitialContext();30 * TestResource resource = (TestResource) ic.lookup("java:comp/env/test/basic");31 * </pre></code>32 */33 public class TestResource {34 private static final Logger log =35 Logger.getLogger(TestResource.class.getName());36 37 /**38 * Sample initialization param set by the <resource>39 */40 private String _value = "default";41 42 /**43 * Sets the value.44 */45 public void setValue(String value)46 {47 _value = value;48 }49 50 /**51 * init() is called at the end of the configuration.52 */53 public void init()54 {55 log.config("TestResource[" + _value + "] init");56 }57 58 /**59 * Returns a printable version of the resource.60 */61 public String toString()62 {63 return "TestResource[" + _value + "]";64 }65 }66