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

📄 netconnectionreply.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/*   Derby - Class org.apache.derby.client.net.NetConnectionReply   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.   Licensed under the Apache License, Version 2.0 (the "License");   you may not use this file except in compliance with the License.   You may obtain a copy of the License at      http://www.apache.org/licenses/LICENSE-2.0   Unless required by applicable law or agreed to in writing, software   distributed under the License is distributed on an "AS IS" BASIS,   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   See the License for the specific language governing permissions and   limitations under the License.*/package org.apache.derby.client.net;import javax.transaction.xa.Xid;import org.apache.derby.client.am.Connection;import org.apache.derby.client.am.ConnectionCallbackInterface;import org.apache.derby.client.am.DisconnectException;import org.apache.derby.client.am.SqlException;import org.apache.derby.client.am.SqlState;import org.apache.derby.client.am.Sqlca;import java.io.UnsupportedEncodingException;public class NetConnectionReply extends Reply        implements ConnectionReplyInterface {    NetConnectionReply(NetAgent netAgent, int bufferSize) {        super(netAgent, bufferSize);    }    // NET only entry point    void readExchangeServerAttributes(Connection connection) throws SqlException {        startSameIdChainParse();        parseEXCSATreply((NetConnection) connection);        endOfSameIdChainData();        agent_.checkForChainBreakingException_();    }    void verifyDeferredReset() throws SqlException {        readDssHeader();        verifyConnectReply(CodePoint.EXCSATRD);        readDssHeader();        verifyConnectReply(CodePoint.ACCSECRD);        readDssHeader();        verifyConnectReply(CodePoint.SECCHKRM);        readDssHeader();        verifyConnectReply(CodePoint.ACCRDBRM);        agent_.checkForChainBreakingException_();    }    void verifyConnectReply(int codept) throws SqlException {        if (peekCodePoint() != codept) {            parseConnectError();            return;        }        readLengthAndCodePoint();        skipBytes();        if (codept == CodePoint.ACCRDBRM) {            int peekCP = peekCodePoint();            if (peekCP == Reply.END_OF_SAME_ID_CHAIN) {                return;            }            parseTypdefsOrMgrlvlovrs();            NetSqlca netSqlca = parseSQLCARD(null);            netAgent_.netConnection_.completeSqlca(netSqlca);        }    }    void parseConnectError() throws DisconnectException {        int peekCP = peekCodePoint();        switch (peekCP) {        case CodePoint.CMDCHKRM:            parseCMDCHKRM();            break;        case CodePoint.MGRLVLRM:            parseMGRLVLRM();            break;        default:            parseCommonError(peekCP);        }    }    void readDummyExchangeServerAttributes(Connection connection) throws SqlException {        startSameIdChainParse();        parseDummyEXCSATreply((NetConnection) connection);        endOfSameIdChainData();        agent_.checkForChainBreakingException_();    }    // NET only entry point    void readAccessSecurity(Connection connection,                            int securityMechanism) throws SqlException {        startSameIdChainParse();        parseACCSECreply((NetConnection) connection, securityMechanism);        endOfSameIdChainData();        agent_.checkForChainBreakingException_();    }    // NET only entry point    void readSecurityCheck(Connection connection) throws SqlException {        startSameIdChainParse();        parseSECCHKreply((NetConnection) connection);        endOfSameIdChainData();        agent_.checkForChainBreakingException_();    }    // NET only entry point    void readAccessDatabase(Connection connection) throws SqlException {        startSameIdChainParse();        parseACCRDBreply((NetConnection) connection);        endOfSameIdChainData();        agent_.checkForChainBreakingException_();    }    public void readCommitSubstitute(ConnectionCallbackInterface connection) throws DisconnectException {        startSameIdChainParse();        parseDummyEXCSATreply((NetConnection) connection);        endOfSameIdChainData();    }    public void readLocalCommit(ConnectionCallbackInterface connection) throws DisconnectException {        startSameIdChainParse();        parseRDBCMMreply(connection);        endOfSameIdChainData();    }    public void readLocalRollback(ConnectionCallbackInterface connection) throws DisconnectException {        startSameIdChainParse();        parseRDBRLLBCKreply(connection);        endOfSameIdChainData();    }    public void readLocalXAStart(ConnectionCallbackInterface connection) throws DisconnectException {    }    public void readLocalXACommit(ConnectionCallbackInterface connection) throws DisconnectException {    }    public void readLocalXARollback(ConnectionCallbackInterface connection) throws DisconnectException {    }    protected void readXaStartUnitOfWork(NetConnection conn) throws DisconnectException {    }    protected int readXaEndUnitOfWork(NetConnection conn) throws DisconnectException {        return 0;    }    protected int readXaPrepare(NetConnection conn) throws DisconnectException {        return 0;    }    protected void readXaCommit(NetConnection conn) throws DisconnectException {    }    protected int readXaRollback(NetConnection conn) throws DisconnectException {        return 0;    }    protected void readXaRecover(NetConnection conn) throws DisconnectException {    }    protected void readXaForget(NetConnection conn) throws DisconnectException {    }    //------------------parse reply for specific command--------------------------    // These methods are "private protected", which is not a recognized java privilege,    // but means that these methods are private to this class and to subclasses,    // and should not be used as package-wide friendly methods.    // Parse the reply for the RDB Commit Unit of Work Command.    // This method handles the parsing of all command replies and reply data    // for the rdbcmm command.    private void parseRDBCMMreply(ConnectionCallbackInterface connection) throws DisconnectException {        int peekCP = parseTypdefsOrMgrlvlovrs();        if (peekCP != CodePoint.ENDUOWRM && peekCP != CodePoint.SQLCARD) {            parseCommitError(connection);            return;        }        if (peekCP == CodePoint.ENDUOWRM) {            parseENDUOWRM(connection);            peekCP = parseTypdefsOrMgrlvlovrs();        }        NetSqlca netSqlca = parseSQLCARD(null);        connection.completeSqlca(netSqlca);    }    // Parse the reply for the RDB Rollback Unit of Work Command.    // This method handles the parsing of all command replies and reply data    // for the rdbrllbck command.    private void parseRDBRLLBCKreply(ConnectionCallbackInterface connection) throws DisconnectException {        int peekCP = parseTypdefsOrMgrlvlovrs();        if (peekCP != CodePoint.ENDUOWRM) {            parseRollbackError();            return;        }        parseENDUOWRM(connection);        peekCP = parseTypdefsOrMgrlvlovrs();        NetSqlca netSqlca = parseSQLCARD(null);        connection.completeSqlca(netSqlca);    }    // Parse the reply for the Exchange Server Attributes Command.    // This method handles the parsing of all command replies and reply data    // for the excsat command.    private void parseEXCSATreply(NetConnection netConnection) throws DisconnectException {        if (peekCodePoint() != CodePoint.EXCSATRD) {            parseExchangeServerAttributesError();            return;        }        parseEXCSATRD(netConnection);    }    // Parse the reply for the Exchange Server Attributes Command (Dummy)    // This method handles the parsing of all command replies and reply data    // for the excsat command.    private void parseDummyEXCSATreply(NetConnection netConnection) throws DisconnectException {        if (peekCodePoint() != CodePoint.EXCSATRD) {            parseExchangeServerAttributesError();            return;        }        parseDummyEXCSATRD(netConnection);    }    // Parse the reply for the Access Security Command.    // This method handles the parsing of all command replies and reply data    // for the accsec command.    private void parseACCSECreply(NetConnection netConnection, int securityMechanism) throws DisconnectException {        int peekCP = peekCodePoint();        if (peekCP != CodePoint.ACCSECRD) {            parseAccessSecurityError(netConnection);            return;        }        parseACCSECRD(netConnection, securityMechanism);        peekCP = peekCodePoint();        if (peekCP == Reply.END_OF_SAME_ID_CHAIN) {            return;        }    }    // Parse the reply for the Security Check Command.    // This method handles the parsing of all command replies and reply data    // for the secchk command.    private void parseSECCHKreply(NetConnection netConnection) throws DisconnectException {        if (peekCodePoint() != CodePoint.SECCHKRM) {            parseSecurityCheckError(netConnection);            return;        }        parseSECCHKRM(netConnection);        if (peekCodePoint() == CodePoint.SECTKN) {            // rpydta used only if the security mechanism returns            // a security token that must be sent back to the source system.            // this is only used for DCSSEC.  In the case of DCESEC,            // the sectkn must be returned as reply data if DCE is using            // mutual authentication.            // Need to double check what to map this to.  This is probably            // incorrect but consider it a conversation protocol error            // 0x03 - OBJDSS sent when not allowed.            //parseSECTKN (true);            boolean done = false;            byte[] bytes = parseSECTKN(false);        }    }    // Parse the reply for the Access RDB Command.    // This method handles the parsing of all command replies and reply data    // for the accrdb command.    private void parseACCRDBreply(NetConnection netConnection) throws DisconnectException {        int peekCP = peekCodePoint();        if (peekCP != CodePoint.ACCRDBRM) {            parseAccessRdbError(netConnection);            return;        }        parseACCRDBRM(netConnection);        peekCP = peekCodePoint();        if (peekCP == Reply.END_OF_SAME_ID_CHAIN) {            return;        }        parseTypdefsOrMgrlvlovrs();        NetSqlca netSqlca = parseSQLCARD(null);        netConnection.completeSqlca(netSqlca);    }    protected int parseTypdefsOrMgrlvlovrs() throws DisconnectException {        boolean targetTypedefCloned = false;        while (true) {            int peekCP = peekCodePoint();            if (peekCP == CodePoint.TYPDEFNAM) {                if (!targetTypedefCloned) {                    netAgent_.targetTypdef_ = (Typdef) netAgent_.targetTypdef_.clone();                    targetTypedefCloned = true;                }                parseTYPDEFNAM();            } else if (peekCP == CodePoint.TYPDEFOVR) {                if (!targetTypedefCloned) {                    netAgent_.targetTypdef_ = (Typdef) netAgent_.targetTypdef_.clone();                    targetTypedefCloned = true;                }                parseTYPDEFOVR();            } else {                return peekCP;            }        }    }    //-----------------------------parse DDM Reply Messages-----------------------    protected void parseCommitError(ConnectionCallbackInterface connection) throws DisconnectException {        int peekCP = peekCodePoint();        switch (peekCP) {        case CodePoint.ABNUOWRM:            NetSqlca sqlca = parseAbnormalEndUow(connection);            connection.completeSqlca(sqlca);            break;        case CodePoint.CMDCHKRM:            parseCMDCHKRM();            break;        case CodePoint.RDBNACRM:            parseRDBNACRM();

⌨️ 快捷键说明

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