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

📄 dblocalclient.java

📁 用Java写的面相对象的数据库管理系统
💻 JAVA
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Core License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: DbLocalClient.java,v 1.9 2000/11/02 20:00:25 daniela Exp $package org.ozoneDB.core.DbRemote;import java.io.*;import org.ozoneDB.DxLib.*;import org.ozoneDB.DxLib.net.DxClient;import org.ozoneDB.*;import org.ozoneDB.core.*;import org.ozoneDB.util.*;/** * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.9 $Date: 2000/11/02 20:00:25 $ */public class DbLocalClient extends DbClient {        protected Env env;        protected User user;        protected DbCommand currentCommand = null;        protected ByteArrayOutputStream copyStream;            public DbLocalClient( ExternalDatabase _db, Env _env, String _user ) throws Exception{        super( _db, _user );        env = _env;                user = env.userManager.userForName( _user );        if (user == null) {            throw new PermissionDeniedExc( "No such user." );        }                 copyStream = new ByteArrayOutputStream( 4 * 1024 );    }            public synchronized void send( Object obj ) throws IOException {        try {            copyStream.reset();                        // FIXME: copy only args of DbInvoke            currentCommand = (DbCommand)copyObject( obj, false );            currentCommand.env = env;            env.transactionManager.handleCommand( currentCommand, user );        } catch (Exception e) {            throw new IOException( e.toString() );        }     }             public synchronized Object receive() throws IOException, ClassNotFoundException {        return copyObject( currentCommand.result, true );    }             /**     * Copy the given object using ByteArrayStreams so all streamable     * objects (all database objects) can be copied.     */    protected synchronized Object copyObject( Object obj, boolean updateLinks ) throws IOException {        ObjectInputStream in = null;        try {            copyStream.reset();                        ObjectOutputStream out = new ObjectOutputStream( copyStream );            out.writeObject( obj );            out.close();                        in = new ObjectInputStream( new ByteArrayInputStream( copyStream.toByteArray() ) );                        // remove in finally clause            if (updateLinks) {                OzoneProxy.linkTable.addForKey( db, in );            }                         Object result = in.readObject();                        return result;        } catch (Exception e) {            throw new IOException( e.toString() );        } finally {            if (updateLinks && in != null) {                OzoneProxy.linkTable.removeForKey( in );            }         }         }             public boolean objectAvailable() {        throw new RuntimeException( "Method not implemented." );    }             public synchronized void close() throws IOException {    }             public void onConnect() throws IOException {        throw new RuntimeException( "Method not implemented." );    }             public void onDeconnect() throws IOException {        throw new RuntimeException( "Method not implemented." );    }             public ObjectInputStream inputStream() {        throw new RuntimeException( "Method not implemented." );    }             public ObjectOutputStream outputStream() {        throw new RuntimeException( "Method not implemented." );    }     }

⌨️ 快捷键说明

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