KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > core > DbRemote > DbCreateObj


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Core License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: DbCreateObj.java,v 1.7 2002/12/29 11:15:56 per_nyfelt Exp $
8

9 package org.ozoneDB.core.DbRemote;
10
11 import org.ozoneDB.OzoneProxy;
12 import org.ozoneDB.core.*;
13
14 import java.io.*;
15
16
17 /**
18  * @author <a HREF="http://www.softwarebuero.de/">SMB</a>
19  * @version $Revision: 1.7 $Date: 2002/12/29 11:15:56 $
20  */

21 public final class DbCreateObj extends DbCommand {
22
23     private String JavaDoc className;
24
25     private int access;
26
27     private String JavaDoc objName;
28
29     private String JavaDoc sig;
30
31     private Object JavaDoc[] args;
32
33
34     public DbCreateObj() {
35     }
36
37
38     public DbCreateObj( String JavaDoc _className, int _access, String JavaDoc _objName, String JavaDoc _sig, Object JavaDoc[] _args ) {
39         className = _className;
40         access = _access;
41         objName = _objName;
42         sig = _sig;
43         args = _args;
44     }
45
46
47     public void perform( Transaction ta ) throws Exception JavaDoc {
48         // env.logWriter.newEntry (this, "DbCreateObj.perform()...", LogWriter.DEBUG);
49
ObjectContainer container = ta.createObject( className, access, objName, sig, args, null );
50
51         try {
52             OzoneProxy resultingProxy = container.ozoneProxy();
53
54             getProxyObjectGate().addObjectReferencedByClient(resultingProxy);
55
56             if (Env.selfCheck) {
57                 if (resultingProxy==null) { // The Proxy should never be null.
58
throw new Error JavaDoc("Found during DbCreateObj.perform(): container="+container+",resultingProxy="+resultingProxy+".");
59                 }
60             }
61
62             result = resultingProxy;
63         } finally {
64             container.unpin();
65         }
66     }
67
68
69     public void writeExternal( ObjectOutput out ) throws IOException {
70         out.writeObject( className );
71         out.writeInt( access );
72         out.writeObject( objName );
73         out.writeObject( sig );
74         out.writeObject( args );
75     }
76
77
78     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException JavaDoc {
79         className = (String JavaDoc)in.readObject();
80         access = in.readInt();
81         objName = (String JavaDoc)in.readObject();
82         sig = (String JavaDoc)in.readObject();
83         args = (Object JavaDoc[])in.readObject();
84     }
85
86
87     public String JavaDoc toString() {
88         return super.toString();
89     }
90
91 }
92
Popular Tags