jndiutil.java

来自「<Java网络程序设计 J2EE>随书源码」· Java 代码 · 共 41 行

JAVA
41
字号
/**/package org.impact.stars.util;import javax.naming.InitialContext;import javax.naming.NamingException;/** * This class implements convenience methods to access JNDI * entries. It is typically used to access application * properties that were configured through deployment * descriptor and hence are accessible through JNDI namespace. */public final class JNDIUtil implements JNDINames {    /**     * a convenience method to get the boolean value corresponding     * to the SEND_CONFIRMATION_MAIL property.     */    public static boolean sendConfirmationMail() {        boolean boolVal = false;        try {            InitialContext ic = new InitialContext();            Boolean bool = (Boolean)                ic.lookup(JNDINames.SEND_CONFIRMATION_MAIL);            if (bool != null) {                boolVal = bool.booleanValue();            }        } catch (NamingException ne) {            // If property is not present in the deployment            // descriptor, conservatively assume that we do not send            // confirmation mail for each order.            Debug.print(ne);        }        return boolVal;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?