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: DbCreateObj.java,v 1.4 2002/06/25 11:40:16 mediumnet Exp $
08:
09: package org.ozoneDB.core.DbRemote;
10:
11: import java.io.*;
12: import org.ozoneDB.DxLib.*;
13: import org.ozoneDB.core.*;
14: import org.ozoneDB.OzoneProxy;
15:
16: /**
17: * @author <a href="http://www.softwarebuero.de/">SMB</a>
18: * @version $Revision: 1.4 $Date: 2002/06/25 11:40:16 $
19: */
20: public final class DbCreateObj extends DbCommand {
21:
22: private String className;
23:
24: private int access;
25:
26: private String objName;
27:
28: private String sig;
29:
30: private Object[] args;
31:
32: public DbCreateObj() {
33: }
34:
35: public DbCreateObj(String _className, int _access, String _objName,
36: String _sig, Object[] _args) {
37: className = _className;
38: access = _access;
39: objName = _objName;
40: sig = _sig;
41: args = _args;
42: }
43:
44: public void perform(Transaction ta) throws Exception {
45: // env.logWriter.newEntry (this, "DbCreateObj.perform()...", LogWriter.DEBUG);
46: ObjectContainer container = ta.createObjectAndPin(className,
47: access, objName, sig, args, null);
48:
49: try {
50: OzoneProxy resultingProxy = container.ozoneProxy();
51:
52: getProxyObjectGate().addObjectReferencedByClient(
53: resultingProxy);
54:
55: if (Env.selfCheck) {
56: if (resultingProxy == null) { // The Proxy should never be null.
57: throw new Error(
58: "Found during DbCreateObj.perform(): container="
59: + container + ",resultingProxy="
60: + resultingProxy + ".");
61: }
62: }
63:
64: result = resultingProxy;
65: } finally {
66: container.unpin();
67: }
68: }
69:
70: public void writeExternal(ObjectOutput out) throws IOException {
71: out.writeObject(className);
72: out.writeInt(access);
73: out.writeObject(objName);
74: out.writeObject(sig);
75: out.writeObject(args);
76: }
77:
78: public void readExternal(ObjectInput in) throws IOException,
79: ClassNotFoundException {
80: className = (String) in.readObject();
81: access = in.readInt();
82: objName = (String) in.readObject();
83: sig = (String) in.readObject();
84: args = (Object[]) in.readObject();
85: }
86:
87: public String toString() {
88: return super.toString();
89: }
90:
91: }
|