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

📄 managedconnectionimpl.java

📁 一个java写的加密算法
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    }    /**     * Returns a javax.resource.spi.LocalTransaction instance. The      * LocalTransaction interface is used by the container to manage local      * transactions for a RM instance.     *     * Because this implementation does not support transactions, the method     * throws an exception.     *     * @return   javax.resource.spi.LocalTransaction instance     *     * @exception ResourceException  if transactions are not supported     */    public javax.resource.spi.LocalTransaction getLocalTransaction() 	throws ResourceException    {        throw new NotSupportedException(resource.getString("NO_TRANSACTION"));    }    /**     * Gets the metadata information for this connection's underlying EIS      * resource manager instance. The ManagedConnectionMetaData interface      * provides information about the underlying EIS instance associated with      * the ManagedConnection instance.     *     * @return ManagedConnectionMetaData  ManagedConnectionMetaData instance     *     * @exception ResourceException  if the metadata cannot be retrieved     */    public ManagedConnectionMetaData getMetaData() 	throws ResourceException    {        checkIfDestroyed();        return new ManagedConnectionMetaDataImpl(this);    }    /**     * Sets the log writer for this ManagedConnection instance.      * The log writer is a character output stream to which all logging and      * tracing messages for this ManagedConnection instance will be printed.     *     * @param out  character output stream to be associated     *     * @exception ResourceException  if the method fails     */    public void setLogWriter(PrintWriter out) 	throws ResourceException    {        this.logWriter = out;    }    /**     * Gets the log writer for this ManagedConnection instance.     *     * @return   the character output stream associated with this      *           ManagedConnection instance     *     * @exception ResourceException  if the method fails     */       public PrintWriter getLogWriter() 	throws ResourceException    {        return logWriter;    }    /**     * Gets the user name of the user associated with the ManagedConnection      * instance.     *     * @return  the username for this connection     */    public String getUserName()     {        if (passCred != null)            return passCred.getUserName();	else 	    return null;    }    /**     * Gets the password for the user associated with the ManagedConnection      * instance.     *     * @return  the password for this connection     */    public PasswordCredential getPasswordCredential()     { 	return passCred;    }    /**     * Associate connection handle with the physical connection.     *     * @param javaMailCon  connection handle     */    public void addJavaMailConnection(JavaMailConnection javaMailCon)     {        connectionSet.add(javaMailCon);    }    /**     * Check validation of the physical connection.     *     * @exception ResourceException  if the connection has been destroyed     */    private void checkIfDestroyed()  	throws ResourceException     {        if (destroyed) {            throw new IllegalStateException(resource.getString("DESTROYED_CONNECTION"));        }    }    /**     * Removes the associated connection handle from the connections set to the      * physical connection.     *     * @param javaMailCon  the connection handle     */    public void removeJavaMailConnection(JavaMailConnection javaMailCon)     {        connectionSet.remove(javaMailCon);    }    /**     * Checks validation of the physical connection.     *     * @return  true if the connection has been destroyed; false otherwise     */    boolean isDestroyed()     {         return destroyed;     }    /**     * Returns the ManagedConnectionFactory that created this instance of      * ManagedConnection.     *     * @return  the ManagedConnectionFactory for this connection     */    public ManagedConnectionFactoryImpl getManagedConnectionFactory()     {        return this.mcf;    }    /**     * Sends a connection event to the application server.     *     * @param eventType  the ConnectionEvent type     * @param ex  exception indicating a connection-related error     */    public void sendEvent(int eventType, Exception ex)     {        eventListener.sendEvent(eventType, ex, null);    }    /**     * Sends a connection event to the application server.     *     * @param eventType  the ConnectionEvent type     * @param ex  exception indicating a connection-related error     * @param connectionHandle  the connection handle associated with the      *                          ManagedConnection instance     */    public void sendEvent(int eventType, Exception ex, Object connectionHandle)     {        eventListener.sendEvent(eventType, ex, connectionHandle);    }        public boolean isTheSameStore(ConnectionRequestInfoImpl cxRequestInfo)    {        logger.info(" X.- (" + myId + ") ManagedConnection::isTheSame called");        return store.isTheSameStore(cxRequestInfo);    }    /** Physical connection **/        private boolean openStore(ConnectionRequestInfo cxRequestInfo)        throws ResourceException    {        ConnectionSpecImpl connectionInfo = new ConnectionSpecImpl();                if (cxRequestInfo != null)        {            connectionInfo.setUserName(((ConnectionRequestInfoImpl)cxRequestInfo).getUserName());            connectionInfo.setPassword(((ConnectionRequestInfoImpl)cxRequestInfo).getPassword());            connectionInfo.setServerName(((ConnectionRequestInfoImpl)cxRequestInfo).getServerName());            connectionInfo.setProtocol(((ConnectionRequestInfoImpl)cxRequestInfo).getProtocol());         } else {            // Use default values            connectionInfo.setUserName(mcf.getUserName());            connectionInfo.setPassword(mcf.getPassword());            connectionInfo.setServerName(mcf.getServerName());            connectionInfo.setProtocol(mcf.getProtocol());         }                try	{	    store = new MailServerStore(connectionInfo);        } catch (Exception e) {      	    logger.severe("JavaMailConnectionImpl::openStore threw exception: " + e);            throw new ResourceException(e.getMessage());        }         return true;    }        private javax.mail.Folder getFolder(String folderName)      throws ResourceException    {        javax.mail.Folder folder;                try	{    	    folder = store.getFolder(folderName);            return folder;        } catch (Exception e) {      	    logger.severe("JavaMailConnectionImpl::getFolder threw exception: " + e);        }         return null;            }        /**     * Application-specific method. Fetches new messages from the mail server.     *     * @return an array of messages     */    public javax.mail.Message[] getNewMessages(javax.mail.Folder folder)      throws ResourceException    {        try	{	    return store.getNewMessages(folder);	} catch (Exception e) {      	    logger.info("ManagedConnectionImpl::getNewMessages threw exception: " + e);	    throw new ResourceException(e.getMessage());        }     }    /**     * Application-specific method. Fetches new message headers from the      * mail server.     *     * @return a String array of message headers     */    public String[] getNewMessageHeaders(javax.mail.Folder folder)      throws ResourceException    {        try	{	    return store.getNewMessageHeaders(folder);	} catch (Exception e) {      	    logger.info("ManagedConnectionImpl::getNewMessageHeaders threw exception: " + e);	    throw new ResourceException(e.getMessage());        }     } }

⌨️ 快捷键说明

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