01: // You can redistribute this software and/or modify it under the terms of
02: // the Ozone Core License version 1 published by ozone-db.org.
03: //
04: // The original code and portions created by SMB are
05: // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
06: //
07: // $Id: DbNextID.java,v 1.1 2001/12/18 10:31:30 per_nyfelt Exp $
08:
09: package org.ozoneDB.core.DbRemote;
10:
11: import java.io.*;
12: import org.ozoneDB.DxLib.*;
13: import org.ozoneDB.core.*;
14:
15: /**
16: * @author <a href="http://www.softwarebuero.de/">SMB</a>
17: * @version $Revision: 1.1 $Date: 2001/12/18 10:31:30 $
18: */
19: public final class DbNextID extends DbCommand {
20:
21: private long range;
22:
23: public DbNextID(long _range) {
24: range = _range;
25: }
26:
27: public void perform(Transaction ta) throws Exception {
28: // env.logWriter.newEntry (this, "DbCreateObj.perform()...", LogWriter.DEBUG);
29:
30: long id = env.keyGenerator.nextID(range);
31: result = new ObjectID(id);
32: }
33:
34: public void writeExternal(ObjectOutput out) throws IOException {
35: out.writeLong(range);
36: }
37:
38: public synchronized void readExternal(ObjectInput in)
39: throws IOException, ClassNotFoundException {
40: range = in.readLong();
41: }
42:
43: }
|