These types of configurable properties are called environment entries . The 
bean can use environment entries to customize its behavior.

Although they can be defined using annotations, environment entries are almost 
always configured via XML, as they really are configuration values and not 
metadata. The <env-entry> element is used to define them. This element contains 
the subelements  (optional), <env-entry-name> (required), <env-entry-type> 
(required), and <env-entry-value> (optional), as well as the element 
<injection-target> (optional). Here is a typical <env-entry> declaration:

<ejb-jar>
   <enterprise-beans>
      
         <ejb-name>ProcessPaymentBean</ejb-name>
      <env-entry>
            <env-entry-name>minCheckNumber 
</env-entry-name>
            <env-entry-type>java.lang.Integer</env-entry-type>
            <env-entry-value>2000</env-entry-value>
         </env-entry>
   </enterprise-beans>
</ejb-jar>



The <env-entry-name> element is relative to the java:comp/env context. For 
example, the minCheckNumber entry can be accessed using the path 
java:comp/env/minCheckNumber in a JNDI ENC lookup:

InitialContext jndiContext = new InitialContext( );
int minValue = (Integer) jndiContext.lookup("java:comp/env/minCheckNumber"); 


Alternatively, it can be looked up with the EJBContext.lookup( ) method using 
the minCheckNumber name.

<env-entry-type> can be of type String or one of the several primitive wrapper 
types, including Integer, Long, Double, Float, Byte, Boolean, and Short.

<env-entry-value> is optional. The value can be specified by the bean developer 
or deferred to the application assembler or deployer.



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991963#3991963

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991963
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to