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

📄 netconnection.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    private void initializePublicKeyForEncryption() throws SqlException {        if (encryptionManager_ == null) {            encryptionManager_ = new org.apache.derby.client.am.EncryptionManager(agent_);        }        publicKey_ = encryptionManager_.obtainPublicKey();    }    private byte[] encryptedPasswordForUSRENCPWD(String password) throws SqlException {        return encryptionManager_.encryptData(netAgent_.sourceCcsidManager_.convertFromUCS2(password, netAgent_),                NetConfiguration.SECMEC_USRENCPWD,                netAgent_.sourceCcsidManager_.convertFromUCS2(user_, netAgent_),                targetPublicKey_);    }    private byte[] encryptedUseridForEUSRIDPWD() throws SqlException {        return encryptionManager_.encryptData(netAgent_.sourceCcsidManager_.convertFromUCS2(user_, netAgent_),                NetConfiguration.SECMEC_EUSRIDPWD,                targetPublicKey_,                targetPublicKey_);    }    private byte[] encryptedPasswordForEUSRIDPWD(String password) throws SqlException {        return encryptionManager_.encryptData(netAgent_.sourceCcsidManager_.convertFromUCS2(password, netAgent_),                NetConfiguration.SECMEC_EUSRIDPWD,                targetPublicKey_,                targetPublicKey_);    }    // Methods to get the manager levels for Regression harness only.    public int getSQLAM() {        return netAgent_.targetSqlam_;    }    public int getAGENT() {        return targetAgent_;    }    public int getCMNTCPIP() {        return targetCmntcpip_;    }    public int getRDB() {        return targetRdb_;    }    public int getSECMGR() {        return targetSecmgr_;    }    public int getXAMGR() {        return targetXamgr_;    }    public int getSYNCPTMGR() {        return targetSyncptmgr_;    }    public int getRSYNCMGR() {        return targetRsyncmgr_;    }    private char[] flipBits(char[] array) {        for (int i = 0; i < array.length; i++) {            array[i] ^= 0xff;        }        return array;    }    private void writeDeferredResetFromCache() {        int length = cachedConnectBytes_.length;        System.arraycopy(cachedConnectBytes_,                0,                netAgent_.netConnectionRequest_.bytes_,                netAgent_.netConnectionRequest_.offset_,                length);        netAgent_.netConnectionRequest_.offset_ += length;        netAgent_.netConnectionRequest_.setDssLengthLocation(netAgent_.netConnectionRequest_.offset_);        netAgent_.netConnectionRequest_.setCorrelationID(4);    }    public void writeCommitSubstitute_() throws SqlException {        netAgent_.connectionRequest_.writeCommitSubstitute(this);    }    public void readCommitSubstitute_() throws SqlException {        netAgent_.connectionReply_.readCommitSubstitute(this);    }    public void writeLocalXAStart_() throws SqlException {        netAgent_.connectionRequest_.writeLocalXAStart(this);    }    public void readLocalXAStart_() throws SqlException {        netAgent_.connectionReply_.readLocalXAStart(this);    }    public void writeLocalXACommit_() throws SqlException {        netAgent_.connectionRequest_.writeLocalXACommit(this);    }    public void readLocalXACommit_() throws SqlException {        netAgent_.connectionReply_.readLocalXACommit(this);    }    public void writeLocalXARollback_() throws SqlException {        netAgent_.connectionRequest_.writeLocalXARollback(this);    }    public void readLocalXARollback_() throws SqlException {        netAgent_.connectionReply_.readLocalXARollback(this);    }    public void writeLocalCommit_() throws SqlException {        netAgent_.connectionRequest_.writeLocalCommit(this);    }    public void readLocalCommit_() throws SqlException {        netAgent_.connectionReply_.readLocalCommit(this);    }    public void writeLocalRollback_() throws SqlException {        netAgent_.connectionRequest_.writeLocalRollback(this);    }    public void readLocalRollback_() throws SqlException {        netAgent_.connectionReply_.readLocalRollback(this);    }    protected void markClosed_() {    }    protected boolean isGlobalPending_() {        return false;    }    protected boolean doCloseStatementsOnClose_() {        return true;    }    protected boolean allowCloseInUOW_() {        return false;    }    // Driver-specific determination if local COMMIT/ROLLBACK is allowed;    // Allow local COMMIT/ROLLBACK only if we are not in an XA transaction    protected boolean allowLocalCommitRollback_() throws org.apache.derby.client.am.SqlException {           	if (getXAState() == XA_T0_NOT_ASSOCIATED) {            return true;        }        return false;    }    public void setInputStream(java.io.InputStream inputStream) {        netAgent_.setInputStream(inputStream);    }    public void setOutputStream(java.io.OutputStream outputStream) {        netAgent_.setOutputStream(outputStream);    }    public java.io.InputStream getInputStream() {        return netAgent_.getInputStream();    }    public java.io.OutputStream getOutputStream() {        return netAgent_.getOutputStream();    }    public void writeTransactionStart(Statement statement) throws SqlException {    }    public void readTransactionStart() throws SqlException {        super.readTransactionStart();    }    public void setIndoubtTransactions(java.util.Hashtable indoubtTransactions) {    }    protected void setReadOnlyTransactionFlag(boolean flag) {        readOnlyTransaction_ = flag;    }    public org.apache.derby.client.am.SectionManager newSectionManager            (String collection,             org.apache.derby.client.am.Agent agent,             String databaseName) {        return new org.apache.derby.client.am.SectionManager(collection, agent, databaseName);    }    protected int getSocketAndInputOutputStreams(String server, int port) {        try {            netAgent_.socket_ = (java.net.Socket) java.security.AccessController.doPrivileged(new OpenSocketAction(server, port));        } catch (java.security.PrivilegedActionException e) {            Exception openSocketException = e.getException();            if (netAgent_.loggingEnabled()) {                netAgent_.logWriter_.tracepoint("[net]", 101, "Client Re-route: " + openSocketException.getClass().getName() + " : " + openSocketException.getMessage());            }            return -1;        }        try {            netAgent_.rawSocketOutputStream_ = netAgent_.socket_.getOutputStream();            netAgent_.rawSocketInputStream_ = netAgent_.socket_.getInputStream();        } catch (java.io.IOException e) {            if (netAgent_.loggingEnabled()) {                netAgent_.logWriter_.tracepoint("[net]", 103, "Client Re-route: java.io.IOException " + e.getMessage());            }            try {                netAgent_.socket_.close();            } catch (java.io.IOException doNothing) {            }            return -1;        }        return 0;    }    protected int checkAlternateServerHasEqualOrHigherProductLevel(ProductLevel orgLvl, int orgServerType) {        if (orgLvl == null && orgServerType == 0) {            return 0;        }        ProductLevel alternateServerProductLvl =                netAgent_.netConnection_.databaseMetaData_.productLevel_;        boolean alternateServerIsEqualOrHigherToOriginalServer =                (alternateServerProductLvl.greaterThanOrEqualTo                (orgLvl.versionLevel_,                        orgLvl.releaseLevel_,                        orgLvl.modificationLevel_)) ? true : false;        // write an entry to the trace        if (!alternateServerIsEqualOrHigherToOriginalServer &&                netAgent_.loggingEnabled()) {            netAgent_.logWriter_.tracepoint("[net]",                    99,                    "Client Re-route failed because the alternate server is on a lower product level than the origianl server.");        }        return (alternateServerIsEqualOrHigherToOriginalServer) ? 0 : -1;    }    public boolean willAutoCommitGenerateFlow() {        // this logic must be in sync with writeCommit() logic        if (!autoCommit_) {            return false;        }        if (!isXAConnection_) {            return true;        }        boolean doCommit = false;        int xaState = getXAState();                if (xaState == XA_T0_NOT_ASSOCIATED) {            doCommit = true;        }        return doCommit;    }    public int getSecurityMechanism() {        return securityMechanism_;    }    public EncryptionManager getEncryptionManager() {        return encryptionManager_;    }    public byte[] getTargetPublicKey() {        return targetPublicKey_;    }    public String getProductID() {        return targetSrvclsnm_;    }    public void doResetNow() throws SqlException {        if (!resetConnectionAtFirstSql_) {            return; // reset not needed        }        agent_.beginWriteChainOutsideUOW();        agent_.flowOutsideUOW();        agent_.endReadChain();    }    	/**	 * @return Returns the connectionNull.	 */	public boolean isConnectionNull() {		return connectionNull;	}	/**	 * @param connectionNull The connectionNull to set.	 */	public void setConnectionNull(boolean connectionNull) {		this.connectionNull = connectionNull;	}}

⌨️ 快捷键说明

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