27.03.2013 Views

JBoss Enterprise Application Platform Common Criteria Certification ...

JBoss Enterprise Application Platform Common Criteria Certification ...

JBoss Enterprise Application Platform Common Criteria Certification ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4 8 Chapter 6. The JNDI Naming Service<br />

mapping information supplied by the Deployer. It must be one of <strong>Application</strong> or Container.<br />

An optional res-sharing-scope element. This currently is not supported by <strong>JBoss</strong>.<br />

The J2EE specification recommends that all resource manager connection factory references be<br />

organized in the subcontexts of the application component's environment, using a different subcontext<br />

for each resource manager type. The recommended resource manager type to subcontext name is as<br />

follows:<br />

JDBC DataSource references should be declared in the java:comp/env/jdbc subcontext.<br />

JMS connection factories should be declared in the java:comp/env/jms subcontext.<br />

JavaMail connection factories should be declared in the java:comp/env/mail subcontext.<br />

URL connection factories should be declared in the java:comp/env/url subcontext.<br />

Example 6.12, “A web.xml resource-ref descriptor fragment” shows an example web.xml descriptor<br />

fragment that illustrates the resource-ref element usage. Example 6.13, “ENC resource-ref access<br />

sample code fragment” provides a code fragment that an application component would use to access<br />

the DefaultMail resource declared by the resource-ref.<br />

Example 6.12. A web.xml resource-ref descriptor fragment<br />

<br />

<br />

<br />

AServlet<br />

<br />

<br />

<br />

<br />

<br />

The default DS<br />

jdbc/DefaultDS<br />

javax.sql.DataSource<br />

Container<br />

<br />

<br />

<br />

Default Mail<br />

mail/DefaultMail<br />

javax.mail.Session<br />

Container<br />

<br />

<br />

<br />

Default QueueFactory<br />

jms/QueueFactory<br />

javax.jms.QueueConnectionFactory<br />

Container<br />

<br />

<br />

Example 6.13. ENC resource-ref access sample code fragment<br />

Context initCtx = new InitialContext();<br />

javax.mail.Session s = (javax.mail.Session)<br />

initCtx.lookup("java:comp/env/mail/DefaultMail");<br />

6.6.1.6. Resource Manager Connection Factory References with jboss.xml and jboss-web.xml<br />

The purpose of the <strong>JBoss</strong> jboss.xml EJB deployment descriptor and jboss-web.xml Web<br />

application deployment descriptor is to provide the link from the logical name defined by the res-refname<br />

element to the JNDI name of the resource factory as deployed in <strong>JBoss</strong>. This is accomplished by<br />

providing a resource-ref element in the jboss.xml or jboss-web.xml descriptor. The <strong>JBoss</strong><br />

resource-ref element consists of the following child elements:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!