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

📄 ozoneserverodmgdatabase.java

📁 用Java写的面相对象的数据库管理系统
💻 JAVA
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by softwarebuero m&b (SMB).//// The original code and portions created by SMB are// Copyright (C) 1997-1999 by softwarebuero m&b (SMB). All rights reserved.//// $Id: OzoneServerODMGDatabase.java,v 1.3 2000/10/28 16:55:19 daniela Exp $package org.ozoneDB.odmg;import java.util.*;import org.odmg.*;import org.ozoneDB.OzoneInterface;import org.ozoneDB.ExternalDatabase;import org.ozoneDB.LocalDatabase;import org.ozoneDB.RemoteDatabase;import org.ozoneDB.OzoneProxy;import org.ozoneDB.OzoneRemote;import org.ozoneDB.OzoneCompatible;/** * Implementation of the ODMG {@link org.odmg.Database} interface that is used * inside the ozone server to give the ODMG database objects their environment * and their interface to the database. *  *  * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.3 $Date: 2000/10/28 16:55:19 $ */public class OzoneServerODMGDatabase implements EnhDatabase {        private int accessMode = OPEN_READ_WRITE;        private org.ozoneDB.core.Env env;            public OzoneServerODMGDatabase() {        env = org.ozoneDB.core.Env.currentEnv();    }            protected int mode() {        return accessMode;    }             /**     * Open this ODMG database.     * @param _url URL of the database (ozonedb:remote://host:port or ozonedb:local://datadir)     */    public synchronized void open( String _url, int _accessMode ) throws ODMGException {        throw new ODMGRuntimeException( "Method must not be called." );    }             public void close() throws ODMGException {        throw new ODMGRuntimeException( "Method must not be called." );    }             protected void finalize() throws Throwable {    }             public void makePersistent( Object object ) {        throw new ODMGRuntimeException( "Method must not be called." );    }             public Object createPersistent( Class cl ) {        if (cl.isAssignableFrom( OzoneCompatible.class )) {            throw new ClassNotPersistenceCapableException( cl.getName() );        }                 try {            return env.database.createObject( cl.getName(), OzoneInterface.Public, null );        } catch (Exception e) {            throw new ODMGRuntimeException( e.toString() );        }     }             public void deletePersistent( Object object ) {        if (!(object instanceof OzoneProxy)) {            throw new ObjectNotPersistentException( object.getClass().getName() );        }                 try {            env.database.deleteObject( (OzoneRemote)object );        } catch (Exception e) {            throw new ODMGRuntimeException( e.toString() );        }     }             public void bind( Object object, String name ) {        if (!(object instanceof OzoneProxy)) {            throw new ClassNotPersistenceCapableException( object.getClass().getName() );        }                 try {            env.database.nameObject( (OzoneRemote)object, name );        } catch (Exception e) {            throw new ODMGRuntimeException( e.toString() );        }     }             public void unbind( String name ) throws ObjectNameNotFoundException {        try {            Object obj = lookup( name );            if (obj != null) {                env.database.nameObject( (OzoneRemote)obj, null );            }         } catch (Exception e) {            throw new ODMGRuntimeException( e.toString() );        }     }             public Object lookup( String name ) throws ObjectNameNotFoundException {        Object result = null;        try {            result = env.database.objectForName( name );        } catch (Exception e) {            throw new ODMGRuntimeException( e.toString() );        }                 if (result == null) {            throw new ObjectNameNotFoundException( name );        }                 return result;    }             public boolean containsObject( Object obj ) {        if (!(obj instanceof OzoneProxy)) {            throw new ClassNotPersistenceCapableException( obj.getClass().getName() );        }                 OzoneProxy proxy = (OzoneProxy)obj;        return proxy.link == env.database;    }     }

⌨️ 快捷键说明

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