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

📄 netconnectionrequest.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*   Derby - Class org.apache.derby.client.net.NetConnectionRequest   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.SqlException;import org.apache.derby.client.am.Utils;public class NetConnectionRequest extends Request implements ConnectionRequestInterface {    NetConnectionRequest(NetAgent netAgent, CcsidManager ccsidManager, int bufferSize) {        super(netAgent, ccsidManager, bufferSize);    }    //----------------------------- entry points ---------------------------------    void writeExchangeServerAttributes(String externalName,                                       int targetAgent,                                       int targetSqlam,                                       int targetRdb,                                       int targetSecmgr,                                       int targetCmntcpip,                                       int targetCmnappc,                                       int targetXamgr,                                       int targetSyncptmgr,                                       int targetRsyncmgr) throws SqlException {        // send the exchange server attributes command to the server.        // no other commands will be chained to the excsat because        // the manager levels are needed before anything else is attempted.        buildEXCSAT(externalName,                targetAgent,                targetSqlam,                targetRdb,                targetSecmgr,                targetCmntcpip,                targetCmnappc,                targetXamgr,                targetSyncptmgr,                targetRsyncmgr);    }    void writeDummyExchangeServerAttributes() throws SqlException {        // send the exchange server attributes command to the server,        // without any parameters        buildDummyEXCSAT();    }    void writeAccessSecurity(int securityMechanism,                             String databaseName,                             byte[] publicKey) throws SqlException {        buildACCSEC(securityMechanism, databaseName, publicKey);    }    void writeSecurityCheck(int securityMechanism,                            String databaseName,                            String userid,                            String password,                            byte[] encryptedUserid,                            byte[] encryptedPassword) throws SqlException {        buildSECCHK(securityMechanism,                databaseName,                userid,                password,                encryptedUserid,                encryptedPassword);    }    void writeAccessDatabase(String rdbnam,                             boolean readOnly,                             byte[] correlationToken,                             byte[] productData,                             Typdef typdef) throws SqlException {        buildACCRDB(rdbnam,                readOnly,                correlationToken,                productData,                typdef);    }    public void writeCommitSubstitute(NetConnection connection) throws SqlException {        buildDummyEXCSAT();    }    public void writeLocalCommit(NetConnection connection) throws SqlException {        buildRDBCMM();    }    public void writeLocalRollback(NetConnection connection) throws SqlException {        buildRDBRLLBCK();    }    public void writeLocalXAStart(NetConnection connection) throws SqlException {    }    //Build the SYNNCTL commit command    public void writeLocalXACommit(NetConnection conn) throws SqlException {    }    //Build the SYNNCTL rollback command    public void writeLocalXARollback(NetConnection conn) throws SqlException {    }    public void writeXaStartUnitOfWork(NetConnection conn) throws SqlException {    }    public void writeXaEndUnitOfWork(NetConnection conn) throws SqlException {    }    protected void writeXaPrepare(NetConnection conn) throws SqlException {    }    protected void writeXaCommit(NetConnection conn, Xid xid) throws SqlException {    }    protected void writeXaRollback(NetConnection conn, Xid xid) throws SqlException {    }    protected void writeXaRecover(NetConnection conn, int flag) throws SqlException {    }    protected void writeXaForget(NetConnection conn, Xid xid) throws SqlException {    }    public void writeSYNCType(int codepoint, int syncType) {        writeScalar1Byte(codepoint, syncType);    }    public void writeForget(int codepoint, int value) {    }    public void writeReleaseConversation(int codepoint, int value) {    }    void writeNullXID(int codepoint) {    }    void writeXID(int codepoint, Xid xid) throws SqlException {    }    void writeXAFlags(int codepoint, int xaFlags) {    }    //----------------------helper methods----------------------------------------    // 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.    // RDB Commit Unit of Work (RDBCMM) Command commits all work performed    // for the current unit of work.    //    // The Relational Database Name (RDBNAM) is an optional parameter    // which will not be sent by this command to reduce size, building,    // and parsing.    void buildRDBCMM() throws SqlException {        createCommand();        writeLengthCodePoint(0x04, CodePoint.RDBCMM);    }    // RDB Rollback Unit of Work(RDBRLLBCK) Command rolls back    // all work performed for the current unit of work.    //    // The Relational Database Name (RDBNAM) is an optional parameter    // which will not be sent by this command to reduce size, building,    // and parsing.    void buildRDBRLLBCK() throws SqlException {        createCommand();        writeLengthCodePoint(0x04, CodePoint.RDBRLLBCK);    }    // build the Exchange Server Attributes Command.    // This command sends the following information to the server.    // - this driver's server class name    // - this driver's level of each of the manager's it supports    // - this driver's product release level    // - this driver's external name    // - this driver's server name    void buildEXCSAT(String externalName,                     int targetAgent,                     int targetSqlam,                     int targetRdb,                     int targetSecmgr,                     int targetCmntcpip,                     int targetCmnappc,                     int targetXamgr,                     int targetSyncptmgr,                     int targetRsyncmgr) throws SqlException {        createCommand();        // begin excsat collection by placing the 4 byte llcp in the buffer.        // the length of this command will be computed later and "filled in"        // with the call to request.updateLengthBytes().        markLengthBytes(CodePoint.EXCSAT);        // place the external name for the client into the buffer.        // the external name was previously calculated before the call to this method.        buildEXTNAM(externalName);        // place the server name for the client into the buffer.        buildSRVNAM("Derby");        // place the server release level for the client into the buffer.        // this is a hard coded value for the driver.        buildSRVRLSLV();        // the managers supported by this driver and their levels will        // be sent to the server.  the variables which store these values        // were initialized during object constrcution to the highest values        // supported by the driver.        // for the case of the manager levels object, there is no        // need to have the length of the ddm object dynamically calculated        // because this method knows exactly how many will be sent and can set        // this now.        // each manager level class and level are 4 bytes long and        // right now 5 are being sent for a total of 20 bytes or 0x14 bytes.        // writeScalarHeader will be called to insert the llcp.        buildMGRLVLLS(targetAgent,                targetSqlam,                targetRdb,                targetSecmgr,                targetXamgr,                targetSyncptmgr,                targetRsyncmgr);        // place the server class name into the buffer.        // this value is hard coded for the driver.        buildSRVCLSNM();        // the excsat command is complete so the updateLengthBytes method        // is called to dynamically compute the length for this command and insert        // it into the buffer        updateLengthBytes();    }    void buildDummyEXCSAT() throws SqlException {        createCommand();        // begin excsat collection by placing the 4 byte llcp in the buffer.        // the length of this command will be computed later and "filled in"        // with the call to request.updateLengthBytes().        markLengthBytes(CodePoint.EXCSAT);        // the excsat command is complete so the updateLengthBytes method        // is called to dynamically compute the length for this command and insert        // it into the buffer        updateLengthBytes();    }    void buildACCSEC(int secmec,                     String rdbnam,                     byte[] sectkn) throws SqlException {        createCommand();        // place the llcp for the ACCSEC in the buffer.  save the length bytes for        // later update        markLengthBytes(CodePoint.ACCSEC);        // the security mechanism is a required instance variable.  it will        // always be sent.        buildSECMEC(secmec);        // the rdbnam will be built and sent.  different sqlam levels support        // different lengths.  at this point the length has been checked against        // the maximum allowable length.  so write the bytes and padd up to the        // minimum length if needed.        buildRDBNAM(rdbnam);        if (sectkn != null) {            buildSECTKN(sectkn);        }        // the accsec command is complete so notify the the request object to        // update the ddm length and the dss header length.        updateLengthBytes();    }    void buildSECCHK(int secmec,                     String rdbnam,                     String user,

⌨️ 快捷键说明

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