⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abstractconfiguration.java

📁 是离开的肌肤了卡机是离开的就富利卡及是了的开发及拉考试及的福利科技阿斯利康的肌肤莱卡及时的离开福建阿斯顿发
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     *    - javax.mail.Session     *    - java.net.URL     *    - javax.resource.cci.ConnectionFactory     *    - org.omg.CORBA_2_3.ORB     *    - any other connection factory defined by a resource adapter     * @param node     * @throws Exception     */    protected void initResourceRef (XmlParser.Node node)    throws Exception    {        String jndiName = node.getString("res-ref-name",false,true);        String type = node.getString("res-type", false, true);        String auth = node.getString("res-auth", false, true);        String shared = node.getString("res-sharing-scope", false, true);        //check for <injection> elements        Class typeClass = TypeUtil.fromName(type);        if (typeClass==null)            typeClass = getWebAppContext().loadClass(type);        initInjection (node, jndiName, typeClass);                bindResourceRef(jndiName, typeClass);    }            /**     * Common Annotations Spec section 2.3:     *   resource-env-ref is for:     *     - javax.transaction.UserTransaction     *     - javax.resource.cci.InteractionSpec     *     - anything else that is not a connection factory     * @param node     * @throws Exception     */    protected void initResourceEnvRef (XmlParser.Node node)    throws Exception    {        String jndiName = node.getString("resource-env-ref-name",false,true);        String type = node.getString("resource-env-ref-type", false, true);        //check for <injection> elements                //JavaEE Spec sec 5.7.1.3 says the resource-env-ref-type        //is mandatory, but the schema says it is optional!        Class typeClass = TypeUtil.fromName(type);        if (typeClass==null)            typeClass = getWebAppContext().loadClass(type);        initInjection (node, jndiName, typeClass);                bindResourceEnvRef(jndiName, typeClass);    }            /**     * Common Annotations Spec section 2.3:     *   message-destination-ref is for:     *     - javax.jms.Queue     *     - javax.jms.Topic     * @param node     * @throws Exception     */    protected void initMessageDestinationRef (XmlParser.Node node)    throws Exception    {        String jndiName = node.getString("message-destination-ref-name",false,true);        String type = node.getString("message-destination-type",false,true);        String usage = node.getString("message-destination-usage",false,true);                Class typeClass = TypeUtil.fromName(type);        if (typeClass==null)            typeClass = getWebAppContext().loadClass(type);        initInjection(node, jndiName, typeClass);                bindMessageDestinationRef(jndiName, typeClass);    }                /**     * Process &lt;post-construct&gt;     * @param node     */    protected void initPostConstruct(XmlParser.Node node)    {        String className = node.getString("lifecycle-callback-class", false, true);        String methodName = node.getString("lifecycle-callback-method", false, true);                if (className==null || className.equals(""))        {            Log.warn("No lifecycle-callback-class specified");            return;        }        if (methodName==null || methodName.equals(""))        {            Log.warn("No lifecycle-callback-method specified for class "+className);            return;        }                try        {            Class clazz = getWebAppContext().loadClass(className);            LifeCycleCallback callback = new PostConstructCallback();            callback.setTarget(clazz, methodName);            _callbacks.add(callback);        }        catch (ClassNotFoundException e)        {            Log.warn("Couldn't load post-construct target class "+className);        }    }            /**     * Process &lt;pre-destroy&gt;     * @param node     */    protected void initPreDestroy(XmlParser.Node node)    {        String className = node.getString("lifecycle-callback-class", false, true);        String methodName = node.getString("lifecycle-callback-method", false, true);        if (className==null || className.equals(""))        {            Log.warn("No lifecycle-callback-class specified for pre-destroy");            return;        }        if (methodName==null || methodName.equals(""))        {            Log.warn("No lifecycle-callback-method specified for pre-destroy class "+className);            return;        }                 try        {            Class clazz = getWebAppContext().loadClass(className);            LifeCycleCallback callback = new PreDestroyCallback();            callback.setTarget(clazz, methodName);            _callbacks.add(callback);        }        catch (ClassNotFoundException e)        {            Log.warn("Couldn't load pre-destory target class "+className);        }    }            /**     * Iterate over the &lt;injection-target&gt; entries for a node     *      * @param node     * @param jndiName     * @param valueClass     * @return the type of the injectable     */    protected void initInjection (XmlParser.Node node, String jndiName, Class valueClass)    {        Iterator  itor = node.iterator("injection-target");                while(itor.hasNext())        {            XmlParser.Node injectionNode = (XmlParser.Node)itor.next();             String targetClassName = injectionNode.getString("injection-target-class", false, true);            String targetName = injectionNode.getString("injection-target-name", false, true);            if ((targetClassName==null) || targetClassName.equals(""))            {                Log.warn("No classname found in injection-target");                continue;            }            if ((targetName==null) || targetName.equals(""))            {                Log.warn("No field or method name in injection-target");                continue;            }            // comments in the javaee_5.xsd file specify that the targetName is looked            // for first as a java bean property, then if that fails, as a field            try            {                Class clazz = getWebAppContext().loadClass(targetClassName);                Injection injection = new Injection();                injection.setTargetClass(clazz);                injection.setJndiName(jndiName);                injection.setTarget(clazz, targetName, valueClass);                 _injections.add(injection);            }            catch (ClassNotFoundException e)            {                Log.warn("Couldn't load injection target class "+targetClassName);            }        }    }            /**     * Parse all classes that are mentioned in web.xml (servlets, filters, listeners)     * for annotations.     *      *      *      * @throws Exception     */    protected abstract void parseAnnotations () throws Exception;               protected void injectAndCallPostConstructCallbacks()    throws Exception    {        //look thru the servlets to apply any runAs annotations        //NOTE: that any run-as in web.xml will already have been applied        ServletHolder[] holders = getWebAppContext().getServletHandler().getServlets();        for (int i=0;holders!=null && i<holders.length;i++)        {            _runAsCollection.setRunAs(holders[i]);        }                        EventListener[] listeners = getWebAppContext().getEventListeners();        for (int i=0;listeners!=null && i<listeners.length;i++)        {            _injections.inject(listeners[i]);            _callbacks.callPostConstructCallback(listeners[i]);        }    }            protected void callPreDestroyCallbacks ()    throws Exception    {        EventListener[] listeners = getWebAppContext().getEventListeners();        for (int i=0; listeners!=null && i<listeners.length;i++)        {            _callbacks.callPreDestroyCallback(listeners[i]);        }    }   }

⌨️ 快捷键说明

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