JingDAO Tutorial: ResolversJingDAO uses the idea of URI (universal resource identifier) Resolvers to determine how to load DAO resources. A set of default resolver schemes is included, but you can easily add more. Default ResolversThe following resolver schemes are included by default:
Resolver ConfigurationThe following shows how to configure a new resolver. In this example, we are looking up a remote object (simpleDao) from a local server using AltRMI. <?xml version="1.0" encoding="ISO-8859-1"?> <container> <resolvers id="resolver"> <resolver scheme="jndi" class="org.jadetower.resolver.impl.JndiResolver"> <parameter name="java.naming.factory.initial" value="org.apache.altrmi.client.impl.naming.DefaultInitialContextFactory"/> <parameter name="java.naming.provider.url" value="altrmi://localhost:7124/SocketCustomStream"/> </resolver> </resolvers> <manager id="default"> <daos> <dao name="simple-local" uri="class://org.jadetower.dao.test.daos.impl.HelloWorldDaoImpl" /> <dao name="simple-remote" uri="jndi://simpleDao"/> </daos> </manager> </container>
You can create your own Resolver by implementing the
Resolvers can be used in either context configuration or in defining the DAO's themselves. The most common uses are to use a JNDI resolver to retrieve a database DataSource object which is placed in the context or to access remote DAO objects such as EJB's. |