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

📄 ozoneodmg.java

📁 用Java写的面相对象的数据库管理系统
💻 JAVA
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library 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: OzoneODMG.java,v 1.10 2000/10/28 16:55:19 daniela Exp $package org.ozoneDB.odmg;import java.io.*;import org.odmg.*;import org.ozoneDB.DxLib.*;/** * Implementation of the ODMG {@link Implementation} interface. *  *  * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.10 $Date: 2000/10/28 16:55:19 $ */public class OzoneODMG extends ODMG {        /**     * All {@link OzoneDatabase} objects that are created by this factory and     * that currently are open.     */    private transient DxSet dbs;            public OzoneODMG() {        if (org.ozoneDB.core.Env.currentEnv() != null) {            throw new ODMGRuntimeException( "Method must not be called from inside an ozone database object." );        }         dbs = new DxHashSet();    }            /**     * Create a new <code>Database</code> object.     * @return The new <code>Database</code> object.     * @see org.odmg.Database     */    public synchronized Database newDatabase() {        if (org.ozoneDB.core.Env.currentEnv() != null) {            throw new ODMGRuntimeException( "Method must not be called from inside an ozone database object." );        }         Database db = new OzoneODMGDatabase( this );        return db;    }             /**     * This method is called by the database objects to inform their factory     * that another database actually has been opened.     */    protected synchronized void databaseOpened( Database db ) {        // don't allow more than one database per factory; the code to support        // this is there but this feature avoid determine the database of a        // given thread which is important for the enhanced ozone version of        // the ODMG Implementation interface        if (dbs.count() > 0) {            throw new ODMGRuntimeException( "More than one open databases per factory are not allowed." );        }                 dbs.add( db );    }             protected synchronized void databaseClosed( Database db ) {        dbs.remove( db );    }             /**     * Get the <code>Database</code> that contains the object <code>obj</code>.     * @param obj The object.     * @return The <code>Database</code> that contains the object.     */    public Database getDatabase( Object obj ) {        if (org.ozoneDB.core.Env.currentEnv() != null) {            throw new ODMGRuntimeException( "Method must not be called from inside an ozone database object." );        }                 DxIterator it = dbs.iterator();        while (it.next() != null) {            OzoneODMGDatabase db = (OzoneODMGDatabase)it.object();            if (db.containsObject( obj )) {                return db;            }         }         return null;    }             /**     * Create a <code>Transaction</code> object and associate it with the     * current thread.     * @return The newly created <code>Transaction</code> instance.     * @see org.odmg.Transaction     */    public Transaction newTransaction() {        if (org.ozoneDB.core.Env.currentEnv() != null) {            throw new ODMGRuntimeException( "Method must not be called from inside an ozone database object." );        }         return new OzoneODMGTransaction( dbs );    }             /**     * Get the current <code>Transaction</code> for the thread.     * @return The current <code>Transaction</code> object or null if there is none.     * @see org.odmg.Transaction     */    public Transaction currentTransaction() {        if (org.ozoneDB.core.Env.currentEnv() != null) {            throw new ODMGRuntimeException( "Method must not be called from inside an ozone database object." );        }         return OzoneODMGTransaction.current();    }             /**     * Get a <code>String</code> representation of the object's identifier.     * @param obj The object whose identifier is being accessed.     * @return The object's identifier in the form of a String     */    public String getObjectId( Object obj ) {        if (org.ozoneDB.core.Env.currentEnv() != null) {            throw new ODMGRuntimeException( "Method must not be called from inside an ozone database object." );        }                 throw new RuntimeException( "Method not implemented yet." );    }             /**     * Create a new <code>OQLQuery</code> object.     * @return The new <code>OQLQuery</code> object.     * @see org.odmg.OQLQuery     */    public OQLQuery newOQLQuery() {        throw new RuntimeException( "newOQLQuery(): ozone does not implement OQL." );    }             /**     * Create a new <code>DList</code> object.     * @return The new <code>DList</code> object.     * @see org.odmg.DList     */    public DList newDList() {        if (org.ozoneDB.core.Env.currentEnv() != null) {            throw new ODMGRuntimeException( "Method must not be called from inside an ozone database object." );        }         return new OzoneODMGDList();    }             /**     * Create a new <code>DBag</code> object.     * @return The new <code>DBag</code> object.     * @see org.odmg.DBag     */    public DBag newDBag() {        if (org.ozoneDB.core.Env.currentEnv() != null) {            throw new ODMGRuntimeException( "Method must not be called from inside an ozone database object." );        }         return new OzoneODMGDBag();    }             /**     * Create a new <code>DSet</code> object.     * @return The new <code>DSet</code> object.     * @see org.odmg.DSet     */    public DSet newDSet() {        if (org.ozoneDB.core.Env.currentEnv() != null) {            throw new ODMGRuntimeException( "Method must not be called from inside an ozone database object." );        }         return new OzoneODMGDSet();    }             /**     * Create a new <code>DArray</code> object.     * @return The new <code>DArray</code> object.     * @see org.odmg.DArray     */    public DArray newDArray() {        if (org.ozoneDB.core.Env.currentEnv() != null) {            throw new ODMGRuntimeException( "Method must not be called from inside an ozone database object." );        }         return new OzoneODMGDArray();    }             /**     * Create a new <code>DMap</code> object.     * @return	The new <code>DMap</code> object.     * @see org.odmg.DMap     */    public DMap newDMap() {        throw new RuntimeException( "Method not implemented yet" );    }     }

⌨️ 快捷键说明

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