As part of the web container injection work I added 2 changes to the ResourceHandler to
allow for complete specification of enc entries via annotations alone as with this
servlet:
| @Resources({
| @Resource(name="mail/DefaultMail", type=javax.mail.Session.class,
mappedName="java:/Mail"),
| @Resource(name="url/JBossHome", type=java.net.URL.class,
mappedName="http://www.jboss.org"),
| @Resource(name="mdr/ConsumesLink", type=javax.jms.Queue.class,
mappedName="MockQueueA"),
| @Resource(name="mdr/ProducesLink", type=javax.jms.Topic.class,
mappedName="MockTopicA")
| })
| public class StandaloneENCAnnotationsServlet extends HttpServlet
| {
| private static final long serialVersionUID = 1;
| private static final Logger log =
Logger.getLogger(StandaloneENCAnnotationsServlet.class);
|
| @Resource(name="jms/QueFactory",
mappedName="java:/ConnectionFactory")
| QueueConnectionFactory queueFactory;
| @Resource(name="TestQueue", mappedName="MockQueueB")
| Queue testQueue;
| @Resource(name="mdr/ConsumesProducesJNDIName",
mappedName="MockQueueA")
| Queue refQueue;
|
| @Resource(name="jdbc/DefaultDS", mappedName="java:/MockDS")
| DataSource ds;
| @EJB(name="ejb/bean3", beanInterface=StatelessSessionHome.class,
| mappedName="jbosstest/ejbs/UnsecuredEJB")
| StatelessSessionHome sshome;
| @EJB(name="ejb/CtsBmp", beanInterface=EntityHome.class,
| mappedName="jbosstest/ejbs/CtsBmp")
| EntityHome entityHome;
| @EJB(name="ejb/local/bean3",
beanInterface=StatelessSessionLocalHome.class,
| mappedName="jbosstest/ejbs/local/ENCBean1")
| StatelessSessionLocalHome localHome;
| @Resource(name="Ints/i0", mappedName="0")
| int i0;
| @Resource(name="Ints/i1", mappedName="1")
| int i1;
| @Resource(name="Floats/f0", mappedName="0.0")
| float f0;
| @Resource(name="Floats/f1", mappedName="1.1")
| float f1;
| @Resource(name="Strings/s0", mappedName="String0")
| String s0;
| @Resource(name="Strings/s1", mappedName="String1")
| String s1;
| @Resource(name="ejb/catalog/CatalogDAOClass",
mappedName="com.sun.model.dao.CatalogDAOImpl")
| String ejbName;
|
1. Class level resource annotations that are of type URL create a URL from the
mappedName.
2. Field/method primative types for env-entry type of resources create the value from the
mappedName.
Rather an overloaded use of mappedName, but that is all there is available and its not in
conflict with the spec.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986588#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...